Implement comprehensive experience and leveling system
**NEW FEATURES:** - Complete EXP system with Pokemon-style stat calculation - Level-based stat growth and automatic HP restoration on level up - Experience gain from catches and battle victories - Visual level up notifications with stat increases **EXPERIENCE SOURCES:** - Successful catches: 5 EXP × caught pet level - Wild battle victories: 10 EXP × defeated pet level - Gym battle victories: 20 EXP × defeated pet level (2x multiplier) **LEVELING MECHANICS:** - Cubic growth formula: level³ × 4 - 12 (smooth progression) - Level cap at 100 - Stats recalculated on level up using Pokemon formulas - Full HP restoration on level up - Real-time stat increase display **EXPERIENCE DISPLAY:** - \!team command now shows "EXP: X to next" for active pets - Level up messages show exact stat gains - Experience awarded immediately after catch/victory **STAT CALCULATION:** - HP: (2 × base + 31) × level / 100 + level + 10 - Other stats: (2 × base + 31) × level / 100 + 5 - Progressive growth ensures meaningful advancement **BATTLE INTEGRATION:** - EXP awarded after wild battles, gym individual battles, and catches - Different multipliers for different victory types - First active pet receives all experience This creates proper RPG progression where pets grow stronger through gameplay, encouraging both exploration (catches) and combat (battles) for advancement. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6053161b6e
commit
bd455f1be5
4 changed files with 233 additions and 4 deletions
|
|
@ -212,6 +212,9 @@ class Exploration(BaseModule):
|
|||
for achievement in all_achievements:
|
||||
self.send_message(channel, f"🏆 {nickname}: Achievement unlocked: {achievement['name']}! {achievement['description']}")
|
||||
|
||||
# Award experience for successful catch
|
||||
await self.award_catch_experience(channel, nickname, player, wild_pet)
|
||||
|
||||
# Remove encounter
|
||||
if player["id"] in self.bot.active_encounters:
|
||||
del self.bot.active_encounters[player["id"]]
|
||||
|
|
@ -233,6 +236,9 @@ class Exploration(BaseModule):
|
|||
|
||||
# Check for achievements after successful catch
|
||||
if "Success!" in result:
|
||||
# Award experience for successful catch
|
||||
await self.award_catch_experience(channel, nickname, player, target_pet)
|
||||
|
||||
type_achievements = await self.game_engine.check_and_award_achievements(player["id"], "catch_type", "")
|
||||
total_achievements = await self.game_engine.check_and_award_achievements(player["id"], "catch_total", "")
|
||||
|
||||
|
|
@ -244,4 +250,32 @@ class Exploration(BaseModule):
|
|||
# Remove the encounter regardless of success
|
||||
del self.bot.active_encounters[player["id"]]
|
||||
|
||||
self.send_message(channel, f"🎯 {nickname}: {result}")
|
||||
self.send_message(channel, f"🎯 {nickname}: {result}")
|
||||
|
||||
async def award_catch_experience(self, channel, nickname, player, caught_pet):
|
||||
"""Award experience to active pets for successful catch"""
|
||||
active_pets = await self.database.get_active_pets(player["id"])
|
||||
if not active_pets:
|
||||
return
|
||||
|
||||
# Calculate experience for catch (less than battle victory)
|
||||
base_exp = caught_pet["level"] * 5 # 5 EXP per level for catches
|
||||
|
||||
# Award to first active pet
|
||||
main_pet = active_pets[0]
|
||||
exp_result = await self.database.award_experience(main_pet["id"], base_exp)
|
||||
|
||||
if exp_result["success"]:
|
||||
# Display experience gain
|
||||
self.send_message(channel,
|
||||
f"⭐ {exp_result['pet_name']} gained {exp_result['exp_gained']} EXP for the catch!")
|
||||
|
||||
# Handle level up
|
||||
if exp_result["leveled_up"]:
|
||||
await self.handle_level_up_display(channel, nickname, exp_result)
|
||||
|
||||
async def handle_level_up_display(self, channel, nickname, exp_result):
|
||||
"""Display level up information (shared with battle system)"""
|
||||
from .battle_system import BattleSystem
|
||||
battle_system = BattleSystem(self.bot, self.database, self.game_engine)
|
||||
await battle_system.handle_level_up_display(channel, nickname, exp_result)
|
||||
Loading…
Add table
Add a link
Reference in a new issue