It is currently 16 Jun 2024, 03:37
   
Text Size

CounterSpell

Moderator: CCGHQ Admins

Re: CounterSpell

Postby sadlyblue » 15 Mar 2012, 11:13

But if that's the problem, shouldn't the RemoveFromGame solve that?
The diference from my code and the Isochron Scepter is the spell being played is a token vs a copy of an exiled card. That's what leads me to conclude the problem is obtaining the token doesn't copy the whole card.
More, what puzzles me is that is lets me make the choices, but it doesn't deal the damage (in the case of the Shock).

Btw:
Code: Select all
local card = MTG():ObtainToken( "SHOCK_245012", Object():GetController() )
card:RemoveFromGame()
if card:GetZone() == ZONE_REMOVED_FROM_GAME then
card:PlayFreeFromAnywhere( Object():GetController() )
end
Did the same thing. Since it lets me choose the targets this way i think proves the token is not nowhere.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: CounterSpell

Postby thefiremind » 15 Mar 2012, 12:06

I think I understood the problem. A token disappears when it moves to a zone that is not the battlefield. You can choose the targets because it happens before actually playing the spell, but then the game tries to move the token on the stack and it disappears. I'm afraid there's no solution to that.
< 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: CounterSpell

Postby sadlyblue » 15 Mar 2012, 19:01

The only solution would be to load the card counterspell to a variable.
I've tried io, but didn't managed to save any thing. I think those libraries are not loaded, and i don't know how to solve it.
If we were able to save an Object, we could know were the problem is. And would help with other code in the future.
Unfortunately, i'm a beginner coder. Emphasis on beginner.
If anyone, more experience with lua, knows how to do it, pls let me know.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: CounterSpell

Postby sadlyblue » 22 Mar 2012, 10:35

I know it not the ideal but this works.
Code: Select all
<TRIGGERED_ABILITY active_zone="any" auto_skip="1">
<TRIGGER value="COMES_INTO_PLAY" simple_qualifier="self" />
<RESOLUTION_TIME_ACTION>
  local card = MTG():ObtainToken( "LAVA_SPIKE_12340091", Object():GetController() )
  MTG():ObjectDataChest():Set_CardPtr( 1, card )
  Object():RetainDataChest()
  Object():GetPlayer():CopySpellWithNewTargets( card )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
As the creature entered battlefield it played the Lava Spike. And it will play any spell (like counterspell).
Not sure it needs the retaindata and set_cardptr. I was trying for so long this ability had the most comment lines ever :lol:

This is sort of good news for Spellstutter Sprite, Chalice of the Void, and so on. Not perfect, since the counterspell will trigger as a normal spell would, but is something. Maybe if we get a way not to trigger other cards, kind of a ghost-split-second counter (in case of the sprites and chalice).
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: CounterSpell

Postby Eglin » 22 Mar 2012, 21:14

sadlyblue wrote:I know it not the ideal but this works.
Code: Select all
<TRIGGERED_ABILITY active_zone="any" auto_skip="1">
<TRIGGER value="COMES_INTO_PLAY" simple_qualifier="self" />
<RESOLUTION_TIME_ACTION>
  local card = MTG():ObtainToken( "LAVA_SPIKE_12340091", Object():GetController() )
  MTG():ObjectDataChest():Set_CardPtr( 1, card )
  Object():RetainDataChest()
  Object():GetPlayer():CopySpellWithNewTargets( card )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
As the creature entered battlefield it played the Lava Spike. And it will play any spell (like counterspell).
Not sure it needs the retaindata and set_cardptr. I was trying for so long this ability had the most comment lines ever :lol:

This is sort of good news for Spellstutter Sprite, Chalice of the Void, and so on. Not perfect, since the counterspell will trigger as a normal spell would, but is something. Maybe if we get a way not to trigger other cards, kind of a ghost-split-second counter (in case of the sprites and chalice).
Great work! This is a fantastic workaround, IMHO.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: CounterSpell

Postby Eglin » 23 Mar 2012, 06:17

nabeshin wrote:There is at me an idea - it is incorrectly caused function, and from a hand it isn't fatal to a call. It is necessary to look than differs playing "spell ability" from "activated ability".
I'm not sure if this is what Nabe was trying to say all along or what, but Spellstutter Sprite can be easily coded by using a <SPELL_ABILTY> instead of a COMES_INTO_PLAY trigger. I've just tested it, and it works flawlessly.

Cheers,
Eglin
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: CounterSpell

Postby sadlyblue » 23 Mar 2012, 09:31

But if you use another way to put in play, like Aether Vial it wont trigger.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: CounterSpell

Postby Eglin » 23 Mar 2012, 10:04

sadlyblue wrote:But if you use another way to put in play, like Aether Vial it wont trigger.
Ahhhh. That makes sense. Shucks.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: CounterSpell

Postby nabeshin » 23 Mar 2012, 15:58

The problem is solved, all can have a rest, recently did Counterbalance and found working option.
Code: Select all
<TRIGGERED_ABILITY internal="1" auto_skip="1" >
  <TRIGGER value="ZONECHANGE">
     return ( TriggerObject():GetZone() == ZONE_STACK and
             TriggerObject():GetPlayer() ~= Object():GetPlayer() and
             also not a land)
  </TRIGGER>
  <RESOLUTION_TIME_ACTION>
     local card = Object():GetPlayer():Library_GetTop()      
     if card and card:GetConvertedManaCost() == TriggerObject():GetConvertedManaCost() then
       TriggerObject():CounterSpell()
       card:GuidedReveal(4,4)
     end
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
The problem is solved a roundabout way, the error rises if ability gets to stack without "internal" mode.
P.S. TRIGGER value="ZONECHANGE", if "spell_played" - then you were late.
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 31 times

Re: CounterSpell

Postby Persee » 23 Mar 2012, 18:13

Great job !!
User avatar
Persee
 
Posts: 168
Joined: 02 Jun 2011, 08:33
Has thanked: 42 times
Been thanked: 24 times

Re: CounterSpell

Postby sadlyblue » 23 Mar 2012, 19:19

Nice.
Just one thing, will the spell countered this way count as a spell played?
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: CounterSpell

Postby nabeshin » 23 Mar 2012, 21:17

didn't check, I think that isn't counted
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 31 times

Previous

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 22 guests


Who is online

In total there are 22 users online :: 0 registered, 0 hidden and 22 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 22 guests

Login Form