Function band_for_today

Source
pub fn band_for_today(
    map: &mut KillFaucetDailyMap,
    family: KillFaucetFamily,
    d_today: f64,
    now: DateTime<Utc>,
) -> &mut KillFaucetDailyState
Expand description

The family’s state for TODAY, snapshotting the band if this is its first eligible roll since the daily reset.

The reset is lazy on purpose: it is a pure function of the stored last_reset_at against now, evaluated when a roll actually happens. That keeps it inside the deterministic handler, needs no separate reset event, and lines up with the authoritative quests/ads daily boundary because both compare calendar dates.

An already-open day is returned UNCHANGED even when d_today differs — that is the anti-repricing invariant. Progressing chapters mid-session must not raise D, refresh the cap, or restore a chance that has already decayed.