pub enum RelayVar {
Unit,
Int(i64),
Damage(u16),
Accuracy(u8),
Bool(bool),
}Expand description
The typed value threaded through a dispatch fold (design §1.2). Mirrors Showdown’s relay variable.
Variants§
Unit
No meaningful payload (side-effecting events such as Residual).
Int(i64)
A signed integer fold value.
Damage(u16)
Accumulated/last damage.
Accuracy(u8)
An accuracy threshold in 0..=255.
Bool(bool)
A boolean verdict (e.g. “did the gate allow the move?”).
Implementations§
Source§impl RelayVar
impl RelayVar
Sourcepub fn as_int(self) -> i64
pub fn as_int(self) -> i64
Read the relay as a signed integer (design §4.1). Non-Int ⇒ 0, so a
handler can fold an int relay without hand-matching every variant.
Sourcepub fn as_accuracy(self) -> u8
pub fn as_accuracy(self) -> u8
Read the relay as an accuracy threshold (design §4.1). Non-Accuracy
⇒ 0.
Sourcepub fn as_bool(self) -> bool
pub fn as_bool(self) -> bool
Read the relay as a boolean verdict (design §4.1). Non-Bool ⇒ false.
Sourcepub fn scale(self, num: u32, den: u32) -> RelayVar
pub fn scale(self, num: u32, den: u32) -> RelayVar
Fold-friendly multiply: scale a numeric relay (Int/Damage/Accuracy)
by num/den (design §4.1, the ×1.5 / ×0.5 modifier shape). Damage and
accuracy clamp into their lanes; the result keeps the relay’s lane so a
ModifyDamage/Accuracy/ModifyStat fold composes. A non-numeric relay
passes through untouched.