It is currently 18 Aug 2018, 21:57
   
Text Size

Coding Boros charm [Solved]

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

Moderators: Xander9009, CCGHQ Admins

Coding Boros charm [Solved]

Postby infernalsham » 06 Jul 2013, 00:35

Currently I am working on creating a R/W deck. However I have some trouble with making Boros Charm work properly. If anyone could be so kind to point out what I have done wrong in the code it would be greatly appreciated. Main issues currently are that indestructability and double strike are not applied to permanents and creature respectivly.

Code: Select all
<SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Choose one — Boros Charm deals 4 damage to target player; or permanents you control are indestructible this turn; or target creature gains double strike until end of turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Choisissez l’un — Le Charme de Boros inflige 4 blessures au joueur ciblé ; ou les permanents que vous contrôlez sont indestructibles ce tour-ci ; ou une créature ciblée acquiert la double initiative jusqu’à la fin du tour.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Elige uno: El Amuleto boros hace 4 puntos de daño al jugador objetivo; o los permanentes que controlas son indestructibles este turno; o la criatura objetivo gana la habilidad de dañar dos veces hasta el final del turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bestimme eines — Das Boros-Amulett fügt einem Spieler deiner Wahl 4 Schadenspunkte zu; oder bleibende Karten, die du kontrollierst, sind in diesem Zug unzerstörbar; oder eine Kreatur deiner Wahl erhält Doppelschlag bis zum Ende des Zuges.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Scegli uno — Il Talismano Boros infligge 4 danni a un giocatore bersaglio; oppure i permanenti che controlli sono indistruttibili in questo turno; oppure una creatura bersaglio ha doppio attacco fino alla fine del turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[以下の3つから1つを選ぶ。「プレイヤー1人を対象とする。ボロスの魔除けはそのプレイヤーに4点のダメージを与える。」「このターン、あなたがコントロールするパーマネントは破壊されない。」「クリーチャー1体を対象とする。それはターン終了時まで二段攻撃を得る。」]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[하나를 선택한다 — 플레이어 한 명을 목표로 정한다. 보로스 부적은 그 플레이어에게 피해 4점을 입힌다; 또는 당신이 조종하는 지속물들은 이 턴에 파괴될 수 없다; 또는 생물 한 개를 목표로 정한다. 그 생물은 턴종료까지 이단공격 능력을 얻는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Выберите одно — Талисман Боросов наносит 4 повреждения целевому игроку; или перманенты под вашим контролем не могут быть уничтожены в этом ходу; или целевое существо получает Двойной удар до конца хода.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Escolha um — Amuleto Boros causa 4 pontos de dano ao jogador alvo; ou as permanentes que você controla são indestrutíveis neste turno; ou a criatura alvo ganha golpe duplo até o final do turno.]]></LOCALISED_TEXT>
   <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="INF_MODE_BOROS_DAMAGE" index="1" />
      <MODE tag="INF_MODE_BOROS_INDESTRUCTABLE" index="2" />
      <MODE tag="INF_MODE_BOROS_DOUBLE_STRIKE" index="3" />
    </MODE_SELECT>
   <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DEAL_4_DAMAGE" definition="0" compartment="0" mode="1" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
   filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1" filter_id="0">
    if (FilteredPlayer() ~= nil) then   
       EffectSourceLKI():DealDamageTo( 4, FilteredPlayer() )
    end
    </RESOLUTION_TIME_ACTION>
    <TARGET_DEFINITION id="1">
    local filter = ClearFilter()
    filter:Add( FE_IS_PERMANENT, true )
   filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="2">
   <CONTINUOUS_ACTION layer="6" filter_id="1">
    if FilteredCard() ~= nil then
       local characteristics =
      FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set(CHARACTERISTIC_INDESTRUCTIBLE, 1)
    end
    </CONTINUOUS_ACTION>
   <DURATION simple_duration="UntilEOT" />
   </RESOLUTION_TIME_ACTION>
   <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_DOUBLE_STRIKE" definition="2" compartment="2" mode="3" count="1" />
    <TARGET_DEFINITION id="2">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="3">
    <CONTINUOUS_ACTION layer="6" filter_id="2">
    if FilteredCard() ~= nil then
       local characteristics =
      FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_DOUBLE_STRIKE, 1 )
    end
    </CONTINUOUS_ACTION>
   <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <CONTINUOUS_ACTION layer="6" filter_id="0">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_DOUBLE_STRIKE, 1 )
    end
    </CONTINUOUS_ACTION>
   <DURATION simple_duration="UntilEOT" />
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
Last edited by infernalsham on 06 Jul 2013, 10:48, edited 1 time in total.
Want to speed up the loading of DotP Magic 2014 when you start it?
Go to: "C:\*\Magic 2014\Movies" and delete Alienware, Stainless and WotC .bik files.
infernalsham
 
