Module stones

Source
Expand description

Trigger/Effect Stone combat runtime — the arithmetic and the bookkeeping keys. The orchestration is crate::logic::stones.

Per-fight trigger state lives in the player entity’s attributes, the same idiom as stun_until_tick and stagger_procs: the fight rebuilds its entities, so the state resets by construction.

Keys are namespaced stone.* so they cannot collide with a stat code — crate::mechanics::fight::get_entity_stat composes <code>, <code>.bonus and <code>.mod.

Constants§

AFTER_SKILL
1 between an original Skill Cast and the next Basic Attack (TR-C06).
CAST_KIND
What the player is currently swinging: CAST_KIND_BASIC or CAST_KIND_SKILL, 0 before the first cast.
CAST_KIND_BASIC
CAST_KIND_SKILL
CAST_RUN_COUNT
CAST_RUN_SLOT
CAST_RUN_TICK
TR-R04 Wide Cast counts how many targets one original Skill reached.
CAST_RUN_WINDOW_TICKS
How long one cast’s per-target events may take to arrive. Half a second — the shipped cast animation. Two separate casts of the same Skill are always further apart (ability cooldowns are tens of seconds), so the window cannot merge them into one oversized “wide” cast.
CRIT_STREAK
How many critical hits the player has landed in an unbroken row.
DAMAGE_BUFF
Timed outgoing bonuses, permyriad: all damage (EF-L06) and original Skills only (EF-R03). Both land as derived damage on top of the real hit, so they can never re-enter a trigger.
DAMAGE_FLOOR
While positive, Core damage may not take the player below 1 HP (EF-L05).
DODGE_RING
How many recent Core Dodges the runtime remembers, i.e. the largest N a “N dodges within a window” condition can ask for.
GLOBAL_COOLDOWN
Tick at which the whole build may fire again — one key, not one per slot. A condition that comes true inside the window is lost, and the sequence counter behind it restarts (reset_sequence_counters).
GUARD_CHARGES
Fully blocked hits with a retaliation behind them (EF-E06): charges, plus the retaliation damage precomputed at arm time so the block site needs no lookup of the attacker.
GUARD_RETALIATION
HIT_REDUCTION
Incoming-damage reduction armed for the next hits taken, permyriad + charges (EF-C04).
HIT_REDUCTION_CHARGES
HP_LOW_WATER
Lowest HP the hero has been at this phase, in permyriad of Max HP (TR-E03). Absent reads as full health — see hp_low_water.
INCOMING_REDUCTION
Timed incoming-damage reduction, permyriad (EF-R04). Expiry is the scheduled inverse, like every other timed stone attribute.
LAST_SKILL
Slot index + 1 of the previous original Skill; 0 = none yet (TR-R05).
LIFESTEAL
Share of landed Core damage healed back, permyriad, timed (EF-R05).
NEXT_ATTACK_BONUS
Damage bonus armed for the caster’s next attacks, in permyriad (2_000 = +20%). Consumed by crate::mechanics::fight::attack, one charge per damaging swing.
NEXT_ATTACK_BONUS_CHARGES
How many more attacks NEXT_ATTACK_BONUS applies to. EF-C05 arms one, EF-R06 three, EF-E07 five.
NEXT_ATTACK_CRIT
Crit-chance bonus armed for the caster’s next attacks, in permyriad, with its own charge count. Consumed by crate::mechanics::fight::attack.
NEXT_ATTACK_CRIT_CHARGES
NEXT_ATTACK_DERIVED
Derived hits added to the next Basic Attack (EF-E02): permyriad of Attack per hit, and how many hits.
NEXT_ATTACK_DERIVED_CHARGES
NEXT_ATTACK_EXTRA_HITS
Extra swings armed for the caster’s next cast. Consumed by crate::mechanics::fight::cast, which queues them through a Proc sink.
NEXT_ATTACK_SPLASH
NEXT_ATTACK_SPLASH_CHARGES
NEXT_SKILL_BONUS
One-shot original-Skill payload bonus, permyriad + charges (EF-C08, EF-L08).
NEXT_SKILL_BONUS_CHARGES
NEXT_SKILL_ECHO
Derived copies of the next original Skill (EF-E01, EF-L02): the strong copy, the weak one, and how many copies are owed.
NEXT_SKILL_ECHO_CHARGES
NEXT_SKILL_ECHO_WEAK
NEXT_SKILL_SPLASH
Splash armed on the next original Skills (EF-R08) and on the next Basic Attacks (EF-L03): permyriad of Attack dealt to every living enemy.
NEXT_SKILL_SPLASH_CHARGES
NEXT_SKILL_SPLIT
Derived copies spread off the next original Skill onto a bounded number of extra targets (EF-E08): the share of that Skill’s own landed payload each copy carries, and how many additional targets it may reach.
NEXT_SKILL_SPLIT_TARGETS
PAID_MANA
Mana the resolving cast actually paid, in x100 fixed point PLUS ONE — 0 means “no payment recorded”, so a genuinely free cast (1) is still distinguishable from a cast that never went through the pool at all.
PREV_HIT_CRIT
1 while the previous Core hit the player landed was a critical one — TR-R06 Corrected Aim needs “crit straight after non-crit”.
SEQUENCE_COUNTERS
Every sequence counter, for the “an activation lost on cooldown restarts the count” rule (acceptance criterion #5).
SEQ_BASIC_ATTACK
Sequence counters, one per condition family — the common tier counts events (“every 5th attack”) rather than reacting to each. A counter that completes while on cooldown restarts from zero rather than banking its activation.
SEQ_DEFEAT
SEQ_HIT_TAKEN
SEQ_SKILL_CAST
SEQ_STAGE
TR-L04 Perfect Sequence is a three-step state machine: Skill → Basic Attack → different Skill, all inside one window. SEQ_STAGE is how far it has come (0/1/2), SEQ_STAGE_TICK when it started, SEQ_STAGE_SKILL which Skill opened it (so “another” can be checked).
SEQ_STAGE_SKILL
SEQ_STAGE_TICK
SKILLS_WITHOUT_DAMAGE
Original Skills cast in a row without taking Core damage (TR-L05).
SKILL_BUFF
SKILL_SLOTS
How many equipped Skill slots the runtime remembers per phase. A build with fewer equipped Skills leaves the tail keys at zero.
SPELLBOOK_DONE
1 once every equipped Skill has been cast at least once this phase (TR-L03). A latch, so the condition fires on the cast that completed the spellbook and not on every cast afterwards.

Functions§

armed_magnitude
The magnitude of a (magnitude, charges) pair, or None when it is spent. Reading is separate from spending because the fight primitives only see &Entity, while the stone runtime holds it mutably.
attr
Raw attribute read; a missing key is zero.
counter_met
Whether an event counter of count satisfies “every period-th”.
crit_streak_met
Whether a crit streak of streak satisfies “required crits in a row”.
dodge_tick_key
Tick + 1 of the index-th most recent Core Dodge (0 = the current one); 0 means “no such dodge yet” (TR-L02).
effect_magnitude
Effect strength for one fire: the template’s own scaling by upgrade level, times the (trigger tier × effect tier) coefficient. Every shipped cell of that matrix is 1.0, so tier interaction stays a config edit.
hp_low_water
The phase’s low-water HP mark. An absent key means the mark has never been written, which is full health — not zero, which would read as “already dead” and disarm every HP threshold for the whole fight.
hp_permyriad
The hero’s HP as permyriad of Max HP.
interval_due_key
BAL-027 Battle Rhythm: fight-clock tick at which the interval trigger in this socket fires next. 0 (absent) means “not armed yet” — the first sighting arms the metronome without firing.
reset_sequence_counters
Zeroes every sequence counter, called when a condition came true while the global cooldown was running.
skill_last_cast_key
Tick + 1 of the last cast of the player’s equipped Skill in slot index; 0 = not cast this phase.
socketed_stat_bonuses
Every passive stat the character’s socketed stones grant, as (attribute, value) pairs ready to fold into an attribute delta map.