Okay, stayed up all night coding and put together something experimental and a bit more easy to read:
- Code: Select all
Name:Abyssal Horror
ManaCost:4 B B
Types:Creature Horror
Text:When Abyssal Horror enters the battlefield, target player discards two cards.
PT:2/2
K:Flying
T:Mode$ ChangesZone | From$ Any | To$ Battlefield | ValidCard$ Self | Execute$ ETBDiscard | StackDescription$ Target player discards 2 cards.
SVar:ETBDiscard:AB$Discard | Cost$ 0 | ValidTgts$ Player | TgtPrompt$ Select target player. | NumCards$ 2 | Mode$ TgtChoose
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/abyssal_horror.jpg
SetInfo:USG|Rare|http://magiccards.info/scans/en/us/115.jpg
SetInfo:S99|Rare|http://magiccards.info/scans/en/st/63.jpg
SetInfo:7ED|Rare|http://magiccards.info/scans/en/7e/115.jpg
End
T: lines define a trigger, i.e. "The When".
Then, in an SVar, a regular ability is written and referenced by the trigger, i.e. "The What". (Cost$ should usually be 0, unless it's a "Whenever
X, you may pay Y to..."-type deal. Triggers have 3 universal parameters currently: Mode,
Execute and Optional.Mode specifies what kind of trigger it is,
Execute specifies which SVar contains the ability to trigger and Optional is kind of self-explanatory

. All other parameters depend on which Mode is used.
When adding a new trigger-mode, you'd have to do these 3 steps:
- Add a new private boolean XTest(Trigger trigger,HashMap<String,Object> runParams) method to the new TriggerHandler class, where X is the name of the mode.
- Add a call to that method from TriggerHandler.runTrigger.
- Add calls to TriggerHandler.runTrigger from where the trigger should be uh triggered, where you must also fill out the runParams map with all objects that will be needed for the test to work.
Things I'm still working on:
- SpellDescriptions: At this time, a description of the triggered ability is not added to the card's text box.
- Parse triggers only once: Right now, they're parsed again and again whenever they are registered with the handler, which is when their host card comes into play. Speaking of which...
- Parse and register certain triggers before they come into play: There are probably cards with triggered abilities that function outside the battlefield that I just can't recall right now.
- More modes: DamageDone is in it's infant stages. CastSpell is a possibility. Suggestions welcome!
Of course, this is just an experimental draft, please do point out flaws or suggest alterations.