mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Commander state-based action -Fixed that commander movement did not always work correctly after rollback (#6866).
This commit is contained in:
parent
f7b3e33f92
commit
d721c0bea3
2 changed files with 14 additions and 12 deletions
|
@ -1,5 +1,7 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
@ -13,9 +15,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Plopman, JayDi85
|
||||
*/
|
||||
|
@ -40,12 +39,13 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
/**
|
||||
*
|
||||
* @param commanderId
|
||||
* @param alsoHand is the replacement effect also applied if commander
|
||||
* object goes to hand zone
|
||||
* @param alsoLibrary is the replacement effect also applied if commander
|
||||
* object goes to library zone
|
||||
* @param forceToMove used for signature spell of Oathbreaker format (spell
|
||||
* is mandatory moved to command zone instead)
|
||||
* @param alsoHand is the replacement effect also applied if
|
||||
* commander object goes to hand zone
|
||||
* @param alsoLibrary is the replacement effect also applied if
|
||||
* commander object goes to library zone
|
||||
* @param forceToMove used for signature spell of Oathbreaker format
|
||||
* (spell is mandatory moved to command zone
|
||||
* instead)
|
||||
* @param commanderTypeName type of commander object to set the correct text
|
||||
*/
|
||||
public CommanderReplacementEffect(UUID commanderId, boolean alsoHand, boolean alsoLibrary, boolean forceToMove, String commanderTypeName) {
|
||||
|
@ -118,7 +118,7 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
return true;
|
||||
}
|
||||
if (forceToMove) {
|
||||
switch (zEvent.getToZone()) {
|
||||
switch (zEvent.getToZone()) { // Normal commander movement is handled in state-based actions in GameImpl
|
||||
case BATTLEFIELD:
|
||||
case GRAVEYARD:
|
||||
return true;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue