use of mage.abilities.common.EndOfCombatTriggeredAbility in project mage by magefree.
the class DelinaWildMageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 1, true, true);
effect.setIsntLegendary(true);
effect.addAdditionalAbilities(new EndOfCombatTriggeredAbility(new ExileSourceEffect(), false, "Exile this creature at end of combat."));
effect.setTargetPointer(getTargetPointer());
while (true) {
int result = player.rollDice(outcome, source, game, 20);
effect.apply(game, source);
if (result < 15 || 20 < result || !player.chooseUse(outcome, "Roll again?", source, game)) {
break;
}
}
return true;
}
Aggregations