use of mage.abilities.effects.common.GainLifeTargetEffect in project mage by magefree.
the class KravTheUnredeemedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = GetXValue.instance.calculate(game, source, this);
new DrawCardTargetEffect(xValue).apply(game, source);
new GainLifeTargetEffect(xValue).apply(game, source);
new AddCountersSourceEffect(CounterType.P1P1.createInstance(xValue)).apply(game, source);
return true;
}
use of mage.abilities.effects.common.GainLifeTargetEffect in project mage by magefree.
the class FieldsOfSummerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null || !cPlane.getPlaneType().equals(Planes.PLANE_FIELDS_OF_SUMMER)) {
return false;
}
Player owner = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (owner != null && owner.canRespond() && owner.chooseUse(Outcome.Benefit, "Gain 2 life?", source, game)) {
Effect effect = new GainLifeTargetEffect(2);
effect.setTargetPointer(new FixedTarget(owner.getId())).apply(game, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.GainLifeTargetEffect in project mage by magefree.
the class CurseOfVitalityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {
Set<UUID> players = new HashSet<>();
for (UUID attacker : game.getCombat().getAttackers()) {
UUID defender = game.getCombat().getDefenderId(attacker);
if (defender.equals(enchantedPlayer.getId()) && game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) {
players.add(game.getPermanent(attacker).getControllerId());
}
}
players.add(source.getControllerId());
for (UUID player : players) {
game.getPlayer(player);
Effect effect = new GainLifeTargetEffect(2);
effect.setTargetPointer(new FixedTarget(player));
effect.apply(game, source);
}
}
return true;
}
return false;
}
Aggregations