Crew Ability Cost & Crewbonus

Revised cards to use {crew(targetchooser)} (modified taptargetcost) so
it can use crewbonus ability from other creatures.
This commit is contained in:
Anthony Calosa
2017-02-01 17:11:55 +08:00
parent c8dc416071
commit ea5e397595
10 changed files with 144 additions and 72 deletions

View File

@@ -771,8 +771,8 @@ TapTargetCost * TapTargetCost::clone() const
return ec;
}
TapTargetCost::TapTargetCost(TargetChooser *_tc)
: ExtraCost("Tap Target", _tc)
TapTargetCost::TapTargetCost(TargetChooser *_tc, bool crew)
: ExtraCost("Tap Target", _tc), crew(crew)
{
}
@@ -785,6 +785,13 @@ int TapTargetCost::isPaymentSet()
target = NULL;
return 0;
}
if (crew && target && target->has(Constants::CANTCREW))
{
tc->removeTarget(target);
target->isExtraCostTarget = false;
target = NULL;
return 0;
}
if (target)
return 1;
return 0;
@@ -798,6 +805,20 @@ int TapTargetCost::doPay()
{
source->storedCard = target->createSnapShot();
_target->tap();
//crew ability
if(crew)
{
if(_target->getCrewAbility().size())
{
AbilityFactory af(_target->getObserver());
MTGAbility * crewAbility = af.parseMagicLine(_target->getCrewAbility(), -1, NULL, source,false,true);
crewAbility->oneShot = true;
crewAbility->canBeInterrupted = false;
crewAbility->target = source;
crewAbility->resolve();
}
}
//end
target = NULL;
if (tc)
tc->initTargets();