use of mage.abilities.effects.common.PreventCombatDamageBySourceEffect in project mage by magefree.
the class MtendaLionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getCombat().getDefendingPlayerId(source.getSourceId(), game));
if (player == null) {
return false;
}
Cost cost = new ManaCostsImpl("{U}");
if (!player.chooseUse(outcome, "Pay {U} to prevent damage?", source, game) || !cost.pay(source, game, source, player.getId(), false)) {
return false;
}
game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.PreventCombatDamageBySourceEffect in project mage by magefree.
the class UrzasScienceFairProjectEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int amount = controller.rollDice(outcome, source, game, 6);
Effect effect = null;
// 6 - gets +2/+2 until end of turn";
if (amount == 1) {
game.addEffect(new BoostSourceEffect(-2, -2, Duration.EndOfTurn), source);
} else if (amount == 2) {
game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source);
} else if (amount == 3) {
game.addEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 4) {
game.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 5) {
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 6) {
game.addEffect(new BoostSourceEffect(+2, +2, Duration.EndOfTurn), source);
}
return true;
}
return false;
}
Aggregations