- When a permanent leaves the battlefield, remove all changed keywords on it (fixes e.g. the results of Magical Hack on Leviathan still partially persisting after it dies and is reanimated by something).

This commit is contained in:
Agetian
2017-08-12 14:56:22 +00:00
parent 22e2e32377
commit 5350e77125
3 changed files with 14 additions and 0 deletions

View File

@@ -437,6 +437,8 @@ public class GameAction {
copied.setState(CardStateName.Original, true);
}
unattachCardLeavingBattlefield(copied);
// Remove all changed keywords
copied.removeAllChangedText(game.getNextTimestamp());
} else if (toBattlefield) {
// reset timestamp in changezone effects so they have same timestamp if ETB simutaneously
copied.setTimestamp(game.getNextTimestamp());

View File

@@ -3371,6 +3371,13 @@ public class Card extends GameEntity implements Comparable<Card> {
updateChangedText();
}
public final void removeAllChangedText(final Long timestamp) {
changedTextTypes.removeAll();
changedTextColors.removeAll();
updateKeywordsOnRemoveChangedText(removeChangedCardKeywords(timestamp));
updateChangedText();
}
private void updateKeywordsChangedText(final Long timestamp) {
if (hasSVar("LockInKeywords")) {
return;

View File

@@ -29,6 +29,11 @@ public final class CardChangedWords {
isDirty = true;
}
public void removeAll() {
map.clear();
isDirty = true;
}
void copyFrom(final CardChangedWords other) {
map.clear();
map.putAll(other.map);