Search in sources :

Example 1 with LoseLifeOpponentsEffect

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);
    }
}
Also used : SacrificeOpponentsEffect(mage.abilities.effects.common.SacrificeOpponentsEffect) TwoChoiceVote(mage.choices.TwoChoiceVote) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect)

Example 2 with LoseLifeOpponentsEffect

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);
}
Also used : Player(mage.players.Player) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect)

Example 3 with LoseLifeOpponentsEffect

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;
}
Also used : Player(mage.players.Player) MageObject(mage.MageObject) CardsImpl(mage.cards.CardsImpl) CitysBlessingHint(mage.abilities.hint.common.CitysBlessingHint) Card(mage.cards.Card) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect)

Example 4 with LoseLifeOpponentsEffect

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;
}
Also used : Player(mage.players.Player) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect)

Example 5 with LoseLifeOpponentsEffect

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;
}
Also used : Outcome(mage.constants.Outcome) OneShotEffect(mage.abilities.effects.OneShotEffect) AdventureCard(mage.cards.AdventureCard) LifelinkAbility(mage.abilities.keyword.LifelinkAbility) UUID(java.util.UUID) MageInt(mage.MageInt) SubType(mage.constants.SubType) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) CardSetInfo(mage.cards.CardSetInfo) Game(mage.game.Game) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect) CardType(mage.constants.CardType) Ability(mage.abilities.Ability) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) LoseLifeOpponentsEffect(mage.abilities.effects.common.LoseLifeOpponentsEffect)

Aggregations

LoseLifeOpponentsEffect (mage.abilities.effects.common.LoseLifeOpponentsEffect)5 Player (mage.players.Player)3 Card (mage.cards.Card)2 CardsImpl (mage.cards.CardsImpl)2 UUID (java.util.UUID)1 MageInt (mage.MageInt)1 MageObject (mage.MageObject)1 Ability (mage.abilities.Ability)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 SacrificeOpponentsEffect (mage.abilities.effects.common.SacrificeOpponentsEffect)1 CitysBlessingHint (mage.abilities.hint.common.CitysBlessingHint)1 LifelinkAbility (mage.abilities.keyword.LifelinkAbility)1 AdventureCard (mage.cards.AdventureCard)1 CardSetInfo (mage.cards.CardSetInfo)1 TwoChoiceVote (mage.choices.TwoChoiceVote)1 CardType (mage.constants.CardType)1 Outcome (mage.constants.Outcome)1 SubType (mage.constants.SubType)1 Game (mage.game.Game)1