Page 22 of 102

Re: Card Creation Request Thread

PostPosted: 14 Feb 2013, 11:25
by NEMESiS
The land id seems to have been the culprit. Such a simple mistake....

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 09:30
by SoulStorm
I'm stepping away from my {G} {U} deck for a bit, but in the meantime I'm contemplating a {W} {R} deck and Lightmine Field would be nice to have.

Also, when I return to my {G} {U} deck, I'd like to see how Pulse of the Tangle interacts with it.

Thanks!

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 10:17
by thefiremind
SoulStorm wrote:I'm stepping away from my {G} {U} deck for a bit, but in the meantime I'm contemplating a {W} {R} deck and Lightmine Field would be nice to have.
Lightmine Field wasn't as easy as it seemed, because Gatherer says:
Gatherer rulings wrote:Which creatures are dealt damage is based on which creatures were declared as attackers during the declare attackers step.
How much damage each of those creatures is dealt is based how many creatures are attacking at the time the ability resolves.
So I had to:
  • Count the attackers during the ATTACKERS_DECLARED trigger check: if they are more than 0, save the attackers in a chest and start the trigger.
  • Count the attackers again during the resolution and save the result to be used as damage amount.
  • Iterate over the previously filled chest to deal the damage to the declared attackers (whether they are still attacking or not).
I hope it works.

SoulStorm wrote:Also, when I return to my {G} {U} deck, I'd like to see how Pulse of the Tangle interacts with it.
Pulse of the Tangle was easy: the comparison code was already on Avatar of Might, there was just a "+3" to remove. :lol:

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 11:04
by SoulStorm
thefiremind wrote:Lightmine Field wasn't as easy as it seemed.
It didn't seem easy to me at all. I looked at a bunch of different cards trying to cobble it together, but the card was just beyond my scripting ability.

I swear you have a team of clones working for you! =D>

Thanks for continuing to feed my deck building habit! :mrgreen:

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 13:58
by SoulStorm
Each Lightmine Field is triggering twice.

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 14:49
by thefiremind
SoulStorm wrote:Each Lightmine Field is triggering twice.
I hope it's not the same as my attempt on Crucible of Worlds... try to change the trigger like this:
Code: Select all
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    if MTG():GetStep() == STEP_DECLARE_ATTACKERS then
       local filter = Object():GetFilter()
       filter:SetZone( ZONE_IN_PLAY )
       filter:AddCardType( CARD_TYPE_CREATURE )
       filter:AddExtra( FILTER_EXTRA_CREATURE_ATTACKING )
       filter:NotTargetted()
       local filter_count = filter:EvaluateObjects()
       if filter_count &gt; 0 then
          EffectDC():Set_Int(0, filter_count)
          local attackersDC = EffectDC():Make_Chest(1)
          for i=0,filter_count-1 do
             attackersDC:Set_CardPtr( i, filter:GetNthEvaluatedObject(i) )
          end
          return true
       end
    end
    return false
    </TRIGGER>
Let me know if it works.

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 15:35
by SoulStorm
thefiremind wrote:Let me know if it works.
Now it doesn't trigger at all.

This is a tricky card.

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 17:24
by thefiremind
OK, I got the right trigger now:
Code: Select all
    <TRIGGER value="ATTACKERS_DECLARED" simple_qualifier="controller">
    local filter = Object():GetFilter()
    filter:SetZone( ZONE_IN_PLAY )
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:AddExtra( FILTER_EXTRA_CREATURE_ATTACKING )
    filter:NotTargetted()
    local filter_count = filter:EvaluateObjects()
    if filter_count &gt; 0 then
       EffectDC():Set_Int(0, filter_count)
       local attackersDC = EffectDC():Make_Chest(1)
       for i=0,filter_count-1 do
          attackersDC:Set_CardPtr( i, filter:GetNthEvaluatedObject(i) )
       end
       return true
    end
    return false
    </TRIGGER>
The ATTACKERS_DECLARED trigger works like the step triggers: it is checked once for each player, so even if we want to make Lightmine Field trigger for any player, the simple_qualifier="controller" is needed, otherwise it will trigger once for each player in each combat.

I also updated the attachment in the previous post.

Re: Card Creation Request Thread

PostPosted: 15 Feb 2013, 21:55
by RiiakShiNal
thefiremind wrote:The ATTACKERS_DECLARED trigger works like the step triggers: it is checked once for each player, so even if we want to make Lightmine Field trigger for any player, the simple_qualifier="controller" is needed, otherwise it will trigger once for each player in each combat.

I also updated the attachment in the previous post.
Or you could use the function TriggeredForMe() to make sure it only triggers for the controller. Either way works just differences in implementation.

Re: Card Creation Request Thread

