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 Hellfish » 12 Jan 2011, 20:26
Well, I'm pretty sure I've taken care of the trigger ordering(It's at least in APNAP order now
), and just maybe at least some of the "intervening if" problem as well though that will take some testing. What I'm trying is; I wrap the SpellAbility I get from the AbilityFactory in another Ability object, which in it's resolve calls the AF's spellability's resolve but not before doing the same restrictionCheck() that is done when the trigger first goes off (which will, and currently does, handle all checks from intervening ifs) I then play this wrapper instead.

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 » 15 Jan 2011, 14:33
Hellfish, can you merge your Trigger docs into the Wiki attached in a few places like how everything else is?
- 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 Sloth » 15 Jan 2011, 15:01
I just tested the card Abyssal Horror, you converted and it:
a) triggers when any card enters the battlefield and
b) while Abyssal Horror is in your hand.
a) triggers when any card enters the battlefield and
b) while Abyssal Horror is in your hand.
- Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | Execute$ TrigDiscard | TriggerDescription$ When CARDNAME enters the battlefield, target player discards two cards.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Trigger discussion (was WheneverKeyword reference)
by jeffwadsworth » 15 Jan 2011, 17:24
I was testing Desolation Angel implementation with triggers. When it triggered, 4 Abyssal Horror discard 2 messages stacked up. There were no cards of this type in either deck. Please disregard the cost of the cards...test.
- Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDestroyLand | TrigDescription$ Test
SVar:TrigDestroyLand:AB$DestroyAll | Cost$ 3 B B | ValidCards$ Land.YouCtrl | SpellDescription$ Destroy all lands you control.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Trigger discussion (was WheneverKeyword reference)
by Hellfish » 16 Jan 2011, 01:55
Once I´ve sobered up I will
A) I've already added the trigger docs I had to the wiki
B) I will test Abyssal Horror more closely to see what is up with that.
C) I will look into the desolation angel issue.
Thanks for reporting things!
A) I've already added the trigger docs I had to the wiki
B) I will test Abyssal Horror more closely to see what is up with that.
C) I will look into the desolation angel issue.
Thanks for reporting things!

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 » 16 Jan 2011, 02:25
I don't think the Desolation Angel is an issue. Desolation Angel needs to be kicked while it's being cast. Then during the Trigger it should either kill your lands, or if it was kicked kill all lands. I'm not sure if this conditional can be handled right now.Hellfish wrote:Once I´ve sobered up I will
A) I've already added the trigger docs I had to the wiki
B) I will test Abyssal Horror more closely to see what is up with that.
C) I will look into the desolation angel issue.
Thanks for reporting things!
- 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 jeffwadsworth » 16 Jan 2011, 02:42
Let me be a little clearer. I was only testing one part of Desolation Angel. I am aware that you can stack spells to account for Kicker; for example Urza's Rage. I noticed that you can not currently do that with Triggers. My point in the previous post was to note a strange error with the Abyssal Horror.
On a side note, the card Sunblast Angel does not work correctly. Sometimes it will destroy the tapped creatures and at others, nothing happens.
On a side note, the card Sunblast Angel does not work correctly. Sometimes it will destroy the tapped creatures and at others, nothing happens.
Last edited by jeffwadsworth on 16 Jan 2011, 03:09, edited 2 times in total.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Trigger discussion (was WheneverKeyword reference)
by friarsol » 16 Jan 2011, 02:56
Oh alright.
Just so you know comparing the Angel to Rage isn't exactly apples to oranges though, since for non-permanent spells you can have the Kicker cost included in the cost to allow for a "kicked" spell. But for permanent spells there isn't a way to change the casting cost to account for being kicked and using a different Trigger.
Just so you know comparing the Angel to Rage isn't exactly apples to oranges though, since for non-permanent spells you can have the Kicker cost included in the cost to allow for a "kicked" spell. But for permanent spells there isn't a way to change the casting cost to account for being kicked and using a different Trigger.
- 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 » 16 Jan 2011, 19:44
Withe your added ValidCard restriction, the card worked fine here. May have been something related that someone else fixed elsewhere. I'll add your fix though, thanks!jeffwadsworth wrote:I was testing Desolation Angel implementation with triggers. When it triggered, 4 Abyssal Horror discard 2 messages stacked up. There were no cards of this type in either deck. Please disregard the cost of the cards...test.
- Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDestroyLand | TrigDescription$ Test
SVar:TrigDestroyLand:AB$DestroyAll | Cost$ 3 B B | ValidCards$ Land.YouCtrl | SpellDescription$ Destroy all lands you control.
If we add some way to specify kicker-costs(Single costs at least) in text-only, the triggers can be used as-is for that sort of thing. i.e.friarsol wrote:Oh alright.
Just so you know comparing the Angel to Rage isn't exactly apples to oranges though, since for non-permanent spells you can have the Kicker cost included in the cost to allow for a "kicked" spell. But for permanent spells there isn't a way to change the casting cost to account for being kicked and using a different Trigger.
- Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+kicked etc...
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 » 16 Jan 2011, 20:10
Yep kicked and nonkicked would probably be a good way to handle these types of things.Hellfish wrote:If we add some way to specify kicker-costs(Single costs at least) in text-only, the triggers can be used as-is for that sort of thing. i.e.
- Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+kicked etc...
- 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 Zirbert » 19 Jan 2011, 03:20
Any chance we could get a phase-trigger example added to the wiki (http://www.slightlymagic.net/wiki/User:Hellfish/Trigger), to go with the Contagion Clasp example? That one's great - I especially like the annotation / code commenting - but I can't quite grok the syntax if I'm trying to code a card that says "At the beginning of your upkeep, do X".
Or, if somebody could point me toward some cards in the 01-14 beta that use the new trigger syntax, I'll try to do my own homework from there.
I'm still hoping to eventually contribute a card or two to this project, but I am - and will doubtlessly remain - an utter neophyte at coding (and that's being generous). I've got to read other text-implemented cards and cobble things together from there.
-Zirbert
http://zirbert.blogspot.com
Or, if somebody could point me toward some cards in the 01-14 beta that use the new trigger syntax, I'll try to do my own homework from there.
I'm still hoping to eventually contribute a card or two to this project, but I am - and will doubtlessly remain - an utter neophyte at coding (and that's being generous). I've got to read other text-implemented cards and cobble things together from there.
-Zirbert
http://zirbert.blogspot.com
Re: Trigger discussion (was WheneverKeyword reference)
by Sloth » 19 Jan 2011, 06:18
You can take a peek at what's been submitted to the SVN here: http://code.google.com/p/cardforge/source/list. At the moment a lot of cards with the trigger mechanic are added or converted.Zirbert wrote:Or, if somebody could point me toward some cards in the 01-14 beta that use the new trigger syntax, I'll try to do my own homework from there.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Trigger discussion (was WheneverKeyword reference)
by Hellfish » 19 Jan 2011, 07:41
I'll write up another example this afternoon. Also, there are no "official" cards using the trigger-system included in the 1-14 beta because it needed alot of additional polish before public release, or we'd have to do alot more frequent betas for a time afterwards to address fixes that can be quite serious. (For a time, trigger system cards only worked correctly if there were no more than one in the game! o_O)
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 Zirbert » 19 Jan 2011, 22:44
Thanks for the tips on finding trigger examples! Confession time - until last night, I had no idea there were docs on coding in the wiki, and didn't know about the Committed Changes page until Sloth pointed me toward it. I'm getting a lot better idea how to write up a card or three.
I *think* this will work. Those who already know what you're doing, please feel free to correct my errors. And don't worry about being gentle, I want to learn. My first (finished) card attempt:
-Zirbert
I *think* this will work. Those who already know what you're doing, please feel free to correct my errors. And don't worry about being gentle, I want to learn. My first (finished) card attempt:
- Code: Select all
Name: Merrow Commerce
ManaCost:1 U
Types: Tribal Enchantment Merfolk
Text: At the beginning of your end step, untap all Merfolk you control.
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ UntapMerfolk | TriggerDescription$ At the beginning of your end step, untap all Merfolk you control.
SVar:UntapMerfolk:A:SP$UntapAll|Cost$0|ValidCards$Merfolk.YouCtrl|SpellDescription$Untap all Merfolk you control.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
#SVar:Picture:http://www.wizards.com/global/images/magic/general/merrow_commerce.jpg
SVar:Picture:http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=139663&type=card
SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/72.jpg
- Code: Select all
null
Version:
Forge -- official beta: $Date: 2011-01-06 11:34:48 -0500 (Thu, 06 Jan 2011) $, SVN revision: $Revision: 4891 $
OS: Linux Version: 2.6.31-9-rt Architecture: amd64
Java Version: 1.6.0_18 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.NullPointerException
at forge.ReadCard.loadCard(ReadCard.java:154)
at forge.ReadCard.run(ReadCard.java:118)
at forge.CardFactory.readCards(CardFactory.java:92)
at forge.CardFactory.<init>(CardFactory.java:66)
at forge.AllZone.<clinit>(AllZone.java:29)
at forge.Gui_NewGame$2.run(Gui_NewGame.java:185)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
-Zirbert
Re: Trigger discussion (was WheneverKeyword reference)
by friarsol » 19 Jan 2011, 23:20
This isn't going to work in the beta for a few reasons.Zirbert wrote:
- Code: Select all
Name: Merrow Commerce
ManaCost:1 U
Types: Tribal Enchantment Merfolk
Text: At the beginning of your end step, untap all Merfolk you control.
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ UntapMerfolk | TriggerDescription$ At the beginning of your end step, untap all Merfolk you control.
SVar:UntapMerfolk:A:AB$UntapAll|Cost$0|ValidCards$Merfolk.YouCtrl|SpellDescription$Untap all Merfolk you control.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
#SVar:Picture:http://www.wizards.com/global/images/magic/general/merrow_commerce.jpg
SVar:Picture:http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=139663&type=card
SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/72.jpg
1. Card Files need to have "End" as the last line in the file.
2. Phase triggers weren't setup for End of Turn yet
3. It needs to be AB$ (for Ability) not A:SP$ (for Spell) (And the A: isn't used)
Also don't put spaces after the Colon I'll see if I can get this working as expected.
Edit: I might have lied about it not being setup in the beta.
Try this and see if it works:
- Code: Select all
Name:Merrow Commerce
ManaCost:1 U
Types:Tribal Enchantment Merfolk
Text:no text
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ TrigUntapMerfolk | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your end step, untap all Merfolk you control.
SVar:TrigUntapMerfolk:AB$UntapAll|Cost$0|ValidCards$Merfolk.YouCtrl|SpellDescription$Untap all Merfolk you control.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
#SVar:Picture:http://www.wizards.com/global/images/magic/general/merrow_commerce.jpg
SVar:Picture:http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=139663&type=card
SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/72.jpg
[/code]
Last edited by friarsol on 19 Jan 2011, 23:25, edited 2 times in total.
- 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 46 guests