produceextra, lki(last known information) for power, toughness and basic abilities

This commit is contained in:
Anthony Calosa
2015-09-30 23:45:54 +08:00
parent 956d21d431
commit e1c02c8bf5
10 changed files with 80 additions and 20 deletions
+6 -6
View File
@@ -2081,16 +2081,16 @@ int AADynamic::resolve()
switch(type)
{
case DYNAMIC_ABILITY_TYPE_POWER:
sourceamount = ((MTGCardInstance *) source)->power;
targetamount = ((MTGCardInstance *) _target)->power;
sourceamount = ((MTGCardInstance *) source)->getCurrentPower();
targetamount = ((MTGCardInstance *) _target)->getCurrentPower();
if(eachother )
sourceamount = ((MTGCardInstance *) source)->power;
sourceamount = ((MTGCardInstance *) source)->getCurrentPower();
break;
case DYNAMIC_ABILITY_TYPE_TOUGHNESS:
sourceamount = ((MTGCardInstance *) source)->toughness;
targetamount = ((MTGCardInstance *) _target)->toughness;
sourceamount = ((MTGCardInstance *) source)->getCurrentToughness();
targetamount = ((MTGCardInstance *) _target)->getCurrentToughness();
if(eachother )
sourceamount = ((MTGCardInstance *) source)->toughness;
sourceamount = ((MTGCardInstance *) source)->getCurrentToughness();
break;
case DYNAMIC_ABILITY_TYPE_MANACOST:
if(amountsource == 1)
+1
View File
@@ -42,6 +42,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
return;
basicAbilities = source->basicAbilities;
origbasicAbilities = source->basicAbilities;
LKIbasicAbilities = source->basicAbilities;
for (size_t i = 0; i < source->types.size(); ++i)
types.push_back(source->types[i]);
+3
View File
@@ -608,6 +608,9 @@ void GameObserver::gameStateBasedEffects()
for (int j = zone->nb_cards - 1; j >= 0; j--)
{
MTGCardInstance * card = zone->cards[j];
card->LKIpower = card->power;
card->LKItoughness = card->toughness;
card->LKIbasicAbilities = card->basicAbilities;
card->afterDamage();
card->mPropertiesChangedSinceLastUpdate = false;
if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0)))
+7 -1
View File
@@ -2659,6 +2659,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return NEW AEvolveAbility(observer, id, card);
}
//produce additional mana when tapped for mana
if (s.find("produceextra:") != string::npos)
{
return NEW AProduceExtraAbility(observer, id, card,s.substr(13));
}
//flanking
if (s.find("flanker") != string::npos)
{
@@ -4259,7 +4265,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (current->hasType(Subtypes::TYPE_CREATURE))
{
card->controller()->game->putInGraveyard(current);
damage += current->power;
damage += current->getCurrentPower();
}
}
observer->mLayers->stackLayer()->addDamage(card, target, damage);
+16
View File
@@ -61,6 +61,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
discarded = false;
copiedID = getId();
modifiedbAbi = 0;
LKIpower = power;
LKItoughness = toughness;
}
MTGCardInstance * MTGCardInstance::createSnapShot()
@@ -723,6 +725,20 @@ void MTGCardInstance::switchPT(bool apply)
}
}
int MTGCardInstance::getCurrentPower()
{
if(!isInPlay(observer))
return LKIpower;
return power;
}
int MTGCardInstance::getCurrentToughness()
{
if(!isInPlay(observer))
return LKItoughness;
return toughness;
}
int MTGCardInstance::canBlock()
{
if (tapped)
+2 -2
View File
@@ -2707,7 +2707,7 @@ int MTGLifelinkRule::receiveEvent(WEvent * event)
WEventDamage * e = (WEventDamage *) event;
Damage * d = e->damage;
MTGCardInstance * card = d->source;
if (d->damage > 0 && card && card->basicAbilities[(int)Constants::LIFELINK])
if (d->damage > 0 && card && (card->basicAbilities[(int)Constants::LIFELINK]||card->LKIbasicAbilities[(int)Constants::LIFELINK]))
{
card->controller()->gainLife(d->damage);
return 1;
@@ -2751,7 +2751,7 @@ int MTGDeathtouchRule::receiveEvent(WEvent * event)
return 0;
MTGCardInstance * _target = (MTGCardInstance *) (d->target);
if (card->basicAbilities[(int)Constants::DEATHTOUCH])
if (card->basicAbilities[(int)Constants::DEATHTOUCH]||card->LKIbasicAbilities[(int)Constants::DEATHTOUCH])
{
_target->destroy();
return 1;