From c45b5751af98fd2b935b88a5648b4b190f8c4871 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 4 Aug 2016 05:41:22 +0800 Subject: [PATCH 1/2] cantattack change some cards since -cantattack overrides cantattack. If there is an effect that makes creatures can't attack, you can just activate the ability to remove -cantattack... --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 135 ++++++------------- projects/mtg/include/AllAbilities.h | 12 ++ projects/mtg/src/MTGRules.cpp | 2 + 3 files changed, 58 insertions(+), 91 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 4d1031ed0..13c6002fe 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -3395,7 +3395,7 @@ type=Artifact [card] name=Angelic Arbiter abilities=flying -auto=@movedTo(*|opponentstack):all(creature|opponentBattlefield) cantattack +auto=@movedTo(*|opponentstack):lord(creature|opponentBattlefield) cantattack auto=@combat(attacking) source(creature|opponentBattlefield):maxCast(*)0 opponent ueot text=Flying -- Each opponent who cast a spell this turn can't attack with creatures. -- Each opponent who attacked with creatures this turn can't cast spells. mana={5}{W}{W} @@ -5337,8 +5337,7 @@ toughness=5 [/card] [card] name=Armored Galleon -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Armored Galleon can't attack unless defending player controls an Island. mana={4}{U} type=Creature @@ -10863,9 +10862,8 @@ type=Instant [/card] [card] name=Blind-Spot Giant -abilities=cantattack,cantblock -auto=aslongas(other giant|myBattlefield) -cantattack -auto=aslongas(other giant|myBattlefield) -cantblock +auto=aslongas(other giant|myBattlefield) cantattack <1 +auto=aslongas(other giant|myBattlefield) cantblock <1 text=Blind-Spot Giant can't attack or block unless you control another Giant. mana={2}{R} type=Creature @@ -11384,10 +11382,9 @@ toughness=2 [/card] [card] name=Bloodcrazed Goblin -auto=this(opponentdamagecount >0) -cantattack +auto=this(opponentdamagecount <1) cantattack text=Bloodcrazed Goblin can't attack unless an opponent was dealt noncombat damage this turn. mana={R} -abilities=cantattack type=Creature subtype=Goblin Berserker power=2 @@ -25593,8 +25590,7 @@ toughness=6 [/card] [card] name=Deep-Sea Serpent -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Deep-Sea Serpent can't attack unless defending player controls an Island. mana={4}{U}{U} type=Creature @@ -29450,8 +29446,7 @@ type=Artifact [/card] [card] name=Dreamwinder -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 auto={U}{S(island|myBattlefield)}:ueot name(land becomes an island) loseabilities && losesubtypesof(land) && transforms((island)) target(land) text=Dreamwinder can't attack unless defending player controls an Island. -- {U}, Sacrifice an Island: Target land becomes an Island until end of turn. mana={3}{U} @@ -34396,8 +34391,8 @@ toughness=3 [/card] [card] name=Ethereal Whiskergill -abilities=cantattack,flying -auto=aslongas(island|opponentBattlefield) -cantattack +abilities=flying +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Flying -- Ethereal Whiskergill can't attack unless defending player controls an Island. mana={3}{U} type=Creature @@ -34705,7 +34700,7 @@ toughness=5 [card] name=Exalted Dragon abilities=flying,cantattack -auto={S(land|myBattlefield)}:-cantattack +auto={S(land|myBattlefield)}:-cantattack restriction{myattackersonly} text=Flying -- Exalted Dragon can't attack unless you sacrifice a land. mana={4}{W}{W} type=Creature @@ -36443,8 +36438,7 @@ type=Artifact [/card] [card] name=Felhide Brawler -abilities=cantblock -auto=aslongas(other minotaur|myBattlefield) -cantblock +auto=aslongas(other minotaur|myBattlefield) cantblock <1 text=Felhide Brawler can't block unless you control another Minotaur. mana={1}{B} type=Creature @@ -38640,9 +38634,8 @@ toughness=2 [/card] [card] name=Floodchaser -abilities=cantattack auto=counter(1/1,6) -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 auto={U}{C(1/1,-1)}:ueot name(land becomes an island) loseabilities && losesubtypesof(land) && transforms((island)) target(land) text=Floodchaser enters the battlefield with six +1/+1 counters on it. -- Floodchaser can't attack unless defending player controls an Island. -- {U}, Remove a +1/+1 counter from Floodchaser: Target land becomes an Island until end of turn. mana={5}{U} @@ -42875,8 +42868,8 @@ type=Land [/card] [card] name=Glacial Crasher -abilities=trample, cantattack -auto=aslongas(mountain|Battlefield) -cantattack +abilities=trample +auto=aslongas(mountain|Battlefield) cantattack <1 text=Trample (If this creature would assign enough damage to its blockers to destroy them, you may have it assign the rest of its damage to defending player or planeswalker.) -- Glacial Crasher can't attack unless there is a mountain on the battlefield. mana={4}{U}{U} type=Creature @@ -43820,8 +43813,7 @@ toughness=3 [/card] [card] name=Goblin Cohort -abilities=cantattack -auto=@movedTo(creature|mystack):-cantattack ueot +auto=this(variable{countmycrespell}<1) cantattack text=Goblin Cohort can't attack unless you've cast a creature spell this turn. mana={R} type=Creature @@ -44353,9 +44345,9 @@ toughness=2 [/card] [card] name=Goblin Rock Sled -abilities=trample,cantattack +abilities=trample auto=@combat(attacking) source(this):frozen -auto=aslongas(mountain|opponentbattlefield) -cantattack +auto=aslongas(mountain|opponentbattlefield) cantattack <1 text=Trample -- Goblin Rock Sled doesn't untap during your untap step if it attacked during your last turn. -- Goblin Rock Sled can't attack unless defending player controls a Mountain. mana={1}{R} type=Creature @@ -44728,9 +44720,7 @@ toughness=4 [/card] [card] name=Godhunter Octopus -abilities=cantattack -auto=aslongas(enchantment|opponentBattlefield) -cantattack -auto=aslongas(*[enchanted]|opponentBattlefield) -cantattack +auto=aslongas(*[enchantment;enchanted]|opponentBattlefield) cantattack <1 text=Godhunter Octopus can't attack unless defending player controls an enchantment or an enchanted permanent. mana={5}{U} type=Creature @@ -47962,8 +47952,7 @@ subtype=Aura [/card] [card] name=Hammerhead Shark -abilities=cantattack -auto=aslongas(island|opponentbattlefield) -cantattack +auto=aslongas(island|opponentbattlefield) cantattack <1 text=Hammerhead Shark can't attack unless defending player controls an Island. mana={1}{U} type=Creature @@ -51535,9 +51524,7 @@ type=Enchantment [/card] [card] name=Howlpack Wolf -abilities=cantblock -auto=aslongas(wolf|mybattlefield) -cantblock -auto=aslongas(werewolf|mybattlefield) -cantblock +auto=aslongas(other *[wolf;werewolf]|mybattlefield) cantblock <1 text=Howlpack Wolf can't block unless you control another Wolf or Werewolf. mana={2}{R} type=Creature @@ -60413,8 +60400,7 @@ toughness=2 [/card] [card] name=Lambholt Pacifist -abilities=cantattack -auto=aslongas(creature[power>=4]|mybattlefield) transforms((,newability[-cantattack])) +auto=aslongas(creature[power>=4]|mybattlefield) cantattack <1 auto=@each upkeep restriction{lastturn(*|stack)~lessthan~1}:flip(Lambholt Butcher) text=Lambholt Pacifist can't attack unless you control a creature with power 4 or greater. -- At the beginning of each upkeep, if no spells were cast last turn, transform Lambholt Pacifist. mana={1}{G} @@ -68408,8 +68394,7 @@ toughness=0 [/card] [card] name=Mindless Null -abilities=cantblock -auto=aslongas(vampire|myBattlefield) -cantblock +auto=aslongas(vampire|myBattlefield) cantblock <1 text=Mindless Null can't block unless you control a Vampire. mana={2}{B} type=Creature @@ -69596,8 +69581,7 @@ type=Artifact [/card] [card] name=Mogg Conscripts -abilities=cantattack -auto=@movedTo(creature|mystack):-cantattack ueot +auto=this(variable{countmycrespell}<1) cantattack text=Mogg Conscripts can't attack unless you've cast a creature spell this turn. mana={R} type=Creature @@ -79799,23 +79783,9 @@ type=Artifact [/card] [card] name=Phyrexian Marauder -abilities=cantblock,cantattack +abilities=cantblock auto=counter(1/1,X) -auto=this(counter{1/1.1}=) {1}:-cantattack myAttackersOnly -auto=this(counter{1/1.2}=) {2}:-cantattack myAttackersOnly -auto=this(counter{1/1.3}=) {3}:-cantattack myAttackersOnly -auto=this(counter{1/1.4}=) {4}:-cantattack myAttackersOnly -auto=this(counter{1/1.5}=) {5}:-cantattack myAttackersOnly -auto=this(counter{1/1.6}=) {6}:-cantattack myAttackersOnly -auto=this(counter{1/1.7}=) {7}:-cantattack myAttackersOnly -auto=this(counter{1/1.8}=) {8}:-cantattack myAttackersOnly -auto=this(counter{1/1.9}=) {9}:-cantattack myAttackersOnly -auto=this(counter{1/1.10}=) {10}:-cantattack myAttackersOnly -auto=this(counter{1/1.11}=) {11}:-cantattack myAttackersOnly -auto=this(counter{1/1.12}=) {12}:-cantattack myAttackersOnly -auto=this(counter{1/1.13}=) {13}:-cantattack myAttackersOnly -auto=this(counter{1/1.14}=) {14}:-cantattack myAttackersOnly -auto=this(counter{1/1.15}=) {15}:-cantattack myAttackersOnly +auto=attackcost:counter{1%1} text=Phyrexian Marauder enters the battlefield with X +1/+1 counters on it. -- Phyrexian Marauder can't block. -- Phyrexian Marauder can't attack unless you pay {1} for each +1/+1 counter on it. mana={X} type=Artifact Creature @@ -86230,8 +86200,7 @@ type=Enchantment [/card] [card] name=Red Cliffs Armada -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Red Cliffs Armada can't attack unless defending player controls an Island. mana={4}{U} type=Creature @@ -89241,8 +89210,7 @@ toughness=6 [/card] [card] name=Ronom Serpent -abilities=cantattack -auto=aslongas(land[snow]|opponentBattlefield) -cantattack +auto=aslongas(land[snow]|opponentBattlefield) cantattack <1 auto=aslongas(land[snow]|myBattlefield) all(this) sacrifice while <1 text=Ronom Serpent can't attack unless defending player controls a snow land. -- When you control no snow lands, sacrifice Ronom Serpent. mana={5}{U} @@ -92379,9 +92347,7 @@ toughness=4 [/card] [card] name=Scarred Puma -abilities=cantattack -auto=aslongas(creature[green;attacking]|myBattlefield) -cantattack -auto=aslongas(creature[black;attacking]|myBattlefield) -cantattack +auto=aslongas(other creature[black;green;attacking]|myBattlefield) cantattack <1 text=Scarred Puma can't attack unless a black or green creature also attacks. mana={R} type=Creature @@ -93512,8 +93478,7 @@ type=Instant [/card] [card] name=Sea Monster -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Sea Monster can't attack unless defending player controls an Island. mana={4}{U}{U} type=Creature @@ -93686,8 +93651,7 @@ type=Sorcery [/card] [card] name=Sealock Monster -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 auto=this(cantargetcard(*[-monstrous]) {5}{U}{U}:becomes(monstrous) forever && counter(1/1,3) && transforms((,newAbility[target(land|opponentbattlefield) becomes(island) forever])) forever text=Sealock Monster can't attack unless defending player controls an Island. -- {5}{U}{U}: Monstrosity 3. (If this creature isn't monstrous, put three +1/+1 counters on it and it becomes monstrous.) -- When Sealock Monster becomes monstrous, target land becomes an Island in addition to its other types. mana={3}{U}{U} @@ -94916,8 +94880,7 @@ type=Artifact [/card] [card] name=Serpent of the Endless Sea -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 anyzone=type:island:myBattlefield/type:island:myBattlefield cdaactive text=Serpent of the Endless Sea's power and toughness are each equal to the number of Islands you control. -- Serpent of the Endless Sea can't attack unless defending player controls an Island. mana={4}{U} @@ -97538,8 +97501,7 @@ toughness=1 [/card] [card] name=Silburlind Snapper -abilities=cantattack -auto=@movedto(*[-creature]|mystack):-cantattack ueot +auto=this(variable{countmynoncrespell}<1) cantattack text=Silburlind Snapper can't attack unless you've cast a noncreature spell this turn. mana={5}{U} type=Creature @@ -100064,8 +100026,7 @@ type=Land [/card] [card] name=Slipstream Eel -abilities=cantattack -auto=aslongas(island|opponentbattlefield) -cantattack +auto=aslongas(island|opponentbattlefield) cantattack <1 autohand=__CYCLING__({1}{U}) text=Slipstream Eel can't attack unless defending player controls an Island. -- Cycling {1}{U} ({1}{U}, Discard this card: Draw a card.) mana={5}{U}{U} @@ -100076,10 +100037,10 @@ toughness=6 [/card] [card] name=Slipstream Serpent -abilities=islandhome,cantattack +abilities=islandhome facedown={3} autofacedown={5}{U}:morph -auto=aslongas(island|opponentbattlefield) -cantattack +auto=aslongas(island|opponentbattlefield) cantattack <1 text=Slipstream Serpent can't attack unless defending player controls an Island. -- When you control no Islands, sacrifice Slipstream Serpent. -- Morph {5}{U} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) mana={7}{U} type=Creature @@ -104887,8 +104848,7 @@ toughness=3 [/card] [card] name=Steam Frigate -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Steam Frigate can't attack unless defending player controls an Island. mana={2}{U} type=Creature @@ -105007,8 +104967,7 @@ toughness=4 [/card] [card] name=Steelclad Serpent -abilities=cantattack -auto=aslongas(artifact|myBattlefield) -cantattack >1 +auto=aslongas(other artifact|myBattlefield) cantattack <1 text=Steelclad Serpent can't attack unless you control another artifact. mana={5}{U} type=Artifact Creature @@ -114308,9 +114267,8 @@ toughness=1 [/card] [card] name=Training Drone -abilities=cantattack,cantblock -auto=this(gear > 0) -cantattack -auto=this(gear > 0) -cantblock +auto=this(gear < 1) cantattack +auto=this(gear < 1) cantblock text=Training Drone can't attack or block unless it's equipped. mana={3} type=Artifact Creature @@ -118569,9 +118527,8 @@ type=Enchantment [/card] [card] name=Veiled Serpent -abilities=cantattack autohand=__CYCLING__({2}) -auto=aslongas(island|opponentbattlefield) -cantattack +auto=aslongas(island|opponentbattlefield) cantattack <1 auto=@movedto(*|opponentstack) once:transforms((removetypes)) forever && transforms((Serpent Creature,setpower=4,settoughness=4)) forever text=When an opponent casts a spell, if Veiled Serpent is an enchantment, Veiled Serpent becomes a 4/4 Serpent creature that can't attack unless defending player controls an Island. -- Cycling {2} ({2}, Discard this card: Draw a card.) mana={2}{U} @@ -120563,10 +120520,9 @@ toughness=1 [/card] [card] name=Vodalian Serpent -abilities=cantattack kicker={2} auto=kicker counter(1/1,4) -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Kicker {2} (You may pay an additional {2} as you cast this spell.) -- Vodalian Serpent can't attack unless defending player controls an Island. -- If Vodalian Serpent was kicked, it enters the battlefield with four +1/+1 counters on it. mana={3}{U} type=Creature @@ -123650,8 +123606,7 @@ type=Artifact [/card] [card] name=Whimwader -abilities=cantattack -auto=aslongas(*[blue]|opponentBattlefield) -cantattack +auto=aslongas(*[blue]|opponentBattlefield) cantattack <1 text=Whimwader can't attack unless defending player controls a blue permanent. mana={4}{U} type=Creature @@ -126232,8 +126187,7 @@ toughness=1 [/card] [card] name=Wu Warship -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Wu Warship can't attack unless defending player controls an Island. mana={2}{U} type=Creature @@ -127211,8 +127165,7 @@ toughness=3 [/card] [card] name=Zhou Yu, Chief Commander -abilities=cantattack -auto=aslongas(island|opponentBattlefield) -cantattack +auto=aslongas(island|opponentBattlefield) cantattack <1 text=Zhou Yu, Chief Commander can't attack unless defending player controls an Island. mana={5}{U}{U} type=Legendary Creature diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 1e60a6932..817267250 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -551,6 +551,18 @@ private: intValue +=1; } } + else if (s == "countallspell") + { + intValue = card->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + card->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL); + } + else if (s == "countmycrespell") + { + intValue = card->controller()->game->stack->seenThisTurn("creature", Constants::CAST_ALL); + } + else if (s == "countmynoncrespell") + { + intValue = card->controller()->game->stack->seenThisTurn("*[-creature]", Constants::CAST_ALL); + } else if (s == "evictg") { intValue = card->imprintG; diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 04cc78dbf..3ae11aa9e 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -1836,6 +1836,8 @@ int MTGAttackRule::receiveEvent(WEvent *e) card->setAttacker(0); if (card->isAttacker() && !card->has(Constants::VIGILANCE)) card->tap(); + if (card->isAttacker() && card->has(Constants::CANTATTACK)) + card->toggleAttacker();//if a card has cantattack, then you cant } return 1; } From 5f276f6b2266973b4a16a2c90e080c4257c75d07 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 4 Aug 2016 05:46:23 +0800 Subject: [PATCH 2/2] blockcost and attackcost counter{1%1} -> value --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 13c6002fe..65430c348 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -71719,21 +71719,8 @@ toughness=1 [card] name=Myr Prototype auto=@each my upkeep:counter(1/1,1) -auto=this(counter{1/1.1}=) {1}:-cantattack myAttackersOnly -auto=this(counter{1/1.2}=) {2}:-cantattack myAttackersOnly -auto=this(counter{1/1.3}=) {3}:-cantattack myAttackersOnly -auto=this(counter{1/1.4}=) {4}:-cantattack myAttackersOnly -auto=this(counter{1/1.5}=) {5}:-cantattack myAttackersOnly -auto=this(counter{1/1.6}=) {6}:-cantattack myAttackersOnly -auto=this(counter{1/1.7}=) {7}:-cantattack myAttackersOnly -auto=this(counter{1/1.8}=) {8}:-cantattack myAttackersOnly -auto=this(counter{1/1.9}=) {9}:-cantattack myAttackersOnly -auto=this(counter{1/1.10}=) {10}:-cantattack myAttackersOnly -auto=this(counter{1/1.11}=) {11}:-cantattack myAttackersOnly -auto=this(counter{1/1.12}=) {12}:-cantattack myAttackersOnly -auto=this(counter{1/1.13}=) {13}:-cantattack myAttackersOnly -auto=this(counter{1/1.14}=) {14}:-cantattack myAttackersOnly -auto=this(counter{1/1.15}=) {15}:-cantattack myAttackersOnly +auto=attackcost:counter{1%1} +auto=blockcost:counter{1%1} text=At the beginning of your upkeep, put a +1/+1 counter on Myr Prototype. -- Myr Prototype can't attack or block unless you pay {1} for each +1/+1 counter on it. mana={5} type=Artifact Creature