Weapons now do different things. Shovels fill in graves, broom gives a speed and jump bonus and nunchucks just thwack things real hard and have best reach.

This commit is contained in:
Storm Dragon
2025-09-07 13:20:49 -04:00
parent cf3f27d9b8
commit 56a78aa4ff
6 changed files with 88 additions and 16 deletions

View File

@@ -100,7 +100,9 @@ class SaveManager:
'range': weapon.range,
'attackSound': weapon.attackSound,
'hitSound': weapon.hitSound,
'attackDuration': weapon.attackDuration
'attackDuration': weapon.attackDuration,
'speedBonus': getattr(weapon, 'speedBonus', 1.0),
'jumpDurationBonus': getattr(weapon, 'jumpDurationBonus', 1.0)
})
return serialized
@@ -109,13 +111,24 @@ class SaveManager:
from src.weapon import Weapon
weapons = []
for data in weapon_data:
# Handle backward compatibility for old saves
speedBonus = data.get('speedBonus', 1.0)
jumpDurationBonus = data.get('jumpDurationBonus', 1.0)
# For old saves, restore proper bonuses for specific weapons
if data['name'] == 'witch_broom' and speedBonus == 1.0:
speedBonus = 1.17
jumpDurationBonus = 1.25
weapon = Weapon(
name=data['name'],
damage=data['damage'],
range=data['range'],
attackSound=data['attackSound'],
hitSound=data['hitSound'],
attackDuration=data['attackDuration']
attackDuration=data['attackDuration'],
speedBonus=speedBonus,
jumpDurationBonus=jumpDurationBonus
)
weapons.append(weapon)
return weapons