use of mage.abilities.effects.common.LoseLifeOpponentsEffect 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.LoseLifeOpponentsEffect in project mage by magefree.
the class YurikoTheTigersShadowEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
player.revealCards(source, new CardsImpl(card), game);
player.moveCards(card, Zone.HAND, source, game);
return new LoseLifeOpponentsEffect(card.getManaValue()).apply(game, source);
}
use of mage.abilities.effects.common.LoseLifeOpponentsEffect in project mage by magefree.
the class TwilightProphetEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
controller.moveCards(card, Zone.HAND, source, game);
game.getState().processAction(game);
int amount = card.getManaValue();
if (amount > 0) {
new LoseLifeOpponentsEffect(amount).apply(game, source);
controller.gainLife(amount, game, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.LoseLifeOpponentsEffect in project mage by magefree.
the class LilianaUntouchedByDeathGraveyardEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (player.millCards(3, source, game).getCards(game).stream().anyMatch(card -> card.hasSubtype(SubType.ZOMBIE, game))) {
new LoseLifeOpponentsEffect(2).apply(game, source);
player.gainLife(2, game, source);
}
return true;
}
use of mage.abilities.effects.common.LoseLifeOpponentsEffect in project mage by magefree.
the class CurryFavorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = game.getBattlefield().getAllActivePermanents(source.getControllerId()).stream().filter(permanent -> permanent != null && permanent.hasSubtype(SubType.KNIGHT, game)).mapToInt(p -> 1).sum();
new GainLifeEffect(xValue).apply(game, source);
new LoseLifeOpponentsEffect(xValue).apply(game, source);
return true;
}
Aggregations