pub struct OrderKey(pub i32, pub i32, pub u32);Expand description
A turn-ordering sort key produced by BattleProvider::turn_order_key.
The engine stable-sorts actors ascending by this key, so the game must
encode “acts earlier” as a smaller key. The tuple is ordered
(priority, speed, tiebreak):
priority— move/action priority bracket. Higher-priority actions act first, so the game should store the negated bracket here (e.g.-1for a +1 priority move) to make ascending order put them first.speed— likewise the negated effective speed, so the faster battler (larger speed → more-negative key) sorts first. The game applies its own speed modifiers (paralysis cut, badge boosts) before negating.tiebreak— a game-supplied tie-break value (e.g. a coin-flip drawn from the injected RNG for the Gen-1 speed tie). Smaller acts first.
Stability of the sort guarantees that equal keys preserve submission order,
so a game that wants pure submission order on ties can leave tiebreak at
0.
Tuple Fields§
§0: i32§1: i32§2: u32Trait Implementations§
impl Copy for OrderKey
impl Eq for OrderKey
Source§impl Ord for OrderKey
impl Ord for OrderKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for OrderKey
impl PartialOrd for OrderKey
impl StructuralPartialEq for OrderKey
Auto Trait Implementations§
impl Freeze for OrderKey
impl RefUnwindSafe for OrderKey
impl Send for OrderKey
impl Sync for OrderKey
impl Unpin for OrderKey
impl UnsafeUnpin for OrderKey
impl UnwindSafe for OrderKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more