Search in sources :

Example 1 with EndOfCombatTriggeredAbility

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;
}
Also used : ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) EndOfCombatTriggeredAbility(mage.abilities.common.EndOfCombatTriggeredAbility)

Aggregations

EndOfCombatTriggeredAbility (mage.abilities.common.EndOfCombatTriggeredAbility)1 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)1 ExileSourceEffect (mage.abilities.effects.common.ExileSourceEffect)1 Player (mage.players.Player)1