Split Cant pay life and Cant sacrifice

This commit is contained in:
Anthony Calosa
2016-06-14 10:06:37 +08:00
parent 41e97134ef
commit dbf78e2bae
4 changed files with 18 additions and 23 deletions

View File

@@ -3076,8 +3076,9 @@ toughness=6
[/card]
[card]
name=Angel of Jubilation
abilities=flying,cantpaylifeorsaccreatures
abilities=flying,cantpaylife
auto=lord(other creature[-black]|mybattlefield) 1/1
auto=lord(creature) cantbesacrified
text=Flying -- Other nonblack creatures you control get +1/+1. -- Players can't pay life or sacrifice creatures to cast spells or activate abilities.
mana={1}{W}{W}{W}
type=Creature

View File

@@ -244,8 +244,9 @@ class Constants
DEVOID = 123,
CANTCHANGELIFE = 124,
COMBATTOUGHNESS = 125,
CANTPAYLIFEORSACCREATURES = 126,
NB_BASIC_ABILITIES = 127,
CANTPAYLIFE = 126,
CANTBESACRIFIED = 127,
NB_BASIC_ABILITIES = 128,
RARITY_S = 'S', //Special Rarity

View File

@@ -246,8 +246,8 @@ int LifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target->controller()->life <= 0 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) ||
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return 0;
}
@@ -286,8 +286,8 @@ int SpecificLifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life >= slc && !_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return 1;
}
@@ -336,15 +336,15 @@ int LifeorManaCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if ( _target->controller()->life <= 1 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) ||
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) ||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
{
return _target->controller()->getManaPool()->canAfford(getManaCost());
}
else if((_target->controller()->life > 1 || _target->controller()->getManaPool()->canAfford(getManaCost())) &&
(!_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES)))
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE)))
{
return 1;
}
@@ -936,11 +936,8 @@ ExtraCost("Select creature to offer", _tc)
int Offering::canPay()
{
if(source->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
source->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
{
if (target && target->has(Constants::CANTBESACRIFIED))
return 0;
}
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
{
@@ -1001,13 +998,8 @@ SacrificeCost::SacrificeCost(TargetChooser *_tc)
int SacrificeCost::canPay()
{
if(source->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES) ||
source->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFEORSACCREATURES))
{
if (target && target->isCreature())
if (target && target->has(Constants::CANTBESACRIFIED))
return 0;
}
return 1;
}

View File

@@ -156,7 +156,8 @@ const char* Constants::MTGBasicAbilities[] = {
"devoid",
"cantchangelife",
"combattoughness",
"cantpaylifeorsaccreatures"
"cantpaylife",
"cantbesacrified"
};
map<string,int> Constants::MTGBasicAbilitiesMap;