allow action to be followed by if condition

master
melvin 2012-12-15 10:41:34 +08:00
parent c7ece8234f
commit 2c5d68010f
3 changed files with 20 additions and 4 deletions

View File

@ -19,7 +19,7 @@ Effect
;
SingleEffect
= (Duration SEP)? (Optional SPACE)? (SelectPlayer SPACE)? (Optional SPACE)? Action (SPACE Duration)?
= (Duration SEP)? (Optional SPACE)? (SelectPlayer SPACE)? (Optional SPACE)? Action (SPACE Duration)? (SPACE IfCondition)?
;
Optional

View File

@ -2106,6 +2106,8 @@ modular 3
modular 4
modular 6
morbid — at the beginning of each end step, if a creature died this turn, destroy target non-demon creature.
morbid — @ enters the battlefield with four +1/+1 counters on it if a creature died this turn.
morbid — @ enters the battlefield with two +1/+1 counters on it if a creature died this turn.
morbid — when @ enters the battlefield, if a creature died this turn, put a 2/2 black zombie creature token onto the battlefield.
morbid — when @ enters the battlefield, if a creature died this turn, put two +1/+1 counters on target creature.
morbid — when @ enters the battlefield, if a creature died this turn, target creature gets -4/-4 until end of turn.

View File

@ -1,6 +1,6 @@
//=========================================================================
//
// This file was generated by Mouse 1.5 at 2012-12-13 05:52:01 GMT
// This file was generated by Mouse 1.5 at 2012-12-15 02:40:20 GMT
// from grammar '/home/melvin/Modules/magarena/grammar/mtg.peg'.
//
//=========================================================================
@ -137,7 +137,8 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
//=====================================================================
// SingleEffect = (Duration SEP)? (Optional SPACE)? (SelectPlayer
// SPACE)? (Optional SPACE)? Action (SPACE Duration)? ;
// SPACE)? (Optional SPACE)? Action (SPACE Duration)? (SPACE
// IfCondition)? ;
//=====================================================================
private boolean SingleEffect()
{
@ -148,6 +149,7 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
SingleEffect_1();
if (!Action()) return reject();
SingleEffect_3();
SingleEffect_4();
return sem.action() && accept();
}
@ -195,6 +197,17 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
return acceptInner();
}
//-------------------------------------------------------------------
// SingleEffect_4 = SPACE IfCondition
//-------------------------------------------------------------------
private boolean SingleEffect_4()
{
if (savedInner(SingleEffect_4)) return reuseInner();
if (!SPACE()) return rejectInner();
if (!IfCondition()) return rejectInner();
return acceptInner();
}
//=====================================================================
// Optional = "you may have" / "you may" / "if you don't," / "if you
// can't," / "if you do," / "may" ;
@ -4431,6 +4444,7 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
final Cache SingleEffect_1 = new Cache("SingleEffect_1"); // Optional SPACE
final Cache SingleEffect_2 = new Cache("SingleEffect_2"); // SelectPlayer SPACE
final Cache SingleEffect_3 = new Cache("SingleEffect_3"); // SPACE Duration
final Cache SingleEffect_4 = new Cache("SingleEffect_4"); // SPACE IfCondition
final Cache ActivatedAbility_0 = new Cache("ActivatedAbility_0"); // SPACE AbilityRestriction EOS
final Cache ActivationCosts_0 = new Cache("ActivationCosts_0"); // SEP Action
final Cache TriggeredAbility_0 = new Cache("TriggeredAbility_0"); // SEP IfCondition
@ -4620,7 +4634,7 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
Enchantment,Permanent,Card,Spell,NoRegen,PowerToughness,
SignedNumber,Number,Sign,SEP,EOC,SPACE,EOS,EOR,Rule_0,
SpellEffect_0,Effect_0,SingleEffect_0,SingleEffect_1,
SingleEffect_2,SingleEffect_3,ActivatedAbility_0,
SingleEffect_2,SingleEffect_3,SingleEffect_4,ActivatedAbility_0,
ActivationCosts_0,TriggeredAbility_0,Keyword_0,Keyword_1,
Keyword_2,Keyword_3,Keyword_4,Keyword_5,Keyword_6,Keyword_7,
Keyword_8,Keyword_9,Keyword_10,Keyword_11,Keyword_12,Keyword_13,