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