struct Fight {
lobby: SharedLobbyState,
configs: ConfigSet,
power_mode: [f64; 2],
lightsabers: [f64; 6],
matchup: (PlayerId, PlayerId, bool),
winner: Option<Option<PlayerInMatchup>>,
round: u64,
living_units: Vec<FightingUnit>,
}Fields§
§lobby: SharedLobbyState§configs: ConfigSet§power_mode: [f64; 2]power mode for Player 1, then Player 2
lightsabers: [f64; 6]rgb for Player 1, then Player 2
matchup: (PlayerId, PlayerId, bool)§winner: Option<Option<PlayerInMatchup>>§round: u64§living_units: Vec<FightingUnit>Implementations§
Source§impl Fight
impl Fight
fn info(&self) -> FightInfo
Sourceasync fn try_move_unit(
&mut self,
uid: usize,
movements: &mut Movement,
pfx: &Prefix,
) -> bool
async fn try_move_unit( &mut self, uid: usize, movements: &mut Movement, pfx: &Prefix, ) -> bool
Makes one movement attempt, see gen_unit_movement.
If the movement attempt succeeds, increments movements_this_round
and adds the movement to the movements message.
Sourceasync fn gen_unit_movement(
&mut self,
uid: usize,
pfx: &Prefix,
) -> Option<SingleMovement>
async fn gen_unit_movement( &mut self, uid: usize, pfx: &Prefix, ) -> Option<SingleMovement>
Makes one movement attempt. May return None if movement is not possible because another unit blocks the path, or if the unit has no target. Panics if this unit is dead. Not recommended to be called directly, use do_moves_if_target_not_in_range or try_move_unit instead.
Sourceasync fn do_moves_if_target_not_in_range(
&mut self,
movements: &mut Movement,
filter: impl Fn(&FightingUnit) -> bool,
pfx: &Prefix,
)
async fn do_moves_if_target_not_in_range( &mut self, movements: &mut Movement, filter: impl Fn(&FightingUnit) -> bool, pfx: &Prefix, )
Perform movements (and push them to movements) for all units for which filter returns
true, and which do not have their target in range.
Auto Trait Implementations§
impl Freeze for Fight
impl !RefUnwindSafe for Fight
impl Send for Fight
impl Sync for Fight
impl Unpin for Fight
impl !UnwindSafe for Fight
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