Add support for Amonkhet Mechanics

and fix some cards.
Added exerted trigger, event and add removemc keyword inside transforms
ability so we can soft code Embalm and Eternalize...
This commit is contained in:
Anthony Calosa
2017-08-03 09:49:37 +08:00
parent 1f670b9919
commit 6bd09e42e0
11 changed files with 166 additions and 34 deletions
+1 -1
View File
@@ -1040,7 +1040,7 @@ void ActionStack::Update(float dt)
if (getCurrentTutorial() && (observer->players[0]->isHuman() || observer->players[1]->isHuman() ) )
return;
if (observer->mLayers->actionLayer()->menuObject || observer->LPWeffect)
if (observer->mLayers->actionLayer()->menuObject)// || observer->LPWeffect) //test fix for hang for both legendary with action/reveal
if(observer->players[0]->isHuman() || observer->players[1]->isHuman())
return;//dont do any of this if a menuobject exist.
+4
View File
@@ -6046,6 +6046,7 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou
}
myCurrentTurn = 1000;
//this subkeyword adds a color without removing the existing colors.
removemc = (sabilities.find("removemc") != string::npos);
addNewColors = (sabilities.find("newcolors") != string::npos);
remove = (stypes.find("removealltypes") != string::npos);
removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos);
@@ -6235,6 +6236,9 @@ for (it = types.begin(); it != types.end(); it++)
_target->addbaseT(val->getValue());
delete val;
}
//remove manacost
if(removemc)
_target->getManaCost()->resetCosts();
return MTGAbility::addToGame();
}
+20 -3
View File
@@ -439,7 +439,7 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if (grave->hasType("land")) checkTypesAmount++;
if (grave->hasType("artifact")) checkTypesAmount++;
if (grave->hasType("planeswalker")) checkTypesAmount++;
if (grave->hasType("tribal")) checkTypesAmount++;
if (grave->hasType("tribal")) checkTypesAmount++;
if (checkTypesAmount < 4)
return 0;
}
@@ -458,7 +458,7 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if (grave->hasType("land")) checkTypesAmount++;
if (grave->hasType("artifact")) checkTypesAmount++;
if (grave->hasType("planeswalker")) checkTypesAmount++;
if (grave->hasType("tribal")) checkTypesAmount++;
if (grave->hasType("tribal")) checkTypesAmount++;
if (checkTypesAmount > 3)
return 0;
}
@@ -1070,6 +1070,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser *tc = parseSimpleTC(s,"phasedin", card))
return NEW TrCardPhasesIn(observer, id, card, tc,once);
//Card Exerted
if (TargetChooser *tc = parseSimpleTC(s,"exerted", card))
return NEW TrCardExerted(observer, id, card, tc,once);
//CombatTrigger
//Card card attacked and is blocked
found = s.find("combat(");
@@ -2928,7 +2932,20 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
((AManifest*)a)->withenchant = true;
return a;
}
//exert
found = s.find("exert");
if (found != string::npos)
{
MTGAbility * a = NEW AExert(observer, id, card, target);
a->oneShot = 1;
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AExert*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}
//provoke
found = s.find("provoke");
if (found != string::npos)
+1
View File
@@ -224,6 +224,7 @@ void MTGCardInstance::initMTGCI()
blinked = false;
isExtraCostTarget = false;
morphed = false;
exerted = false;
turningOver = false;
isMorphed = false;
MeldedFrom = "";
+19 -19
View File
@@ -1219,12 +1219,12 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
void MTGDeck::printDetailedDeckText(std::ofstream& file )
{
ostringstream currentCard, creatures, lands, spells, types;
ostringstream ss_creatures, ss_lands, ss_spells;
int numberOfCreatures = 0;
int numberOfSpells = 0;
int numberOfLands = 0;
ostringstream ss_creatures, ss_lands, ss_spells;
int numberOfCreatures = 0;
int numberOfSpells = 0;
int numberOfLands = 0;
map<int, int>::iterator it;
map<int, int>::iterator it;
for (it = cards.begin(); it != cards.end(); it++)
{
int cardId = it->first;
@@ -1271,29 +1271,29 @@ void MTGDeck::printDetailedDeckText(std::ofstream& file )
currentCard <<endl;
setInfo = NULL;
// Add counter to know number of creatures, non-creature spells and lands present in the deck
// Add counter to know number of creatures, non-creature spells and lands present in the deck
if ( card->data->isLand() )
{
{
lands<< currentCard.str();
numberOfLands+=nbCards;
}
numberOfLands+=nbCards;
}
else if ( card->data->isCreature() )
{
{
creatures << currentCard.str();
numberOfCreatures+=nbCards;
}
numberOfCreatures+=nbCards;
}
else
{
{
spells << currentCard.str();
numberOfSpells+=nbCards;
}
numberOfSpells+=nbCards;
}
currentCard.str("");
}
ss_creatures << numberOfCreatures;
ss_spells << numberOfSpells;
ss_lands << numberOfLands;
ss_creatures << numberOfCreatures;
ss_spells << numberOfSpells;
ss_lands << numberOfLands;
file << getCardBlockText( "Creatures x " + ss_creatures.str(), creatures.str() ) << endl;
file << getCardBlockText( "Creatures x " + ss_creatures.str(), creatures.str() ) << endl;
file << getCardBlockText( "Spells x " + ss_spells.str(), spells.str() ) << endl;
file << getCardBlockText( "Lands x " + ss_lands.str(), lands.str() ) << endl;
creatures.str("");
+23 -4
View File
@@ -554,6 +554,13 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
}
}
}
//remove exerted if changing controls
if((to == g->players[0]->game->battlefield && from == g->players[1]->game->battlefield)||
(to == g->players[1]->game->battlefield && from == g->players[0]->game->battlefield))
{
if(ret->exerted)
ret->exerted = false;
}
}
if(!asCopy)
{
@@ -1125,13 +1132,25 @@ void MTGInPlay::untapAll()
card->setUntapping();
if (!card->basicAbilities[(int)Constants::DOESNOTUNTAP] && !card->basicAbilities[(int)Constants::SHACKLER])
{
if (card->frozen < 1)
if(card->exerted)
{
card->attemptUntap();
card->exerted = false;
if (card->frozen >= 1)
{
card->frozen = 0;
}
}
if (card->frozen >= 1)
else
{
card->frozen = 0;
card->exerted = false;
if (card->frozen < 1)
{
card->attemptUntap();
}
if (card->frozen >= 1)
{
card->frozen = 0;
}
}
}
}
+11
View File
@@ -121,6 +121,11 @@ WEventCardUpdate(card)
{
}
WEventCardExerted::WEventCardExerted(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventVampire::WEventVampire(MTGCardInstance * card,MTGCardInstance * source,MTGCardInstance * victem) :
WEventCardUpdate(card),source(source),victem(victem)
{
@@ -377,6 +382,12 @@ Targetable * WEventCardCycle::getTarget(int target)
return NULL;
}
Targetable * WEventCardExerted::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardAttackedNotBlocked::getTarget(int target)
{
if (target) return card;