game: fixed miss state triggers check in multi-steps abilities/effects (#10564)

This commit is contained in:
Oleg Agafonov 2023-07-05 09:52:38 +04:00
parent b66189d3da
commit f26b1470fa
4 changed files with 31 additions and 8 deletions

View file

@ -8,6 +8,15 @@ import mage.game.events.GameEvent;
import java.util.UUID;
/**
* 603.8.
* Some triggered abilities trigger when a game state (such as a player controlling no permanents of
* a particular card type) is true, rather than triggering when an event occurs. These abilities trigger
* as soon as the game state matches the condition. They'll go onto the stack at the next available opportunity.
* These are called state triggers. (Note that state triggers aren't the same as state-based actions.)
* A state-triggered ability doesn't trigger again until the ability has resolved, has been countered,
* or has otherwise left the stack. Then, if the object with the ability is still in the same zone and
* the game state still matches its trigger condition, the ability will trigger again.
*
* @author BetaSteward_at_googlemail.com
*/
public abstract class StateTriggeredAbility extends TriggeredAbilityImpl {
@ -21,7 +30,8 @@ public abstract class StateTriggeredAbility extends TriggeredAbilityImpl {
}
public boolean canTrigger(Game game) {
//20100716 - 603.8
// 603.8 - A state-triggered ability doesn't trigger again until the ability has resolved,
// has been countered, or has otherwise left the stack
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
}