use of mage.abilities.effects.common.counter.AddCountersAttachedEffect in project mage by magefree.
the class ConsumingFerocityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) {
Effect effect = new AddCountersAttachedEffect(CounterType.P1P0.createInstance(), "enchanted creature");
effect.apply(game, source);
if (creature.getCounters(game).getCount(CounterType.P1P0) > 2) {
Player player = game.getPlayer(creature.getControllerId());
if (player != null) {
player.damage(creature.getPower().getValue(), creature.getId(), source, game);
}
effect = new DestroyTargetEffect(true);
effect.setTargetPointer(new FixedTarget(creature, game));
effect.apply(game, source);
return true;
}
}
return false;
}
Aggregations