def crane_falters(self) -> str: # Drop what's currently being held. if self.crane_holds: treasure = self.crane_holds for treas in treasure: bury_treasure_at(treas, self.sub.movement.get_position()) self.crane_holds = [] self.crane_down = False return f"Dropped {to_titled_list(treasure)} because the crane faltered!" return ""
async def damage_tick(self): if self.damage_to_apply > 0: self.health -= self.damage_to_apply if self.health <= 0: for treasure in self.treasure: bury_treasure_at(treasure, (self.x, self.y)) await notify_control( f"**{self.full_name()}** took a total of {self.damage_to_apply} damage and **died**!" ) await self.deathrattle() await kill_npc(self.id, False) else: await notify_control( f"**{self.full_name()}** took a total of {self.damage_to_apply} damage!" ) self.damage_to_apply = 0 self.observant = True
def drop(self, item: str) -> str: if item not in self.inventory or self.inventory[item] <= 0: return f"Cannot drop an item that you don't own." if item[-1] == '*': return f"Cannot drop undroppable item (item with * at the end of its name)." if bury_treasure_at(item, self.sub.movement.get_position()): self.remove(item) return f"1x {item.title()} dropped!" return f"Could not drop {item.title()} here."
def bury_treasure(name : str, x : int, y : int) -> DiscordAction: if bury_treasure_at(name, (x, y)): return OKAY_REACT return FAIL_REACT