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

@ -513,13 +513,10 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
// If the top card of your library changes while youre casting a spell, playing a land, or activating an ability,
// you cant look at the new top card until you finish doing so. This means that if you cast the top card of
// your library, you cant look at the next one until youre done paying for that spell. (2019-05-03)
if (!game.getStack().isEmpty()) {
StackObject stackObject = game.getStack().getFirst();
return !(stackObject instanceof Spell)
|| !Zone.LIBRARY.equals(((Spell) stackObject).getFromZone())
|| stackObject.getStackAbility().getManaCostsToPay().isPaid(); // mana payment finished
}
return true;
StackObject stackObject = game.getStack().getFirstOrNull();
return !(stackObject instanceof Spell)
|| !Zone.LIBRARY.equals(((Spell) stackObject).getFromZone())
|| stackObject.getStackAbility().getManaCostsToPay().isPaid(); // mana payment finished
}
@Override