Cant life change

This commit is contained in:
Anthony Calosa
2016-06-02 09:10:30 +08:00
parent aaf2d271bc
commit aabb905313
11 changed files with 37 additions and 24 deletions
+2
View File
@@ -4623,6 +4623,8 @@ int AAExchangeLife::resolve()
Damageable * _target = (Damageable *) getTarget();
if (_target)
{
if(_target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && ((Player*)_target)->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
return 0;
Player *player = source->controller();
int oldlife = player->getLife();
int targetOldLife = _target->getLife();
+6 -2
View File
@@ -196,7 +196,8 @@ int Damage::resolve()
{
//Damage + 1, 2, or 3 poison counters on player
Player * _target = (Player *) target;
a = target->dealDamage(damage);
if(!_target->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
a = target->dealDamage(damage);
target->damageCount += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
@@ -228,7 +229,10 @@ int Damage::resolve()
{
// "Normal" case,
//return the left over amount after effects have been applied to them.
a = target->dealDamage(damage);
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && !((Player *)target)->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
a = target->dealDamage(damage);
else
a = target->dealDamage(damage);
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){
((MTGCardInstance*)target)->wasDealtDamage = true;
+2 -2
View File
@@ -245,7 +245,7 @@ LifeCost::LifeCost(TargetChooser *_tc)
int LifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life <= 0)
if(_target->controller()->life <= 0 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
{
return 0;
}
@@ -283,7 +283,7 @@ SpecificLifeCost::SpecificLifeCost(TargetChooser *_tc, int slc)
int SpecificLifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life >= slc)
if(_target->controller()->life >= slc && !_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
{
return 1;
}
+6 -3
View File
@@ -4389,8 +4389,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
case 130553:// Beacon of Immortality
{
Player * player = spell->getNextPlayerTarget();
if (player->life < (INT_MAX / 4))
player->life += player->life;
if (!player->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
{
if (player->life < (INT_MAX / 4))
player->life += player->life;
}
zones->putInZone(card, spell->from, zones->library);
zones->library->shuffle();
break;
@@ -5771,7 +5774,7 @@ const string AManaProducer::getMenuText()
menutext.append(",");
sprintf(buffer, "%i ", value);
menutext.append(buffer);
if (i == Constants::MTG_COLOR_WASTE)
if (i == Constants::MTG_COLOR_WASTE)
menutext.append(_(" colorless"));
else if (i >= Constants::MTG_COLOR_GREEN && i <= Constants::MTG_COLOR_WASTE)
menutext.append(_(Constants::MTGColorStrings[i]));
+2 -1
View File
@@ -153,7 +153,8 @@ const char* Constants::MTGBasicAbilities[] = {
"trinisphere",
"canplayfromexile",
"libraryeater",
"devoid"
"devoid",
"cantchangelife"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
-1
View File
@@ -882,7 +882,6 @@ int ManaCost::pay(ManaCost * _cost)
ManaCost * diff = Diff(toPay);
for (int i = 0; i < Constants::NB_Colors; i++)
{
cost[i] = diff->getCost(i);
}
delete diff;
+2 -1
View File
@@ -162,7 +162,8 @@ int Player::gainOrLoseLife(int value)
thatmuch = abs(value); //the value that much is a variable to be used with triggered abilities.
//ie:when ever you gain life, draw that many cards. when used in a trigger draw:thatmuch, will return the value
//that the triggered event stored in the card for "that much".
life+=value;
if (!inPlay()->hasAbility(Constants::CANTCHANGELIFE))
life+=value;
if (value<0)
lifeLostThisTurn += abs(value);