Skip to content

Commit

Permalink
Remove bad LKI storage under wrong ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ssk97 committed Jul 23, 2024
1 parent 0a9c6b4 commit c32dc7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Mage/src/main/java/mage/cards/CardImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ public boolean removeFromZone(Game game, Zone fromZone, Ability source) {
}
if (removed) {
if (fromZone != Zone.OUTSIDE) {
game.rememberLKI(lkiObject != null ? lkiObject.getId() : objectId, fromZone, lkiObject != null ? lkiObject : this);
game.rememberLKI(fromZone, lkiObject != null ? lkiObject : this);
}
} else {
logger.warn("Couldn't find card in fromZone, card=" + getIdName() + ", fromZone=" + fromZone);
Expand Down
2 changes: 1 addition & 1 deletion Mage/src/main/java/mage/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ default boolean isOpponent(Player player, UUID playerToCheckId) {
*/
boolean checkShortLivingLKI(UUID objectId, Zone zone);

void rememberLKI(UUID objectId, Zone zone, MageObject object);
void rememberLKI(Zone zone, MageObject object);

void resetLKI();

Expand Down
7 changes: 3 additions & 4 deletions Mage/src/main/java/mage/game/GameImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,6 @@ protected void resolve() {
} finally {
if (top != null) {
state.getStack().remove(top, this); // seems partly redundant because move card from stack to grave is already done and the stack removed
rememberLKI(top.getSourceId(), Zone.STACK, top);
checkInfiniteLoop(top.getSourceId());
if (!getTurn().isEndTurnRequested()) {
while (state.hasSimultaneousEvents()) {
Expand Down Expand Up @@ -3314,7 +3313,7 @@ protected void leave(UUID playerId) { // needs to be executed from the game thre
}
}
for (Card card : toOutside) {
rememberLKI(card.getId(), Zone.BATTLEFIELD, card);
rememberLKI(Zone.BATTLEFIELD, card);
}
// needed to send event that permanent leaves the battlefield to allow non stack effects to execute
player.moveCards(toOutside, Zone.OUTSIDE, null, this);
Expand Down Expand Up @@ -3586,12 +3585,12 @@ public boolean checkShortLivingLKI(UUID objectId, Zone zone) {
/**
* Remembers object state to be used as Last Known Information.
*
* @param objectId
* @param zone
* @param object
*/
@Override
public void rememberLKI(UUID objectId, Zone zone, MageObject object) {
public void rememberLKI(Zone zone, MageObject object) {
UUID objectId = object.getId();
if (object instanceof Permanent || object instanceof StackObject) {
MageObject copy = object.copy();

Expand Down

0 comments on commit c32dc7c

Please sign in to comment.