Skip to main content

TreeAggregate

Struct TreeAggregate 

Source
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: f64, pub click_add: f64, pub click_mul: f64, pub click_flat: f64, pub prestige_add: f64, pub prestige_mul: f64, pub powerup_spawn_mul: [f64; 4], pub powerup_reward_mul: [f64; 4], pub powerup_duration_mul: [f64; 4], pub green_coin_strength_mul: f64,
}
Expand description

All of the tree’s contributions, pre-folded into a single struct for O(1) reads on the hot paths.

Fields§

§per_fingerer: Vec<FingererTreeContrib>

Per-fingerer contributions, indexed by FINGERERS catalog position.

§all_fingerers_flat: f64

Global “all fingerers” contributions — distribute across every fingerer’s per-tier output. Stack on top of per-fingerer.

§all_fingerers_add: f64§all_fingerers_mul: f64§click_add: f64

Click contributions.

§click_mul: f64§click_flat: f64§prestige_add: f64

Prestige multiplier extensions (applied on top of the base prestige formula).

§prestige_mul: f64§powerup_spawn_mul: [f64; 4]

Per-powerup-kind multipliers, indexed by PowerupKind as usize.

§powerup_reward_mul: [f64; 4]§powerup_duration_mul: [f64; 4]§green_coin_strength_mul: f64

Green Coin AddPercent strength multiplier (the base +10% becomes +10% * green_coin_strength_mul on catch).

Implementations§

Source§

impl TreeAggregate

Source

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.

Source

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.

Source

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.

Source

pub fn fold_out_node(&mut self, node: &NodeSpec)

Inverse of fold_in_node: subtract a node’s contribution. Called on refund.

Source

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

Source§

fn clone(&self) -> TreeAggregate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TreeAggregate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TreeAggregate

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.