Corrections

This commit is contained in:
Anthony Calosa
2016-06-13 15:27:33 +08:00
parent 70c0957248
commit 9ac1540cdc
7 changed files with 71 additions and 37 deletions

View File

@@ -245,7 +245,9 @@ LifeCost::LifeCost(TargetChooser *_tc)
int LifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life <= 0 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
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))
{
return 0;
}
@@ -283,7 +285,9 @@ SpecificLifeCost::SpecificLifeCost(TargetChooser *_tc, int slc)
int SpecificLifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life >= slc && !_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
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))
{
return 1;
}
@@ -331,7 +335,16 @@ LifeorManaCost::LifeorManaCost(TargetChooser *_tc, string manaType)
int LifeorManaCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target->controller()->getManaPool()->canAfford(getManaCost()) || _target->controller()->life > 1)
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))
{
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)))
{
return 1;
}
@@ -923,6 +936,12 @@ 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))
{
return 0;
}
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
{
tc->removeTarget(target);
@@ -980,6 +999,18 @@ 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())
return 0;
}
return 1;
}
int SacrificeCost::doPay()
{
if (target)