use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class SunhomeEnforcerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedEvent damageEvent = (DamagedEvent) event;
if (damageEvent.isCombatDamage()) {
if (event.getSourceId().equals(this.sourceId)) {
this.getEffects().clear();
this.getEffects().add(new GainLifeEffect(damageEvent.getAmount()));
return true;
}
}
return false;
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class NoblePurposeTriggeredAbility 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(damageEvent.getAmount()));
return true;
}
}
return false;
}
use of mage.abilities.effects.common.GainLifeEffect 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;
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class TolsimirFriendToWolvesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
new GainLifeEffect(3).apply(game, source);
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return true;
}
Permanent wolf = wolfMor.getPermanent(game);
if (wolf == null) {
return false;
}
return wolf.fight(permanent, source, game);
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class VigorousChargeTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedEvent damageEvent = (DamagedEvent) event;
if (damageEvent.isCombatDamage()) {
if (event.getSourceId().equals(this.sourceId)) {
this.getEffects().clear();
this.getEffects().add(new GainLifeEffect(damageEvent.getAmount()));
return true;
}
}
return false;
}
Aggregations