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);
}
Aggregations