Sound has been updated. As a result snares can be collected from a bit further away as it is now harder to tell when you're about to step on it. A few string updates. Mountain terrain added. May require rope for traversal.
This commit is contained in:
@@ -17,7 +17,7 @@ bool crossfade_active = false;
|
||||
bool crossfade_to_night = false; // true = fading to night, false = fading to day
|
||||
timer crossfade_timer;
|
||||
const int CROSSFADE_DURATION = 60000; // 1 minute (1 game hour)
|
||||
const float CROSSFADE_MIN_VOLUME = -40.0; // dB, effectively silent but not extreme
|
||||
const float CROSSFADE_MIN_VOLUME = -25.0; // dB, keep overlap audible during crossfade
|
||||
const float CROSSFADE_MAX_VOLUME = 0.0; // dB, full volume
|
||||
|
||||
// Expansion and invasion tracking
|
||||
@@ -53,6 +53,16 @@ void expand_area() {
|
||||
// Play invasion sound
|
||||
p.play_stationary("sounds/enemies/invasion.ogg", false);
|
||||
|
||||
// 25% chance for mountain, 75% for regular expansion
|
||||
int type_roll = random(0, 3);
|
||||
if (type_roll == 0) {
|
||||
expand_mountain();
|
||||
} else {
|
||||
expand_regular_area();
|
||||
}
|
||||
}
|
||||
|
||||
void expand_regular_area() {
|
||||
// Calculate new area
|
||||
int new_start = MAP_SIZE;
|
||||
int new_end = MAP_SIZE + EXPANSION_SIZE - 1;
|
||||
@@ -103,6 +113,30 @@ void expand_area() {
|
||||
notify("The area has expanded! New territory discovered to the east.");
|
||||
}
|
||||
|
||||
void expand_mountain() {
|
||||
int new_start = MAP_SIZE;
|
||||
int size = MOUNTAIN_SIZE;
|
||||
int new_end = new_start + size - 1;
|
||||
|
||||
if (expanded_area_start == -1) {
|
||||
expanded_area_start = new_start;
|
||||
}
|
||||
expanded_area_end = new_end;
|
||||
MAP_SIZE += size;
|
||||
|
||||
// Generate mountain range
|
||||
MountainRange@ mountain = MountainRange(new_start, size);
|
||||
world_mountains.insert_last(mountain);
|
||||
|
||||
// Fill terrain types array for compatibility with save system
|
||||
for (int i = 0; i < size; i++) {
|
||||
expanded_terrain_types.insert_last("mountain:" + mountain.terrain_types[i]);
|
||||
}
|
||||
|
||||
area_expanded_today = true;
|
||||
notify("A mountain range has been discovered to the east!");
|
||||
}
|
||||
|
||||
void start_invasion() {
|
||||
expand_area();
|
||||
invasion_active = true;
|
||||
@@ -139,26 +173,34 @@ void schedule_invasion() {
|
||||
}
|
||||
|
||||
void check_scheduled_invasion() {
|
||||
if (invasion_active || invasion_triggered_today) return;
|
||||
if (invasion_scheduled_hour == -1) return;
|
||||
if (current_hour == invasion_scheduled_hour) {
|
||||
invasion_scheduled_hour = -1;
|
||||
invasion_triggered_today = true;
|
||||
start_invasion();
|
||||
} else if (current_hour > 11) {
|
||||
invasion_scheduled_hour = -1;
|
||||
if (invasion_active) return;
|
||||
|
||||
// Check scheduled invasion regardless of triggered flag (fixes bug where flag was set early in old saves)
|
||||
if (invasion_scheduled_hour != -1) {
|
||||
if (current_hour == invasion_scheduled_hour) {
|
||||
invasion_scheduled_hour = -1;
|
||||
invasion_triggered_today = true;
|
||||
start_invasion();
|
||||
} else if (current_hour > 11) {
|
||||
invasion_scheduled_hour = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (invasion_triggered_today) return;
|
||||
}
|
||||
|
||||
void attempt_daily_invasion() {
|
||||
if (current_day < 2) return;
|
||||
if (invasion_triggered_today || invasion_active) return;
|
||||
if (invasion_roll_done_today) return;
|
||||
if (current_hour < 6 || current_hour > 12) return;
|
||||
|
||||
invasion_roll_done_today = true;
|
||||
|
||||
int roll = random(1, 100);
|
||||
if (roll > invasion_chance) return;
|
||||
|
||||
invasion_triggered_today = true;
|
||||
schedule_invasion();
|
||||
check_scheduled_invasion();
|
||||
}
|
||||
@@ -250,24 +292,30 @@ void attempt_blessing() {
|
||||
favor -= 1.0;
|
||||
if (favor < 0) favor = 0;
|
||||
|
||||
string[] god_names = {
|
||||
"Odin's", "Thor's", "Freyja's", "Loki's", "Tyr's", "Baldur's",
|
||||
"Frigg's", "Heimdall's", "Hel's", "Fenrir's", "Freyr's", "The gods'"
|
||||
};
|
||||
string god_name = god_names[random(0, god_names.length() - 1)];
|
||||
|
||||
if (choice == 0) {
|
||||
int before = player_health;
|
||||
player_health += BLESSING_HEAL_AMOUNT;
|
||||
if (player_health > max_health) player_health = max_health;
|
||||
int healed = player_health - before;
|
||||
string bonus = (healed > 0) ? "You feel restored. +" + healed + " health." : "You feel restored.";
|
||||
notify("The gods' favor shines upon you. " + bonus);
|
||||
notify(god_name + " favor shines upon you. " + bonus);
|
||||
} else if (choice == 1) {
|
||||
blessing_speed_active = true;
|
||||
blessing_speed_timer.restart();
|
||||
update_max_health_from_equipment();
|
||||
notify("The gods' favor shines upon you. You feel swift for a while.");
|
||||
notify(god_name + " favor shines upon you. You feel swift for a while.");
|
||||
} else if (choice == 2) {
|
||||
int gained = add_barricade_health(BLESSING_BARRICADE_REPAIR);
|
||||
string bonus = (gained > 0)
|
||||
? "A divine force repairs the barricade. +" + gained + " health."
|
||||
: "A divine force surrounds the barricade.";
|
||||
notify("The gods' favor shines upon you. " + bonus);
|
||||
notify(god_name + " favor shines upon you. " + bonus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,10 +441,11 @@ void update_crossfade() {
|
||||
float progress = float(crossfade_timer.elapsed) / float(CROSSFADE_DURATION);
|
||||
if (progress > 1.0) progress = 1.0;
|
||||
|
||||
// Volume interpolation: fade out goes 0 -> -40, fade in goes -40 -> 0
|
||||
float volume_range = CROSSFADE_MAX_VOLUME - CROSSFADE_MIN_VOLUME; // 40 dB range
|
||||
float fade_out_vol = CROSSFADE_MAX_VOLUME - (volume_range * progress); // 0 -> -40
|
||||
float fade_in_vol = CROSSFADE_MIN_VOLUME + (volume_range * progress); // -40 -> 0
|
||||
// Volume interpolation: use a slow-start curve to make fade-outs more gradual
|
||||
float volume_range = CROSSFADE_MAX_VOLUME - CROSSFADE_MIN_VOLUME; // dB range
|
||||
float eased_progress = progress * progress;
|
||||
float fade_out_vol = CROSSFADE_MAX_VOLUME - (volume_range * eased_progress); // 0 -> min
|
||||
float fade_in_vol = CROSSFADE_MIN_VOLUME + (volume_range * eased_progress); // min -> 0
|
||||
|
||||
if (crossfade_to_night) {
|
||||
// Fading day out, night in
|
||||
|
||||
Reference in New Issue
Block a user