added stack check, modified life check

if activating ability, playing a land or casting sorcery spell at
sorcery level(timing restriction), if the stack is not empty, don't
allow it. Modified the life state check, if any of the players would
lose the game, allow the gamestateeffects to check... added
reduceto:value for ali from cairo...
This commit is contained in:
Anthony Calosa
2015-10-01 22:25:26 +08:00
parent e1c02c8bf5
commit ddee2c08e2
10 changed files with 112 additions and 71 deletions

View File

@@ -688,6 +688,13 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "worshipped")//Worship
{
if(card->controller()->game->battlefield->hasType("creature"))
intValue = card->controller()->life;
else
intValue = 0;
}
else if (s == "pancientooze")//Ancient Ooze
{
intValue = 0;
@@ -5997,6 +6004,37 @@ public:
}
};
//Reduce to .. Ali from Cairo...
class AReduceToAbility: public MTGAbility
{
public:
string life_s;
AReduceToAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _life_s) :
MTGAbility(observer, _id, _source)
{
life_s = _life_s;
}
int receiveEvent(WEvent * event)
{
if(WEventDamage * isDamaged = dynamic_cast<WEventDamage *> (event))
{
if (isDamaged->damage->target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
Player * p = (Player *) isDamaged->damage->target;
WParsedInt lifetoset(life_s, NULL, source);
if(p && p == source->controller() && p->life <= lifetoset.getValue())
p->life = lifetoset.getValue();
}
}
return 1;
}
AReduceToAbility * clone() const
{
return NEW AReduceToAbility(*this);
}
};
//flanking ability
class AFlankerAbility: public MTGAbility
{