Posts: 17
Joined: 27 Jun 2013, 15:54
Has thanked: 3 times
Been thanked: 1 time

Re: Coding Boros charm

Postby sumomole » 06 Jul 2013, 01:01

Boros Charm | Open
Code: Select all
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Choose one — Boros Charm deals 4 damage to target player; or permanents you control are indestructible this turn; or target creature gains double strike until end of turn.]]></LOCALISED_TEXT>
    <SFX text="GLOBAL_MAGMA_PLAY" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="MODE_BOROS_FLAME" index="1" />
      <MODE tag="MODE_BOROS_DEFENSE" index="2" />
      <MODE tag="MODE_BOROS_FURY" index="3" />
    </MODE_SELECT>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DEAL_4_DAMAGE" definition="0" compartment="0" mode="1" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
    local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
    if target_player ~= nil then
       EffectSourceLKI():DealDamageTo( 4, target_player )
    end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="6" mode="2">
    local filter = ClearFilter()
    filter:Add( FE_IS_PERMANENT, true )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    local numCards = filter:EvaluateObjects()
    for i=0,(numCards-1) do
       local card = filter:GetNthEvaluatedObject(i)
       if card ~= nil then
         local characteristics = card:GetCurrentCharacteristics()
         characteristics:Bool_Set( CHARACTERISTIC_INDESTRUCTIBLE, 1 )
       end
    end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_GAIN_DOUBLESTRIKE" definition="1" compartment="1" mode="3" count="1" />
    <TARGET_DEFINITION id="1">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    </TARGET_DEFINITION>
    <CONTINUOUS_ACTION layer="6" mode="3">
    local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_DOUBLE_STRIKE, 1 )
    end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
    <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
    <AI_SIMPLIFIED_TARGETING compartment="1" hint="HINT_ALLIED_ONLY" />
  </SPELL_ABILITY>
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times

Re: Coding Boros charm

Postby infernalsham » 06 Jul 2013, 08:52

Thanks a lot Sumomole.
Want to speed up the loading of DotP Magic 2014 when you start it?
Go to: "C:\*\Magic 2014\Movies" and delete Alienware, Stainless and WotC .bik files.
infernalsham
 
Posts: 17
Joined: 27 Jun 2013, 15:54
Has thanked: 3 times
Been thanked: 1 time

Re: Coding Boros charm

Postby thefiremind » 06 Jul 2013, 09:15

According to the new rules, I think that the indestructibility was more correct in infernalsham's attempt: I'm not sure if I managed to understand the change from being a "property" to being an "ability", but I think one of the consequences is that indestructible is granted only to those who are on the battlefield at resolution time, not to those who enter the battlefield later that turn. Could someone confirm?
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Coding Boros charm

Postby infernalsham » 06 Jul 2013, 10:05

Good news: The damage is now being dealt when the spell resolves if first option is picked, and double strike is properly added to target creature when option 3 is chosen.
Bad news: Indestructability is still not granted to any permanents when the spell resolves.

