pub struct Battle<'a> {
pub round: u32,
pub started: Option<BattleSide>,
pub left: BattleTeam<'a>,
pub right: BattleTeam<'a>,
pub rng: Rng,
}
Fields§
§round: u32
§started: Option<BattleSide>
§left: BattleTeam<'a>
§right: BattleTeam<'a>
§rng: Rng
Implementations§
Source§impl<'a> Battle<'a>
impl<'a> Battle<'a>
pub fn new( left: &'a mut [BattleFighter], right: &'a mut [BattleFighter], ) -> Self
Sourcepub fn simulate(&mut self, logger: &mut impl BattleLogger) -> BattleSide
pub fn simulate(&mut self, logger: &mut impl BattleLogger) -> BattleSide
Simulates a battle between the two sides. Returns the winning side.
pub fn reset(&mut self)
Sourcepub fn simulate_turn(
&mut self,
logger: &mut impl BattleLogger,
) -> Option<BattleSide>
pub fn simulate_turn( &mut self, logger: &mut impl BattleLogger, ) -> Option<BattleSide>
Simulates one turn (attack) in a battle. If one side is not able to fight anymore, or is for another reason invalid, the other side is returned as the winner
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Battle<'a>
impl<'a> RefUnwindSafe for Battle<'a>
impl<'a> Send for Battle<'a>
impl<'a> Sync for Battle<'a>
impl<'a> Unpin for Battle<'a>
impl<'a> !UnwindSafe for Battle<'a>
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