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