Merge pull request #649 from kevlahnota/master

Persist/Undying Fix, Raid support
This commit is contained in:
Anthony Calosa
2015-10-20 12:02:47 +08:00
9 changed files with 46 additions and 20 deletions
+11 -11
View File
@@ -2744,8 +2744,8 @@ toughness=2
[/card] [/card]
[card] [card]
name=Anafenza, the Foremost name=Anafenza, the Foremost
abilities=oppgcreatureexiler
auto=@combat(attacking) source(this):counter(1/1,1) target(other creature[tapped]|mybattlefield) auto=@combat(attacking) source(this):counter(1/1,1) target(other creature[tapped]|mybattlefield)
auto=@movedTo(creature|opponentGraveyard):all(trigger[to]) moveTo(exile)
text=When Anafenza, the Foremost attacks, put a +1/+1 counter on another target tapped creature you control. -- If a creature card would be put into an opponent's graveyard from anywhere, exile it instead. text=When Anafenza, the Foremost attacks, put a +1/+1 counter on another target tapped creature you control. -- If a creature card would be put into an opponent's graveyard from anywhere, exile it instead.
mana={W}{B}{G} mana={W}{B}{G}
type=Legendary Creature type=Legendary Creature
@@ -8586,7 +8586,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Bellowing Saddlebrute name=Bellowing Saddlebrute
auto=ifnot thisturn(creature[attacking]|mybattlefield)~morethan~0 then life:-4 controller auto=ifnot raid then life:-4 controller
text=Raid — When Bellowing Saddlebrute enters the battlefield, you lose 4 life unless you attacked with a creature this turn. text=Raid — When Bellowing Saddlebrute enters the battlefield, you lose 4 life unless you attacked with a creature this turn.
mana={3}{B} mana={3}{B}
type=Creature type=Creature
@@ -10685,7 +10685,7 @@ toughness=3
[card] [card]
name=Bloodsoaked Champion name=Bloodsoaked Champion
abilities=cantblock abilities=cantblock
autograveyard={1}{B}:moveTo(mybattlefield) restriction{thisturn(creature[attacking]|mybattlefield)~morethan~0} autograveyard={1}{B}:moveTo(mybattlefield) restriction{raid}
text=Bloodsoaked Champion can't block. -- Raid — {1}{B}: Return Bloodsoaked Champion from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn. text=Bloodsoaked Champion can't block. -- Raid — {1}{B}: Return Bloodsoaked Champion from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn.
mana={B} mana={B}
type=Creature type=Creature
@@ -59747,7 +59747,7 @@ toughness=1
[/card] [/card]
[card] [card]
name=Mardu Heart-Piercer name=Mardu Heart-Piercer
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then damage:2 target(creature,player) auto=if raid then damage:2 target(creature,player)
text=Raid -- When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player. text=Raid -- When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.
mana={3}{R} mana={3}{R}
type=Creature type=Creature
@@ -59757,7 +59757,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Mardu Hordechief name=Mardu Hordechief
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then token(Warrior,Creature Warrior,1/1,white) auto=if raid then token(Warrior,Creature Warrior,1/1,white)
text=Raid - When Mardu Hordechief enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield. text=Raid - When Mardu Hordechief enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield.
mana={2}{W} mana={2}{W}
type=Creature type=Creature
@@ -59811,7 +59811,7 @@ toughness=1
[card] [card]
name=Mardu Skullhunter name=Mardu Skullhunter
auto=tap auto=tap
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then target(opponent) ability$!name(discard) target(*|myhand) reject!$ targetedplayer auto=if raid then target(opponent) ability$!name(discard) target(*|myhand) reject!$ targetedplayer
text=Mardu Skullhunter enters the battlefield tapped. -- Raid - When Mardu Skullhunter enters the battlefield, if you attacked with a creature this turn, target opponent discards a card. text=Mardu Skullhunter enters the battlefield tapped. -- Raid - When Mardu Skullhunter enters the battlefield, if you attacked with a creature this turn, target opponent discards a card.
mana={1}{B} mana={1}{B}
type=Creature type=Creature
@@ -59833,7 +59833,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Mardu Warshrieker name=Mardu Warshrieker
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then Add{R}{W}{B} auto=if raid then Add{R}{W}{B}
text=Raid - When Mardu Warshrieker enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool. text=Raid - When Mardu Warshrieker enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool.
mana={3}{R} mana={3}{R}
type=Creature type=Creature
@@ -69828,7 +69828,7 @@ toughness=1
name=Orgg name=Orgg
abilities=trample abilities=trample
auto=cantbeblockerof(creature[white;power>=3]) auto=cantbeblockerof(creature[white;power>=3])
auto=aslongas(creature[power>=3;-tapped]|opponentbattlefield]) cantattack auto=aslongas(creature[power>=3;-tapped]|opponentbattlefield) cantattack
text=Trample -- Orgg can't attack if defending player controls an untapped creature with power 3 or greater. -- Orgg can't block creatures with power 3 or greater. text=Trample -- Orgg can't attack if defending player controls an untapped creature with power 3 or greater. -- Orgg can't block creatures with power 3 or greater.
mana={3}{R}{R} mana={3}{R}{R}
type=Creature type=Creature
@@ -102844,7 +102844,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Timely Hordemate name=Timely Hordemate
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then moveTo(mybattlefield) target(creature[manacost<=2]|mygraveyard) auto=if raid then moveTo(mybattlefield) target(creature[manacost<=2]|mygraveyard)
text=Raid - When Timely Hordemate enters the battlefield, if you attacked with a creature this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield. text=Raid - When Timely Hordemate enters the battlefield, if you attacked with a creature this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.
mana={3}{W} mana={3}{W}
type=Creature type=Creature
@@ -111460,7 +111460,7 @@ type=Instant
[/card] [/card]
[card] [card]
name=War-Name Aspirant name=War-Name Aspirant
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then counter(1/1,1) auto=if raid then counter(1/1,1)
auto=cantbeblockedby(creature[power<=1]) auto=cantbeblockedby(creature[power<=1])
text=Raid - War-Name Aspirant enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn. -- War-Name Aspirant can't be blocked by creatures with power 1 or less. text=Raid - War-Name Aspirant enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn. -- War-Name Aspirant can't be blocked by creatures with power 1 or less.
mana={1}{R} mana={1}{R}
@@ -113628,7 +113628,7 @@ toughness=1
[card] [card]
name=Wingmate Roc name=Wingmate Roc
abilities=flying abilities=flying
auto=if thisturn(creature[attacking]|mybattlefield)~morethan~0 then token(Bird,Creature Bird,3/4,white,flying) auto=if raid then token(Bird,Creature Bird,3/4,white,flying)
auto=@combat(attacking) source(this):life:type:creature[attacking]:battlefield controller auto=@combat(attacking) source(this):life:type:creature[attacking]:battlefield controller
text=Flying. -- Raid - When Wingmate Roc enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield. -- Whenever Wingmate Roc attacks, you gain 1 life for each attacking creature. text=Flying. -- Raid - When Wingmate Roc enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield. -- Whenever Wingmate Roc attacks, you gain 1 life for each attacking creature.
mana={3}{W}{W} mana={3}{W}{W}
+3 -1
View File
@@ -232,7 +232,9 @@ class Constants
AURAWARD = 114, AURAWARD = 114,
MADNESS = 115, MADNESS = 115,
PROTECTIONFROMCOLOREDSPELLS = 116, PROTECTIONFROMCOLOREDSPELLS = 116,
NB_BASIC_ABILITIES = 117, MYGCREATUREEXILER = 117,
OPPGCREATUREEXILER = 118,
NB_BASIC_ABILITIES = 119,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
+1
View File
@@ -44,6 +44,7 @@ public:
int drawCounter; int drawCounter;
int epic; int epic;
int initLife; int initLife;
int raidcount;
vector<string> prowledTypes; vector<string> prowledTypes;
vector<MTGCardInstance*>curses; vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
+13 -7
View File
@@ -204,6 +204,8 @@ void GameObserver::nextGamePhase()
cleanupPhase(); cleanupPhase();
currentPlayer->damageCount = 0; currentPlayer->damageCount = 0;
currentPlayer->drawCounter = 0; currentPlayer->drawCounter = 0;
currentPlayer->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
currentPlayer->preventable = 0; currentPlayer->preventable = 0;
@@ -593,15 +595,19 @@ void GameObserver::gameStateBasedEffects()
///////////////////////////////////// /////////////////////////////////////
for (int d = 0; d < 2; d++) for (int d = 0; d < 2; d++)
{ {
MTGGameZone * zone = players[d]->game->inPlay; MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library };
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) for (int k = 0; k < 4; k++)
{ {
for (int c = zone->nb_cards - 1; c >= 0; c--) MTGGameZone * zone = dzones[k];
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
{ {
zone->cards[c]->cardistargetted = 0; for (int c = zone->nb_cards - 1; c >= 0; c--)
zone->cards[c]->cardistargetter = 0; {
zone->cards[c]->cardistargetted = 0;
zone->cards[c]->cardistargetter = 0;
}
} }
} }//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue
players[d]->DeadLifeState(); players[d]->DeadLifeState();
} }
//////////////////////////////////// ////////////////////////////////////
+7
View File
@@ -418,6 +418,13 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0; return 0;
} }
check = restriction[i].find("raid");
if(check != string::npos)
{
if(card->controller()->raidcount < 1)
return 0;
}
check = restriction[i].find("ownerscontrol"); check = restriction[i].find("ownerscontrol");
if(check != string::npos) if(check != string::npos)
{ {
+3 -1
View File
@@ -145,7 +145,9 @@ const char* Constants::MTGBasicAbilities[] = {
"nolifegainopponent", "nolifegainopponent",
"auraward", "auraward",
"madness", "madness",
"protectionfromcoloredspells" "protectionfromcoloredspells",
"mygcreatureexiler",
"oppgcreatureexiler"
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;
+2
View File
@@ -349,6 +349,8 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
if ((to == g->players[i]->game->graveyard) && ( if ((to == g->players[i]->game->graveyard) && (
(g->players[i]->game->battlefield->hasAbility(Constants::MYGCREATUREEXILER) && card->isCreature()) ||
(g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGCREATUREEXILER) && card->isCreature())||
g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) || g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) ||
g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER))) g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER)))
{ {
+5
View File
@@ -1398,6 +1398,7 @@ int MTGCombatTriggersRule::receiveEvent(WEvent *e)
if (card && card->isAttacker()) if (card && card->isAttacker())
{ {
card->eventattacked(); card->eventattacked();
card->controller()->raidcount += 1;
} }
} }
} }
@@ -2276,6 +2277,10 @@ int MTGPersistRule::receiveEvent(WEvent * event)
if (e->from == p->game->inPlay) if (e->from == p->game->inPlay)
ok = 1; ok = 1;
} }
if (card->owner->game->battlefield->hasAbility(Constants::MYGRAVEEXILER)||card->owner->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER))
ok = 0;
if ((card->owner->game->battlefield->hasAbility(Constants::MYGCREATUREEXILER)||card->owner->opponent()->game->battlefield->hasAbility(Constants::OPPGCREATUREEXILER))&&(card->isCreature()))
ok = 0;
if (!ok) if (!ok)
return 0; return 0;
+1
View File
@@ -34,6 +34,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
extraTurn = 0; extraTurn = 0;
drawCounter = 0; drawCounter = 0;
epic = 0; epic = 0;
raidcount = 0;
prowledTypes.clear(); prowledTypes.clear();
doesntEmpty = NEW ManaCost(); doesntEmpty = NEW ManaCost();
poolDoesntEmpty = NEW ManaCost(); poolDoesntEmpty = NEW ManaCost();