third time's the charm

This commit is contained in:
Tao Tien 2026-01-15 14:00:55 -08:00
parent 723cd0b6e4
commit 2b95c642df
18 changed files with 547 additions and 173 deletions

View file

@ -45,7 +45,7 @@ impl Default for MatchSettings {
}
}
#[derive(Component, Clone, Copy, FromRepr, EnumCount)]
#[derive(Component, Clone, Copy, FromRepr, EnumCount, PartialEq)]
pub enum Wind {
Ton,
Nan,
@ -53,6 +53,12 @@ pub enum Wind {
Pei,
}
pub enum WindRelation {
Shimocha,
Toimen,
Kamicha,
}
impl EnumNextCycle for Wind {
fn next(&self) -> Self {
if (*self as usize + 1) >= Self::COUNT {
@ -63,6 +69,18 @@ impl EnumNextCycle for Wind {
}
}
impl Wind {
pub fn relate(&self, other: &Self) -> WindRelation {
if self.next() == *other {
WindRelation::Shimocha
} else if other.next() == *self {
WindRelation::Kamicha
} else {
WindRelation::Toimen
}
}
}
#[derive(Resource)]
pub(crate) struct CurrentPlayer(pub Entity);
@ -97,7 +115,7 @@ pub(crate) fn tsumo(
curr_turnstate: Res<State<TurnState>>,
mut next_turnstate: ResMut<NextState<TurnState>>,
) {
trace!("tsumo for: {:?}", curr_player.0);
debug!("tsumo for: {:?}", curr_player.0);
let drawn = walltiles.last().unwrap();
commands.entity(*wall_ent).remove_child(*drawn);