farming-weight
Version:
Tools for calculating farming weight and fortune in Hypixel Skyblock
64 lines (63 loc) • 3.06 kB
TypeScript
import type { Stat } from '../constants/stats.js';
import { type AppliedEffect, type DropContext, type Effect, type EffectAddDropPayload, type EffectEnvironment, type EffectPhase, type StatContext } from './types.js';
/** Resolve an effect's phase, defaulting from its op when omitted. */
export declare function effectPhase(effect: Effect): EffectPhase;
/**
* Throw if a multiplicative effect carries an invalid value. Catches the
* Cropeetle/Deep-Fried delta-vs-factor mismatch class of bugs at the source.
*/
export declare function assertValidEffect(effect: Effect): void;
/**
* Sum `add-stat` effects matching a stat query and a `StatContext`.
*
* Drop-only scoped effects are rejected by the matcher.
*/
export declare function resolveStatTotal(effects: readonly Effect[], stat: Stat, ctx: StatContext): number;
/**
* Per-stat breakdown of `add-stat` contributions matching a `StatContext`.
* Returns `{ source: amount }` aggregated by source name.
*/
export declare function resolveStatBreakdown(effects: readonly Effect[], stat: Stat, ctx: StatContext): Record<string, number>;
/**
* Compute the virtual scalar for `Stat.Overbloom`.
*
* Sums `value` from `add-rare-pct` effects whose `relatedStats` includes
* `Stat.Overbloom` and whose scope is global Overbloom-shaped. Scoped Overbloom-
* flavored effects are excluded by design - see the architecture plan.
*/
export declare function resolveOverbloomScalar(effects: readonly Effect[], ctx: StatContext, overbloomStat: Stat): number;
/**
* Per-source breakdown of the global Overbloom scalar.
*/
export declare function resolveOverbloomBreakdown(effects: readonly Effect[], ctx: StatContext, overbloomStat: Stat): Record<string, number>;
export interface ProducedDrop {
source: string;
payload: EffectAddDropPayload;
}
/**
* Collect drops emitted by `add-drop` effects whose env-level scope matches.
*
* Real per-drop scope filtering (tags, items, etc.) happens later when the
* calculator builds a `DropContext` for each candidate.
*/
export declare function produceAddedDrops(effects: readonly Effect[], env: EffectEnvironment): ProducedDrop[];
export interface DropResolutionResult {
/** Additive percentage points (e.g. 50 = +50%) summed from `add-rare-pct` effects. */
addRarePct: number;
/** Combined `mul-rare` factor (product of all matching factors). 1.0 = identity. */
mulRare: number;
/** Combined `mul-drop` factor (product of all matching factors). 1.0 = identity. */
mulDrop: number;
/** Per-effect record of contributions to this drop, in pipeline order. */
applied: AppliedEffect[];
}
/**
* Resolve `add-rare-pct`, `mul-rare`, and `mul-drop` effects for a single drop.
*
* The calculator is expected to combine the parts as:
* `final = base * (1 + addRarePct/100) * mulRare * mulDrop`
*
* `applied` records every effect that touched this drop, with phase and
* resolved amount, for breakdown UIs.
*/
export declare function resolveDropEffects(effects: readonly Effect[], ctx: DropContext): DropResolutionResult;