Module pet_facets

Source
Expand description

Pet Facets / Team Die v0 — the die, the bookkeeping keys and the arithmetic. The orchestration is crate::logic::pet_facets.

Per-fight facet state lives in the player entity’s attributes, the same idiom the stones and laws runtimes use. Keys are namespaced pet.* so they cannot collide with a stat code (crate::mechanics::fight::get_entity_stat composes <code>, <code>.bonus and <code>.mod) nor with stone.* / law.*.

Structs§

RolledFacet
One rolled outcome: the facet the die landed on and the level of the pet it belongs to (rank scales the numbers of that facet and nothing else).

Constants§

APPLYING
1 while a facet outcome is being applied. The recursion guard of “a facet-generated repeat cannot repeat itself”.
BUDGET_CASTS
PET-02 Budget Plan: remaining original casts that pay the reduced Mana Cost, and the multiplier they pay it at (permyriad, 7_500 = ×0.75).
BUDGET_MULT
DREAM_READER
PET-10 Dream Reader: share the chosen hidden Law runs at (permyriad) on the next suitable Core event, with its single charge.
DREAM_READER_CHARGES
FIRST_SPELL
PET-09 First Spell: strength of the one repeat of the phase’s first ordinary gear Effect (permyriad), with its single charge.
FIRST_SPELL_CHARGES
LAST_ROLL
The facet the die last landed on, as PetFacet ordinal + 1 (0 = the die has not been rolled this fight). Presentation and tests read it; the runtime arms the outcome directly.
LEAD_READING_BONUS
LEAD_READING_CHARGES
PET-06 Lead Reading: remaining activations of the chosen source Law that bank extra Resonance, and the bonus they bank (permyriad).
LIFE_BLOOM
PET-11 Life Bloom: share of the player’s landed Core damage healed back, permyriad, for as long as the window is open.
LUCKY_STAR
PET-05 Lucky Star: derived burst owed on the next Core CRITICAL hit, permyriad of Attack, with its charge.
LUCKY_STAR_CHARGES
NEXT_SKILL_BONUS
Payload bonus armed by Open Tab for the cast it overpaid on, permyriad of the hit’s own damage. Spent by the pet hook on that cast’s landed Core hit.
NEXT_SKILL_BONUS_CHARGES
NEXT_SKILL_ECHO
PET-01 Second Spark: derived repeat of the next original Skill, permyriad of Attack, with its charge.
NEXT_SKILL_ECHO_CHARGES
OPEN_TAB_CHARGES
PET-02 Open Tab: armed for exactly one original cast. SURCHARGE is the share of the cost it may overpay (permyriad), PAYLOAD_SHARE how much of that surcharge becomes payload (permyriad).
OPEN_TAB_PAYLOAD_SHARE
OPEN_TAB_SURCHARGE
PHASE_SCOPED_KEYS
Every key a flip must clear, because it describes ONE phase rather than one fight. Everything else (the armed “next N casts” charges) belongs to the player and survives the flip that armed it.
PREPARED_SLOTS
PET-09 Prepared Slots: the strength the first proc of each gear slot runs at this phase (permyriad, 14_000 = 140%). Per-slot spend marker below.
RETALIATION
PET-04 Retaliation: derived area burst owed on the next Core hit TAKEN, permyriad of Attack, with its charge.
RETALIATION_CHARGES
RISING_GATE_MULT
RISING_GATE_PROCS
PET-08 Rising Gate (BAL-014): remaining gear Trigger procs of this phase whose Gauge award is multiplied, and the multiplier itself (hundredths, so 200 is x2).
ROLL_REVISION
Flip revision + 1 the die last rolled on, so one flip rolls exactly once however many times GlobalFlip reaches the hook.
SOUVENIR_CHARGES
PET-10 Souvenir: remaining Trigger procs that also run the paired hidden Effect, and the share they run it at (permyriad).
SOUVENIR_SHARE
WILD_READING_BONUS
WILD_READING_UNTIL
PET-06 Wild Reading: tick + 1 the chosen active Law’s Effect bonus expires at, and the bonus itself (permyriad). A tick rather than a scheduled inverse because the multiplier is read, not stored on a stat.

Functions§

armed
The magnitude of a (magnitude, charges) pair, or None when it is spent.
attr
Raw attribute read; a missing key is zero.
clear_phase_state
Clears every phase-scoped key. Called by the flip, before the incoming phase’s own facet arms anything — a Real phase must not inherit the previous Real phase’s Prepared Slots.
eligible_facets
The eligible face set of one side: one facet per equipped pet, in slot order.
permyriad
A whole-percent magnitude, rank-scaled, as permyriad (35.0 at rank 1 → 3_500).
prepared_slot_key
Per-slot “this slot has already spent its Prepared Slots bonus this phase” marker. Holds flip revision + 1, so an untouched attribute reads as “not this phase” even at revision 0 — the same shape VA-04 Opening Five uses.
roll_team_die
Rolls the Team Die: a uniform 1-of-N pick over the incoming side’s faces.
spend_charge
Spends one charge of a (magnitude, charges) pair, clearing the magnitude with the last one so a stale value can never apply for free.
ticks
A tick magnitude, rank-scaled (Head Start’s 1.2 s is a number the rank raises, not a rule it changes).