pub struct TreeAggregate {Show 13 fields
pub per_fingerer: Vec<FingererTreeContrib>,
pub all_fingerers_flat: f64,
pub all_fingerers_add: f64,
pub all_fingerers_mul: Mag,
pub click_add: f64,
pub click_mul: Mag,
pub click_flat: f64,
pub prestige_add: f64,
pub prestige_mul: Mag,
pub powerup_spawn_mul: [f64; 4],
pub powerup_reward_mul: [Mag; 4],
pub powerup_duration_mul: [Mag; 4],
pub green_coin_strength_mul: Mag,
}Expand description
All of the tree’s contributions, pre-folded into a single struct for O(1) reads on the hot paths.
All multiplicative fields are Mag so multi-thousand-node stacks
can’t overflow. The few small-magnitude additive fields stay f64
because they don’t compound. powerup_spawn_mul also stays f64
because its consumer (sim::next_cooldown) computes
base / mul_f64 directly and we’d just round-trip through f64
anyway.
Fields§
§per_fingerer: Vec<FingererTreeContrib>Per-fingerer contributions, indexed by FINGERERS catalog position.
all_fingerers_flat: f64Global “all fingerers” contributions — distribute across every fingerer’s per-tier output. Stack on top of per-fingerer.
all_fingerers_add: f64§all_fingerers_mul: Mag§click_add: f64Click contributions.
click_mul: Mag§click_flat: f64§prestige_add: f64Prestige multiplier extensions (applied on top of the base prestige formula).
prestige_mul: Mag§powerup_spawn_mul: [f64; 4]Per-powerup-kind spawn-rate multiplier. f64 because the only
consumer (sim::next_cooldown) needs the raw value as a divisor
and the per-node cap (×1.005) keeps any realistic stack inside
f64 range.
powerup_reward_mul: [Mag; 4]Per-powerup-kind reward multiplier. Mag because this stage was
the headline overflow path: powerup_reward_mul[Buff] scales the
7× MulFactor that gets persisted on a fingerer every Buff catch,
and 10k+ deep tree stacks would otherwise blow past f64.
powerup_duration_mul: [Mag; 4]§green_coin_strength_mul: MagGreen Coin AddPercent strength multiplier (the base +10% becomes +10% * green_coin_strength_mul on catch).
Implementations§
Source§impl TreeAggregate
impl TreeAggregate
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resize per_fingerer to match the live FINGERERS length and
reset every field to identity. Cheap; do this in migrate_runtime
before walking bought.
Sourcepub fn rebuild_from_bought(&mut self, bought: &HashSet<TreeCoord>)
pub fn rebuild_from_bought(&mut self, bought: &HashSet<TreeCoord>)
Rebuild the aggregate from scratch by regenerating each owned node
from its lot coord and folding its primitives in. Called by
migrate_runtime on load and by prestige_reset after clearing
bought.
Sourcepub fn fold_in_node(&mut self, node: &NodeSpec)
pub fn fold_in_node(&mut self, node: &NodeSpec)
Fold a single node’s primitive stack into the aggregate. Called when the player buys a node — incremental update, O(primitives in node) ≈ 1-4.
Sourcepub fn fold_out_node(&mut self, node: &NodeSpec)
pub fn fold_out_node(&mut self, node: &NodeSpec)
Inverse of fold_in_node: subtract a node’s contribution. Called
on refund.
Sourcepub fn effective_for_fingerer(&self, idx: usize) -> FingererTreeContrib
pub fn effective_for_fingerer(&self, idx: usize) -> FingererTreeContrib
Convenience: get the per-fingerer contrib for a catalog index,
folded with the global all_fingerers_* contributions.
Trait Implementations§
Source§impl Clone for TreeAggregate
impl Clone for TreeAggregate
Source§fn clone(&self) -> TreeAggregate
fn clone(&self) -> TreeAggregate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TreeAggregate
impl Debug for TreeAggregate
Auto Trait Implementations§
impl Freeze for TreeAggregate
impl RefUnwindSafe for TreeAggregate
impl Send for TreeAggregate
impl Sync for TreeAggregate
impl Unpin for TreeAggregate
impl UnsafeUnpin for TreeAggregate
impl UnwindSafe for TreeAggregate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more