manifest support

also fix guiplay
This commit is contained in:
Anthony Calosa
2017-03-09 07:44:06 +08:00
parent 01d46615a7
commit 53f0c2421d
9 changed files with 230 additions and 67 deletions
+17
View File
@@ -3243,6 +3243,7 @@ AAMorph::AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCard
ActivatedAbility(observer, id, card, _cost, restrictions)
{
target = _target;
face = false;
}
int AAMorph::resolve()
@@ -3288,6 +3289,7 @@ int AAMorph::resolve()
}
}
}
_target->isFacedown = false;
WEvent * e = NEW WEventCardFaceUp(_target);
game->receiveEvent(e);
currentAbilities.clear();
@@ -3312,6 +3314,16 @@ int AAMorph::testDestroy()
const string AAMorph::getMenuText()
{
if(face && target)
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target && _target->model)
{
std::ostringstream abname;
abname << "Face Up " << _target->model->data->getManaCost()->toString();
return abname.str();
}
}
return "Morph";
}
@@ -3544,6 +3556,11 @@ int AAFlip::resolve()
_target->mPropertiesChangedSinceLastUpdate = true;
if(!isflipcard)
{
if(_target->isFacedown)
_target->isFacedown = false;
else
_target->isFacedown = true;
WEvent * e = NEW WEventCardTransforms(_target);
game->receiveEvent(e);
}
+2 -2
View File
@@ -447,12 +447,12 @@ int GuiPlay::receiveEventPlus(WEvent * e)
Replace();
else if (dynamic_cast<WEventCardControllerChange*> (e))
Replace();
else if (dynamic_cast<WEventCardTransforms*> (e))
/*else if (dynamic_cast<WEventCardTransforms*> (e))
Replace();
else if (dynamic_cast<WEventCardCopiedACard*> (e))
Replace();
else if (dynamic_cast<WEventCardFaceUp*> (e))
Replace();
Replace();*/
Replace();
return 0;
}
+25 -1
View File
@@ -2895,6 +2895,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//manifest
found = s.find("manifest");
if (found != string::npos)
{
MTGAbility * a = NEW AManifest(observer, id, card, target);
a->oneShot = 1;
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AManifest*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}
//clone
found = s.find("clone");
if (found != string::npos)
@@ -4019,7 +4034,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = 1;
return a;
}
//morph
found = s.find("manafaceup");
if (found != string::npos)
{
MTGAbility * a = NEW AAMorph(observer, id, card, target);
a->oneShot = 1;
((AAMorph*)a)->face = true;
return a;
}
//identify what a leveler creature will max out at.
vector<string> splitMaxlevel = parseBetween(s, "maxlevel:", " ", false);
if (splitMaxlevel.size())
+1
View File
@@ -246,6 +246,7 @@ void MTGCardInstance::initMTGCI()
isDualWielding = false;
suspended = false;
isBestowed = false;
isFacedown = false;
castMethod = Constants::NOT_CAST;
mPropertiesChangedSinceLastUpdate = false;
stillNeeded = true;
+11 -1
View File
@@ -217,7 +217,17 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
}
break;
case 'm': //Mill yourself as a cost
manaCost->addExtraCost(NEW MillCost(tc));
{
if (value == "mycost")
{
if(c && c->model)
manaCost->add(c->model->data->getManaCost());
else
break;
}
else
manaCost->addExtraCost(NEW MillCost(tc));
}
break;
case 'n': //return unblocked attacker cost
{