wip(0.S3): the packages migrated by ludic migrate state packages - every package test green
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1e8b5b0523
commit
07505e7ef2
294 changed files with 14996 additions and 14675 deletions
|
|
@ -1,16 +1,16 @@
|
|||
# fight.ludic - what takes, how big it is, and the green band the marker has to cross in
|
||||
# a legend on a lure, likelier in deep water and with skill; else an everyday one by weight
|
||||
function fishing_pick() -> int {
|
||||
function fishing_pick(fishing_st: mut FishingState) -> int {
|
||||
let leg = fishing_legend()
|
||||
if leg >= 0 and fishing_lure_on {
|
||||
if leg >= 0 and fishing_st.fishing_lure_on {
|
||||
let k = FishSpecies[leg]
|
||||
var p = k.chance
|
||||
if FishingWorld.afloat() or FishingWorld.depth(fishing_bx, fishing_bz) >= fishing_deep { p = k.chance_deep }
|
||||
if fishing_rand() < p + FishingWorld.skill() { return leg }
|
||||
if FishingWorld.afloat() or FishingWorld.depth(fishing_st.fishing_bx, fishing_st.fishing_bz) >= fishing_st.fishing_deep { p = k.chance_deep }
|
||||
if fishing_rand(fishing_st) < p + FishingWorld.skill() { return leg }
|
||||
}
|
||||
var total = 0.0
|
||||
for s in 0 .. FISH_COUNT { if not FishSpecies[s].legend { total = total + FishSpecies[s].weight } }
|
||||
var r = fishing_rand() * total
|
||||
var r = fishing_rand(fishing_st) * total
|
||||
var last = -1
|
||||
for s in 0 .. FISH_COUNT {
|
||||
if FishSpecies[s].legend { continue }
|
||||
|
|
@ -21,37 +21,37 @@ function fishing_pick() -> int {
|
|||
return last
|
||||
}
|
||||
|
||||
function fishing_size(s: int) -> int {
|
||||
function fishing_size(fishing_st: mut FishingState, s: int) -> int {
|
||||
let k = FishSpecies[s]
|
||||
let spread = int(fishing_rand() * float(k.cm_spread + 1))
|
||||
let spread = int(fishing_rand(fishing_st) * float(k.cm_spread + 1))
|
||||
return k.cm_min + spread + int(FishingWorld.skill() * k.skill_cm)
|
||||
}
|
||||
|
||||
# the green's half width this crossing: a fish that closes it does so at every rung, and Hard
|
||||
# closes it for everything else
|
||||
export function fishing_window() -> float {
|
||||
if not fishing_kind_ok(fishing_sp) { return 0.12 }
|
||||
let k = FishSpecies[fishing_sp]
|
||||
let hw = FishingWorld.window(fishing_sp)
|
||||
if k.closes > 0.0 { return Math.max(hw * (1.0 - k.closes * float(fishing_won)), hw * k.floor) }
|
||||
if FishingWorld.level() == FISHING_HARD { return Math.max(hw * (1.0 - 0.10 * float(fishing_won)), hw * 0.55) }
|
||||
export function fishing_window(fishing_st: FishingState) -> float {
|
||||
if not fishing_kind_ok(fishing_st.fishing_sp) { return 0.12 }
|
||||
let k = FishSpecies[fishing_st.fishing_sp]
|
||||
let hw = FishingWorld.window(fishing_st.fishing_sp)
|
||||
if k.closes > 0.0 { return Math.max(hw * (1.0 - k.closes * float(fishing_st.fishing_won)), hw * k.floor) }
|
||||
if FishingWorld.level() == FISHING_HARD { return Math.max(hw * (1.0 - 0.10 * float(fishing_st.fishing_won)), hw * 0.55) }
|
||||
return hw
|
||||
}
|
||||
|
||||
export function fishing_window_lo() -> float { return Math.clamp(fishing_win_c - fishing_window(), 0.0, 1.0) }
|
||||
export function fishing_window_hi() -> float { return Math.clamp(fishing_win_c + fishing_window(), 0.0, 1.0) }
|
||||
export function fishing_window_lo(fishing_st: FishingState) -> float { return Math.clamp(fishing_st.fishing_win_c - fishing_window(fishing_st), 0.0, 1.0) }
|
||||
export function fishing_window_hi(fishing_st: FishingState) -> float { return Math.clamp(fishing_st.fishing_win_c + fishing_window(fishing_st), 0.0, 1.0) }
|
||||
|
||||
# where it sits: the middle on Relaxed, somewhere new each crossing above it
|
||||
function fishing_new_window() -> void {
|
||||
function fishing_new_window(fishing_st: mut FishingState) -> void {
|
||||
let lv = FishingWorld.level()
|
||||
if lv == FISHING_RELAXED or fishing_gentle_on {
|
||||
fishing_win_c = 0.5
|
||||
if lv == FISHING_RELAXED or fishing_st.fishing_gentle_on {
|
||||
fishing_st.fishing_win_c = 0.5
|
||||
return
|
||||
}
|
||||
let hw = fishing_window() + 0.05
|
||||
fishing_win_c = hw + fishing_rand() * (1.0 - hw - hw)
|
||||
let hw = fishing_window(fishing_st) + 0.05
|
||||
fishing_st.fishing_win_c = hw + fishing_rand(fishing_st) * (1.0 - hw - hw)
|
||||
}
|
||||
|
||||
function fishing_in_window() -> bool {
|
||||
return fishing_mark > fishing_win_c - fishing_window() and fishing_mark < fishing_win_c + fishing_window()
|
||||
function fishing_in_window(fishing_st: FishingState) -> bool {
|
||||
return fishing_st.fishing_mark > fishing_st.fishing_win_c - fishing_window(fishing_st) and fishing_st.fishing_mark < fishing_st.fishing_win_c + fishing_window(fishing_st)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue