Integrate pet fainting tracking into battle system
- Update wild battle defeat handling to mark pets as fainted - Update gym battle defeat handling to mark pets as fainted - Add database faint_pet() calls when pets lose battles - Ensure fainted pets are properly tracked with timestamps - Both wild and gym battles now consistently handle pet fainting - Defeated pets are immediately marked as fainted in database - Maintains existing battle flow while adding fainting mechanics 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d758d6b924
commit
a333306ad3
1 changed files with 11 additions and 0 deletions
|
|
@ -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!\"")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue