refactor: improved search in stack

This commit is contained in:
Oleg Agafonov 2025-08-10 02:07:15 +04:00
parent 26adccdfd5
commit 384ce67cc3
20 changed files with 101 additions and 119 deletions

View file

@ -638,8 +638,8 @@ public class HumanPlayer extends PlayerImpl {
// Check check if the spell being paid for cares about the color of mana being paid
// See: https://github.com/magefree/mage/issues/9070
boolean caresAboutManaColor = false;
if (!game.getStack().isEmpty() && game.getStack().getFirst() instanceof Spell) {
Spell spellBeingCast = (Spell) game.getStack().getFirst();
if (game.getStack().getFirstOrNull() instanceof Spell) {
Spell spellBeingCast = (Spell) game.getStack().getFirstOrNull();
if (!spellBeingCast.isResolving() && spellBeingCast.getControllerId().equals(this.getId())) {
CardImpl card = (CardImpl) game.getCard(spellBeingCast.getSourceId());
caresAboutManaColor = card.caresAboutManaColor(game);