Example #1
0
 @Override
 public boolean replaceEvent(GameEvent event, Ability source, Game game) {
   PreventionEffectData preventionResult = preventDamageAction(event, source, game);
   if (preventionResult.getPreventedDamage() > 0) {
     Permanent redirectTo = game.getPermanent(getTargetPointer().getFirst(game, source));
     if (redirectTo != null) {
       game.informPlayers(
           "Dealing "
               + preventionResult.getPreventedDamage()
               + " to "
               + redirectTo.getLogName()
               + " instead.");
       DamageEvent damageEvent = (DamageEvent) event;
       redirectTo.damage(
           preventionResult.getPreventedDamage(),
           event.getSourceId(),
           game,
           damageEvent.isCombatDamage(),
           damageEvent.isPreventable(),
           event.getAppliedEffects());
     }
     discard(); // (only once)
   }
   return false;
 }
Example #2
0
 @Override
 public boolean replaceEvent(GameEvent event, Ability source, Game game) {
   PreventionEffectData preventEffectData = preventDamageAction(event, source, game);
   if (preventEffectData.getPreventedDamage() > 0) {
     used = true;
     Player player = game.getPlayer(source.getControllerId());
     if (player != null) {
       player.gainLife(preventEffectData.getPreventedDamage(), game);
     }
   }
   return false;
 }