game: fixed "if mana was spent to cast" abilities after leaves (#11419)

* ManaWasSpentCondition should use MageObjectReferences
This commit is contained in:
ssk97 2023-11-17 00:02:47 -08:00 committed by GitHub
parent 44b8a0faf4
commit ca80849249
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 22 deletions

View file

@ -6,6 +6,7 @@ import mage.abilities.condition.Condition;
import mage.constants.AbilityType;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.util.CardUtil;
import mage.watchers.common.ManaSpentToCastWatcher;
import java.util.Arrays;
@ -53,7 +54,7 @@ public enum AdamantCondition implements Condition {
if (watcher == null) {
return false;
}
Mana payment = watcher.getLastManaPayment(source.getSourceId());
Mana payment = watcher.getManaPayment(CardUtil.getSourceStackMomentReference(game, source));
if (payment == null) {
return false;
}

View file

@ -6,6 +6,7 @@ import mage.abilities.condition.Condition;
import mage.constants.AbilityType;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.util.CardUtil;
import mage.watchers.common.ManaSpentToCastWatcher;
/**
@ -33,7 +34,7 @@ public enum ManaWasSpentCondition implements Condition {
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class);
if (watcher != null) {
Mana payment = watcher.getLastManaPayment(source.getSourceId());
Mana payment = watcher.getManaPayment(CardUtil.getSourceStackMomentReference(game, source));
if (payment != null) {
return payment.getColor(coloredManaSymbol) > 0;
}