pub struct LawBridgeCharges {
pub bridges: Vec<BridgeCharge>,
pub capacity_hundredths: i64,
pub amplification_cap_permyriad: i64,
}Expand description
Per-fight bridge state of ONE combatant. Lives on the combat entity rather than on the fight because PvP and party fights hold several heroes, each with an independent active side and independent charges.
Combat-runtime only, exactly like Entity::proc_entropy: it is
serde(skip)ped off the wire and the client state patch. active_fight is
never persisted (storage::state always hydrates it as None), so there is
no durable copy that could drift.
Carries the capacity and the amplification ceiling this combatant’s bridges
play against, rather than reading them from config at every call. They are
fixed for the whole fight (artifact stones only change out of combat) and
the artifact’s Bridge Law socket moves them per player, so keeping them here
is what lets the strip-and-refold of the passive law contribution
(entities::refresh_law_attributes) use the same numbers coming and going —
a config lookup could not, because it has no idea whose bridges these are.
Fields§
§bridges: Vec<BridgeCharge>§capacity_hundredths: i64Charge ONE direction can hold, in hundredths (CHARGE_SCALE).
Everything above it burns.
amplification_cap_permyriad: i64Law Power a completely full bridge is worth, in permyriad.
Implementations§
Source§impl LawBridgeCharges
impl LawBridgeCharges
pub fn new( bridges: Vec<BridgeCharge>, capacity_hundredths: i64, amplification_cap_permyriad: i64, ) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn add_resonance(&mut self, law_id: LawTemplateId, amount: i64) -> i64
pub fn add_resonance(&mut self, law_id: LawTemplateId, amount: i64) -> i64
Puts amount of Resonance in on behalf of law_id, i.e. into the
charge that flows AWAY from it. Everything above capacity burns, like
Flip Gauge overflow. Returns how much actually landed.
amount is in hundredths (CHARGE_SCALE); the ceiling is this
combatant’s own Self::capacity_hundredths.
Sourcepub fn pending_from(&self, law_id: LawTemplateId) -> i64
pub fn pending_from(&self, law_id: LawTemplateId) -> i64
Charge currently sitting in the direction law_id fills, in hundredths.
Sourcepub fn delivered_units(&self, law_id: LawTemplateId) -> i64
pub fn delivered_units(&self, law_id: LawTemplateId) -> i64
WHOLE units law_id received at the last flip — the floor of the exact
charge. This is the only number amplification is ever priced from; the
fractional remainder is kept by Self::delivered_hundredths but never
counts until it completes a unit.
Zero when the law is in no bridge, which is what makes an unbridged law run unamplified.
Sourcepub fn delivered_hundredths(&self, law_id: LawTemplateId) -> i64
pub fn delivered_hundredths(&self, law_id: LawTemplateId) -> i64
Exact charge law_id received at the last flip, in hundredths.
Sourcepub fn deliver(&mut self)
pub fn deliver(&mut self)
Flip step 1+2 (plan §3): every accumulated charge is handed to the law at the far end and the charge is zeroed.
Both directions are delivered, not just the one the outgoing phase filled: the other direction was zeroed by the previous flip and has had no active law to fill it since, so delivering it is a no-op that keeps the step free of “which side was up” bookkeeping.
Trait Implementations§
Source§impl Clone for LawBridgeCharges
impl Clone for LawBridgeCharges
Source§fn clone(&self) -> LawBridgeCharges
fn clone(&self) -> LawBridgeCharges
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more