Search in sources :

Example 11 with TwoChoiceVote

use of mage.choices.TwoChoiceVote in project mage by magefree.

the class LieutenantsOfTheGuardEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // Outcome.Benefit - AI will boost all the time (Strength choice)
    // TODO: add AI hint logic in the choice method, see Tyrant's Choice as example
    TwoChoiceVote vote = new TwoChoiceVote("Strength (+1/+1 counter)", "Numbers (1/1 token)", Outcome.Benefit);
    vote.doVotes(source, game);
    int strengthCount = vote.getVoteCount(true);
    int numbersCount = vote.getVoteCount(false);
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (strengthCount > 0 && permanent != null) {
        permanent.addCounters(CounterType.P1P1.createInstance(strengthCount), source.getControllerId(), source, game);
    }
    if (numbersCount > 0) {
        new SoldierToken().putOntoBattlefield(numbersCount, game, source, source.getControllerId());
    }
    return strengthCount + numbersCount > 0;
}
Also used : SoldierToken(mage.game.permanent.token.SoldierToken) Permanent(mage.game.permanent.Permanent) TwoChoiceVote(mage.choices.TwoChoiceVote)

Example 12 with TwoChoiceVote

use of mage.choices.TwoChoiceVote in project mage by magefree.

the class CapitalPunishmentEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // Outcome.Detriment - AI will discard a card all the time (taxes choice)
    // TODO: add AI hint logic in the choice method, see Tyrant's Choice as example
    TwoChoiceVote vote = new TwoChoiceVote("Death (sacrifice creature)", "Taxes (discard card)", Outcome.Detriment);
    vote.doVotes(source, game);
    int deathCount = vote.getVoteCount(true);
    int taxesCount = vote.getVoteCount(false);
    if (deathCount > 0) {
        new SacrificeOpponentsEffect(deathCount, StaticFilters.FILTER_CONTROLLED_CREATURE).apply(game, source);
    }
    if (taxesCount > 0) {
        new DiscardEachPlayerEffect(StaticValue.get(taxesCount), false, TargetController.OPPONENT).apply(game, source);
    }
    return true;
}
Also used : SacrificeOpponentsEffect(mage.abilities.effects.common.SacrificeOpponentsEffect) DiscardEachPlayerEffect(mage.abilities.effects.common.discard.DiscardEachPlayerEffect) TwoChoiceVote(mage.choices.TwoChoiceVote)

Aggregations

TwoChoiceVote (mage.choices.TwoChoiceVote)12 Player (mage.players.Player)8 Permanent (mage.game.permanent.Permanent)5 Objects (java.util.Objects)2 UUID (java.util.UUID)2 Ability (mage.abilities.Ability)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 DestroyAllEffect (mage.abilities.effects.common.DestroyAllEffect)2 SacrificeOpponentsEffect (mage.abilities.effects.common.SacrificeOpponentsEffect)2 DiscardEachPlayerEffect (mage.abilities.effects.common.discard.DiscardEachPlayerEffect)2 CardImpl (mage.cards.CardImpl)2 CardSetInfo (mage.cards.CardSetInfo)2 CardType (mage.constants.CardType)2 Outcome (mage.constants.Outcome)2 FilterPermanent (mage.filter.FilterPermanent)2 Game (mage.game.Game)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 MageInt (mage.MageInt)1