Page 1 of 1

New trigger: Always

PostPosted: 08 Jul 2011, 19:36
by Sloth
I've added a new trigger: Always. It triggers whenever static effects are checked. Example cards are Synod Centurion, Barbarian Outcast, Dandan etc.

The problem is that these triggers have conditions when they will trigger, but these are no intervening if clauses. The conditions should not be checked a second time on resolution. What's the best way to handle this? Are there any other triggers that have a similar problem?

Re: New trigger: Always

PostPosted: 08 Jul 2011, 20:24
by friarsol
Firstly, Did this file make it onto the server? I seem to be getting errors in my Eclipse.

I think the only way to handle this is in TriggerHandler.java wrapperAbility.resolve() line 855ish

Code: Select all
if (!regtrig.requirementsCheck()) {
   return;
}
Before that requirementsCheck happens we would need to check if the Trigger is (or is not) an Intervening If. I think it's more common to have an Intervening If, so we should probably leave that as the default. So these cards would have some type of "SkipResolveCheck$ True" as a parameter, which would be set before the Ability was created.

Code: Select all
final boolean skipResolveCheck = trigParams.containsKey("SkipResolveCheck");
// ...
if (!skipResolveCheck && !regtrig.requirementsCheck()) {
   return;
}

Re: New trigger: Always

PostPosted: 08 Jul 2011, 20:31
by friarsol
Also, here's some info about "State Triggers":

"When you control no permanents with phylactery counters on them, sacrifice Phylactery Lich."

"Phylactery Lich's last ability is a "state trigger." Once a state trigger triggers, it won't trigger again as long as the ability is on the stack. If the ability is countered and the trigger condition is still true, it will immediately trigger again."

We should make sure that gets implemented while you're in this part of the code.

Re: New trigger: Always

PostPosted: 08 Jul 2011, 20:36
by Hellfish
Original:
Not currently. My thinking is adding another parameter to specify InterveningIf$ True or False rather than
basically duplicate Trigger.requirementsCheck().

Post-Sol: (:P)
Yeah, basically SkipRequirementsCheck$. As for the state trigger business, if the ability is countered: the countering ability would resolve, state effects would be checked again and the trigger would go off again. Or have I misunderstood when our state effects are checked?

Re: New trigger: Always

PostPosted: 08 Jul 2011, 20:44
by Sloth
friarsol wrote:Firstly, Did this file make it onto the server? I seem to be getting errors in my Eclipse.
Fixed. I always forget the new files.

Hellfish wrote:Post-Sol: (:P)
Yeah, basically SkipRequirementsCheck$. As for the state trigger business, if the ability is countered: the countering ability would resolve, state effects would be checked again and the trigger would go off again. Or have I misunderstood when our state effects are checked?
The trigger would trigger again after the next ability hits the stack. Maybe an infinite loop is possible here. :?

Re: New trigger: Always

PostPosted: 08 Jul 2011, 20:45
by friarsol
Hellfish wrote:As for the state trigger business, if the ability is countered: the countering ability would resolve, state effects would be checked again and the trigger would go off again. Or have I misunderstood when our state effects are checked?
The important part is: while it might get checked at each State Check, it only goes on the Stack if it's not already on the Stack. This is only important in a complex example.

Example:
I have an Emperor Crocodile with no other creatures. It's trigger goes on the stack. In response I cast Carrion Call. The trigger doesn't go on the stack again because it's already on. The Call resolves. Then Croc's trigger resolves and it gets sacrificed.

Example2:
I have an Emperor Crocodile with no other creatures. It's trigger goes on the stack. In response I cast Stifle on the trigger. In response to that I cast Carrion Call. Call resolves. I get some tokens. Stifle resolves countering Croc's trigger. Now we have a State Check, but I now have creatures, so the State Trigger doesn't occur.

Edit: Fixing some poor wording

Re: New trigger: Always

PostPosted: 08 Jul 2011, 21:28
by Hellfish
Ah, that's gonna require some additional tracking...

Re: New trigger: Always

PostPosted: 08 Jul 2011, 21:41
by friarsol
Sloth wrote:The trigger would trigger again after the next ability hits the stack. Maybe an infinite loop is possible here. :?
Infinite Loops is the other reason it doesn't go on the stack if it's already on. :-d

Re: New trigger: Always

PostPosted: 09 Jul 2011, 10:47
by Hellfish
It wasn't as bad as I feared, actually, just an extra field in SpellAbility,an extra method in MagicStack and a couple of if's in runSingleTrigger. Of course, I still have to verify it all :mrgreen:
EDIT:Looks good to me, the examples and some additional tests check out fine!

Re: New trigger: Always

PostPosted: 09 Jul 2011, 16:09
by Sloth
Hellfish wrote:It wasn't as bad as I feared, actually, just an extra field in SpellAbility,an extra method in MagicStack and a couple of if's in runSingleTrigger. Of course, I still have to verify it all :mrgreen:
EDIT:Looks good to me, the examples and some additional tests check out fine!
Thanks for fixing this Hellfish.