new item, shin bone , added.
This commit is contained in:
@@ -49,10 +49,16 @@ class PowerUp(Object):
|
||||
player.restore_health()
|
||||
elif self.item_type == 'guts':
|
||||
player.add_guts()
|
||||
player.collectedItems.append('guts')
|
||||
self.check_for_nunchucks(player)
|
||||
elif self.item_type == 'jack_o_lantern':
|
||||
player.add_jack_o_lantern()
|
||||
elif self.item_type == 'extra_life':
|
||||
player.extra_life()
|
||||
elif self.item_type == 'shin_bone': # Add shin bone handling
|
||||
player.shinBoneCount += 1
|
||||
player._coins += 5
|
||||
self.check_for_nunchucks(player)
|
||||
elif self.item_type == 'witch_broom':
|
||||
broomWeapon = Weapon.create_witch_broom()
|
||||
player.add_weapon(broomWeapon)
|
||||
@@ -81,3 +87,16 @@ class PowerUp(Object):
|
||||
|
||||
# Item tracking
|
||||
player.stats.update_stat('Items collected', 1)
|
||||
|
||||
def check_for_nunchucks(self, player):
|
||||
"""Check if player has materials for nunchucks and create if conditions are met"""
|
||||
print("Checking for nunchucks.")
|
||||
print(f"Player has {player.shinBoneCount} shin bones and {player.collectedItems}.")
|
||||
if (player.shinBoneCount >= 2 and
|
||||
'guts' in player.collectedItems and
|
||||
not any(weapon.name == "nunchucks" for weapon in player.weapons)):
|
||||
nunchucksWeapon = Weapon.create_nunchucks()
|
||||
player.add_weapon(nunchucksWeapon)
|
||||
player.equip_weapon(nunchucksWeapon)
|
||||
play_sound(self.sounds['get_nunchucks'])
|
||||
player.stats.update_stat('Items collected', 1)
|
||||
|
Reference in New Issue
Block a user