generalized 'that creature's controller' to work for any permanent

master
melvin 2012-12-15 11:37:52 +08:00
parent 2c5d68010f
commit 62a1403de3
4 changed files with 49 additions and 29 deletions

View File

@ -448,8 +448,8 @@ wiki/UpcomingCards.wiki: cards/new.txt
echo "#summary New cards in the next release" > $@
cat <(echo "{{{") $^ <(echo "}}}") >> $@
parser/test: $(MAG) grammar/parsable.txt
$(JAVA) magic.grammar.Check < $(word 2,$^)
parser/test: $(MAG)
$(JAVA) magic.grammar.Check < grammar/parsable.txt
parser/test_all: $(MAG) grammar/rules.txt
$(JAVA) magic.grammar.Check < $(word 2,$^)

View File

@ -414,7 +414,7 @@ Player
/ "you"
/ "he or she"
/ "its controller"
/ "that creature's controller"
/ "that " SelectPermanent "'s controller"
/ "its owner"
/ "player"
/ "a player"

View File

@ -1406,6 +1406,7 @@ destroy target artifact.
destroy target artifact creature.
destroy target artifact creature or black creature. it can't be regenerated.
destroy target artifact, creature, or land. @ deals 3 damage to you.
destroy target artifact. @ deals 3 damage to that artifact's controller.
destroy target artifact, enchantment, or land.
destroy target artifact. it can't be regenerated.
destroy target artifact. its controller loses 1 life.
@ -1418,6 +1419,7 @@ destroy target artifact or enchantment. you gain 4 life.
destroy target artifact or land.
destroy target artifact or land. it can't be regenerated.
destroy target artifact or land. its controller loses 1 life.
destroy target artifact with converted mana cost x. it can't be regenerated. @ deals x damage to that artifact's controller.
destroy target artifact you don't control.
destroy target attacking creature.
destroy target attacking creature with flying.
@ -1458,6 +1460,7 @@ destroy target land. creatures without flying can't block this turn.
destroy target land. @ deals 13 damage to target creature.
destroy target land. @ deals 1 damage to each creature and each player.
destroy target land. @ deals 1 damage to each human creature.
destroy target land. @ deals 2 damage to that land's controller.
destroy target land. its controller discards a card.
destroy target land. its controller loses 2 life.
destroy target land or nonblack creature.
@ -1484,6 +1487,7 @@ destroy target non-spirit creature.
destroy target non-vampire, non-werewolf, non-zombie creature.
destroy target nonwhite permanent.
destroy target permanent.
destroy target plains or island. @ deals 3 damage to that land's controller.
destroy target spirit.
destroy target spirit or enchantment.
destroy target tapped creature.
@ -3746,6 +3750,7 @@ whenever a goblin enters the battlefield under your control, you may put a quest
whenever a goblin you control dies, you may put a +1/+1 counter on @.
whenever a green creature dies, its controller discards a card.
whenever a human enters the battlefield under your control, @ deals 1 damage to target creature or player.
whenever a land enters the battlefield, @ deals 2 damage to that land's controller.
whenever a land enters the battlefield, tap all lands its controller controls.
whenever a land enters the battlefield under your control, put a +1/+1 counter on @.
whenever a land enters the battlefield under your control, untap @.

View File

