mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Fixed missing watchers from DelayedTriggeredAbility:
* Planeswalkers Mischief - fixed rollback error on play; * Psychic Theft - fixed rollback error on play;
This commit is contained in:
parent
32b7c592c8
commit
848c5b6052
6 changed files with 67 additions and 17 deletions
|
|
@ -890,6 +890,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
// TODO: add sources for triggers - the same way as in addEffect: sources
|
||||
this.triggers.add((TriggeredAbility) ability, sourceId, attachedTo);
|
||||
}
|
||||
|
||||
List<Watcher> watcherList = new ArrayList<>(ability.getWatchers()); // Workaround to prevent ConcurrentModificationException, not clear to me why this is happening now
|
||||
for (Watcher watcher : watcherList) {
|
||||
// TODO: Check that watcher for commanderAbility (where attachedTo = null) also work correctly
|
||||
|
|
@ -897,6 +898,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
watcher.setSourceId(attachedTo == null ? ability.getSourceId() : attachedTo.getId());
|
||||
watchers.add(watcher);
|
||||
}
|
||||
|
||||
for (Ability sub : ability.getSubAbilities()) {
|
||||
addAbility(sub, sourceId, attachedTo);
|
||||
}
|
||||
|
|
@ -949,6 +951,13 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
|
||||
public void addDelayedTriggeredAbility(DelayedTriggeredAbility ability) {
|
||||
this.delayed.add(ability);
|
||||
|
||||
List<Watcher> watcherList = new ArrayList<>(ability.getWatchers()); // Workaround to prevent ConcurrentModificationException, not clear to me why this is happening now
|
||||
for (Watcher watcher : watcherList) {
|
||||
watcher.setControllerId(ability.getControllerId());
|
||||
watcher.setSourceId(ability.getSourceId());
|
||||
this.watchers.add(watcher);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDelayedTriggeredAbility(UUID abilityId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue