added functionality to may and choice ability so that it can check a "restriction{}" like a activated ability with cost, that can keep a menu option from appearing if the restriction is not met

auto=choice damage:1 target(creature) restriction{type(creature[blue])~morethan~1}

this choice menu will only appear is there is more than one blue creature inplay
This commit is contained in:
omegablast2002@yahoo.com
2013-01-28 03:49:24 +00:00
parent a32a58f621
commit 2b9cae8950
3 changed files with 20 additions and 4 deletions
+11 -2
View File
@@ -3077,8 +3077,8 @@ IfThenAbility::~IfThenAbility()
//
//May Abilities
MayAbility::MayAbility(GameObserver* observer, int _id, MTGAbility * _ability, MTGCardInstance * _source, bool must) :
MTGAbility(observer, _id, _source), NestedAbility(_ability), must(must)
MayAbility::MayAbility(GameObserver* observer, int _id, MTGAbility * _ability, MTGCardInstance * _source, bool must,string _cond) :
MTGAbility(observer, _id, _source), NestedAbility(_ability), must(must), Cond(_cond)
{
triggered = 0;
mClone = NULL;
@@ -3093,6 +3093,15 @@ void MayAbility::Update(float dt)
triggered = 1;
if(optionalCost && !source->controller()->getManaPool()->canAfford(optionalCost))
return;
if(Cond.size())
{
AbilityFactory af(game);
int checkCond = af.parseCastRestrictions(source,source->controller(),Cond);
if(!checkCond)
{
return;
}
}
if (TargetAbility * ta = dynamic_cast<TargetAbility *>(ability))
{
if (!ta->getActionTc()->validTargetsExist())