New trigger: Always
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
10 posts
• Page 1 of 1
New trigger: Always
by Sloth » 08 Jul 2011, 19:36
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?
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?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New trigger: Always
by friarsol » 08 Jul 2011, 20:24
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
I think the only way to handle this is in TriggerHandler.java wrapperAbility.resolve() line 855ish
- Code: Select all
if (!regtrig.requirementsCheck()) {
return;
}
- Code: Select all
final boolean skipResolveCheck = trigParams.containsKey("SkipResolveCheck");
// ...
if (!skipResolveCheck && !regtrig.requirementsCheck()) {
return;
}
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New trigger: Always
by friarsol » 08 Jul 2011, 20:31
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.
"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.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New trigger: Always
by Hellfish » 08 Jul 2011, 20:36
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?
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?
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: New trigger: Always
by Sloth » 08 Jul 2011, 20:44
Fixed. I always forget the new files.friarsol wrote:Firstly, Did this file make it onto the server? I seem to be getting errors in my Eclipse.
The trigger would trigger again after the next ability hits the stack. Maybe an infinite loop is possible here.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?

-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New trigger: Always
by friarsol » 08 Jul 2011, 20:45
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.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?
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
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New trigger: Always
by Hellfish » 08 Jul 2011, 21:28
Ah, that's gonna require some additional tracking...
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: New trigger: Always
by friarsol » 08 Jul 2011, 21:41
Infinite Loops is the other reason it doesn't go on the stack if it's already on. :-dSloth wrote:The trigger would trigger again after the next ability hits the stack. Maybe an infinite loop is possible here.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New trigger: Always
by Hellfish » 09 Jul 2011, 10:47
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
EDIT:Looks good to me, the examples and some additional tests check out fine!

EDIT:Looks good to me, the examples and some additional tests check out fine!
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: New trigger: Always
by Sloth » 09 Jul 2011, 16:09
Thanks for fixing this Hellfish.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![]()
EDIT:Looks good to me, the examples and some additional tests check out fine!
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 40 guests