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:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user