Page 3 of 8

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 12 Jan 2011, 20:26
by Hellfish
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 15 Jan 2011, 14:33
by friarsol
Hellfish, can you merge your Trigger docs into the Wiki attached in a few places like how everything else is?

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 15 Jan 2011, 15:01
by Sloth
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.

Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | Execute$ TrigDiscard | TriggerDescription$ When CARDNAME enters the battlefield, target player discards two cards.
EDIT: I added "ValidCard$ Card.Self | " and the issue is gone, but now the ability triggered 4 times, when Abyssal Horror etB'ed!

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 15 Jan 2011, 17:24
by jeffwadsworth
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 01:55
by Hellfish
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! :)

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 02:25
by friarsol
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! :)
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 02:42
by jeffwadsworth
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 02:56
by friarsol
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 19:44
by Hellfish
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.
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!
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.
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...

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 16 Jan 2011, 20:10
by friarsol
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...
Yep kicked and nonkicked would probably be a good way to handle these types of things.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 19 Jan 2011, 03:20
by Zirbert
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

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 19 Jan 2011, 06:18
by Sloth
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.
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.

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 19 Jan 2011, 07:41
by Hellfish
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)

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 19 Jan 2011, 22:44
by Zirbert
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:

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
I'm running the 1-14 beta, and it really doesn't like this card being added to /res/cardsfolder - it makes my Forge throw up on attempted boot with this error:

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)
I'm going to assume (hope) that this is because I'm running an "old" version that can't handle the new trigger coding. I'm not quite ready to try running SVN just yet. Or it could be because I've coded something completely nonsensical and heinous. Feedback is welcome...

-Zirbert

Re: Trigger discussion (was WheneverKeyword reference)

PostPosted: 19 Jan 2011, 23:20
by friarsol
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
This isn't going to work in the beta for a few reasons.

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
End
[/code]