Core: Add State add/remove/set Helpers (#4845)

This commit is contained in:
Aaron Wagener
2025-05-22 08:46:33 -05:00
committed by GitHub
parent c5e768ffe3
commit 1d655a07cd
3 changed files with 42 additions and 6 deletions

View File

@@ -428,13 +428,13 @@ class MessengerWorld(World):
def collect(self, state: "CollectionState", item: "Item") -> bool:
change = super().collect(state, item)
if change and "Time Shard" in item.name:
state.prog_items[self.player]["Shards"] += int(item.name.strip("Time Shard ()"))
state.add_item("Shards", self.player, int(item.name.strip("Time Shard ()")))
return change
def remove(self, state: "CollectionState", item: "Item") -> bool:
change = super().remove(state, item)
if change and "Time Shard" in item.name:
state.prog_items[self.player]["Shards"] -= int(item.name.strip("Time Shard ()"))
state.remove_item("Shards", self.player, int(item.name.strip("Time Shard ()")))
return change
@classmethod