I based my version of the second ability on what Avacyn does.
Avacyn (Ind) code:
Code: Select all
<FILTER>
    local filter = ClearFilter()
    filter:Add( FE_CARD_INSTANCE, OP_NOT, EffectSource() )
    filter:Add( FE_IS_PERMANENT, true )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <CONTINUOUS_ACTION layer="6" filter_id="0">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_INDESTRUCTIBLE, 1 )
    end
    </CONTINUOUS_ACTION>
    <DURATION>
    return (EffectSource() == nil)
    </DURATION>
Want to speed up the loading of DotP Magic 2014 when you start it?
Go to: "C:\*\Magic 2014\Movies" and delete Alienware, Stainless and WotC .bik files.
infernalsham
 
Posts: 17
Joined: 27 Jun 2013, 15:54
Has thanked: 3 times
Been thanked: 1 time

Re: Coding Boros charm

Postby infernalsham » 06 Jul 2013, 10:48

Solved it. Feel so stupid I didn't notice it earlier. #-o

Code: Select all
<FILTER>
    local filter = ClearFilter()
    filter:Add( FE_IS_PERMANENT, true )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <CONTINUOUS_ACTION layer="6" filter_id="0">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_INDESTRUCTIBLE, 1 )
    end
    </CONTINUOUS_ACTION>
   <DURATION simple_duration="UntilEOT" />   
Want to speed up the loading of DotP Magic 2014 when you start it?
Go to: "C:\*\Magic 2014\Movies" and delete Alienware, Stainless and WotC .bik files.
infernalsham
 
Posts: 17
Joined: 27 Jun 2013, 15:54
Has thanked: 3 times
Been thanked: 1 time

Re: Coding Boros charm

Postby sumomole » 06 Jul 2013, 11:04

thefiremind wrote:According to the new rules, I think that the indestructibility was more correct in infernalsham's attempt: I'm not sure if I managed to understand the change from being a "property" to being an "ability", but I think one of the consequences is that indestructible is granted only to those who are on the battlefield at resolution time, not to those who enter the battlefield later that turn. Could someone confirm?
In fact, I don't understand the new rules for indestructible, and why Falkenrath Aristocrat can be destroyed by Turn / Burn, so I just copied the code of other cards. But for the second point you said, I think you confuse "this turn" and "until end of turn", Boros Charm and Rootborn Defenses are "this turn".
Boros Charm: If you choose the second mode, permanents that come under your control later in the turn will also be indestructible.
Rootborn Defenses: The creature token you put onto the battlefield as well as creatures that come under your control later in the turn will also be indestructible.


infernalsham wrote:I based my version of the second ability on what Avacyn does.
You too.
Last edited by sumomole on 06 Jul 2013, 11:31, edited 1 time in total.
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times

Re: Coding Boros charm [Solved]

Postby thefiremind » 06 Jul 2013, 11:07

The cards still say "this turn" because their wording hasn't been updated yet.

Here's the proof that infernalsham's version is correct:
Case 2: Creatures (or permanents) you control are made indestructible until end of turn by a spell or ability (for example, Boros Charm). Previously, a creature that came under your control after that spell or ability resolved would be indestructible, as that spell or ability didn't change the characteristics of any creature. With the change, that new creature won't have indestructible as it wasn't under your control at the right time to gain it.
From http://www.wizards.com/magic/magazine/a ... ature/248e
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Coding Boros charm [Solved]

Postby sumomole » 06 Jul 2013, 11:31

thefiremind wrote:The cards still say "this turn" because their wording hasn't been updated yet.

Here's the proof that infernalsham's version is correct:
Case 2: Creatures (or permanents) you control are made indestructible until end of turn by a spell or ability (for example, Boros Charm). Previously, a creature that came under your control after that spell or ability resolved would be indestructible, as that spell or ability didn't change the characteristics of any creature. With the change, that new creature won't have indestructible as it wasn't under your control at the right time to gain it.
From http://www.wizards.com/magic/magazine/a ... ature/248e
Well, I'm out. :mrgreen:
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times


Return to New MTG Cards and Decks

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form