fix for recover cards, preliminary support for madness

This commit is contained in:
Anthony Calosa
2015-09-28 21:27:27 +08:00
parent 04e53f2002
commit 021343ca02
12 changed files with 226 additions and 136 deletions
+3 -3
View File
@@ -1160,14 +1160,14 @@ int GenericPaidAbility::resolve()
baseAbility->target = target;
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
// hacky way to produce better MenuText
/*// hacky way to produce better MenuText
AAFakeAbility* isFake = dynamic_cast< AAFakeAbility* >( baseAbility );
size_t findPayN = isFake->named.find(" {value} mana");
if (isFake && findPayN != string::npos) {
stringstream parseN;
parseN << optionalCost->getCost(Constants::MTG_COLOR_ARTIFACT);
isFake->named.replace(findPayN + 1, 7, parseN.str());
}
}//commented out, it crashes cards with recover ability*/
MTGAbility * set = baseAbility->clone();
set->oneShot = true;
@@ -5724,7 +5724,7 @@ const string AACastCard::getMenuText()
return nameThis.c_str();
if(putinplay)
return "Put Into Play";
return "Cast For Free";
return "Cast Card";
}
AACastCard * AACastCard::clone() const
+10
View File
@@ -411,6 +411,13 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
}
}
check = restriction[i].find("discarded");
if(check != string::npos)
{
if(!card->discarded)
return 0;
}
check = restriction[i].find("ownerscontrol");
if(check != string::npos)
{
@@ -3542,6 +3549,9 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
badAbilities[(int)Constants::WEAK] = true;
badAbilities[(int)Constants::NOLIFEGAIN] = true;
badAbilities[(int)Constants::NOLIFEGAINOPPONENT] = true;
badAbilities[(int)Constants::CANTLOSE] = false;
badAbilities[(int)Constants::CANTLIFELOSE] = false;
badAbilities[(int)Constants::CANTMILLLOSE] = false;
if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast<AInstantBasicAbilityModifierUntilEOT *>(a))
{
+1
View File
@@ -58,6 +58,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
isSwitchedPT = false;
isACopier = false;
bypassTC = false;
discarded = false;
}
MTGCardInstance * MTGCardInstance::createSnapShot()
+2 -1
View File
@@ -143,7 +143,8 @@ const char* Constants::MTGBasicAbilities[] = {
"spellmastery",
"nolifegain",
"nolifegainopponent",
"auraward"
"auraward",
"madness"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+16
View File
@@ -325,6 +325,15 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
bool ripToken = false;
if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace"))
ripToken = true;
//Madness or Put in Play...
for(int i = 0; i < 2; ++i)
{
if (card->discarded && (to == g->players[i]->game->graveyard) && (from == g->players[i]->game->hand))
{
if(card->basicAbilities[(int)Constants::MADNESS])
to = g->players[i]->game->exile;
}
}
//Darksteel Colossus, Legacy Weapon ... top priority since we replace destination directly automatically...
for(int i = 0; i < 2; ++i)
{
@@ -361,6 +370,13 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
{
copy->miracle = true;
}
if (card->discarded)
{//set discarded for madness...
if(from == g->players[0]->game->hand || from == g->players[1]->game->hand)
copy->discarded = true;
else//turn off discarded if its previous zone is not in hand...
copy->discarded = false;
}
if (options[Options::SFXVOLUME].number > 0)
{
if (to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard)
+1
View File
@@ -106,6 +106,7 @@ WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance
WEventCardDiscard::WEventCardDiscard(MTGCardInstance * card) :
WEventCardUpdate(card)
{
card->discarded = true;
}
WEventCardCycle::WEventCardCycle(MTGCardInstance * card) :