* Commander state-based action -Fixed that commander movement did not always work correctly after rollback (#6866).

This commit is contained in:
LevelX2 2020-07-20 22:22:20 +02:00
parent f7b3e33f92
commit d721c0bea3
2 changed files with 14 additions and 12 deletions

View file

@ -99,7 +99,7 @@ public class GameState implements Serializable, Copyable<GameState> {
private Map<UUID, Card> copiedCards = new HashMap<>();
private int permanentOrderNumber;
private final Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
private final Set<MageObjectReference> commandersToStay = new HashSet<>();
private Set<MageObjectReference> commandersToStay = new HashSet<>(); // commanders that do not go back to command zone
private int applyEffectsCounter; // Upcounting number of each applyEffects execution
@ -181,6 +181,7 @@ public class GameState implements Serializable, Copyable<GameState> {
this.applyEffectsCounter = state.applyEffectsCounter;
state.usePowerInsteadOfToughnessForDamageLethalityFilters.forEach((uuid, filter)
-> this.usePowerInsteadOfToughnessForDamageLethalityFilters.put(uuid, filter.copy()));
this.commandersToStay.addAll(state.commandersToStay);
}
public void restoreForRollBack(GameState state) {
@ -228,6 +229,7 @@ public class GameState implements Serializable, Copyable<GameState> {
this.applyEffectsCounter = state.applyEffectsCounter;
state.usePowerInsteadOfToughnessForDamageLethalityFilters.forEach((uuid, filter)
-> this.usePowerInsteadOfToughnessForDamageLethalityFilters.put(uuid, filter.copy()));
this.commandersToStay = state.commandersToStay;
}
@Override
@ -1028,7 +1030,7 @@ public class GameState implements Serializable, Copyable<GameState> {
* @param attachedTo
* @param ability
* @param copyAbility copies non MageSingleton abilities before adding to
* state
* state
*/
public void addOtherAbility(Card attachedTo, Ability ability, boolean copyAbility) {
Ability newAbility;