forked from External/mage
Update damage prevention effects to use preventDamageAction (#14071)
This commit is contained in:
parent
caf7a2b8a9
commit
f0e551dafb
31 changed files with 156 additions and 514 deletions
|
|
@ -2,16 +2,14 @@ package mage.cards.a;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.DevotionCount;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
|
@ -46,16 +44,14 @@ public final class AcolytesReward extends CardImpl {
|
|||
|
||||
class AcolytesRewardEffect extends PreventionEffectImpl {
|
||||
|
||||
protected int amount = 0;
|
||||
|
||||
AcolytesRewardEffect() {
|
||||
super(Duration.EndOfTurn);
|
||||
super(Duration.EndOfTurn, 0, false, true, DevotionCount.W);
|
||||
staticText = "Prevent the next X damage that would be dealt to target creature this turn, where X is your devotion to white. If damage is prevented this way, {this} deals that much damage to any target";
|
||||
}
|
||||
|
||||
private AcolytesRewardEffect(final AcolytesRewardEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,64 +59,25 @@ class AcolytesRewardEffect extends PreventionEffectImpl {
|
|||
return new AcolytesRewardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
amount = DevotionCount.W.calculate(game, source, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
boolean result = false;
|
||||
int toPrevent = amount;
|
||||
if (event.getAmount() < this.amount) {
|
||||
toPrevent = event.getAmount();
|
||||
amount -= event.getAmount();
|
||||
} else {
|
||||
amount = 0;
|
||||
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
||||
if (preventionData.getPreventedDamage() > 0) {
|
||||
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
targetCreature.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game, false, true);
|
||||
}
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
targetPlayer.damage(preventionData.getPreventedDamage(), source.getSourceId(), source, game, false, true);
|
||||
}
|
||||
}
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage());
|
||||
if (game.replaceEvent(preventEvent)) {
|
||||
return result;
|
||||
}
|
||||
Permanent targetCreature = game.getPermanent(event.getTargetId());
|
||||
if (targetCreature == null) {
|
||||
return result;
|
||||
}
|
||||
if (amount == 0) {
|
||||
this.used = true;
|
||||
this.discard();
|
||||
}
|
||||
if (event.getAmount() >= toPrevent) {
|
||||
event.setAmount(event.getAmount() - toPrevent);
|
||||
} else {
|
||||
event.setAmount(0);
|
||||
result = true;
|
||||
}
|
||||
if (toPrevent == 0) {
|
||||
return result;
|
||||
}
|
||||
game.informPlayers("Acolyte's Reward prevented " + toPrevent + " to " + targetCreature.getName());
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent));
|
||||
|
||||
Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
targetPlayer.damage(toPrevent, source.getSourceId(), source, game);
|
||||
game.informPlayers("Acolyte's Reward deals " + toPrevent + " damage to " + targetPlayer.getLogName());
|
||||
return result;
|
||||
}
|
||||
Permanent targetDamageCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (targetDamageCreature == null) {
|
||||
return result;
|
||||
}
|
||||
targetDamageCreature.damage(toPrevent, source.getSourceId(), source, game, false, true);
|
||||
game.informPlayers("Acolyte's Reward deals " + toPrevent + " damage to " + targetDamageCreature.getName());
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return !this.used && super.applies(event, source, game) && event.getTargetId().equals(source.getFirstTarget());
|
||||
return super.applies(event, source, game) && event.getTargetId().equals(source.getFirstTarget());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,14 +57,13 @@ class AweStrikeEffect extends PreventionEffectImpl {
|
|||
if (player != null) {
|
||||
player.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
this.used = true;
|
||||
this.discard();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (!this.used && super.applies(event, source, game)) {
|
||||
if (super.applies(event, source, game)) {
|
||||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
return targetCreature != null && targetCreature.getId().equals(event.getSourceId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
|||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -46,7 +46,7 @@ public final class BattletideAlchemist extends CardImpl {
|
|||
class BattletideAlchemistEffect extends PreventionEffectImpl {
|
||||
|
||||
BattletideAlchemistEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
super(Duration.WhileOnBattlefield, 0, false, false, new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.CLERIC, "Clerics")));
|
||||
this.staticText = "If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control";
|
||||
}
|
||||
|
||||
|
|
@ -61,27 +61,14 @@ class BattletideAlchemistEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
boolean result = false;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(event.getTargetId());
|
||||
if (controller != null && targetPlayer != null) {
|
||||
int numberOfClericsControlled = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.CLERIC, "Clerics")).calculate(game, source, this);
|
||||
int toPrevent = Math.min(numberOfClericsControlled, event.getAmount());
|
||||
if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
if (event.getAmount() >= toPrevent) {
|
||||
event.setAmount(event.getAmount() - toPrevent);
|
||||
} else {
|
||||
event.setAmount(0);
|
||||
result = true;
|
||||
}
|
||||
game.informPlayers("Battletide Alchemist prevented " + toPrevent + " damage to " + targetPlayer.getName());
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent));
|
||||
if (amountToPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + amountToPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) {
|
||||
preventDamageAction(event, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -10,13 +11,9 @@ import mage.counters.CounterType;
|
|||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.MulticoloredPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -67,26 +64,15 @@ class BraceForImpactPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (game.replaceEvent(preventEvent)) {
|
||||
return false;
|
||||
}
|
||||
int prevented;
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
|
||||
// add counters now
|
||||
if (prevented > 0) {
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), source.getControllerId(), source, game);
|
||||
game.informPlayers("Brace for Impact: Prevented " + prevented + " damage ");
|
||||
game.informPlayers("Brace for Impact: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -9,12 +8,13 @@ import mage.abilities.effects.PreventionEffectImpl;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
|
@ -63,7 +63,6 @@ class CallousGiantEffect extends PreventionEffectImpl {
|
|||
if(event.getAmount() <= 3)
|
||||
{
|
||||
preventDamageAction(event, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.keyword.SpliceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -9,10 +10,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
|
|
@ -50,7 +48,7 @@ class CandlesGlowPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
private int amount = 3;
|
||||
|
||||
public CandlesGlowPreventDamageTargetEffect(Duration duration) {
|
||||
super(duration);
|
||||
super(duration, 3, false);
|
||||
staticText = "Prevent the next 3 damage that would be dealt to any target this turn. You gain life equal to the damage prevented this way";
|
||||
}
|
||||
|
||||
|
|
@ -66,39 +64,17 @@ class CandlesGlowPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int prevented;
|
||||
if (event.getAmount() >= this.amount) {
|
||||
int damage = amount;
|
||||
event.setAmount(event.getAmount() - amount);
|
||||
this.used = true;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
} else {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
amount -= damage;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
}
|
||||
|
||||
// add live now
|
||||
if (prevented > 0) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(prevented, game, source);
|
||||
game.informPlayers("Candles' Glow: Prevented " + prevented + " damage ");
|
||||
game.informPlayers("Candles' Glow: " + controller.getLogName() + " gained " + prevented + "life");
|
||||
}
|
||||
}
|
||||
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (!this.used && super.applies(event, source, game)) {
|
||||
if (super.applies(event, source, game)) {
|
||||
return source.getTargets().getFirstTarget().equals(event.getTargetId());
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
|
|
@ -18,6 +17,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
|
@ -70,7 +71,7 @@ class ChannelHarmEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,19 +1,21 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
|
@ -38,10 +40,10 @@ public final class CrumblingSanctuary extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CrumblingSanctuaryEffect extends PreventionEffectImpl {
|
||||
class CrumblingSanctuaryEffect extends ReplacementEffectImpl {
|
||||
|
||||
CrumblingSanctuaryEffect() {
|
||||
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false);
|
||||
super(Duration.WhileOnBattlefield, Outcome.PreventDamage);
|
||||
staticText = "If damage would be dealt to a player, that player exiles that many cards from the top of their library instead.";
|
||||
}
|
||||
|
||||
|
|
@ -59,16 +61,18 @@ class CrumblingSanctuaryEffect extends PreventionEffectImpl {
|
|||
int amount = event.getAmount();
|
||||
Player player = game.getPlayer(event.getTargetId());
|
||||
if(player != null) {
|
||||
preventDamageAction(event, source, game);
|
||||
player.moveCards(player.getLibrary().getTopCards(game, amount), Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return super.applies(event, source, game) && (game.getPlayer(event.getTargetId()) != null);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
|
|
@ -15,7 +14,6 @@ import mage.filter.FilterSource;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -65,22 +63,10 @@ class DarkSpherePreventionEffect extends PreventNextDamageFromChosenSourceEffect
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source);
|
||||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
int damage = damageEvent.getAmount();
|
||||
if (controller == null || damage <= 0) {
|
||||
return false;
|
||||
}
|
||||
controller.damage(
|
||||
(int) Math.ceil(damage / 2.0), damageEvent.getSourceId(), source, game,
|
||||
damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects()
|
||||
);
|
||||
StringBuilder sb = new StringBuilder(sourceObject != null ? sourceObject.getLogName() : "");
|
||||
sb.append(": ").append(damage / 2).append(" damage prevented");
|
||||
sb.append(" from ").append(controller.getLogName());
|
||||
game.informPlayers(sb.toString());
|
||||
amountToPrevent = (int) Math.floor(damageEvent.getAmount() / 2.0);
|
||||
preventDamageAction(event, source, game);
|
||||
discard(); // only one use
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,12 +110,10 @@ class DesperateGambitEffect extends PreventionEffectImpl {
|
|||
if (super.applies(event, source, game) && event instanceof DamageEvent && event.getAmount() > 0) {
|
||||
if (wonFlip) {
|
||||
event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2));
|
||||
this.discard();
|
||||
} else {
|
||||
preventDamageAction(event, source, game);
|
||||
this.discard();
|
||||
return true;
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -10,12 +10,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
|
@ -58,18 +54,6 @@ class EnergyFieldEffect extends PreventionEffectImpl {
|
|||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.informPlayers("Damage has been prevented: " + damage);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
||||
|
|
|
|||
|
|
@ -15,13 +15,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
|
@ -118,19 +114,6 @@ class GideonsInterventionPreventAllDamageEffect extends PreventionEffectImpl {
|
|||
public GideonsInterventionPreventAllDamageEffect copy() {
|
||||
return new GideonsInterventionPreventAllDamageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.informPlayers("Damage has been prevented: " + damage);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
|
|
@ -15,6 +14,8 @@ import mage.game.events.GameEvent;
|
|||
import mage.target.TargetSource;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
|
|
@ -70,12 +71,6 @@ class HealingGraceEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
preventDamageAction(event, source, game);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
@ -66,17 +67,6 @@ class HeartOfLightEffect extends PreventionEffectImpl {
|
|||
return new HeartOfLightEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game) && event instanceof DamageEvent) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
|
|
@ -58,11 +57,6 @@ class HiddenRetreatEffect extends PreventionEffectImpl {
|
|||
return new HiddenRetreatEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return (super.applies(event, source, game)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseGameSourceControllerEffect;
|
||||
|
|
@ -17,10 +18,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
|
|
@ -102,24 +100,14 @@ class ImmortalCoilPreventionEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
if (game.replaceEvent(new PreventDamageEvent(
|
||||
event.getTargetId(), source.getSourceId(), source, source.getControllerId(),
|
||||
event.getAmount(), ((DamageEvent) event).isCombatDamage()
|
||||
))) {
|
||||
return false;
|
||||
}
|
||||
int damage = event.getAmount();
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(Math.min(damage, player.getGraveyard().size()), StaticFilters.FILTER_CARD);
|
||||
if (player != null && preventionEffectData.getPreventedDamage() > 0) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(Math.min(preventionEffectData.getPreventedDamage(), player.getGraveyard().size()), StaticFilters.FILTER_CARD);
|
||||
target.withNotTarget(true);
|
||||
player.choose(outcome, target, source, game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
|
||||
}
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(
|
||||
event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import mage.constants.*;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -86,21 +84,6 @@ class MagebaneArmorPreventionEffect extends PreventionEffectImpl {
|
|||
return new MagebaneArmorPreventionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game) && !((DamageEvent) event).isCombatDamage()) {
|
||||
|
|
|
|||
|
|
@ -15,12 +15,8 @@ import mage.constants.Duration;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -74,20 +70,11 @@ class NineLivesPreventionEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Permanent nineLives = source.getSourcePermanentIfItStillExists(game);
|
||||
if (nineLives != null) {
|
||||
nineLives.addCounters(CounterType.INCARNATION.createInstance(1), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
Permanent nineLives = source.getSourcePermanentIfItStillExists(game);
|
||||
if (nineLives != null) {
|
||||
nineLives.addCounters(CounterType.INCARNATION.createInstance(1), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
return super.replaceEvent(event, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -50,18 +46,6 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl {
|
|||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.informPlayers("Damage has been prevented: " + damage);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.cards.p;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -10,13 +11,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -67,19 +64,15 @@ class PhyrexianHydraEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
boolean retValue = false;
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
int damage = event.getAmount();
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
retValue = true;
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(damage), source.getControllerId(), source, game);
|
||||
}
|
||||
return retValue;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -23,6 +20,10 @@ import mage.players.Player;
|
|||
import mage.target.TargetSource;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
|
@ -92,11 +93,6 @@ class ProtectiveSphereEffect extends PreventionEffectImpl {
|
|||
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
manaUsed = (Mana) game.getState().getValue("ProtectiveSphere" + source.getSourceId().toString());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
|
|
@ -13,14 +12,15 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Pete Rossi
|
||||
|
|
@ -73,8 +73,7 @@ class PurityEffect extends PreventionEffectImpl {
|
|||
if (player != null) {
|
||||
player.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import mage.abilities.hint.common.CreaturesYouControlHint;
|
|||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -50,7 +50,7 @@ public final class ShieldOfTheAvatar extends CardImpl {
|
|||
class ShieldOfTheAvatarPreventionEffect extends PreventionEffectImpl {
|
||||
|
||||
ShieldOfTheAvatarPreventionEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
super(Duration.WhileOnBattlefield, 0, false, false);
|
||||
this.staticText = "If a source would deal damage to equipped creature, prevent X of that damage, where X is the number of creatures you control.";
|
||||
}
|
||||
|
||||
|
|
@ -65,26 +65,8 @@ class ShieldOfTheAvatarPreventionEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
boolean result = false;
|
||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
int numberOfCreaturesControlled = CreaturesYouControlCount.PLURAL.calculate(game, source, this);
|
||||
int toPrevent = Math.min(numberOfCreaturesControlled, event.getAmount());
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent, ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
if (event.getAmount() >= toPrevent) {
|
||||
event.setAmount(event.getAmount() - toPrevent);
|
||||
} else {
|
||||
event.setAmount(0);
|
||||
result = true;
|
||||
}
|
||||
if (toPrevent > 0) {
|
||||
game.informPlayers("Shield of the Avatar " + "prevented " + toPrevent + " damage to " + game.getPermanent(equipment.getAttachedTo()).getName());
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), toPrevent));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
amountToPrevent = CreaturesYouControlCount.PLURAL.calculate(game, source, this);
|
||||
return super.replaceEvent(event, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -13,17 +12,18 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetSource;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
|
|
@ -86,12 +86,6 @@ class ShieldmageAdvocateEffect extends PreventionEffectImpl {
|
|||
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
preventDamageAction(event, source, game);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
|
@ -11,12 +10,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -66,25 +61,6 @@ class StonewiseFortifierPreventAllDamageToEffect extends PreventionEffectImpl {
|
|||
return new StonewiseFortifierPreventAllDamageToEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), event.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int preventedDamage = event.getAmount();
|
||||
MageObject damageSource = game.getObject(event.getSourceId());
|
||||
MageObject preventionSource = game.getObject(source);
|
||||
if (damageSource != null && preventionSource != null) {
|
||||
String message = " damage from " +
|
||||
damageSource.getName() + " prevented " +
|
||||
'(' + preventionSource + ')';
|
||||
game.informPlayers(message);
|
||||
}
|
||||
event.setAmount(0);
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), preventedDamage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game) && event.getTargetId().equals(source.getSourceId())) {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ class StormwildCapridorEffect extends PreventionEffectImpl {
|
|||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.cards.t;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -10,10 +11,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -44,22 +42,13 @@ public final class Temper extends CardImpl {
|
|||
|
||||
class TemperPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||
|
||||
private int amount;
|
||||
private final DynamicValue dVal;
|
||||
private boolean initialized;
|
||||
|
||||
public TemperPreventDamageTargetEffect(DynamicValue dVal, Duration duration) {
|
||||
super(duration);
|
||||
this.initialized = false;
|
||||
this.dVal = dVal;
|
||||
super(duration, 0, false, true, dVal);
|
||||
staticText = "Prevent the next X damage that would be dealt to target creature this turn. For each 1 damage prevented this way, put a +1/+1 counter on that creature";
|
||||
}
|
||||
|
||||
private TemperPreventDamageTargetEffect(final TemperPreventDamageTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.dVal = effect.dVal;
|
||||
this.initialized = effect.initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -69,36 +58,13 @@ class TemperPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
if (!initialized) {
|
||||
amount = dVal.calculate(game, source, this);
|
||||
initialized = true;
|
||||
}
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int prevented = 0;
|
||||
if (event.getAmount() >= this.amount) {
|
||||
int damage = amount;
|
||||
event.setAmount(event.getAmount() - amount);
|
||||
this.used = true;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
} else {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
amount -= damage;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
}
|
||||
|
||||
// add counters now
|
||||
if (prevented > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), source.getControllerId(), source, game);
|
||||
game.informPlayers("Temper: Prevented " + prevented + " damage ");
|
||||
game.informPlayers("Temper: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
|
||||
}
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -8,10 +9,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -42,16 +40,14 @@ public final class TestOfFaith extends CardImpl {
|
|||
|
||||
class TestOfFaithPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||
|
||||
private int amount = 3;
|
||||
|
||||
public TestOfFaithPreventDamageTargetEffect(Duration duration) {
|
||||
super(duration);
|
||||
super(duration, 3, false);
|
||||
staticText = "Prevent the next 3 damage that would be dealt to target creature this turn. For each 1 damage prevented this way, put a +1/+1 counter on that creature";
|
||||
}
|
||||
|
||||
private TestOfFaithPreventDamageTargetEffect(final TestOfFaithPreventDamageTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -61,32 +57,13 @@ class TestOfFaithPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int prevented = 0;
|
||||
if (event.getAmount() >= this.amount) {
|
||||
int damage = amount;
|
||||
event.setAmount(event.getAmount() - amount);
|
||||
this.used = true;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
} else {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
amount -= damage;
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), damage));
|
||||
prevented = damage;
|
||||
}
|
||||
|
||||
// add counters now
|
||||
if (prevented > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), source.getControllerId(), source, game);
|
||||
game.informPlayers("Test of Faith: Prevented " + prevented + " damage ");
|
||||
game.informPlayers("Test of Faith: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName());
|
||||
}
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,21 +4,20 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.SourceTappedCondition;
|
||||
import mage.abilities.decorator.ConditionalPreventionEffect;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.decorator.ConditionalReplacementEffect;
|
||||
import mage.abilities.effects.RedirectionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.UnblockedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.DamagePlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -35,10 +34,8 @@ public final class VeteranBodyguard extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// As long as Veteran Bodyguard is untapped, all damage that would be dealt to you by unblocked creatures is dealt to Veteran Bodyguard instead.
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalPreventionEffect(
|
||||
new VeteranBodyguardEffect(),
|
||||
SourceTappedCondition.UNTAPPED,
|
||||
"As long as {this} is untapped, all damage that would be dealt to you by unblocked creatures is dealt to {this} instead."
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalReplacementEffect(new VeteranBodyguardEffect(), SourceTappedCondition.UNTAPPED)
|
||||
.setText("As long as {this} is untapped, all damage that would be dealt to you by unblocked creatures is dealt to {this} instead."
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +49,7 @@ public final class VeteranBodyguard extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class VeteranBodyguardEffect extends PreventionEffectImpl {
|
||||
class VeteranBodyguardEffect extends RedirectionEffect {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("unblocked creatures");
|
||||
|
||||
|
|
@ -69,22 +66,6 @@ class VeteranBodyguardEffect extends PreventionEffectImpl {
|
|||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.damage(damageEvent.getAmount(), event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getPlayerId().equals(source.getControllerId())
|
||||
|
|
@ -93,6 +74,9 @@ class VeteranBodyguardEffect extends PreventionEffectImpl {
|
|||
if (p != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
if (event.getSourceId().equals(permanent.getId())) {
|
||||
TargetPermanent target = new TargetPermanent();
|
||||
target.add(source.getSourceId(), game);
|
||||
this.redirectTarget = target;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,18 +4,18 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.PreventDamageEvent;
|
||||
import mage.game.events.PreventedDamageEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -37,7 +37,7 @@ public final class Vigor extends CardImpl {
|
|||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// If damage would be dealt to a creature you control other than Vigor, prevent that damage. Put a +1/+1 counter on that creature for each 1 damage prevented this way.
|
||||
this.addAbility(new SimpleStaticAbility(new VigorReplacementEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new VigorEffect()));
|
||||
|
||||
// When Vigor is put into a graveyard from anywhere, shuffle it into its owner's library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
|
|
@ -53,36 +53,34 @@ public final class Vigor extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class VigorReplacementEffect extends ReplacementEffectImpl {
|
||||
class VigorEffect extends PreventionEffectImpl {
|
||||
|
||||
VigorReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
VigorEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "if damage would be dealt to another creature you control, prevent that damage. Put a +1/+1 counter on that creature for each 1 damage prevented this way";
|
||||
|
||||
}
|
||||
|
||||
private VigorReplacementEffect(final VigorReplacementEffect effect) {
|
||||
private VigorEffect(final VigorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new PreventDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), event.getAmount(), ((DamageEvent) event).isCombatDamage());
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int preventedDamage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(preventedDamage), source.getControllerId(), source, game);
|
||||
}
|
||||
game.fireEvent(new PreventedDamageEvent(event.getTargetId(), source.getSourceId(), source, source.getControllerId(), preventedDamage));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public VigorEffect copy() {
|
||||
return new VigorEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), source.getControllerId(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -94,8 +92,4 @@ class VigorReplacementEffect extends ReplacementEffectImpl {
|
|||
&& !event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public VigorReplacementEffect copy() {
|
||||
return new VigorReplacementEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.*;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagePermanentEvent;
|
||||
|
|
@ -21,6 +20,8 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jimga150
|
||||
|
|
@ -129,7 +130,7 @@ class WeepingAngelDamageEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
game.preventDamage(event, source, game, Integer.MAX_VALUE);
|
||||
preventDamageAction(event, source, game);
|
||||
Card card = game.getPermanent(event.getTargetId());
|
||||
if (card == null) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue