Fix zcc off by 1 in MayCastTargetCardEffect

This commit is contained in:
Susucre 2024-04-05 02:07:40 +02:00
parent 9a47fd2980
commit 01ddee2c75

View file

@ -30,22 +30,22 @@ public class MayCastTargetCardEffect extends OneShotEffect {
/** /**
* Allows to cast the target card immediately, for its manacost. * Allows to cast the target card immediately, for its manacost.
*/ */
public MayCastTargetCardEffect(boolean exileOnResolve) { public MayCastTargetCardEffect(boolean thenExile) {
this(CastManaAdjustment.NONE, exileOnResolve); this(CastManaAdjustment.NONE, thenExile);
} }
/** /**
* Allows to cast the target card immediately, either for its cost or with a modifier (like for free, or mana as any type). * Allows to cast the target card immediately, either for its cost or with a modifier (like for free, or mana as any type).
*/ */
public MayCastTargetCardEffect(CastManaAdjustment manaAdjustment, boolean exileOnResolve) { public MayCastTargetCardEffect(CastManaAdjustment manaAdjustment, boolean thenExile) {
this(Duration.OneUse, manaAdjustment, exileOnResolve); this(Duration.OneUse, manaAdjustment, thenExile);
} }
/** /**
* Makes the target card playable for the specified duration as long as it remains in that zone. * Makes the target card playable for the specified duration as long as it remains in that zone.
*/ */
public MayCastTargetCardEffect(Duration duration, boolean exileOnResolve) { public MayCastTargetCardEffect(Duration duration, boolean thenExile) {
this(duration, CastManaAdjustment.NONE, exileOnResolve); this(duration, CastManaAdjustment.NONE, thenExile);
} }
protected MayCastTargetCardEffect(Duration duration, CastManaAdjustment manaAdjustment, boolean thenExile) { protected MayCastTargetCardEffect(Duration duration, CastManaAdjustment manaAdjustment, boolean thenExile) {
@ -83,6 +83,7 @@ public class MayCastTargetCardEffect extends OneShotEffect {
if (card == null) { if (card == null) {
return false; return false;
} }
FixedTarget fixedTarget = new FixedTarget(card, game);
if (duration == Duration.OneUse) { if (duration == Duration.OneUse) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller == null || !controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller == null || !controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) {
@ -98,7 +99,7 @@ public class MayCastTargetCardEffect extends OneShotEffect {
// TODO: untangle why there is a confusion between the two. // TODO: untangle why there is a confusion between the two.
ContinuousEffect effect = ContinuousEffect effect =
new YouMaySpendManaAsAnyColorToCastTargetEffect(Duration.Custom, controller.getId(), null); new YouMaySpendManaAsAnyColorToCastTargetEffect(Duration.Custom, controller.getId(), null);
effect.setTargetPointer(new FixedTarget(card, game)); effect.setTargetPointer(fixedTarget.copy());
game.addEffect(effect, source); game.addEffect(effect, source);
break; break;
default: default:
@ -116,7 +117,7 @@ public class MayCastTargetCardEffect extends OneShotEffect {
} }
if (thenExile) { if (thenExile) {
ContinuousEffect effect = new ThatSpellGraveyardExileReplacementEffect(true); ContinuousEffect effect = new ThatSpellGraveyardExileReplacementEffect(true);
effect.setTargetPointer(new FixedTarget(card, game)); effect.setTargetPointer(fixedTarget.copy());
game.addEffect(effect, source); game.addEffect(effect, source);
} }
return true; return true;