Search in sources :

Example 6 with LoseLifeTargetEffect

use of mage.abilities.effects.common.LoseLifeTargetEffect in project mage by magefree.

the class SanguineBondTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (event.getPlayerId().equals(this.controllerId)) {
        this.getEffects().clear();
        this.addEffect(new LoseLifeTargetEffect(event.getAmount()));
        return true;
    }
    return false;
}
Also used : LoseLifeTargetEffect(mage.abilities.effects.common.LoseLifeTargetEffect)

Example 7 with LoseLifeTargetEffect

use of mage.abilities.effects.common.LoseLifeTargetEffect in project mage by magefree.

the class SowerOfDiscordTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    int damage = event.getAmount();
    Player player1 = (Player) game.getState().getValue(this.getSourceId() + "_player1");
    Player player2 = (Player) game.getState().getValue(this.getSourceId() + "_player2");
    if (player1 == null || player2 == null || damage == 0) {
        return false;
    }
    Effect effect = new LoseLifeTargetEffect(damage);
    if (event.getTargetId().equals(player1.getId())) {
        this.getEffects().clear();
        effect.setTargetPointer(new FixedTarget(player2.getId()));
        this.addEffect(effect);
        return true;
    } else if (event.getTargetId().equals(player2.getId())) {
        this.getEffects().clear();
        effect.setTargetPointer(new FixedTarget(player1.getId()));
        this.addEffect(effect);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) OneShotEffect(mage.abilities.effects.OneShotEffect) LoseLifeTargetEffect(mage.abilities.effects.common.LoseLifeTargetEffect) Effect(mage.abilities.effects.Effect) LoseLifeTargetEffect(mage.abilities.effects.common.LoseLifeTargetEffect)

Aggregations

LoseLifeTargetEffect (mage.abilities.effects.common.LoseLifeTargetEffect)7 FixedTarget (mage.target.targetpointer.FixedTarget)4 Effect (mage.abilities.effects.Effect)3 Player (mage.players.Player)2 UUID (java.util.UUID)1 MageObject (mage.MageObject)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)1 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 StaticHint (mage.abilities.hint.StaticHint)1 Permanent (mage.game.permanent.Permanent)1 TargetPlayer (mage.target.TargetPlayer)1