use of mage.abilities.effects.common.SacrificeOpponentsEffect in project mage by magefree.
the class TyrantsChoiceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
TwoChoiceVote vote = new TwoChoiceVote("Death (sacrifice a creature)", "Torture (lose 4 life)", Outcome.Benefit);
vote.doVotes(source, game, (voteHandler, aiPlayer, aiDecidingPlayer, aiSource, aiGame) -> {
// ai hint
if (aiSource.isControlledBy(aiDecidingPlayer.getId())) {
// best for controller - lose life
return Boolean.FALSE;
} else {
// best for opponent - sacrifice
return Boolean.TRUE;
}
});
int deathCount = vote.getVoteCount(true);
int tortureCount = vote.getVoteCount(false);
if (deathCount > tortureCount) {
return new SacrificeOpponentsEffect(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT).apply(game, source);
} else {
return new LoseLifeOpponentsEffect(4).apply(game, source);
}
}
use of mage.abilities.effects.common.SacrificeOpponentsEffect in project mage by magefree.
the class RavenousRotbellyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetPermanent target = new TargetPermanent(0, 3, filter, true);
player.choose(outcome, target, source.getSourceId(), game);
int amount = 0;
for (UUID permanentId : target.getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null && permanent.sacrifice(source, game)) {
amount++;
}
}
if (amount < 1) {
return false;
}
game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(new SacrificeOpponentsEffect(amount, StaticFilters.FILTER_PERMANENT_CREATURES), false, "each opponent sacrifices that many creatures"), source);
return true;
}
use of mage.abilities.effects.common.SacrificeOpponentsEffect in project mage by magefree.
the class MalfegorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int sacrificeNumber = controller.getHand().size();
if (sacrificeNumber == 0) {
return true;
}
new DiscardHandControllerEffect().apply(game, source);
return new SacrificeOpponentsEffect(sacrificeNumber, StaticFilters.FILTER_CONTROLLED_CREATURE).apply(game, source);
}
use of mage.abilities.effects.common.SacrificeOpponentsEffect 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