It is currently 18 Apr 2024, 14:51
   
Text Size

Need coding help on Psionic Blast

User-made mods in DLC (Downloadable Content) form.
Get MTG cards here for your DotP that aren't available anywhere else!

Moderator: CCGHQ Admins

Need coding help on Psionic Blast

Postby MC Brodie » 01 Jun 2013, 16:21

Let me start by saying this community is awesome for the work its doing and the availability of information out there to help someone new try to pick up modding. I don't really have much of a programming background (limited to a hangman game I made for a school project 8 yrs ago), but you've all made it easy for me to pick up and get started. Though I still have far to go before I can be somewhat competent.

I am trying to make an Ally deck Orion79 made from the version of Manalink 3.0 I downloaded. Some of the cards I could not find on the site so I took to making them myself. I potentially (haven't found any problems yet) have successfully made Utopia Tree, Oran-Rief Survivalist, and Umara Raptor. I ran into somewhat of my first stepping stone with Psionic Blast (deals 4 to target creature/player and 2 to you). I am having trouble with the 2 damage thats done back to you. Like I said, I have a limited programming background. My method of card creation consists of starting with thefiremind's xml generator and copy/pasting in the ability text. For Psionic Blast I took text from the Searing Spear in the original Duels 2013 Chandra deck and added an additional <resolution> block for the damage back to you (of which I stole from Solemn Offering and changed life gain to damage). Unfortunately when I added the damage back to the casting player, it made the game crash. The code I came up with is below. If it looks like a bunch of junk, that's probably because it is. I was hoping for some advice or guidance to fix the card.

I do have some other general coding questions besides the issue above.
- I have been using my own ID scheme for the cards instead of the multiverseID. Is this bad? I started it when I first started messing with existing cards and adding abilities. I didn't want to break an already working card in the game. I'm only doing this to the filename and not the actual multiverseID variable in the card.

- In looking at some of the cards that came with the game, I see that there is some AI definitions (like the ones I stole from searing spear). I assume these aren't required but are useful if you want the AI to make somewhat decent plays. Is this true? Also, is there a source where I can find what their definitions mean if I need to start programming these?

Thanks for any help. It is much appreciated.

edit: for some reason I cannot post the code (says there are URLs). I'm trying to figure it out.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Need coding help on Psionic Blast

Postby thefiremind » 01 Jun 2013, 16:38

MC Brodie wrote:edit: for some reason I cannot post the code (says there are URLs). I'm trying to figure it out.
It happens when you have less than a certain number of posts, anyway making Psionic Blast by adding another action is just overly complicated. Look at my Char:
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="CHAR_87942" />
  <CARDNAME text="CHAR" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Char]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ardere]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verkohlen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Carboniser]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Quemar]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[黒焦げ]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Char]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Головешка]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Carbonizar]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="87942" />
  <ARTID value="A87942" />
  <ARTIST name="Adam Rex" />
  <CASTING_COST cost="{2}{R}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Izzet mages often acquire their magic reagents from dubious sources, so the potency of their spells is never predictable.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[I maghi Izzet spesso acquistano i propri reagenti magici da fonti poco sicure e, di conseguenza, la forza delle loro magie è imprevedibile.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Izzet-Magier besorgen sich ihre magische Zutaten oft aus dubiosen Quellen, daher sind die Ergebnisse ihrer Zauber nie vorhersagbar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les mages d’Izzet acquièrent souvent leurs composants magiques de sources douteuses, et la puissance de leurs sorts est toujours imprévisible.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los magos ízzet muchas veces adquieren sus reactivos mágicos de fuentes dudosas, por lo que la potencia de sus hechizos nunca es predecible.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[イゼットの魔道士は魔法の試薬を胡散臭い筋から手に入れることがしばしばある。なので、彼らの呪文の効果も予測しがたい。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Izzet mages often acquire their magic reagents from dubious sources, so the potency of their spells is never predictable.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Маги Иззета зачастую получают свои реагенты из сомнительных источников, так что результаты их заклинаний всегда непредсказуемы.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os magos Izzet freqüentemente adquirem seus reagentes mágicos de fontes duvidosas, por isso a potência de suas mágicas é imprevisível.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Instant" />
  <EXPANSION value="RAV" />
  <RARITY metaname="R" />
  <SPELL_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Char deals 4 damage to target creature or player and 2 damage to you.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ardere infligge 4 danni a una creatura o a un giocatore bersaglio e 2 danni a te.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verkohlen fügt einer Kreatur oder einem Spieler deiner Wahl 4 Schadenspunkte und dir 2 Schadenspunkte zu.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Carboniser inflige 4 blessures à une cible, créature ou joueur, et vous inflige 2 blessures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Quemar hace 4 puntos de daño a la criatura o jugador objetivo y te hace 2 puntos de daño.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[クリーチャー1体かプレイヤー1人を対象とする。黒焦げはそれに4点のダメージを与え、あなたに2点のダメージを与える。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Char deals 4 damage to target creature or player and 2 damage to you.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Головешка наносит 4 повреждения целевому существу или игроку и 2 повреждения вам.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Carbonizar causa 4 pontos de dano à criatura ou ao jogador alvo e 2 pontos de dano a você.]]></LOCALISED_TEXT>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_CARDS + FILTER_TYPE_PLAYERS )
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    filter:AddCardType( CARD_TYPE_CREATURE )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_DEAL_4_DAMAGE", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_creature = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
    local source = EffectSource()
    if source == nil then
       source = Object()
    end
    if target_creature ~= nil then
       target_creature:DealDamage(4, source)
       EffectController():DealDamage(2, source)
    elseif target_player ~= nil then
       target_player:DealDamage(4, source)
       EffectController():DealDamage(2, source)
    end
    </RESOLUTION_TIME_ACTION>
    <SFX text="TARGET_FIREBALL_PLAY" />
  </SPELL_ABILITY>
  <AI_AVAILABILITY type="in_response" />
  <AI_AVAILABILITY step="begin_combat" turn="their_turn" />
  <AI_AVAILABILITY step="main_1" turn="my_turn" />
  <AI_AVAILABILITY step="declare_attackers" turn="their_turn" />
  <AI_AVAILABILITY step="declare_blockers" />
  <AI_AVAILABILITY step="end_of_turn" />
  <AI_BASE_SCORE score="1050" zone="ZONE_HAND" />
</CARD_V2>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Need coding help on Psionic Blast

Postby MC Brodie » 01 Jun 2013, 16:47

I see... Thank you for the response. Before you posted this I actually got it to work by taking out the second <resolution_time_action> block and moving it into the first block (like you said). I guess I messed something up when I added the 2nd <resolution> block, or forgot to define somehting. Nonetheless, thanks for the help.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times


Return to New MTG Cards and Decks (2010, 2012, 2013, 2014, 2015, Magic Duels)

Who is online

Users browsing this forum: No registered users and 13 guests


Who is online

In total there are 13 users online :: 0 registered, 0 hidden and 13 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 13 guests

Login Form