A resource that refills on its own as turns pass - a wand's limited charges regenerating
one every few turns - distinct from a straight spendable pool (mana spent per cast,
restored only by an explicit event, which a StatBlock stat already covers on its own).
What that alone cannot express is "this refills automatically over time," so Charges
carries its own regeneration progress instead of leaning on TurnClock for it - a charge
either has or does not have enough banked turns to regenerate, which is exactly the kind
of running total a class holds more naturally than a callback would.
Example
import { Charges } from'@datamoc/mwg/actors';
constwand = newCharges({ max:3, regenRate:10 }); // one charge every 10 turns wand.spend(1);
wand.advance(10); // 10 turns pass; one charge regenerates console.log(wand.current); // back to max
wand.refund(1); // a kill or crit grants a charge directly, outside the normal regen path
A resource that refills on its own as turns pass - a wand's limited charges regenerating one every few turns - distinct from a straight spendable pool (mana spent per cast, restored only by an explicit event, which a
StatBlockstat already covers on its own). What that alone cannot express is "this refills automatically over time," soChargescarries its own regeneration progress instead of leaning onTurnClockfor it - a charge either has or does not have enough banked turns to regenerate, which is exactly the kind of running total a class holds more naturally than a callback would.Example