Search in sources :

Example 41 with DamageEvent

use of mage.game.events.DamageEvent in project mage by magefree.

the class BloodOfTheMartyrEffect method applies.

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(event.getTargetId());
    DamageEvent damageEvent = (DamageEvent) event;
    return controller != null && permanent != null && permanent.isCreature(game) && controller.chooseUse(outcome, "Have " + damageEvent.getAmount() + " damage dealt to you instead of " + permanent.getLogName() + "?", source, game);
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) DamageEvent(mage.game.events.DamageEvent)

Aggregations

DamageEvent (mage.game.events.DamageEvent)41 Player (mage.players.Player)25 Permanent (mage.game.permanent.Permanent)22 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)8 TargetPermanent (mage.target.TargetPermanent)7 MageObject (mage.MageObject)6 FilterPermanent (mage.filter.FilterPermanent)5 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)4 UUID (java.util.UUID)3 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)2 FilterSpell (mage.filter.FilterSpell)2 BlockedByIdPredicate (mage.filter.predicate.permanent.BlockedByIdPredicate)2 Spell (mage.game.stack.Spell)2 TargetSpell (mage.target.TargetSpell)2 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)2 PreventionEffectData (mage.abilities.effects.PreventionEffectData)1 SacrificeControllerEffect (mage.abilities.effects.common.SacrificeControllerEffect)1 CardsImpl (mage.cards.CardsImpl)1 FilterInPlay (mage.filter.FilterInPlay)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1