Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Skipping a combat step (new findings added)
Moderator: CCGHQ Admins
Skipping a combat step (new findings added)
by thefiremind » 12 Apr 2012, 11:28
I was thinking about cards that force a player to skip their next combat step. Let's take Blinding Angel for example. A very easy way to achieve this would be to set PLAYER_CHARACTERISTIC_CANT_ATTACK on the affected player and make it last until that player's next end of combat step. This way, the player doesn't really skip the phase, but he can't do anything during that phase anyway.
The problem is that if you look at Blinding Angel on Gatherer, the rulings say: "If you are damaged by more than one, the effects are cumulative and you skip multiple combat phases." This makes things harder! I could probably keep track of the combat phases to skip with an integer on that player's data chest, and keep a static ability on Blinding Angel that works in any zone and sets PLAYER_CHARACTERISTIC_CANT_ATTACK as long as that integer is greater than 0. But since I'm already making an approximation of the real behaviour, I'd like to know if anybody comes with a lighter solution.
EDIT: I discovered that it's not an approximation at all! If you can't attack with any creature, the combat phase is actually skipped! Here is my Blinding Angel, for reference:
As long as all the cards we code use the same value for COMPARTMENT_ID_COMBAT_SKIPS, we can make any card that makes players skip their combat phase, and they will interact together nicely.
Incidentally, I discovered that layers really matter: if I use layer="6" instead of layer="8" for the static ability, the creatures that must attack each turn will attack anyway!
The problem is that if you look at Blinding Angel on Gatherer, the rulings say: "If you are damaged by more than one, the effects are cumulative and you skip multiple combat phases." This makes things harder! I could probably keep track of the combat phases to skip with an integer on that player's data chest, and keep a static ability on Blinding Angel that works in any zone and sets PLAYER_CHARACTERISTIC_CANT_ATTACK as long as that integer is greater than 0. But since I'm already making an approximation of the real behaviour, I'd like to know if anybody comes with a lighter solution.
EDIT: I discovered that it's not an approximation at all! If you can't attack with any creature, the combat phase is actually skipped! Here is my Blinding Angel, for reference:
- Code: Select all
<?xml version='1.0'?>
<CARD_V2 custom="true">
<FILENAME text="BLINDING_ANGEL_19991618" />
<CARDNAME text="BLINDING_ANGEL" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Blinding Angel]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Angelo Accecante]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="19991618" />
<ARTID value="19991618" />
<FRAMECOLOUR name="W" />
<COLOUR value="W" />
<ARTIST name="Todd Lockwood" />
<CASTING_COST cost="{3}{W}{W}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“Their eyes will shrivel and blacken before faith’s true light.”]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“I loro occhi avvizziranno e si oscureranno davanti alla vera luce della fede.”]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Creature" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
<SUB_TYPE metaname="Angel" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
<EXPANSION value="9E" />
<RARITY metaname="R" />
<POWER value="2" />
<TOUGHNESS value="4" />
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
<CONTINUOUS_ACTION>
local characteristics = Object():GetCurrentCharacteristics()
characteristics:Badge_Set( BADGE_FLYING )
characteristics:FX_Set( SPECIAL_EFFECT_FLYING )
characteristics:CanOnlyBeBlockedBy_Set( EVASION_INDEX_FLYING )
characteristics:CanBlock_Set( EVASION_INDEX_FLYING )
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<TRIGGERED_ABILITY auto_skip="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Blinding Angel deals combat damage to a player, that player skips his or her next combat phase.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta l’Angelo Accecante infligge danno da combattimento a un giocatore, quel giocatore salta la sua prossima fase di combattimento.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<TRIGGER value="PLAYER_TOOK_COMBAT_DAMAGE">
return Damage():GetSource() == Object()
</TRIGGER>
<RESOLUTION_TIME_ACTION>
TriggerPlayer():PlayerDataChest():Int_Inc( COMPARTMENT_ID_COMBAT_SKIPS )
</RESOLUTION_TIME_ACTION>
<SFX text="GLOBAL_SUNBLAST_ABILITY_RESOLVED_PLAY" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY active_zone="any" zone="any" pre_trigger="1" internal="1">
<TRIGGER value="BEGINNING_OF_STEP">
return MTG():GetStep() == STEP_MAIN_2 and
TriggerPlayer():MyTurn() ~= 0 and
TriggerPlayer():PlayerDataChest():Int_Get( COMPARTMENT_ID_COMBAT_SKIPS ) > 0
</TRIGGER>
<RESOLUTION_TIME_ACTION>
TriggerPlayer():PlayerDataChest():Int_Dec( COMPARTMENT_ID_COMBAT_SKIPS )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<STATIC_ABILITY influencing_zone="player" zone="any" layer="8">
<FILTER>
return FilteredPlayer() ~= nil
</FILTER>
<CONTINUOUS_ACTION>
if FilteredPlayer():PlayerDataChest():Int_Get( COMPARTMENT_ID_COMBAT_SKIPS ) > 0 then
FilteredPlayer():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_CANT_ATTACK, 1 )
end
</CONTINUOUS_ACTION>
<AI_BASE_SCORE score="900" zone="in_play" />
</STATIC_ABILITY>
<HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="Any" />
<SFX text="COMBAT_ANGEL_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_ANGEL_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
As long as all the cards we code use the same value for COMPARTMENT_ID_COMBAT_SKIPS, we can make any card that makes players skip their combat phase, and they will interact together nicely.
Incidentally, I discovered that layers really matter: if I use layer="6" instead of layer="8" for the static ability, the creatures that must attack each turn will attack anyway!
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1632
- Joined: 07 Nov 2011, 10:55
- Has thanked: 60 times
- Been thanked: 358 times
Re: Skipping a combat step (new findings added)
by Pesi » 03 May 2012, 15:24
If this card is used in two-headed-giant or archenemy, do all the players on that team skip the combat phase?
- Pesi
- Posts: 21
- Joined: 03 May 2012, 15:19
- Has thanked: 0 time
- Been thanked: 0 time
Re: Skipping a combat step (new findings added)
by thefiremind » 04 May 2012, 08:42
Good question... I didn't try. Actually, I don't even know what is the exact behaviour on those situations. I could guess that in Two-Headed Giant both players should be unable to attack, but in Archenemy the life totals are separate, so I don't know.Pesi wrote:If this card is used in two-headed-giant or archenemy, do all the players on that team skip the combat phase?
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1632
- Joined: 07 Nov 2011, 10:55
- Has thanked: 60 times
- Been thanked: 358 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest


