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,64 +1,64 @@
|
|||
# run.ludic - `dt` real seconds of a line in the water: the wait, the bite, and the fight
|
||||
function fishing_run_wait() -> void {
|
||||
if fishing_t >= 0.0 { return }
|
||||
fishing_st = FISHING_BITE_ON
|
||||
fishing_t = 1.6
|
||||
fishing_sp = fishing_pick()
|
||||
fishing_say(FISHING_BITE)
|
||||
function fishing_run_wait(base_st: mut BaseState, fishing_st: mut FishingState) -> void {
|
||||
if fishing_st.fishing_t >= 0.0 { return }
|
||||
fishing_st.fishing_st = FISHING_BITE_ON
|
||||
fishing_st.fishing_t = 1.6
|
||||
fishing_st.fishing_sp = fishing_pick(fishing_st)
|
||||
fishing_say(base_st, fishing_st, FISHING_BITE)
|
||||
}
|
||||
|
||||
# a fish that runs: the marker is all over the bar and nothing done with it helps
|
||||
function fishing_run_runs(dt: float) -> float {
|
||||
let k = FishSpecies[fishing_sp]
|
||||
if fishing_run_t > 0.0 {
|
||||
fishing_run_t = fishing_run_t - dt
|
||||
if fishing_run_t <= 0.0 {
|
||||
fishing_run_t = 0.0
|
||||
fishing_say(FISHING_TIRED)
|
||||
function fishing_run_runs(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> float {
|
||||
let k = FishSpecies[fishing_st.fishing_sp]
|
||||
if fishing_st.fishing_run_t > 0.0 {
|
||||
fishing_st.fishing_run_t = fishing_st.fishing_run_t - dt
|
||||
if fishing_st.fishing_run_t <= 0.0 {
|
||||
fishing_st.fishing_run_t = 0.0
|
||||
fishing_say(base_st, fishing_st, FISHING_TIRED)
|
||||
}
|
||||
return 4.2
|
||||
}
|
||||
if fishing_run_left > 0 {
|
||||
fishing_run_next = fishing_run_next - dt
|
||||
if fishing_run_next <= 0.0 {
|
||||
fishing_run_left -= 1
|
||||
fishing_run_t = 2.2
|
||||
fishing_run_next = 4.0 + fishing_rand() * 4.0
|
||||
fishing_say(FISHING_RUNS)
|
||||
if fishing_st.fishing_run_left > 0 {
|
||||
fishing_st.fishing_run_next = fishing_st.fishing_run_next - dt
|
||||
if fishing_st.fishing_run_next <= 0.0 {
|
||||
fishing_st.fishing_run_left -= 1
|
||||
fishing_st.fishing_run_t = 2.2
|
||||
fishing_st.fishing_run_next = 4.0 + fishing_rand(fishing_st) * 4.0
|
||||
fishing_say(base_st, fishing_st, FISHING_RUNS)
|
||||
}
|
||||
}
|
||||
return k.speed + k.speed_per_hit * float(fishing_won)
|
||||
return k.speed + k.speed_per_hit * float(fishing_st.fishing_won)
|
||||
}
|
||||
|
||||
function fishing_run_reel(dt: float) -> void {
|
||||
let sp = fishing_run_runs(dt)
|
||||
if fishing_gentle_on {
|
||||
fishing_ring_t = fishing_ring_t - dt
|
||||
if fishing_ring_t <= 0.0 { fishing_lost(FISHING_LINE_SNAPPED) }
|
||||
function fishing_run_reel(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> void {
|
||||
let sp = fishing_run_runs(base_st, fishing_st, dt)
|
||||
if fishing_st.fishing_gentle_on {
|
||||
fishing_st.fishing_ring_t = fishing_st.fishing_ring_t - dt
|
||||
if fishing_st.fishing_ring_t <= 0.0 { fishing_lost(base_st, fishing_st, FISHING_LINE_SNAPPED) }
|
||||
return
|
||||
}
|
||||
fishing_mark = fishing_mark + sp * fishing_dir * dt
|
||||
if fishing_mark > 1.0 {
|
||||
fishing_mark = 1.0
|
||||
fishing_dir = -1.0
|
||||
fishing_st.fishing_mark = fishing_st.fishing_mark + sp * fishing_st.fishing_dir * dt
|
||||
if fishing_st.fishing_mark > 1.0 {
|
||||
fishing_st.fishing_mark = 1.0
|
||||
fishing_st.fishing_dir = -1.0
|
||||
}
|
||||
if fishing_mark < 0.0 {
|
||||
fishing_mark = 0.0
|
||||
fishing_dir = 1.0
|
||||
if fishing_st.fishing_mark < 0.0 {
|
||||
fishing_st.fishing_mark = 0.0
|
||||
fishing_st.fishing_dir = 1.0
|
||||
}
|
||||
if fishing_t < 0.0 { fishing_lost(FISHING_SLACK) }
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(base_st, fishing_st, FISHING_SLACK) }
|
||||
}
|
||||
|
||||
export function fishing_run(dt: float) -> void {
|
||||
if fishing_st == FISHING_OFF { return }
|
||||
fishing_t = fishing_t - dt
|
||||
if fishing_st == FISHING_WAIT {
|
||||
fishing_run_wait()
|
||||
export function fishing_run(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> void {
|
||||
if fishing_st.fishing_st == FISHING_OFF { return }
|
||||
fishing_st.fishing_t = fishing_st.fishing_t - dt
|
||||
if fishing_st.fishing_st == FISHING_WAIT {
|
||||
fishing_run_wait(base_st, fishing_st)
|
||||
return
|
||||
}
|
||||
if fishing_st == FISHING_BITE_ON {
|
||||
if fishing_t < 0.0 { fishing_lost(FISHING_MISSED) }
|
||||
if fishing_st.fishing_st == FISHING_BITE_ON {
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(base_st, fishing_st, FISHING_MISSED) }
|
||||
return
|
||||
}
|
||||
fishing_run_reel(dt)
|
||||
fishing_run_reel(base_st, fishing_st, dt)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue