Search in sources :

Example 1 with ModularAbility

use of mage.abilities.keyword.ModularAbility in project mage by magefree.

the class ZabazTheGlimmerwaspEffect method applies.

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
    if (!event.getData().equals(CounterType.P1P1.getName()) || event.getAmount() < 1) {
        return false;
    }
    StackObject stackAbility = game.getStack().getStackObject(event.getSourceId());
    if (stackAbility == null || !(stackAbility.getStackAbility() instanceof ModularAbility)) {
        return false;
    }
    Permanent permanent = game.getPermanent(event.getTargetId());
    if (permanent == null) {
        permanent = game.getPermanentEntering(event.getTargetId());
    }
    return permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.isCreature(game);
}
Also used : Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) StackObject(mage.game.stack.StackObject) ModularAbility(mage.abilities.keyword.ModularAbility)

Aggregations

ModularAbility (mage.abilities.keyword.ModularAbility)1 Permanent (mage.game.permanent.Permanent)1 StackObject (mage.game.stack.StackObject)1 TargetPermanent (mage.target.TargetPermanent)1