From 2351579bb541ce1cdfe663b84da10370fb9b75f8 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 10 Feb 2025 20:49:50 -0500 Subject: [PATCH] new item, shin bone , added. --- levels/Wicked Quest/1.json | 2 +- levels/Wicked Quest/2.json | 5 ++--- levels/Wicked Quest/3.json | 4 ++-- levels/Wicked Quest/4.json | 10 +++++----- levels/Wicked Quest/5.json | 10 +++++----- levels/Wicked Quest/6.json | 6 +++--- levels/Wicked Quest/7.json | 4 ++-- sounds/get_nunchucks.ogg | 3 +++ sounds/get_shin_bone.ogg | 3 +++ sounds/player_nunchuck_attack.ogg | 3 +++ sounds/player_nunchuck_hit.ogg | 3 +++ src/enemy.py | 4 +++- src/player.py | 5 +++-- src/powerup.py | 19 +++++++++++++++++++ src/weapon.py | 13 +++++++++++++ 15 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 sounds/get_nunchucks.ogg create mode 100644 sounds/get_shin_bone.ogg create mode 100644 sounds/player_nunchuck_attack.ogg create mode 100644 sounds/player_nunchuck_hit.ogg diff --git a/levels/Wicked Quest/1.json b/levels/Wicked Quest/1.json index 0c92f2d..a6f6fb9 100644 --- a/levels/Wicked Quest/1.json +++ b/levels/Wicked Quest/1.json @@ -157,7 +157,7 @@ "sound": "grave", "static": true, "zombie_spawn_chance": 0, - "item": "guts" + "item": "shin_bone" } ], "boundaries": { diff --git a/levels/Wicked Quest/2.json b/levels/Wicked Quest/2.json index 0645b50..6eaa4ac 100644 --- a/levels/Wicked Quest/2.json +++ b/levels/Wicked Quest/2.json @@ -61,8 +61,7 @@ "x": 55, "y": 3, "sound": "coffin", - "type": "coffin", - "item": "guts" + "type": "coffin" }, { "x_range": [65, 70], @@ -140,7 +139,7 @@ "x_range": [165, 175], "y": 0, "enemy_type": "witch", - "health": 2, + "health": 3, "damage": 2, "attack_range": 1.5, "attack_pattern": { diff --git a/levels/Wicked Quest/3.json b/levels/Wicked Quest/3.json index 2e7538d..c2e1e9c 100644 --- a/levels/Wicked Quest/3.json +++ b/levels/Wicked Quest/3.json @@ -144,7 +144,7 @@ "x_range": [101, 111], "y": 0, "enemy_type": "witch", - "health": 6, + "health": 3, "damage": 2, "attack_range": 1, "attack_pattern": { @@ -196,7 +196,7 @@ "x_range": [146, 166], "y": 0, "enemy_type": "ghoul", - "health": 10, + "health": 6, "damage": 3, "attack_range": 2, "attack_pattern": { diff --git a/levels/Wicked Quest/4.json b/levels/Wicked Quest/4.json index 0b4100f..46111a4 100644 --- a/levels/Wicked Quest/4.json +++ b/levels/Wicked Quest/4.json @@ -24,7 +24,7 @@ "x_range": [20, 30], "y": 0, "enemy_type": "goblin", - "health": 3, + "health": 4, "damage": 2, "attack_range": 1, "attack_pattern": { @@ -61,14 +61,13 @@ "x": 55, "y": 3, "sound": "coffin", - "type": "coffin", - "item": "guts" + "type": "coffin" }, { "x_range": [60, 70], "y": 0, "enemy_type": "witch", - "health": 4, + "health": 6, "damage": 2, "attack_range": 1, "attack_pattern": { @@ -81,6 +80,7 @@ "type": "grave", "sound": "grave", "static": true, + "item": "guts", "zombie_spawn_chance": 10 }, { @@ -169,7 +169,7 @@ "x_range": [175, 185], "y": 0, "enemy_type": "ghoul", - "health": 8, + "health": 6, "damage": 2, "attack_range": 1.5, "attack_pattern": { diff --git a/levels/Wicked Quest/5.json b/levels/Wicked Quest/5.json index 44b266f..380543a 100644 --- a/levels/Wicked Quest/5.json +++ b/levels/Wicked Quest/5.json @@ -25,8 +25,8 @@ { "x_range": [20, 35], "y": 0, - "enemy_type": "witch", - "health": 5, + "enemy_type": "goblin", + "health": 4, "damage": 2, "attack_range": 1.5, "attack_pattern": { @@ -69,7 +69,7 @@ "x_range": [65, 80], "y": 0, "enemy_type": "ghoul", - "health": 8, + "health": 6, "damage": 2, "attack_range": 1.5, "attack_pattern": { @@ -120,7 +120,7 @@ "x_range": [120, 135], "y": 0, "enemy_type": "witch", - "health": 5, + "health": 6, "damage": 2, "attack_range": 1.5, "attack_pattern": { @@ -153,7 +153,7 @@ "x_range": [160, 180], "y": 0, "enemy_type": "ghoul", - "health": 10, + "health": 6, "damage": 3, "attack_range": 2, "attack_pattern": { diff --git a/levels/Wicked Quest/6.json b/levels/Wicked Quest/6.json index 89ec6e8..2ca0051 100644 --- a/levels/Wicked Quest/6.json +++ b/levels/Wicked Quest/6.json @@ -22,8 +22,8 @@ { "x_range": [20, 35], "y": 0, - "enemy_type": "witch", - "health": 6, + "enemy_type": "goblin", + "health": 4, "damage": 2, "attack_range": 1.5, "attack_pattern": { @@ -149,7 +149,7 @@ "x_range": [160, 180], "y": 0, "enemy_type": "ghoul", - "health": 10, + "health": 8, "damage": 3, "attack_range": 2, "attack_pattern": { diff --git a/levels/Wicked Quest/7.json b/levels/Wicked Quest/7.json index f1a68a2..6bdd2f0 100644 --- a/levels/Wicked Quest/7.json +++ b/levels/Wicked Quest/7.json @@ -65,6 +65,7 @@ "type": "grave", "sound": "grave", "static": true, + "item": "shin_bone", "zombie_spawn_chance": 20 }, { @@ -178,8 +179,7 @@ "type": "grave", "sound": "grave", "static": true, - "item": "hand_of_glory", - "zombie_spawn_chance": 0 + "zombie_spawn_chance": 20 }, { "type": "spider_web", diff --git a/sounds/get_nunchucks.ogg b/sounds/get_nunchucks.ogg new file mode 100644 index 0000000..00142b7 --- /dev/null +++ b/sounds/get_nunchucks.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07a45cc5d749ccf84a725fb0f1dcde24860c8001b18d2915fb289d094fab4538 +size 10720 diff --git a/sounds/get_shin_bone.ogg b/sounds/get_shin_bone.ogg new file mode 100644 index 0000000..2a32502 --- /dev/null +++ b/sounds/get_shin_bone.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a648fcd7d14cc160c7fb6de67c92c0ec623e1e9629e29678ac4fdf1e6b61424b +size 26185 diff --git a/sounds/player_nunchuck_attack.ogg b/sounds/player_nunchuck_attack.ogg new file mode 100644 index 0000000..27c1441 --- /dev/null +++ b/sounds/player_nunchuck_attack.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4236b11ae1db1b8ab36c93d49aead3d4855ec3f7b5b537babd98a7406fe1021 +size 5932 diff --git a/sounds/player_nunchuck_hit.ogg b/sounds/player_nunchuck_hit.ogg new file mode 100644 index 0000000..0f912ed --- /dev/null +++ b/sounds/player_nunchuck_hit.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e14383984c7b75e1eb18aadd0f08a57582f55f169357867ecf97b9806b37f71 +size 6290 diff --git a/src/enemy.py b/src/enemy.py index e9e5d79..7eeab3f 100644 --- a/src/enemy.py +++ b/src/enemy.py @@ -181,7 +181,9 @@ class Enemy(Object): if self.enemyType == "witch": # Determine which item to drop hasBroom = any(weapon.name == "witch_broom" for weapon in self.level.player.weapons) - itemType = "cauldron" if hasBroom else "witch_broom" + hasNunchucks = any(weapon.name == "nunchucks" for weapon in self.level.player.weapons) + # Drop witch_broom only if player has neither broom nor nunchucks + itemType = "witch_broom" if not (hasBroom or hasNunchucks) else "cauldron" # Create drop 1-2 tiles away in random direction direction = random.choice([-1, 1]) diff --git a/src/player.py b/src/player.py index 43aa0a7..0370c4f 100644 --- a/src/player.py +++ b/src/player.py @@ -43,6 +43,7 @@ class Player: self.collectedItems = [] self._coins = 0 self._jack_o_lantern_count = 0 + self.shinBoneCount = 0 # Combat related attributes self.weapons = [] @@ -64,7 +65,7 @@ class Player: hitSound="player_shovel_hit", attackDuration=200 # 200ms attack duration )) - + def should_play_footstep(self, currentTime): """Check if it's time to play a footstep sound""" return (self.distanceSinceLastStep >= self.get_step_distance() and @@ -211,7 +212,7 @@ class Player: """Add an item to inventory""" self.inventory.append(item) self.collectedItems.append(item) - + def start_attack(self, currentTime): """Attempt to start an attack with the current weapon""" if self.currentWeapon and self.currentWeapon.start_attack(currentTime): diff --git a/src/powerup.py b/src/powerup.py index 3cb2016..1c69f1b 100644 --- a/src/powerup.py +++ b/src/powerup.py @@ -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) diff --git a/src/weapon.py b/src/weapon.py index 97dd180..3c91cfd 100644 --- a/src/weapon.py +++ b/src/weapon.py @@ -10,6 +10,19 @@ class Weapon: self.lastAttackTime = 0 self.hitEnemies = set() + @classmethod + def create_nunchucks(cls): + """Create the nunchucks weapon""" + return cls( + name="nunchucks", + damage=6, + range=4, + attackSound="player_nunchuck_attack", + hitSound="player_nunchuck_hit", + cooldown=250, + attackDuration=100 + ) + @classmethod def create_witch_broom(cls): """Create the witch's broom weapon"""