cassiopeia icon indicating copy to clipboard operation
cassiopeia copied to clipboard

item undo bug

Open RogerLiu-Yuxuan opened this issue 3 years ago • 0 comments

In match.py:

The undo function is defined by the following script.

def undo(self, event: Event): assert event.after_id == 0 or event.before_id == 0 item_id = event.before_id or event.after_id prev = None while prev is None or prev.item_id != item_id: prev = self._events.pop() if prev.type == "ITEM_PURCHASED": self.destroy(prev.item_id) elif prev.type == "ITEM_DESTROYED": self.add(prev.item_id) elif prev.type == "ITEM_SOLD": self.add(prev.item_id) else: raise TypeError(f"Unexpected event type {prev.type}")

The event of synthetic an item is down by destroying the previous item first and then purchasing a new item. If an undo event happens to this item, the item will be destroyed directly. However, the correct undo of synthetic is disassembled this item.

RogerLiu-Yuxuan avatar Jan 19 '22 22:01 RogerLiu-Yuxuan