Separated PT Modifiers, Fixed Changeling, Modified Counter as a cost
CDA Todo
This commit is contained in:
@@ -4183,23 +4183,17 @@ for (it = types.begin(); it != types.end(); it++)
|
||||
if(newpowerfound )
|
||||
{//setting p/t only overrides base p/t as of M15 changes
|
||||
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
|
||||
oldpower = _target->power;
|
||||
oldpowerbonus = oldpower - _target->basepower;
|
||||
_target->setPower(oldpowerbonus + val->getValue());
|
||||
_target->basepower = val->getValue();
|
||||
//?effects that change pt outside this?
|
||||
//_target->power += reapplyCountersBonus(_target,false,true);
|
||||
_target->isSettingBase = true;
|
||||
_target->applyPTL();
|
||||
delete val;
|
||||
}
|
||||
if(newtoughnessfound )
|
||||
{//setting p/t only overrides base p/t as of M15 changes
|
||||
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
|
||||
oldtoughness = _target->toughness;
|
||||
oldtoughnessbonus = oldtoughness - _target->basetoughness;
|
||||
_target->setToughness(oldtoughnessbonus + val->getValue());
|
||||
_target->basetoughness = val->getValue();
|
||||
//_target->addToToughness(reapplyCountersBonus(_target,true,false));
|
||||
_target->life = _target->toughness;
|
||||
_target->isSettingBase = true;
|
||||
_target->applyPTL();
|
||||
delete val;
|
||||
}
|
||||
|
||||
@@ -4286,16 +4280,15 @@ int ATransformer::destroy()
|
||||
|
||||
if(newpowerfound )
|
||||
{//override since we changed tha base, the bonus must have changed
|
||||
oldpowerbonus = (_target->power - _target->basepower);//math hurts my head...it's all over the place :P
|
||||
_target->setPower(_target->origpower + oldpowerbonus);
|
||||
_target->basepower = _target->origpower;//revert
|
||||
_target->isSettingBase = false;
|
||||
_target->basepower = _target->origpower;
|
||||
_target->applyPTL();
|
||||
}
|
||||
if(newtoughnessfound )
|
||||
{//override since we changed tha base, the bonus must have changed
|
||||
oldtoughnessbonus = (_target->toughness - _target->basetoughness);
|
||||
_target->setToughness(_target->origtoughness + oldtoughnessbonus);
|
||||
_target->basetoughness = _target->origtoughness;//revert
|
||||
_target->life = _target->toughness;//update
|
||||
{
|
||||
_target->isSettingBase = false;
|
||||
_target->basetoughness = _target->origtoughness;
|
||||
_target->applyPTL();
|
||||
}
|
||||
if(newAbilityFound)
|
||||
{
|
||||
|
||||
@@ -56,8 +56,9 @@ int Counter::added()
|
||||
{
|
||||
if (power != 0 || toughness != 0)
|
||||
{
|
||||
target->power += power;
|
||||
target->addToToughness(toughness);
|
||||
target->pbonus += power;
|
||||
target->tbonus += toughness;
|
||||
target->applyPTL();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -66,8 +67,9 @@ int Counter::removed()
|
||||
{
|
||||
if (power != 0 || toughness != 0)
|
||||
{
|
||||
target->power -= power;
|
||||
target->addToToughness(-toughness);
|
||||
target->pbonus -= power;
|
||||
target->tbonus -= toughness;
|
||||
target->applyPTL();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -85,7 +87,7 @@ Counters::~Counters()
|
||||
}
|
||||
}
|
||||
|
||||
int Counters::addCounter(const char * _name, int _power, int _toughness)
|
||||
int Counters::addCounter(const char * _name, int _power, int _toughness, bool _noevent)
|
||||
{
|
||||
/*420.5n If a permanent has both a +1/+1 counter and a -1/-1 counter on it, N +1/+1 and N -1/-1 counters are removed from it, where N is the smaller of the number of +1/+1 and -1/-1 counters on it.*/
|
||||
GameObserver *g = target->getObserver();
|
||||
@@ -109,9 +111,12 @@ int Counters::addCounter(const char * _name, int _power, int _toughness)
|
||||
Counter * counter = NEW Counter(target, _name, _power, _toughness);
|
||||
counters.push_back(counter);
|
||||
counter->added();
|
||||
WEvent * w = NEW WEventCounters(this,_name,_power,_toughness,true,false);
|
||||
dynamic_cast<WEventCounters*>(w)->targetCard = this->target;
|
||||
g->receiveEvent(w);
|
||||
if (!_noevent)
|
||||
{
|
||||
WEvent * w = NEW WEventCounters(this,_name,_power,_toughness,true,false);
|
||||
dynamic_cast<WEventCounters*>(w)->targetCard = this->target;
|
||||
g->receiveEvent(w);
|
||||
}
|
||||
mCount++;
|
||||
this->target->doDamageTest = 1;
|
||||
this->target->afterDamage();
|
||||
@@ -122,7 +127,12 @@ int Counters::addCounter(const char * _name, int _power, int _toughness)
|
||||
|
||||
int Counters::addCounter(int _power, int _toughness)
|
||||
{
|
||||
return addCounter("", _power, _toughness);
|
||||
return addCounter("", _power, _toughness, false);
|
||||
}
|
||||
|
||||
int Counters::addCounter(int _power, int _toughness, bool _noevent)
|
||||
{
|
||||
return addCounter("", _power, _toughness, _noevent);
|
||||
}
|
||||
|
||||
int Counters::init()
|
||||
|
||||
@@ -949,8 +949,8 @@ int CounterCost::doPay()
|
||||
if (counter->nb >= 0)
|
||||
{ //Add counters as a cost
|
||||
for (int i = 0; i < counter->nb; i++)
|
||||
{
|
||||
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness);
|
||||
{//send no event because its a cost not an effect... for doubling season
|
||||
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness, true);
|
||||
}
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
|
||||
@@ -3597,9 +3597,9 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
||||
if(card->previous && card->previous->morphed && !card->turningOver)
|
||||
{
|
||||
magicText = card->magicTexts["facedown"];
|
||||
card->power = 2;
|
||||
card->basepower = 2;
|
||||
card->life = 2;
|
||||
card->toughness = 2;
|
||||
card->basetoughness = 2;
|
||||
card->setColor(0,1);
|
||||
card->name = "Morph";
|
||||
card->types.clear();
|
||||
@@ -3607,12 +3607,17 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
||||
card->setType(cre.c_str());
|
||||
card->basicAbilities.reset();
|
||||
card->getManaCost()->resetCosts();
|
||||
card->isSettingBase = true;
|
||||
card->applyPTL();
|
||||
}
|
||||
else if(card && !card->morphed && card->turningOver)
|
||||
{
|
||||
card->power += card->origpower-2;
|
||||
card->life += card->origtoughness-2;
|
||||
card->toughness += card->origtoughness-2;
|
||||
card->isSettingBase = false;
|
||||
card->power = card->origpower;
|
||||
card->basepower = card->origpower;
|
||||
card->life = card->origtoughness;
|
||||
card->toughness = card->origtoughness;
|
||||
card->basetoughness = card->origtoughness;
|
||||
card->setColor(0,1);
|
||||
card->name = card->model->data->name;
|
||||
card->types = card->model->data->types;
|
||||
@@ -3626,6 +3631,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
||||
string faceupC= card->magicTexts["faceup"];
|
||||
magicText.append("\n");
|
||||
magicText.append(faceupC);
|
||||
card->applyPTL();
|
||||
|
||||
}
|
||||
else if(card && card->hasType(Subtypes::TYPE_EQUIPMENT) && card->target)
|
||||
|
||||
@@ -37,8 +37,10 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
lifeOrig = life;
|
||||
origpower = power;
|
||||
basepower = origpower;
|
||||
pbonus = 0;
|
||||
origtoughness = toughness;
|
||||
basetoughness = origtoughness;
|
||||
tbonus = 0;
|
||||
belongs_to = arg_belongs_to;
|
||||
owner = NULL;
|
||||
if (arg_belongs_to)
|
||||
@@ -51,6 +53,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
thatmuch = 0;
|
||||
flanked = 0;
|
||||
castMethod = Constants::NOT_CAST;
|
||||
isSettingBase = false;
|
||||
isPTswitch = false;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGCardInstance::createSnapShot()
|
||||
@@ -62,6 +66,34 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
return snapShot;
|
||||
}
|
||||
|
||||
void MTGCardInstance::applyPTL()
|
||||
{
|
||||
//7a ??how to add cda(Characteristic Defining Ability)??
|
||||
power = origpower;
|
||||
toughness = origtoughness;
|
||||
//7b
|
||||
if (isSettingBase)
|
||||
{
|
||||
power = basepower;
|
||||
toughness = basetoughness;
|
||||
}
|
||||
//7c - 7d shared?
|
||||
power += pbonus;
|
||||
toughness += tbonus;
|
||||
life = toughness;
|
||||
//7e switch is last
|
||||
if (isPTswitch)
|
||||
{
|
||||
oldP = power;
|
||||
oldT = toughness;
|
||||
this->addToToughness(oldP);
|
||||
this->addToToughness(-oldT);
|
||||
this->power = oldT;
|
||||
}
|
||||
/* end */
|
||||
doDamageTest = 1;
|
||||
}
|
||||
|
||||
void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
{
|
||||
MTGCard * source = card->model;
|
||||
|
||||
@@ -1078,7 +1078,13 @@ bool TypeTargetChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
|
||||
if (card->hasSubtype(types[i])) return true;
|
||||
if (card->data->basicAbilities[(int)Constants::CHANGELING]) return true;//changelings can be targeted as any subtype.
|
||||
if (card->data->basicAbilities[(int)Constants::CHANGELING])
|
||||
{
|
||||
if (!MTGAllCards::isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
if(card->getLCName().size())
|
||||
{
|
||||
if (MTGAllCards::findType(card->getLCName()) == types[i])
|
||||
|
||||
Reference in New Issue
Block a user