Search in sources :

Example 16 with ChoiceCreatureType

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;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ChoiceCreatureType(mage.choices.ChoiceCreatureType) ContinuousEffect(mage.abilities.effects.ContinuousEffect) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect)

Example 17 with ChoiceCreatureType

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;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) MageObject(mage.MageObject) ChoiceCreatureType(mage.choices.ChoiceCreatureType) BecomesSubtypeAllEffect(mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect)

Example 18 with ChoiceCreatureType

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;
}
Also used : FilterCard(mage.filter.FilterCard) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) Choice(mage.choices.Choice) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) MageObject(mage.MageObject) ChoiceCreatureType(mage.choices.ChoiceCreatureType) CardsImpl(mage.cards.CardsImpl)

Example 19 with ChoiceCreatureType

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;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) ChoiceCreatureType(mage.choices.ChoiceCreatureType) PermanentsOnBattlefieldCount(mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect)

Example 20 with ChoiceCreatureType

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;
}
Also used : Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ChoiceCreatureType(mage.choices.ChoiceCreatureType) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect)

Aggregations

ChoiceCreatureType (mage.choices.ChoiceCreatureType)29 Player (mage.players.Player)29 Choice (mage.choices.Choice)28 MageObject (mage.MageObject)15 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)13 Permanent (mage.game.permanent.Permanent)9 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 PermanentsOnBattlefieldCount (mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount)5 FixedTarget (mage.target.targetpointer.FixedTarget)5 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)4 FilterCard (mage.filter.FilterCard)4 UUID (java.util.UUID)3 Card (mage.cards.Card)3 CardsImpl (mage.cards.CardsImpl)3 FilterPermanent (mage.filter.FilterPermanent)3 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)3 FilterCreatureCard (mage.filter.common.FilterCreatureCard)3 HashSet (java.util.HashSet)2 DestroyAllEffect (mage.abilities.effects.common.DestroyAllEffect)2 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)2