@ -1,6 +1,6 @@
//=========================================================================
//
// This file was generated by Mouse 1.5 at 2012-12-15 02:40:20 GMT
// This file was generated by Mouse 1.5 at 2012-12-15 03:36:31 GMT
// from grammar '/home/melvin/Modules/magarena/grammar/mtg.peg'.
//
//=========================================================================
@ -1907,8 +1907,9 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
//=====================================================================
// Player = "target player" / "target opponent" / "that player" /
// "each player" / "each opponent" / "your opponents" / "an
// opponent" / "you" / "he or she" / "its controller" / "that
// creature's controller" / "its owner" / "player" / "a player" ;
// opponent" / "you" / "he or she" / "its controller" / "that "
// SelectPermanent "'s controller" / "its owner" / "player" / "a
// player" ;
//=====================================================================
private boolean Player()
{
@ -1923,13 +1924,25 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
if (next("you")) return sem.action() && accept();
if (next("he or she")) return sem.action() && accept();
if (next("its controller")) return sem.action() && accept();
if (next("that creature's controller")) return sem.action() && accept();
if (Player_0()) return sem.action() && accept();
if (next("its owner")) return sem.action() && accept();
if (next("player")) return sem.action() && accept();
if (next("a player")) return sem.action() && accept();
return reject();
}
//-------------------------------------------------------------------
// Player_0 = "that " SelectPermanent "'s controller"
//-------------------------------------------------------------------
private boolean Player_0()
{
if (savedInner(Player_0)) return reuseInner();
if (!next("that ")) return rejectInner();
if (!SelectPermanent()) return rejectInner();
if (!next("'s controller")) return rejectInner();
return acceptInner();
}
//=====================================================================
// PutCardAction = "put " SelectCard " onto the battlefield under your
// control" / "put " SelectCard " onto the battlefield" ;
@ -4516,6 +4529,7 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
final Cache SelectPlayer_0 = new Cache("SelectPlayer_0"); // Player &(SEP SingleEffect)
final Cache SelectPlayer_1 = new Cache("SelectPlayer_1"); // Player (SEP Player)*
final Cache SelectPlayer_2 = new Cache("SelectPlayer_2"); // SEP Player
final Cache Player_0 = new Cache("Player_0"); // "that " SelectPermanent "'s controller"
final Cache PutCardAction_0 = new Cache("PutCardAction_0"); // "put " SelectCard " onto the battlefield under your control"
final Cache PutCardAction_1 = new Cache("PutCardAction_1"); // "put " SelectCard " onto the battlefield"
final Cache BounceVerb_0 = new Cache("BounceVerb_0"); // "return" "s"?
@ -4653,27 +4667,28 @@ public class MagicRuleParser extends magic.grammar.ParserMemo
ControlAction_0,ControlAction_1,ChangeCounterAction_0,
ChangeCounterAction_1,PayManaAction_0,ChangeLifeVerb_0,
ChangeLifeVerb_1,ChangeLifeVerb_2,SelectPlayer_0,SelectPlayer_1,
SelectPlayer_2,PutCardAction_0,PutCardAction_1,BounceVerb_0,
BounceVerb_1,PreventAction_0,PreventAction_1,PreventAction_2,
PreventAction_3,DamageRestriction_0,TapAction_0,DamageAction_0,
DamageAction_1,DamageAction_2,DamageAction_3,DamageAction_4,
Enchant_0,Duration_0,GainAction_0,ManaSource_0,ManaSource_1,
DiscardAction_0,DiscardAction_1,ExileAction_0,ExileAction_1,
CounterAction_0,SelectCard_0,SelectCard_1,SelectCard_2,
SelectCard_3,SelectCard_4,SelectCreature_0,SelectCreature_1,
SelectCreature_2,SelectCreature_3,SelectCreature_4,
SelectPermanent_0,SelectPermanent_1,SelectPermanent_2,
SelectPermanent_3,SelectSpell_0,SelectSpell_1,SelectSpell_2,
SelectSpell_3,RestrictedPermanent_0,RestrictedPermanent_1,
RestrictedPermanent_2,RestrictedArtifact_0,RestrictedLand_0,
RestrictedLand_1,RestrictedSpell_0,RestrictedSpell_1,ColorSpec_0,
ColorSpec_1,ColorSpec_2,SpellRestriction_0,SpellRestriction_1,
SpellRestriction_2,RestrictedCard_0,RestrictedCreature_0,
RestrictedCreature_1,RestrictedCreature_2,RestrictedCreature_3,
RestrictedCreature_4,PermanentRestriction_0,
PermanentRestriction_1,PermanentRestriction_2,
CreatureRestriction_0,CreatureRestriction_1,CreatureRestriction_2,
CreatureRestriction_3,CreatureRestriction_4,Tribal_0,Tribal_1,
Artifact_0,Artifact_1,Land_0,Land_1,Land_2,Land_3,Land_4,Number_0
SelectPlayer_2,Player_0,PutCardAction_0,PutCardAction_1,
BounceVerb_0,BounceVerb_1,PreventAction_0,PreventAction_1,
PreventAction_2,PreventAction_3,DamageRestriction_0,TapAction_0,
DamageAction_0,DamageAction_1,DamageAction_2,DamageAction_3,
DamageAction_4,Enchant_0,Duration_0,GainAction_0,ManaSource_0,
ManaSource_1,DiscardAction_0,DiscardAction_1,ExileAction_0,
ExileAction_1,CounterAction_0,SelectCard_0,SelectCard_1,
SelectCard_2,SelectCard_3,SelectCard_4,SelectCreature_0,
SelectCreature_1,SelectCreature_2,SelectCreature_3,
SelectCreature_4,SelectPermanent_0,SelectPermanent_1,
SelectPermanent_2,SelectPermanent_3,SelectSpell_0,SelectSpell_1,
SelectSpell_2,SelectSpell_3,RestrictedPermanent_0,
RestrictedPermanent_1,RestrictedPermanent_2,RestrictedArtifact_0,
RestrictedLand_0,RestrictedLand_1,RestrictedSpell_0,
RestrictedSpell_1,ColorSpec_0,ColorSpec_1,ColorSpec_2,
SpellRestriction_0,SpellRestriction_1,SpellRestriction_2,
RestrictedCard_0,RestrictedCreature_0,RestrictedCreature_1,
RestrictedCreature_2,RestrictedCreature_3,RestrictedCreature_4,
PermanentRestriction_0,PermanentRestriction_1,
PermanentRestriction_2,CreatureRestriction_0,
CreatureRestriction_1,CreatureRestriction_2,CreatureRestriction_3,
CreatureRestriction_4,Tribal_0,Tribal_1,Artifact_0,Artifact_1,
Land_0,Land_1,Land_2,Land_3,Land_4,Number_0
};
}