Search in sources :

Example 1 with BecomesSubtypeAllEffect

use of mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect in project mage by magefree.

the class StandardizeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    String chosenType = "";
    if (player != null && sourceObject != null) {
        Choice typeChoice = new ChoiceCreatureType(sourceObject);
        typeChoice.setMessage("Choose a creature type other than Wall");
        typeChoice.getChoices().remove("Wall");
        if (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
            return false;
        }
        game.informPlayers(sourceObject.getLogName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
        chosenType = typeChoice.getChoice();
        if (chosenType != null && !chosenType.isEmpty()) {
            // ADD TYPE TO TARGET
            game.addEffect(new BecomesSubtypeAllEffect(Duration.EndOfTurn, Arrays.asList(SubType.byDescription(chosenType)), StaticFilters.FILTER_PERMANENT_CREATURE, true), source);
            return true;
        }
    }
    return false;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) MageObject(mage.MageObject) ChoiceCreatureType(mage.choices.ChoiceCreatureType) BecomesSubtypeAllEffect(mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect)

Aggregations

MageObject (mage.MageObject)1 BecomesSubtypeAllEffect (mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect)1 Choice (mage.choices.Choice)1 ChoiceCreatureType (mage.choices.ChoiceCreatureType)1 Player (mage.players.Player)1