diff --git a/modules/battle_system.py b/modules/battle_system.py index 911392f..639bdd3 100644 --- a/modules/battle_system.py +++ b/modules/battle_system.py @@ -148,6 +148,12 @@ class BattleSystem(BaseModule): del self.bot.active_encounters[player["id"]] else: self.send_message(channel, f"💀 {nickname}: Your pet fainted! You lost the battle...") + + # Mark pet as fainted in database + pets = await self.database.get_player_pets(player["id"], active_only=True) + if pets: + await self.database.faint_pet(pets[0]["id"]) + # Remove encounter if player["id"] in self.bot.active_encounters: del self.bot.active_encounters[player["id"]] @@ -293,6 +299,11 @@ class BattleSystem(BaseModule): # Player lost gym battle result = await self.database.end_gym_battle(player["id"], victory=False) + # Mark pet as fainted in database + pets = await self.database.get_player_pets(player["id"], active_only=True) + if pets: + await self.database.faint_pet(pets[0]["id"]) + self.send_message(channel, f"💀 {nickname}: Your pet fainted!") self.send_message(channel, f"{gym_battle['badge_icon']} {gym_battle['leader_name']}: \"Good battle! Train more and come back stronger!\"")