Fishing should check more often. Messages when trying to use a weapon without ammo should read now instead of making noise.

This commit is contained in:
Storm Dragon
2026-01-24 14:28:54 -05:00
parent 0d711095c1
commit 09c2250ade
5 changed files with 44 additions and 14 deletions

View File

@@ -412,7 +412,7 @@ void main()
sling_sound_handle = p.play_stationary("sounds/weapons/sling_swing.ogg", true); sling_sound_handle = p.play_stationary("sounds/weapons/sling_swing.ogg", true);
last_sling_stage = -1; last_sling_stage = -1;
} else { } else {
speak_with_history("No stones.", true); speak_ammo_blocked("No stones.");
} }
} }
@@ -437,8 +437,15 @@ void main()
if (spear_equipped) attack_cooldown = 800; if (spear_equipped) attack_cooldown = 800;
if (axe_equipped) attack_cooldown = 1600; if (axe_equipped) attack_cooldown = 1600;
if(!fishing_pole_equipped && (key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && attack_timer.elapsed > attack_cooldown) bool ctrl_down = (key_down(KEY_LCTRL) || key_down(KEY_RCTRL));
{ if (bow_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
if (get_personal_count(ITEM_ARROWS) <= 0) {
speak_ammo_blocked("No arrows.");
} else {
attack_timer.restart();
perform_attack(x);
}
} else if (!bow_equipped && !fishing_pole_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
attack_timer.restart(); attack_timer.restart();
perform_attack(x); perform_attack(x);
} }

View File

@@ -11,6 +11,20 @@ void perform_attack(int current_x) {
} }
} }
timer ammoBlockTimer;
string lastAmmoBlockMessage = "";
const int AMMO_BLOCK_COOLDOWN_MS = 3000;
void speak_ammo_blocked(string message) {
if (message == lastAmmoBlockMessage && ammoBlockTimer.elapsed < AMMO_BLOCK_COOLDOWN_MS) {
return;
}
lastAmmoBlockMessage = message;
ammoBlockTimer.restart();
speak_with_history(message, true);
}
int attack_enemy_ranged(int start_x, int end_x, int damage) { int attack_enemy_ranged(int start_x, int end_x, int damage) {
for (int check_x = start_x; check_x <= end_x; check_x++) { for (int check_x = start_x; check_x <= end_x; check_x++) {
// Check for bandits first (priority during daytime) // Check for bandits first (priority during daytime)

View File

@@ -42,6 +42,7 @@ void reset_fishing_session() {
target_stream_end = -1; target_stream_end = -1;
catch_chance = 0; catch_chance = 0;
hooked_fish_type = ""; hooked_fish_type = "";
fishing_checks_done = 0;
} }
bool get_nearby_stream(int pos, int range, int &out stream_start, int &out stream_end) { bool get_nearby_stream(int pos, int range, int &out stream_start, int &out stream_end) {
@@ -182,6 +183,7 @@ void release_cast() {
if (is_position_in_water(cast_position)) { if (is_position_in_water(cast_position)) {
line_in_water = true; line_in_water = true;
catch_chance = 0; catch_chance = 0;
fishing_checks_done = 0;
fishing_timer.restart(); fishing_timer.restart();
p.play_stationary("sounds/actions/start_fishing.ogg", false); p.play_stationary("sounds/actions/start_fishing.ogg", false);
} else { } else {
@@ -200,18 +202,23 @@ void release_cast() {
void update_waiting_for_fish() { void update_waiting_for_fish() {
if (!line_in_water) return; if (!line_in_water) return;
int minutes_waited = fishing_timer.elapsed / 60000; const int check_interval = 30000;
int new_chance = minutes_waited * FISHING_CATCH_CHANCE_STEP; int checks_ready = fishing_timer.elapsed / check_interval;
if (new_chance > FISHING_CATCH_CHANCE_MAX) new_chance = FISHING_CATCH_CHANCE_MAX;
catch_chance = new_chance;
if (catch_chance > 0 && random(1, 100) <= catch_chance) { while (fishing_checks_done < checks_ready) {
line_in_water = false; fishing_checks_done++;
fish_on_line = true; catch_chance += FISHING_CATCH_CHANCE_STEP;
reel_position = get_random_stream_tile(); if (catch_chance > FISHING_CATCH_CHANCE_MAX) catch_chance = FISHING_CATCH_CHANCE_MAX;
reel_direction = 0;
hooked_fish_type = get_random_fish_type(); if (catch_chance > 0 && random(1, 100) <= catch_chance) {
speak_with_history("A fish is on the line!", true); line_in_water = false;
fish_on_line = true;
reel_position = get_random_stream_tile();
reel_direction = 0;
hooked_fish_type = get_random_fish_type();
speak_with_history("A fish is on the line!", true);
break;
}
} }
} }

View File

@@ -53,6 +53,7 @@ timer cast_move_timer; // Controls discrete position movement (150ms
int catch_chance = 0; // Current catch percentage (starts 0, +15% per minute, max 85%) int catch_chance = 0; // Current catch percentage (starts 0, +15% per minute, max 85%)
int cast_sound_handle = -1; // Handle for cast_strength.ogg int cast_sound_handle = -1; // Handle for cast_strength.ogg
string hooked_fish_type = ""; // Type of fish on the line string hooked_fish_type = ""; // Type of fish on the line
int fishing_checks_done = 0; // Number of catch checks performed while waiting
// Favor system // Favor system
double favor = 0.0; double favor = 0.0;

View File

@@ -186,6 +186,7 @@ void reset_game_state() {
target_stream_start = -1; target_stream_start = -1;
target_stream_end = -1; target_stream_end = -1;
catch_chance = 0; catch_chance = 0;
fishing_checks_done = 0;
hooked_fish_type = ""; hooked_fish_type = "";
if (cast_sound_handle != -1) { if (cast_sound_handle != -1) {
p.destroy_sound(cast_sound_handle); p.destroy_sound(cast_sound_handle);