Breaking items for residents and basket collection improved. Time for catching fish adjusted.

This commit is contained in:
Storm Dragon
2026-02-01 12:35:02 -05:00
parent f675db3161
commit e1928a1039
6 changed files with 29 additions and 7 deletions

View File

@@ -184,7 +184,7 @@ const int RESIDENT_SNARE_ESCAPE_CHANCE = 5; // 5% chance game escapes when resi
const int RESIDENT_SNARE_CHECK_CHANCE = 15; // 15% chance per hour to check snares
const int RESIDENT_FISHING_CHANCE = 6; // 6% chance per resident per hour to catch a fish
const int RESIDENT_SMOKE_FISH_CHANCE = 10; // 10% chance per hour to smoke a stored fish
const int RESIDENT_TOOL_BREAK_CHANCE = 5; // 5% chance tools break during resident use (fishing poles, knives, baskets)
const int RESIDENT_TOOL_BREAK_CHANCE = 2; // 2% chance tools break during resident use (fishing poles, knives, baskets)
// Goose settings
const int GOOSE_HEALTH = 1;

View File

@@ -122,6 +122,10 @@ bool can_undead_attack_player(Undead@ undead) {
return false;
}
if (fylgjaCharging) {
return false;
}
if (abs(undead.position - x) > 1) {
return false;
}

View File

@@ -1,8 +1,9 @@
// Fishing system
const int FISHING_NEAR_STREAM_RANGE = 2;
const int FISHING_CAST_MOVE_MS = 300;
const int FISHING_CATCH_CHANCE_STEP = 15;
const int FISHING_CATCH_CHANCE_MAX = 85;
const int FISHING_CATCH_CHANCE_START = 5;
const int FISHING_CATCH_CHANCE_STEP = 1;
const int FISHING_CATCH_CHANCE_MAX = 95;
const int FISHING_BAD_CAST_BREAK_CHANCE = 40;
const int FISHING_EARLY_ESCAPE_CHANCE = 50;
const int FISHING_LATE_ESCAPE_CHANCE = 50;
@@ -226,12 +227,12 @@ void release_cast() {
void update_waiting_for_fish() {
if (!line_in_water) return;
const int check_interval = 30000;
const int check_interval = 1000;
int checks_ready = fishing_timer.elapsed / check_interval;
while (fishing_checks_done < checks_ready) {
fishing_checks_done++;
catch_chance += FISHING_CATCH_CHANCE_STEP;
catch_chance = FISHING_CATCH_CHANCE_START + (fishing_checks_done - 1) * FISHING_CATCH_CHANCE_STEP;
if (catch_chance > FISHING_CATCH_CHANCE_MAX) catch_chance = FISHING_CATCH_CHANCE_MAX;
if (catch_chance > 0 && random(1, 100) <= catch_chance) {

View File

@@ -288,7 +288,9 @@ void update_fylgja_charge() {
y = targetElevation;
if (targetElevation < previousY) {
int fallHeight = previousY - targetElevation;
apply_falling_damage(fallHeight);
if (fallHeight > SAFE_FALL_HEIGHT) {
apply_falling_damage(fallHeight);
}
}
}

View File

@@ -67,7 +67,7 @@ int target_stream_start = -1; // Start of target stream for casting
int target_stream_end = -1; // End of target stream for casting
timer fishing_timer; // Tracks time line has been in water
timer cast_move_timer; // Controls discrete position movement (150ms per tile)
int catch_chance = 0; // Current catch percentage (starts 0, +15% per minute, max 85%)
int catch_chance = 0; // Current catch percentage (starts 5% after 1s, +1% per second, max 95%)
int cast_sound_handle = -1; // Handle for cast_strength.ogg
string hooked_fish_type = ""; // Type of fish on the line
int fishing_checks_done = 0; // Number of catch checks performed while waiting

View File

@@ -438,6 +438,19 @@ void attempt_blessing() {
}
}
bool should_attempt_resident_foraging(int hour) {
int residentCount = residents_count;
if (residentCount <= 0) return false;
if (hour == 6) return true;
if (residentCount == 1) return false;
if (residentCount == 2) return hour == 12;
if (residentCount == 3) return hour == 12 || hour == 18;
// 4+ residents: spread across daytime hours
return hour == 10 || hour == 14 || hour == 18;
}
void update_time() {
if (hour_timer.elapsed >= MS_PER_HOUR) {
hour_timer.restart();
@@ -507,6 +520,8 @@ void update_time() {
process_daily_weapon_breakage();
attempt_daily_quest();
attempt_resident_butchering();
}
if (should_attempt_resident_foraging(current_hour)) {
attempt_resident_foraging();
}
attempt_daily_invasion();