pub struct Threats<P> { /* private fields */ }Expand description
The threats of one side, in the game’s order. Answers which reach a tile, whether a tile is safe, the danger zone, and the danger at a tile by the game’s forecast.
Implementations§
Source§impl<P> Threats<P>
impl<P> Threats<P>
Sourcepub fn reaches(&self, at: Pos) -> impl Iterator<Item = &P> + '_
pub fn reaches(&self, at: Pos) -> impl Iterator<Item = &P> + '_
The pieces whose area holds at, in order. Allocates nothing.
Sourcepub fn zone(&self) -> TileSet
pub fn zone(&self) -> TileSet
Every tile some threat reaches: the danger zone. Its grid is the
first threat’s (an empty 0 × 0 set when there is none); a tile
of another threat outside that grid is left out.
Sourcepub fn danger(
&self,
at: Pos,
strike: impl FnMut(&P) -> Option<Strike>,
) -> Danger
pub fn danger( &self, at: Pos, strike: impl FnMut(&P) -> Option<Strike>, ) -> Danger
The danger at at: the sum of strike(piece) over every threat
that reaches at and that strike answers Some for (None: the
piece wouldn’t strike there, as a healer wouldn’t). Every threat
counts, with no guess at which the other side will choose (module
docs). Rounding and caps (at most the target’s health, a share of
the striker’s) are the game’s, on the sums or in strike. Sums
saturate.