Tidy up a little...
This commit is contained in:
@@ -4186,10 +4186,7 @@ for (it = types.begin(); it != types.end(); it++)
|
||||
if(newpowerfound )
|
||||
{
|
||||
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
|
||||
_target->basepower = val->getValue();
|
||||
_target->power -= _target->pbonus;
|
||||
_target->power = (_target->power + _target->basepower) - _target->power;
|
||||
_target->power += _target->pbonus;
|
||||
_target->addbaseP(val->getValue());
|
||||
delete val;
|
||||
}
|
||||
if(newtoughnessfound )
|
||||
@@ -4197,10 +4194,7 @@ for (it = types.begin(); it != types.end(); it++)
|
||||
//and you turn it into 1/1, the 1 damage is still there and the creature must die...
|
||||
//the toughness is intact but what we see in the game is the life...
|
||||
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
|
||||
_target->basetoughness = val->getValue();
|
||||
_target->addToToughness(-_target->tbonus);
|
||||
_target->addToToughness(_target->basetoughness - _target->toughness);
|
||||
_target->addToToughness(_target->tbonus);
|
||||
_target->addbaseT(val->getValue());
|
||||
delete val;
|
||||
}
|
||||
|
||||
@@ -4290,19 +4284,11 @@ int ATransformer::destroy()
|
||||
|
||||
if(newpowerfound )
|
||||
{
|
||||
_target->power -= _target->pbonus;
|
||||
_target->power += _target->origpower;
|
||||
_target->power -= _target->basepower;
|
||||
_target->power += _target->pbonus;
|
||||
_target->basepower = _target->origpower;
|
||||
_target->revertbaseP();
|
||||
}
|
||||
if(newtoughnessfound )
|
||||
{
|
||||
_target->addToToughness(-_target->tbonus);
|
||||
_target->addToToughness(_target->origtoughness);
|
||||
_target->addToToughness(-_target->basetoughness);
|
||||
_target->addToToughness(_target->tbonus);
|
||||
_target->basetoughness = _target->origtoughness;
|
||||
_target->revertbaseT();
|
||||
}
|
||||
if(newAbilityFound)
|
||||
{
|
||||
|
||||
@@ -56,12 +56,7 @@ int Counter::added()
|
||||
{
|
||||
if (power != 0 || toughness != 0)
|
||||
{
|
||||
target->power -= target->pbonus;
|
||||
target->addToToughness(-target->tbonus);
|
||||
target->pbonus += power;
|
||||
target->tbonus += toughness;
|
||||
target->power += target->pbonus;
|
||||
target->addToToughness(target->pbonus);
|
||||
target->addcounter(power, toughness);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -70,12 +65,7 @@ int Counter::removed()
|
||||
{
|
||||
if (power != 0 || toughness != 0)
|
||||
{
|
||||
target->power -= target->pbonus;
|
||||
target->addToToughness(-target->tbonus);
|
||||
target->pbonus -= power;
|
||||
target->tbonus -= toughness;
|
||||
target->power += target->pbonus;
|
||||
target->addToToughness(target->pbonus);
|
||||
target->removecounter(power, toughness);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -599,6 +599,101 @@ int MTGCardInstance::setToughness(int value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void MTGCardInstance::stripPTbonus()
|
||||
{
|
||||
power -= pbonus;
|
||||
addToToughness(-tbonus);
|
||||
}
|
||||
|
||||
void MTGCardInstance::plusPTbonus(int p, int t)
|
||||
{
|
||||
pbonus += p;
|
||||
tbonus += t;
|
||||
}
|
||||
|
||||
void MTGCardInstance::minusPTbonus(int p, int t)
|
||||
{
|
||||
pbonus -= p;
|
||||
tbonus -= t;
|
||||
}
|
||||
|
||||
void MTGCardInstance::applyPTbonus()
|
||||
{
|
||||
power += pbonus;
|
||||
addToToughness(tbonus);
|
||||
}
|
||||
|
||||
void MTGCardInstance::addcounter(int p, int t)
|
||||
{
|
||||
stripPTbonus();
|
||||
plusPTbonus(p,t);
|
||||
applyPTbonus();
|
||||
}
|
||||
|
||||
void MTGCardInstance::addptbonus(int p, int t)
|
||||
{
|
||||
stripPTbonus();
|
||||
plusPTbonus(p,t);
|
||||
applyPTbonus();
|
||||
}
|
||||
|
||||
void MTGCardInstance::removecounter(int p, int t)
|
||||
{
|
||||
stripPTbonus();
|
||||
minusPTbonus(p,t);
|
||||
applyPTbonus();
|
||||
}
|
||||
|
||||
void MTGCardInstance::removeptbonus(int p, int t)
|
||||
{
|
||||
stripPTbonus();
|
||||
minusPTbonus(p,t);
|
||||
applyPTbonus();
|
||||
}
|
||||
|
||||
void MTGCardInstance::addbaseP(int p)
|
||||
{
|
||||
basepower = p;
|
||||
power -= pbonus;
|
||||
power = p;
|
||||
power += pbonus;
|
||||
}
|
||||
|
||||
void MTGCardInstance::addbaseT(int t)
|
||||
{
|
||||
basetoughness = t;
|
||||
addToToughness(-tbonus);
|
||||
addToToughness(t - toughness);
|
||||
addToToughness(tbonus);
|
||||
}
|
||||
|
||||
void MTGCardInstance::revertbaseP()
|
||||
{
|
||||
power -= pbonus;
|
||||
power += origpower;
|
||||
power -= basepower;
|
||||
power += pbonus;
|
||||
basepower = origpower;
|
||||
}
|
||||
|
||||
void MTGCardInstance::revertbaseT()
|
||||
{
|
||||
addToToughness(-tbonus);
|
||||
addToToughness(origtoughness);
|
||||
addToToughness(-basetoughness);
|
||||
addToToughness(tbonus);
|
||||
basetoughness = origtoughness;
|
||||
}
|
||||
|
||||
void MTGCardInstance::cdaPT(int p, int t)
|
||||
{
|
||||
origpower = p;
|
||||
origtoughness = t;
|
||||
setPower(p);
|
||||
setToughness(t);
|
||||
applyPTbonus();
|
||||
}
|
||||
|
||||
int MTGCardInstance::canBlock()
|
||||
{
|
||||
if (tapped)
|
||||
|
||||
Reference in New Issue
Block a user