use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class OutbreakEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
if (player != null && player.choose(outcome, typeChoice, game)) {
game.informPlayers(player.getLogName() + " has chosen " + typeChoice.getChoice());
FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures of the chosen type");
filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
ContinuousEffect effect = new BoostAllEffect(-1, -1, Duration.WhileOnBattlefield, filter, false);
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.choices.ChoiceCreatureType 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;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class TsabosDecreeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
if (player == null) {
return false;
}
if (sourceObject == null) {
return false;
}
Choice typeChoice = new ChoiceCreatureType(sourceObject);
if (!player.choose(outcome, typeChoice, game)) {
return false;
}
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
targetPlayer.revealCards("hand of " + targetPlayer.getName(), targetPlayer.getHand(), game);
FilterCard filterCard = new FilterCard();
filterCard.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
targetPlayer.discard(new CardsImpl(targetPlayer.getHand().getCards(filterCard, game)), false, source, game);
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
filterCreaturePermanent.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) {
if (creature.isControlledBy(targetPlayer.getId())) {
creature.destroy(source, game, true);
}
}
return true;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class RoarOfTheCrowdEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
if (!player.choose(Outcome.LoseLife, typeChoice, game)) {
return false;
}
FilterControlledPermanent filter = new FilterControlledPermanent();
filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
return new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
}
return false;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class WitchsVengeanceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
ChoiceCreatureType choice = new ChoiceCreatureType();
if (!player.choose(outcome, choice, game)) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(SubType.byDescription(choice.getChoice()).getPredicate());
game.addEffect(new BoostAllEffect(-3, -3, Duration.EndOfTurn, filter, false), source);
return true;
}
Aggregations