Fixed some console command bugs.
This commit is contained in:
@@ -6,6 +6,9 @@ https://git.stormux.org/storm/wicked-quest
|
|||||||
Angus Kola: Beta testing.
|
Angus Kola: Beta testing.
|
||||||
https://angus.kola.casa
|
https://angus.kola.casa
|
||||||
|
|
||||||
|
Chris Wright: Beta testing.
|
||||||
|
https://www.youtube.com/channel/UCDWOwfwJ18lQiXRubVBEFkw
|
||||||
|
|
||||||
Deedra Waters: Beta testing.
|
Deedra Waters: Beta testing.
|
||||||
|
|
||||||
Ember Wolfe: Sound effects, beta testing, and visual verification of messages.
|
Ember Wolfe: Sound effects, beta testing, and visual verification of messages.
|
||||||
|
|||||||
+2
-2
@@ -495,11 +495,11 @@ class Level:
|
|||||||
if self.player.get_health() < self.player.get_max_health():
|
if self.player.get_health() < self.player.get_max_health():
|
||||||
self.player.set_health(min(self.player.get_health() + 1, self.player.get_max_health()))
|
self.player.set_health(min(self.player.get_health() + 1, self.player.get_max_health()))
|
||||||
|
|
||||||
if self.player._coins % 100 == 0:
|
if self.player._coins >= 100:
|
||||||
# Only give extra lives in story mode, not survival mode (level_id 999)
|
# Only give extra lives in story mode, not survival mode (level_id 999)
|
||||||
if self.levelId != 999:
|
if self.levelId != 999:
|
||||||
# Extra life
|
# Extra life
|
||||||
self.player._coins = 0
|
self.player._coins -= 100
|
||||||
self.player._lives += 1
|
self.player._lives += 1
|
||||||
self.levelScore += 1000
|
self.levelScore += 1000
|
||||||
play_sound(self.sounds["get_extra_life"])
|
play_sound(self.sounds["get_extra_life"])
|
||||||
|
|||||||
+56
-13
@@ -53,6 +53,42 @@ class WickedQuest:
|
|||||||
self.initialize_pack_sounds()
|
self.initialize_pack_sounds()
|
||||||
return self.soundSystem if self.soundSystem else self.sounds
|
return self.soundSystem if self.soundSystem else self.sounds
|
||||||
|
|
||||||
|
def get_closest_enemy_info(self):
|
||||||
|
"""Get information about the closest enemy, returns None if no enemies."""
|
||||||
|
if not self.currentLevel or not self.currentLevel.enemies:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Find active enemies
|
||||||
|
active_enemies = []
|
||||||
|
for enemy in self.currentLevel.enemies:
|
||||||
|
if enemy.isActive:
|
||||||
|
distance = abs(enemy.xPos - self.player.xPos)
|
||||||
|
direction = "right" if enemy.xPos > self.player.xPos else "left"
|
||||||
|
active_enemies.append((enemy, distance, direction))
|
||||||
|
|
||||||
|
if not active_enemies:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Sort by distance and get closest
|
||||||
|
active_enemies.sort(key=lambda x: x[1])
|
||||||
|
enemy, distance, direction = active_enemies[0]
|
||||||
|
|
||||||
|
# Convert distance to natural language
|
||||||
|
if distance == 0:
|
||||||
|
return f"{enemy.enemyType} right on top of you"
|
||||||
|
elif distance <= 10:
|
||||||
|
distance_desc = "very close"
|
||||||
|
elif distance <= 30:
|
||||||
|
distance_desc = "close"
|
||||||
|
elif distance <= 60:
|
||||||
|
distance_desc = "far"
|
||||||
|
elif distance <= 100:
|
||||||
|
distance_desc = "very far"
|
||||||
|
else:
|
||||||
|
distance_desc = "extremely far"
|
||||||
|
|
||||||
|
return f"{enemy.enemyType} {distance_desc} to the {direction}"
|
||||||
|
|
||||||
def process_console_command(self, command):
|
def process_console_command(self, command):
|
||||||
"""Process console commands and execute their effects."""
|
"""Process console commands and execute their effects."""
|
||||||
command = command.lower().strip()
|
command = command.lower().strip()
|
||||||
@@ -78,10 +114,11 @@ class WickedQuest:
|
|||||||
if 'get_extra_life' in self.get_sounds():
|
if 'get_extra_life' in self.get_sounds():
|
||||||
play_sound(self.get_sounds()['get_extra_life'])
|
play_sound(self.get_sounds()['get_extra_life'])
|
||||||
elif command == "nekromantix":
|
elif command == "nekromantix":
|
||||||
# Give 100 bone dust
|
# Give 100 bone dust (both types)
|
||||||
if self.player:
|
if self.player:
|
||||||
self.player._boneDust += 100
|
self.player._coins += 100
|
||||||
speak(f"100 bone dust granted. You now have {self.player.get_coins()} bone dust")
|
self.player.add_save_bone_dust(100)
|
||||||
|
speak(f"100 bone dust granted. You now have {self.player.get_coins()} bone dust and {self.player.get_save_bone_dust()} save bone dust")
|
||||||
if 'coin' in self.get_sounds():
|
if 'coin' in self.get_sounds():
|
||||||
play_sound(self.get_sounds()['coin'])
|
play_sound(self.get_sounds()['coin'])
|
||||||
elif command == "calabrese":
|
elif command == "calabrese":
|
||||||
@@ -90,20 +127,19 @@ class WickedQuest:
|
|||||||
enemyCount = len([enemy for enemy in self.currentLevel.enemies if enemy.isActive])
|
enemyCount = len([enemy for enemy in self.currentLevel.enemies if enemy.isActive])
|
||||||
if enemyCount > 0:
|
if enemyCount > 0:
|
||||||
speak(f"{enemyCount} enemies remaining on this level")
|
speak(f"{enemyCount} enemies remaining on this level")
|
||||||
for enemy in self.currentLevel.enemies:
|
closest_enemy_info = self.get_closest_enemy_info()
|
||||||
if enemy.isActive:
|
if closest_enemy_info:
|
||||||
distance = abs(enemy.xPos - self.player.xPos)
|
speak(f"Closest enemy: {closest_enemy_info}")
|
||||||
direction = "right" if enemy.xPos > self.player.xPos else "left"
|
|
||||||
speak(f"{enemy.enemyType} {distance} units to the {direction}")
|
|
||||||
else:
|
else:
|
||||||
speak("No active enemies on this level")
|
speak("No active enemies on this level")
|
||||||
else:
|
else:
|
||||||
speak("No enemies found")
|
speak("No enemies found")
|
||||||
elif command == "balzac":
|
elif command == "balzac":
|
||||||
# Give 200 bone dust
|
# Set bone dust to 200 (both types)
|
||||||
if self.player:
|
if self.player:
|
||||||
self.player._boneDust = 200
|
self.player._coins = 200
|
||||||
speak(f"Bone dust set to 200")
|
self.player._saveBoneDust = 200
|
||||||
|
speak(f"Bone dust set to 200. You now have {self.player.get_coins()} bone dust and {self.player.get_save_bone_dust()} save bone dust")
|
||||||
if 'coin' in self.get_sounds():
|
if 'coin' in self.get_sounds():
|
||||||
play_sound(self.get_sounds()['coin'])
|
play_sound(self.get_sounds()['coin'])
|
||||||
elif command == "blitzkid":
|
elif command == "blitzkid":
|
||||||
@@ -429,9 +465,16 @@ class WickedQuest:
|
|||||||
speak(f"{player.get_health()} health of {player.get_max_health()}")
|
speak(f"{player.get_health()} health of {player.get_max_health()}")
|
||||||
if keys[pygame.K_i]:
|
if keys[pygame.K_i]:
|
||||||
if self.currentLevel.levelId == 999:
|
if self.currentLevel.levelId == 999:
|
||||||
speak(f"Wave {self.survivalWave}. {player.get_health()} health of {player.get_max_health()}. {int(self.currentLevel.levelScore)} points on this wave so far. {player.get_lives()} lives remaining.")
|
base_info = f"Wave {self.survivalWave}. {player.get_health()} health of {player.get_max_health()}. {int(self.currentLevel.levelScore)} points on this wave so far. {player.get_lives()} lives remaining."
|
||||||
else:
|
else:
|
||||||
speak(f"Level {self.currentLevel.levelId}, {self.currentLevel.levelName}. {player.get_health()} health of {player.get_max_health()}. {int(self.currentLevel.levelScore)} points on this level so far. {player.get_lives()} lives remaining.")
|
base_info = f"Level {self.currentLevel.levelId}, {self.currentLevel.levelName}. {player.get_health()} health of {player.get_max_health()}. {int(self.currentLevel.levelScore)} points on this level so far. {player.get_lives()} lives remaining."
|
||||||
|
|
||||||
|
# Add closest enemy info
|
||||||
|
closest_enemy_info = self.get_closest_enemy_info()
|
||||||
|
if closest_enemy_info:
|
||||||
|
speak(f"{base_info} {closest_enemy_info}")
|
||||||
|
else:
|
||||||
|
speak(base_info)
|
||||||
if keys[pygame.K_l]:
|
if keys[pygame.K_l]:
|
||||||
speak(f"{player.get_lives()} lives")
|
speak(f"{player.get_lives()} lives")
|
||||||
if keys[pygame.K_j]: # Check jack o'lanterns
|
if keys[pygame.K_j]: # Check jack o'lanterns
|
||||||
|
|||||||
Reference in New Issue
Block a user