mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
* AI: fixed game freezes with Karn Liberated in the game (#7922);
This commit is contained in:
parent
d9e414db34
commit
b929b28e43
7 changed files with 192 additions and 59 deletions
|
|
@ -193,6 +193,45 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.commandersToStay.addAll(state.commandersToStay);
|
||||
}
|
||||
|
||||
public void clearOnGameRestart() {
|
||||
// special code for Karn Liberated
|
||||
// must clear game data on restart, but also must keep some info (wtf, why?)
|
||||
// if you catch freezes or bugs with Karn then research here
|
||||
// test example: testCommanderRestoredToBattlefieldAfterKarnUltimate
|
||||
// TODO: must be implemented as full data clear?
|
||||
|
||||
battlefield.clear();
|
||||
effects.clear();
|
||||
triggers.clear();
|
||||
delayed.clear();
|
||||
triggered.clear();
|
||||
stack.clear();
|
||||
exile.clear();
|
||||
command.clear();
|
||||
designations.clear();
|
||||
seenPlanes.clear();
|
||||
isPlaneChase = false;
|
||||
revealed.clear();
|
||||
lookedAt.clear();
|
||||
companion.clear();
|
||||
turnNum = 1;
|
||||
stepNum = 0;
|
||||
extraTurn = false;
|
||||
legendaryRuleActive = true;
|
||||
gameOver = false;
|
||||
specialActions.clear();
|
||||
cardState.clear();
|
||||
combat.clear();
|
||||
turnMods.clear();
|
||||
watchers.clear();
|
||||
values.clear();
|
||||
zones.clear();
|
||||
simultaneousEvents.clear();
|
||||
copiedCards.clear();
|
||||
usePowerInsteadOfToughnessForDamageLethalityFilters.clear();
|
||||
permanentOrderNumber = 0;
|
||||
}
|
||||
|
||||
public void restoreForRollBack(GameState state) {
|
||||
restore(state);
|
||||
this.turn = state.turn;
|
||||
|
|
@ -1124,7 +1163,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
if (attachedTo instanceof PermanentCard) {
|
||||
throw new IllegalArgumentException("Error, wrong code usage. If you want to add new ability to the "
|
||||
+ "permanent then use a permanent.addAbility(a, source, game): "
|
||||
+ ability.getClass().getCanonicalName() + " - " + ability.toString());
|
||||
+ ability.getClass().getCanonicalName() + " - " + ability);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1153,39 +1192,6 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.setManaBurn(false);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
battlefield.clear();
|
||||
effects.clear();
|
||||
triggers.clear();
|
||||
delayed.clear();
|
||||
triggered.clear();
|
||||
stack.clear();
|
||||
exile.clear();
|
||||
command.clear();
|
||||
designations.clear();
|
||||
seenPlanes.clear();
|
||||
isPlaneChase = false;
|
||||
revealed.clear();
|
||||
lookedAt.clear();
|
||||
companion.clear();
|
||||
turnNum = 0;
|
||||
stepNum = 0;
|
||||
extraTurn = false;
|
||||
legendaryRuleActive = true;
|
||||
gameOver = false;
|
||||
specialActions.clear();
|
||||
cardState.clear();
|
||||
combat.clear();
|
||||
turnMods.clear();
|
||||
watchers.clear();
|
||||
values.clear();
|
||||
zones.clear();
|
||||
simultaneousEvents.clear();
|
||||
copiedCards.clear();
|
||||
usePowerInsteadOfToughnessForDamageLethalityFilters.clear();
|
||||
permanentOrderNumber = 0;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
this.paused = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue