fix for cards with restrictions

This commit is contained in:
Anthony Calosa
2017-01-22 00:14:46 +08:00
parent 37b3f28065
commit 6fe57be115
6 changed files with 17 additions and 5 deletions
+5 -5
View File
@@ -75301,7 +75301,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Nature's Will name=Nature's Will
auto=@combatdamaged(player) from(creature|myBattlefield):tap all(land|opponentBattlefield) && untap all(land|myBattlefield) auto=@each combatdamage restriction{opponentdamagedbycombat}:tap all(land|opponentBattlefield) && untap all(land|myBattlefield)
text=Whenever one or more creatures you control deal combat damage to a player, tap all lands that player controls and untap all lands you control. text=Whenever one or more creatures you control deal combat damage to a player, tap all lands that player controls and untap all lands you control.
mana={2}{G}{G} mana={2}{G}{G}
type=Enchantment type=Enchantment
@@ -79039,7 +79039,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Ongoing Investigation name=Ongoing Investigation
auto=@combatdamaged(player) from(creature|mybattlefield):token(Clue,Artifact Clue,0/0) and!( transforms((,newability[{S}{2}:draw:1])) forever )! controller auto=@each combatdamage restriction{opponentdamagedbycombat}:token(Clue,Artifact Clue,0/0) and!( transforms((,newability[{S}{2}:draw:1])) forever )! controller
auto={1}{G}{e(creature|mygraveyard)}:token(Clue,Artifact Clue,0/0) and!( transforms((,newability[{S}{2}:draw:1])) forever )! controller && life:2 auto={1}{G}{e(creature|mygraveyard)}:token(Clue,Artifact Clue,0/0) and!( transforms((,newability[{S}{2}:draw:1])) forever )! controller && life:2
text=Whenever one or more creatures you control deal combat damage to a player, investigate. (Put a colorless Clue artifact token onto the battlefield with "{2}, Sacrifice this artifact: Draw a card.") -- {1}{G}, Exile a creature card from your graveyard: Investigate. You gain 2 life. text=Whenever one or more creatures you control deal combat damage to a player, investigate. (Put a colorless Clue artifact token onto the battlefield with "{2}, Sacrifice this artifact: Draw a card.") -- {1}{G}, Exile a creature card from your graveyard: Investigate. You gain 2 life.
mana={1}{U} mana={1}{U}
@@ -86578,7 +86578,7 @@ type=Instant
[card] [card]
name=Pyrewild Shaman name=Pyrewild Shaman
autohand={1}{R}{discard}:name(bloodrush) target(creature[attacking]) 3/1 ueot autohand={1}{R}{discard}:name(bloodrush) target(creature[attacking]) 3/1 ueot
autograveyard=@combatdamaged(player) from(creature|mybattlefield):pay({3}) moveto(ownerhand) autograveyard=@each combatdamage restriction{opponentdamagedbycombat}:pay({3}) moveto(ownerhand)
text=Bloodrush — {1}{R}, Discard Pyrewild Shaman: Target attacking creature gets +3/+1 until end of turn. -- Whenever one or more creatures you control deal combat damage to a player, if Pyrewild Shaman is in your graveyard, you may pay {3}. If you do, return Pyrewild Shaman to your hand. text=Bloodrush — {1}{R}, Discard Pyrewild Shaman: Target attacking creature gets +3/+1 until end of turn. -- Whenever one or more creatures you control deal combat damage to a player, if Pyrewild Shaman is in your graveyard, you may pay {3}. If you do, return Pyrewild Shaman to your hand.
mana={2}{R} mana={2}{R}
type=Creature type=Creature
@@ -90875,7 +90875,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Reveille Squad name=Reveille Squad
auto=@combat(attacking,sourcenottap) source(creature|opponentbattlefield):may untap all(creature|mybattlefield) auto=@each blockers restriction{type(creature[attacking]|opponentbattlefield)~morethan~0} sourcenottap:may untap all(creature|mybattlefield)
text=Whenever one or more creatures attack you, if Reveille Squad is untapped, you may untap all creatures you control. text=Whenever one or more creatures attack you, if Reveille Squad is untapped, you may untap all creatures you control.
mana={2}{W}{W} mana={2}{W}{W}
type=Creature type=Creature
@@ -116417,7 +116417,7 @@ toughness=2
name=Thunderblade Charge name=Thunderblade Charge
target=creature,player target=creature,player
auto=damage:3 auto=damage:3
autograveyard=@combatdamaged(player) from(creature|mybattlefield):pay({2}{R}{R}{R}) name(pay to cast) activate name(pay to cast) castcard(restricted) autograveyard=@each combatdamage restriction{opponentdamagedbycombat}:pay({2}{R}{R}{R}) name(pay to cast) activate name(pay to cast) castcard(restricted)
text=Thunderblade Charge deals 3 damage to target creature or player. -- Whenever one or more creatures you control deal combat damage to a player, if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost. text=Thunderblade Charge deals 3 damage to target creature or player. -- Whenever one or more creatures you control deal combat damage to a player, if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost.
mana={1}{R}{R} mana={1}{R}{R}
type=Sorcery type=Sorcery
+1
View File
@@ -45,6 +45,7 @@ public:
int energyCount; int energyCount;
int epic; int epic;
int forcefield; int forcefield;
int dealsdamagebycombat;
int initLife; int initLife;
int raidcount; int raidcount;
int handmodifier; int handmodifier;
+1
View File
@@ -260,6 +260,7 @@ int Damage::resolve()
target->lifeLostThisTurn += damage; target->lifeLostThisTurn += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes. if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{ {
source->controller()->dealsdamagebycombat = 1; // for restriction check
vector<string> values = MTGAllCards::getCreatureValuesById();//getting a weird crash here. rarely. vector<string> values = MTGAllCards::getCreatureValuesById();//getting a weird crash here. rarely.
for (size_t i = 0; i < values.size(); ++i) for (size_t i = 0; i < values.size(); ++i)
{ {
+1
View File
@@ -213,6 +213,7 @@ void GameObserver::nextGamePhase()
currentPlayer->nonCombatDamage = 0; currentPlayer->nonCombatDamage = 0;
currentPlayer->drawCounter = 0; currentPlayer->drawCounter = 0;
currentPlayer->raidcount = 0; currentPlayer->raidcount = 0;
currentPlayer->dealsdamagebycombat = 0; //clear check for restriction
currentPlayer->opponent()->raidcount = 0; currentPlayer->opponent()->raidcount = 0;
currentPlayer->prowledTypes.clear(); currentPlayer->prowledTypes.clear();
currentPlayer->opponent()->damageCount = 0; //added to clear odcount currentPlayer->opponent()->damageCount = 0; //added to clear odcount
+8
View File
@@ -540,6 +540,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(card->controller()->raidcount < 1) if(card->controller()->raidcount < 1)
return 0; return 0;
} }
check = restriction[i].find("opponentdamagedbycombat");
if(check != string::npos)
{
if(card->controller()->dealsdamagebycombat < 1)
return 0;
}
check = restriction[i].find("outnumbered");//opponent controls atleast 4 or more creatures than you check = restriction[i].find("outnumbered");//opponent controls atleast 4 or more creatures than you
if(check != string::npos) if(check != string::npos)
+1
View File
@@ -37,6 +37,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
energyCount = 0; energyCount = 0;
epic = 0; epic = 0;
forcefield = 0; forcefield = 0;
dealsdamagebycombat = 0;
raidcount = 0; raidcount = 0;
handmodifier = 0; handmodifier = 0;
snowManaG = 0; snowManaG = 0;