Added override capabilities for lots of items, weapons, and hazards.

This commit is contained in:
Storm Dragon
2025-09-20 04:10:32 -04:00
parent 91eecae786
commit 5dd78a1687
12 changed files with 392 additions and 43 deletions

View File

@@ -81,7 +81,7 @@ Instead of using a simple `"description"` field, levels can now include interact
- `narrative`: Set to `true` for descriptive text entries (no speaker)
- `sound`: Optional sound file to play with this dialogue entry. If no sound is specified, the system will automatically play `sounds/dialogue.ogg` if it exists.
**Note:** Levels can use either `"description"` (traditional format) or `"dialog"` (new interactive format), but not both. The dialogue system takes precedence if both are present.
**Note:** Levels can include both `"description"` and `"dialog"`. When both are present, the dialogue plays first, followed by the standard level description message format ("Level X, Name. Description.").
## Adding Objects
@@ -385,13 +385,187 @@ sounds/Samhain Showdown/ambience
├── howling_winds.ogg
```
### Sound Override System
### Advanced Sound Override System
Beyond simple file replacement, Wicked Quest now supports granular sound overrides directly in your level JSON files. This allows thematic consistency where a catapult becomes a "snowball launcher" or grasping hands become an "avalanche" - same mechanics, different sounds and feel.
#### Weapon Sound Overrides
Override weapon sounds and names globally for an entire level:
```json
{
"level_id": 1,
"name": "Winter Wonderland",
"weapon_sound_overrides": {
"rusty_shovel": {
"name": "rusty snow shovel",
"attack_sound": "player_snow_shovel_attack",
"hit_sound": "player_snow_shovel_hit"
},
"nunchucks": {
"name": "ice sickles",
"attack_sound": "player_ice_sickles_attack",
"hit_sound": "player_ice_sickles_hit"
},
"witch_broom": {
"name": "snow broom",
"attack_sound": "player_snow_broom_attack",
"hit_sound": "player_snow_broom_hit"
}
}
}
```
**Weapon Override Properties:**
- `name`: Display name for the weapon (e.g., "ice sickles" instead of "nunchucks")
- `attack_sound`: Sound played when attacking
- `hit_sound`: Sound played when hitting an enemy
#### Object Sound Overrides
Override sounds for individual objects in your level:
```json
{
"x": 25,
"y": 0,
"type": "catapult",
"fire_interval": 3000,
"range": 30,
"sound_overrides": {
"base": "snowball_launcher",
"launch": "snowball_launcher_launch"
}
}
```
```json
{
"x_range": [40, 60],
"y": 0,
"type": "grasping_hands",
"delay": 1000,
"sound_overrides": {
"base": "avalanche"
}
}
```
```json
{
"x": 35,
"y": 0,
"type": "grave",
"item": "shin_bone",
"sound_overrides": {
"base": "snow_mound",
"item": "candy_cane"
}
}
```
**Object Sound Override Properties:**
- `base`: Override the main ambient sound (e.g., "catapult" → "snowball_launcher")
- `launch`: Override launch sound for catapults (e.g., "catapult_launch" → "snowball_launcher_launch")
- `item`: Override pickup sound for grave items (e.g., "get_shin_bone.ogg" → "get_candy_cane.ogg")
- `warning_message`: Override warning message for grasping hands (e.g., "The ground crumbles as snow begins to avalanche!")
- `death_message`: Override death message for grasping hands (e.g., "You vanish under tons of snow!")
#### Themed Item Equivalents
The sound override system includes intelligent item mapping for crafting consistency. Certain themed items automatically behave like their original counterparts:
**Christmas Theme:**
- `"candy_cane"` → Functions as `"shin_bone"` (increments shin bone count)
- `"reindeer_guts"` → Functions as `"guts"` (enables nunchucks crafting)
**Result:** Collecting 2 candy canes + reindeer guts = nunchucks (can be renamed to "ice sickles")
This system allows complete thematic consistency where players collect "2 Candy Canes + Reindeer Guts = Ice Sickles" while preserving all original game mechanics. The mapping works automatically across any level pack - simply use themed item names and they'll function correctly.
**Adding New Themed Equivalents:**
To add your own themed items, modify the `themed_mappings` in `src/powerup.py`:
```python
themed_mappings = {
"your_bone_item": "shin_bone",
"your_guts_item": "guts",
}
```
#### Complete Thematic Example
Here's how to transform a Halloween level into a Christmas level using sound overrides:
```json
{
"level_id": 1,
"name": "Winter Siege",
"description": "Santa's workshop is under attack by snow witches!",
"weapon_sound_overrides": {
"rusty_shovel": {
"name": "snow shovel",
"attack_sound": "player_snow_shovel_attack",
"hit_sound": "player_snow_shovel_hit"
}
},
"objects": [
{
"x": 25,
"y": 0,
"type": "catapult",
"sound_overrides": {
"base": "snowball_launcher",
"launch": "snowball_launcher_launch"
}
},
{
"x_range": [40, 60],
"y": 12,
"type": "skull_storm",
"sound_overrides": {
"base": "snowball_storm"
}
},
{
"x": 75,
"y": 0,
"type": "grave",
"item": "shin_bone",
"sound_overrides": {
"base": "snow_pile",
"item": "candy_cane"
}
},
{
"x_range": [90, 110],
"y": 0,
"type": "grasping_hands",
"sound_overrides": {
"base": "avalanche",
"warning_message": "The ground crumbles as snow begins to avalanche!",
"death_message": "You vanish under tons of snow!"
}
}
]
}
```
**Result:**
- Weapons sound winter-themed when attacking
- "Catapult" becomes "Snowball Launcher" with appropriate launch sounds
- "Skull Storm" becomes "Snowball Storm"
- "Graves" become "Snow Piles" containing "Candy Canes" instead of "Shin Bones"
- "Grasping Hands" becomes "Avalanche" with snow-themed death messages
- All mechanics remain identical - only audio and messaging changes
#### Legacy Sound Override System
- **Custom ambience:** Place in `sounds/[Pack Name]/ambience/`
- **Custom enemy sounds:** Place in `sounds/[Pack Name]/`
- **Custom footsteps:** Reference in level JSON as `"footstep_sound"`
- **Ending scene:** Add `end.ogg` in the level pack directory
This system allows complete audio customization. For example, skull storms could become firestorms just by replacing the skull storm sounds in your pack's sound directory.
This legacy system allows complete audio customization through file replacement. For example, skull storms could become firestorms just by replacing the skull storm sounds in your pack's sound directory.
## Complete Example Level