Separated PT Modifiers, Fixed Changeling, Modified Counter as a cost

CDA Todo
This commit is contained in:
Anthony Calosa
2015-09-12 12:03:52 +08:00
parent 8b287cca0c
commit 11d68c0e27
9 changed files with 119 additions and 66 deletions

View File

@@ -2260,16 +2260,18 @@ public:
{
if(!nonstatic)
return;
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
if(PT.size())
{
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
MTGCardInstance * _target = (MTGCardInstance *) target;
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
}
int addToGame()
@@ -2280,8 +2282,9 @@ public:
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
if(_target->has(Constants::INDESTRUCTIBLE) && wppt->toughness.getValue() < 0 && _target->toughness <= 0)
{
_target->controller()->game->putInGraveyard(_target);
@@ -2291,8 +2294,9 @@ public:
int destroy()
{
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
return 1;
}
const string getMenuText()
@@ -4027,8 +4031,6 @@ string menu;
class ASwapPT: public InstantAbility
{
public:
int oldpower;
int oldtoughness;
ASwapPT(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
InstantAbility(observer, _id, _source, _target)
{
@@ -4042,13 +4044,13 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
if(_target->isPTswitch)
_target->isPTswitch = false;
else
_target->isPTswitch = true;
_target->applyPTL();
}
return 1;
}
@@ -4060,12 +4062,10 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->isPTswitch = false;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
_target->applyPTL();
}
return 1;
@@ -4307,13 +4307,9 @@ public:
string newpower;
bool newpowerfound;
int oldpower;
int oldpowerbonus;
string newtoughness;
bool newtoughnessfound;
int oldtoughness;
int oldtoughnessbonus;
map<Damageable *, vector<MTGAbility *> > newAbilities;
vector<string> newAbilitiesList;
bool newAbilityFound;
@@ -5651,15 +5647,17 @@ public:
{
nbOpponents = source->blockers.size();
if (nbOpponents <= MaxOpponent) return 0;
source->power += PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus += PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus += ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
}
else if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event))
{
if (MTG_PHASE_AFTER_EOT == pe->to->id && nbOpponents > MaxOpponent)
{
source->power -= PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(-ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus -= PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus -= ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
nbOpponents = 0;
}
}