mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fix Redirection effects ending early (#9191)
This commit is contained in:
parent
1e220d9f77
commit
7bed65e8ec
6 changed files with 11 additions and 5 deletions
|
@ -56,7 +56,7 @@ class CaptainsManeuverEffect extends RedirectionEffect {
|
|||
protected MageObjectReference redirectToObject;
|
||||
|
||||
public CaptainsManeuverEffect() {
|
||||
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ONE_USAGE_ABSOLUTE);
|
||||
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ACCORDING_DURATION);
|
||||
staticText = "The next X damage that would be dealt to target creature, planeswalker, or player this turn is dealt to another target creature, planeswalker, or player instead.";
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class HarmsWayPreventDamageTargetEffect extends RedirectionEffect {
|
|||
private final TargetSource damageSource;
|
||||
|
||||
public HarmsWayPreventDamageTargetEffect() {
|
||||
super(Duration.EndOfTurn, 2, UsageType.ONE_USAGE_ABSOLUTE);
|
||||
super(Duration.EndOfTurn, 2, UsageType.ACCORDING_DURATION);
|
||||
staticText = "The next 2 damage that a source of your choice would deal to you and/or permanents you control this turn is dealt to any target instead";
|
||||
this.damageSource = new TargetSource();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class HazduhrTheAbbotRedirectDamageEffect extends RedirectionEffect {
|
|||
private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
public HazduhrTheAbbotRedirectDamageEffect(Duration duration) {
|
||||
super(duration, 0, UsageType.ONE_USAGE_ABSOLUTE);
|
||||
super(duration, 0, UsageType.ACCORDING_DURATION);
|
||||
this.staticText = "The next X damage that would be dealt this turn to target white creature you control is dealt to {this} instead";
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class RaziaBorosArchangelEffect extends RedirectionEffect {
|
|||
protected MageObjectReference redirectToObject;
|
||||
|
||||
public RaziaBorosArchangelEffect(Duration duration, int amount) {
|
||||
super(duration, 3, UsageType.ONE_USAGE_ABSOLUTE);
|
||||
super(duration, amount, UsageType.ACCORDING_DURATION);
|
||||
staticText = "The next " + amount + " damage that would be dealt to target creature you control this turn is dealt to another target creature instead";
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class ShimianNightStalkerRedirectDamageEffect extends RedirectionEffect {
|
|||
private static FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
public ShimianNightStalkerRedirectDamageEffect() {
|
||||
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ONE_USAGE_ABSOLUTE);
|
||||
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ACCORDING_DURATION);
|
||||
this.staticText = "All damage that would be dealt to you this turn by target attacking creature is dealt to {this} instead";
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,12 @@ public abstract class RedirectionEffect extends ReplacementEffectImpl {
|
|||
applyEffectsCounter = game.getState().getApplyEffectsCounter();
|
||||
}
|
||||
}
|
||||
if (usageType == UsageType.ACCORDING_DURATION) {
|
||||
amountToRedirect -= damageEvent.getAmount();
|
||||
if (amountToRedirect <= 0) {
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
Permanent permanent = game.getPermanent(redirectTarget.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.damage(damageToRedirect, event.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
|
||||
|
|
Loading…
Reference in a new issue