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
Implementing "Split Second"
Moderator: CCGHQ Admins
Implementing "Split Second"
by Injuis » 27 Jun 2011, 18:21
I need some help implementing split second as the Community's version used for Extirpate doesn't work at all. You can play whatever you want on the stack, over Extirpate, and abilities can be used at whim.
Currently, I am working on Stonewood Invocation and I have it partially working. Here is the code:
2) The Spell_ability only works when the two triggered_ability do not have zones of "any". I had it working simultaneously with the above at a certain point but broke it again. Now I can't figure out what I did.
3) I have learned that the "CHARACTERISTIC_CANT_USE_ABILITIES" is set but is immediately unset after a triggered_ability resolves. I am not sure why. This characteristic will work 100% if used in a permanent (using Extirpate's mechanics). I'm convinced this is bugged for instants.
I'm stumped at this point. Maybe I'll just move on when Kev gets 2012 going (great work, btw!)
Any thoughts?
Currently, I am working on Stonewood Invocation and I have it partially working. Here is the code:
- Code: Select all
<!--
///////////////////////////////////
Pump, Shroud
///////////////////////////////////
-->
<SPELL_ABILITY layer="7c" tag="STONEWOOD_INVOCATION_RULE_2" simple_filter="Target" >
<TARGET_DETERMINATION>
return TargetCreatureGood()
</TARGET_DETERMINATION>
<PLAYTIME>
ChooseTargetCreature()
</PLAYTIME>
<EFFECT>
AddPowerAndToughnessToTargetCard( 5, 5 )
TargetCardHasShroud()
</EFFECT>
<DURATION>
return UntilEndOfTurn()
</DURATION>
</SPELL_ABILITY>
<!--
///////////////////////////////////
SPLIT SECOND
///////////////////////////////////
-->
<TRIGGERED_ABILITY layer="8" forced_skip="1" zone="any" >
<TRIGGER value="ZONECHANGE">
return (SelfTriggered() and TriggerObject():GetZone() == ZONE_STACK)
</TRIGGER>
<FILTER>
return InHand() or InPlay()
</FILTER>
<EFFECT>
Subject():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_BE_PLAYED, 1 )
Subject():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_USE_ABILITIES, 1 )
<!-- Help with debugging -->
YouGainLife (1)
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="8" forced_skip="1" zone="any">
<TRIGGER value="SPELL_RESOLVED">
return SelfTriggered()
</TRIGGER>
<FILTER>
return InHand() or InPlay()
</FILTER>
<EFFECT>
Subject():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_BE_PLAYED, 0 )
Subject():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_USE_ABILITIES, 0 )
</EFFECT>
</TRIGGERED_ABILITY>
2) The Spell_ability only works when the two triggered_ability do not have zones of "any". I had it working simultaneously with the above at a certain point but broke it again. Now I can't figure out what I did.
3) I have learned that the "CHARACTERISTIC_CANT_USE_ABILITIES" is set but is immediately unset after a triggered_ability resolves. I am not sure why. This characteristic will work 100% if used in a permanent (using Extirpate's mechanics). I'm convinced this is bugged for instants.
I'm stumped at this point. Maybe I'll just move on when Kev gets 2012 going (great work, btw!)
Any thoughts?
- Injuis
- Posts: 4
- Joined: 27 Jun 2011, 18:11
- Has thanked: 0 time
- Been thanked: 0 time
Re: Implementing "Split Second"
by Shatterhouse » 28 Jun 2011, 00:07
Move the EFFECT block from SPELL_ABILITY to TRIGGERED_ABILITY. This way, you cast the spell and *BAM* its effect hits before anybody can possibly activate anything.
- Shatterhouse
- Posts: 69
- Joined: 20 Apr 2011, 00:07
- Has thanked: 0 time
- Been thanked: 1 time
Re: Implementing "Split Second"
by Injuis » 28 Jun 2011, 17:08
Thanks for the quick reply Shatterhouse. I gave what you suggest a shot and it ended up failing on 1, 2, and 3. The troubling part is that 2 will only work if the zone is "any" and 1 will never work if the zone is "any". It's one or the other! I'm gonna try messing around with static abilities and see if I can cook up anything.
- Injuis
- Posts: 4
- Joined: 27 Jun 2011, 18:11
- Has thanked: 0 time
- Been thanked: 0 time
Re: Implementing "Split Second"
by Shatterhouse » 28 Jun 2011, 23:58
I don't think it's even necessary to set a characteristic that prevents anybody from playing spells if you do it like this:
- Code: Select all
<SPELL_ABILITY tag="SUDDEN_SHOCK_RULE_1" layer="0">
<TARGET_DETERMINATION>
return TargetCreatureOrPlayerBad()
</TARGET_DETERMINATION>
</SPELL_ABILITY>
<TRIGGERED_ABILITY zone="HAND" layer="0" forced_skip="1" pre_trigger="1">
<TRIGGER value="SPELL_PLAYED">
return SelfTriggered()
</TRIGGER>
<PLAYTIME>
ChooseTarget( "ChooseCreatureOrPlayerTwoDamage" )
</PLAYTIME>
<EFFECT>
DealDamageToTarget( 2 )
</EFFECT>
</TRIGGERED_ABILITY>
- Shatterhouse
- Posts: 69
- Joined: 20 Apr 2011, 00:07
- Has thanked: 0 time
- Been thanked: 1 time
Re: Implementing "Split Second"
by Injuis » 03 Jul 2011, 17:37
Hm... I'm not sure if perhaps I'm running a different version but your code doesn't work for me. When I use your code I am still able to cast multiple sudden shock's on top of each other (Try it targeting a player and not creature). And when I throw in the mechanics required for stonewood invocation, it just doesn't work at all. I am able to cast spells and abilities on top of the original played spell and the effects for stonwood do not get applied at all. Thanks for your help regardless.
I managed a work-around using a token that implements that static abilities of split second. It works like a charm but kinda leaves an ugly mechanic token the playing field until everything resolves.
I managed a work-around using a token that implements that static abilities of split second. It works like a charm but kinda leaves an ugly mechanic token the playing field until everything resolves.
- Injuis
- Posts: 4
- Joined: 27 Jun 2011, 18:11
- Has thanked: 0 time
- Been thanked: 0 time
Re: Implementing "Split Second"
by keitofu » 22 Feb 2012, 06:52
any news for implementing split second in DOTP 2012 ?
It would be great
It would be great
Re: Implementing "Split Second"
by sadlyblue » 22 Feb 2012, 15:47
I think its easy.
Just tried Sudden Shock, the trick is to use the triggered ability.
Only problem, the spell can be countered, if you do not use the "can't be countered". But has soon the spell hits the stack it will do the 2 damage.
Here's the code:
Thanks
Just tried Sudden Shock, the trick is to use the triggered ability.
Only problem, the spell can be countered, if you do not use the "can't be countered". But has soon the spell hits the stack it will do the 2 damage.
Here's the code:
- Code: Select all
<SPELL_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Sudden Shock deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<SFX text="TARGET_LIGHTNING_PLAY" />
<AI_BASE_SCORE score="750" zone="hand" />
</SPELL_ABILITY>
<TRIGGERED_ABILITY forced_skip="1" active_zone="any" zone="any">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)]]></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[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<TRIGGER value="SPELL_PLAYED" >
return TriggerObject() == Object()
</TRIGGER>
<TARGET_DETERMINATION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetFilterType( FILTER_TYPE_CARDS + FILTER_TYPE_PLAYERS )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
return TargetBadF()
</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">
ChooseTarget( "CARD_QUERY_CHOOSE_DEAL_2_DAMAGE" )
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
if ( Object():GetTargetCard() ~= nil ) then
Object():GetTargetCard():DealDamage(2, Object())
elseif ( Object():GetTargetPlayer() ~= nil ) then
Object():GetTargetPlayer():DealDamage(2, Object())
end
</RESOLUTION_TIME_ACTION>
<AI_BASE_SCORE score="150" zone="in_play" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="Stack">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<TRIGGER value="SPELL_BEING_COUNTERED">
return TriggerObject() == Object()
</TRIGGER>
</TRIGGERED_ABILITY>
Thanks
Re: Implementing "Split Second"
by keitofu » 22 Feb 2012, 16:16
Thanks for the input.
I've just tried but it did not work, I can top a Sudden shock with another spell :-/
I've just tried but it did not work, I can top a Sudden shock with another spell :-/
Re: Implementing "Split Second"
by thefiremind » 22 Feb 2012, 19:05
Did someone try with a continuous action that works when the card is on the stack and shuts down each player's spells and abilities?
I mean, you make the card like it didn't have split second, and then you add something like this:
I mean, you make the card like it didn't have split second, and then you add something like this:
- Code: Select all
<STATIC_ABILITY active_zone="any" influencing_zone="player">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)]]></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[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<FILTER>
return (FilteredPlayer() ~= nil)
</FILTER>
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_STACK then
FilteredPlayer():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_CANT_CAST_SPELLS, 1 )
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<STATIC_ABILITY active_zone="any" influencing_zone="in_play">
<FILTER>
return (FilteredCard() ~= nil)
</FILTER>
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_STACK then
FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_USE_ABILITIES, 1 )
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
< 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: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
Re: Implementing "Split Second"
by sadlyblue » 22 Feb 2012, 21:10
You can play a spell in response, while sudden shock is on the stack, but the 2 damage is already done.keitofu wrote:Thanks for the input.
I've just tried but it did not work, I can top a Sudden shock with another spell :-/
Re: Implementing "Split Second"
by keitofu » 23 Feb 2012, 06:33
My bad, you're absolutely right, as soon as it enters the stack the effect is done.
It is not exactly split second, because you can cast a spell or use an ability while the card is not yet in the graveyard, but the main feature works.
Thanks a lot !
It is not exactly split second, because you can cast a spell or use an ability while the card is not yet in the graveyard, but the main feature works.
Thanks a lot !
Re: Implementing "Split Second"
by keitofu » 24 Feb 2012, 08:33
I have a little problem with your code for split second sadblue. I don't really why, but it seems it messes the target determination.
For sudden death, the spell can only target creature, but even when there is no creature I can play it. Without the modification for split second, I can't.
So I fiddle your Sudden Shock, deleting the filter for player ( FILTER_TYPE_PLAYERS), and I have the same behavior. The card is always enlightened as if the target determination were good. Any ideas ?
Thanks
For sudden death, the spell can only target creature, but even when there is no creature I can play it. Without the modification for split second, I can't.
So I fiddle your Sudden Shock, deleting the filter for player ( FILTER_TYPE_PLAYERS), and I have the same behavior. The card is always enlightened as if the target determination were good. Any ideas ?
Thanks
Re: Implementing "Split Second"
by sadlyblue » 24 Feb 2012, 10:26
You delete the filter_type_players in the triggered ability.
But then you should add a filter to target only creatures on the spell ability. That's what the game checks to see if the spell can be played...
But then you should add a filter to target only creatures on the spell ability. That's what the game checks to see if the spell can be played...
Re: Implementing "Split Second"
by keitofu » 24 Feb 2012, 13:03
Thanks !!
It's exactly that, I moved the <TARGET_DETERMINATION> from the triggered_ability to spell ability and now it works.
Thanks a lot !
It's exactly that, I moved the <TARGET_DETERMINATION> from the triggered_ability to spell ability and now it works.
Thanks a lot !
Re: Implementing "Split Second"
by thefiremind » 24 Feb 2012, 15:02
Hey... I think I made it right this time! This is my implementation of split second:
I tested it in a deck with just Sudden Shock and Cinder Pyromancer, and while a Sudden Shock is on the stack, I can't play other Sudden Shocks or activate the Pyromancer's ability. Let me know if you find bugs.
- Code: Select all
<TRIGGERED_ABILITY internal="1" active_zone="any" zone="InPlayAndPlayers">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Split second]]></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[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE" simple_qualifier="self">
return Object():GetZone() == ZONE_STACK
</TRIGGER>
<FILTER>
return (FilteredPlayer() ~= nil) or (FilteredCard() ~= nil)
</FILTER>
<CONTINUOUS_ACTION>
if (FilteredPlayer() ~= nil) then
FilteredPlayer():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_CANT_CAST_SPELLS, 1 )
elseif (FilteredCard() ~= nil) then
FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_USE_ABILITIES, 1 )
end
</CONTINUOUS_ACTION>
<DURATION>
return (Object():GetZone() ~= ZONE_STACK)
</DURATION>
</TRIGGERED_ABILITY>
I tested it in a deck with just Sudden Shock and Cinder Pyromancer, and while a Sudden Shock is on the stack, I can't play other Sudden Shocks or activate the Pyromancer's ability. Let me know if you find bugs.
< 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: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
23 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest


