pub enum EffectHost {
Battler(BattlerRef),
Side(u8),
Field,
}Expand description
Where an effect is hosted (design §3.1, the broadened addressing). A
cross-gen battle hosts effects not only on a battler (volatiles, ability,
item) but on a side (screens, hazards, Wish) or the field (weather,
terrain, Trick Room). EffectHost is the 3-way scope the engine routes by.
§Non-breaking note (design §3.1, §7)
The design’s §3.1 sketch proposed widening the EffectState.host field
from BattlerRef to EffectHost “via From<BattlerRef> so existing
constructors compile unchanged.” In Rust that does not hold for
struct-literal field initialization (EffectState { host: who, .. } and the
field-shorthand host,): field init requires the exact field type and
never invokes From/Into. Widening the field would therefore force an edit
to all 40+ Gen-1 slice construction sites — a NO-GO on the design’s own
“Non-breaking” axis (§6.2). See the returned findings for the documented
NO-GO.
So EffectHost ships as an additive type: EffectState.host stays
BattlerRef (battler-hosted effects, the only kind the engine fires today —
every slice compiles verbatim), and EffectState::host_scope projects it
to EffectHost::Battler. Side- and field-hosted state is addressed through
the EffectHost::Side/Field cases and the defaulted side_effects/
field_effects resolvers (the game owns that mutable state). From and
PartialEq cross-impls let routing code treat a BattlerRef and an
EffectHost::Battler interchangeably.
Variants§
Battler(BattlerRef)
Hosted on one battler (volatile, ability, item).
Side(u8)
Hosted on a side (screens, hazards, Wish). 0 = player, 1 = opponent.
Field
Hosted on the field (weather, terrain, Trick Room).
Trait Implementations§
Source§impl Clone for EffectHost
impl Clone for EffectHost
Source§fn clone(&self) -> EffectHost
fn clone(&self) -> EffectHost
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more