Search in sources :

Example 21 with GainLifeEffect

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

the class ProperBurialTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    ZoneChangeEvent zoneChangeEvent = (ZoneChangeEvent) event;
    if (zoneChangeEvent.isDiesEvent()) {
        Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
        if (permanent != null && permanent.isControlledBy(this.getControllerId()) && permanent.isCreature(game)) {
            this.getEffects().clear();
            this.addEffect(new GainLifeEffect(permanent.getToughness().getValue()));
            return true;
        }
    }
    return false;
}
Also used : ZoneChangeEvent(mage.game.events.ZoneChangeEvent) Permanent(mage.game.permanent.Permanent) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 22 with GainLifeEffect

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

the class SengirTheDarkBaronWatcher method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    SengirTheDarkBaronWatcher watcher = game.getState().getWatcher(SengirTheDarkBaronWatcher.class);
    if (watcher == null) {
        return false;
    }
    this.getEffects().clear();
    this.addEffect(new GainLifeEffect(watcher.getLife(event.getPlayerId())));
    return true;
}
Also used : GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 23 with GainLifeEffect

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

the class ExquisiteBloodTriggeredAbility method checkTrigger.

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

Example 24 with GainLifeEffect

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

the class IkraShidiqiTheUsurperTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    DamagedEvent damageEvent = (DamagedEvent) event;
    if (damageEvent.isCombatDamage()) {
        Permanent permanent = game.getPermanent(event.getSourceId());
        if (permanent != null && permanent.isCreature(game) && permanent.isControlledBy(this.getControllerId())) {
            this.getEffects().clear();
            this.getEffects().add(new GainLifeEffect(permanent.getToughness().getValue()));
            return true;
        }
    }
    return false;
}
Also used : DamagedEvent(mage.game.events.DamagedEvent) Permanent(mage.game.permanent.Permanent) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 25 with GainLifeEffect

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

the class VarinaLichQueenTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    int attackingZombies = 0;
    for (UUID attacker : game.getCombat().getAttackers()) {
        Permanent creature = game.getPermanent(attacker);
        if (creature != null && creature.getControllerId() != null && creature.isControlledBy(this.getControllerId()) && creature.hasSubtype(SubType.ZOMBIE, game)) {
            attackingZombies++;
        }
    }
    if (attackingZombies > 0) {
        this.getEffects().clear();
        addEffect(new DrawCardSourceControllerEffect(attackingZombies));
        addEffect(new DiscardControllerEffect(attackingZombies, false));
        addEffect(new GainLifeEffect(attackingZombies));
        return true;
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) DrawCardSourceControllerEffect(mage.abilities.effects.common.DrawCardSourceControllerEffect) UUID(java.util.UUID) DiscardControllerEffect(mage.abilities.effects.common.discard.DiscardControllerEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Aggregations

GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)27 Permanent (mage.game.permanent.Permanent)11 Ability (mage.abilities.Ability)7 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)6 Player (mage.players.Player)6 Test (org.junit.Test)6 DamagedEvent (mage.game.events.DamagedEvent)5 UUID (java.util.UUID)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)2 Choice (mage.choices.Choice)2 TargetCardInHand (mage.target.common.TargetCardInHand)2 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)2 ArrayList (java.util.ArrayList)1 MageInt (mage.MageInt)1 SacrificeTargetCost (mage.abilities.costs.common.SacrificeTargetCost)1 PermanentsOnBattlefieldCount (mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount)1