PostPosted: 16 Feb 2013, 10:53
by SoulStorm
thefiremind wrote:OK, I got the right trigger now.
Works perfectly, thanks Firemind.

I'm not sure what the AI is doing though, sometimes it seems like it knows that attacking en masse is a bad idea, and other times it's bye bye AI creatures.

I believe the AI doesn't predict well when it has enough damage on the board to score a kill.

Re: Card Creation Request Thread

PostPosted: 16 Feb 2013, 20:19
by DAJAW
I would like to request Cabal Coffers. I will try to make one using Cloudpost but if anyone has this card it would save work :p

Re: Card Creation Request Thread

PostPosted: 16 Feb 2013, 22:39
by thefiremind
DAJAW wrote:I would like to request Cabal Coffers. I will try to make one using Cloudpost but if anyone has this card it would save work :p
Paying mana to get mana... it's impossible with the usual mana abilities, could be done only with mana tokens (which I don't use).

Re: Card Creation Request Thread

PostPosted: 17 Feb 2013, 20:38
by NEMESiS
I am trying to make Mistmedow Witch. I can get the ability to target and exile a creature but not to return it. I've tried several thing but no luck. Any assistance?


Code: Select all
  <ACTIVATED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{2}{W}{U}: Exile target creature. Return that card to the battlefield under its owner’s control at the beginning of the next end step.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{2}{W}{U}: Rimuovi dal gioco una creatura bersaglio. Rimetti in gioco quella carta sotto il controllo del suo proprietario alla fine del turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{2}{W}{U}: Entferne eine Kreatur deiner Wahl ganz aus dem Spiel. Bringe diese Karte am Ende des Zuges unter der Kontrolle ihres Besitzers ins Spiel zurück.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{2}{W}{U} : Retirez la créature ciblée de la partie. Renvoyez cette carte en jeu sous le contrôle de son propriétaire à la fin du tour.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{2}{W}{U}: Remueve del juego la criatura objetivo. Regresa esa carta al juego bajo el control de su propietario al final del turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{2}{W}{U}:クリーチャー1体を対象とし、それを追放する。 次の終了ステップの開始時に、そのカードをオーナーのコントロール下で戦場に戻す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{2}{W}{U}: Exile target creature. Return that card to the battlefield under its owner’s control at the beginning of the next end step.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{2}{W}{U}: удалите целевое существо из игры. В конце хода верните ту карту в игру под контролем ее владельца.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{2}{W}{U}: Remova a criatura alvo do jogo. Devolva aquele card ao jogo sob o controle de seu dono no final do turno.]]></LOCALISED_TEXT>
    <COST type="Mana" cost="{2}{W}{U}" />
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetPlayer( EffectController() )
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_EXILE", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_NthCardPtr(0)
    if target ~= nil then
       if target:IsToken() == 0 then
          EffectDC():Get_Targets(0)
       end
       target:RemoveFromGame()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_CardPtr(0, EffectDC():Get_Targets(0)
    MTG():CreateDelayedTrigger(2, delayDC)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY resource_id="2">
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return ( MTG():GetStep() == STEP_END_OF_TURN )
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
  <SFX text="COMBAT_PLASMA_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_PLASMA_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
  <AI_BASE_SCORE score="300" zone="ZONE_IN_PLAY" />
</CARD_V2>

Re: Card Creation Request Thread

PostPosted: 17 Feb 2013, 20:48
by thefiremind
Why don't you start from Flickerwisp code? It does the same thing, except it says "target creature" instead of "another target permanent". Just change the target definition accordingly and then add the token check that I included in the fixes (it makes the card "crash-proof" :wink:).

The important part should become like this:
Code: Select all
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_PERMANENT_TO_EXILE", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_NthCardPtr(0)
    if target ~= nil then
       if target:IsToken() == 0 then
          EffectDC():Get_Targets(0):Protect_CardPtr(0)
       end
       target:RemoveFromGame()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_NthCardPtr(0)
    if target ~= nil then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, target)
       MTG():CreateDelayedTrigger(2, delayDC)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY resource_id="2">
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return ( MTG():GetStep() == STEP_END_OF_TURN )
    </TRIGGER>
    <CLEANUP fire_once="1" />
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_CardPtr(0)
    if target ~= nil then
       if target:GetCardType():Test( CARD_TYPE_ENCHANTMENT ) ~= 0 and target:GetSubType():Test( ENCHANTMENT_TYPE_AURA ) ~= 0 then
          target:GetOwner():PseudoPlaySpell(target)
       else
          target:PutIntoPlay( target:GetOwner() )
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

Re: Card Creation Request Thread

PostPosted: 17 Feb 2013, 21:32
by NEMESiS
Ah yes, that would make too much sense.... I got it working now. lol