Trigger discussion (was WheneverKeyword reference)
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Trigger discussion (was WheneverKeyword reference)
by slapshot5 » 17 Mar 2011, 15:33
When does the code for option (a) get called? When the triggered ability resolves, or when it's put on the stack?
I've got that code right below the comment "//All tests passed, execute ability." in TriggerHandler.runSingleTrigger().
Right now, I:
1. select a spell
2. tap a land for mana that triggers this
3. the trigger goes on the stack
4. Click Cancel for paying the rest of the mana
--notice land is untapped, and no mana added to your pool
--expected = land stays tapped, and its mana is added to your mana pool
I've got that code right below the comment "//All tests passed, execute ability." in TriggerHandler.runSingleTrigger().
Right now, I:
1. select a spell
2. tap a land for mana that triggers this
3. the trigger goes on the stack
4. Click Cancel for paying the rest of the mana
--notice land is untapped, and no mana added to your pool
--expected = land stays tapped, and its mana is added to your mana pool
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Trigger discussion (was WheneverKeyword reference)
by slapshot5 » 17 Mar 2011, 17:39
Ok, I see. It's called when the trigger goes on the stack, but my stuff still isn't working correctly. Will dig further.
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Trigger discussion (was WheneverKeyword reference)
by slapshot5 » 17 Mar 2011, 19:28
Error on my end. Move along. Nothing to see here.
-slapshot5
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Trigger discussion (was WheneverKeyword reference)
by friarsol » 08 May 2011, 19:31
Do Triggers have a quick utility function to check whether or not they are mandatory/optional? I was going to add some code into Spell_Permanent so we could get rid of etbLoseLife (and improve AIs handling of other ETB effects). But need to have something like that before I can. Would I just check for OptionalDecider?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Trigger discussion (was WheneverKeyword reference)
by Hellfish » 08 May 2011, 19:44
The system itself just checks for OptionalDecider, yeah, so there's no isMandatory()-like on Trigger objects. Maybe there should be, for clarity?
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: Trigger discussion (was WheneverKeyword reference)
by friarsol » 08 May 2011, 20:24
Maybe. I'll just grab it from the Params, and if we want to create small helper functions for the most commonly used stuff as the AF system does, we can do that at a later point.Hellfish wrote:The system itself just checks for OptionalDecider, yeah, so there's no isMandatory()-like on Trigger objects. Maybe there should be, for clarity?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Who is online
Users browsing this forum: No registered users and 34 guests