From 67cc148bb8eebf44294644b7a51081109b6800c8 Mon Sep 17 00:00:00 2001 From: Seoxi Ryouko <3-Seoxi@users.noreply.git.starbit.dev> Date: Sun, 2 Mar 2025 07:56:35 -0600 Subject: [PATCH] =?UTF-8?q?Made=20condition=20more=20consistent?= =?UTF-8?q?=F0=9F=93=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game.rs b/src/game.rs index 282efba..3c0c7e0 100644 --- a/src/game.rs +++ b/src/game.rs @@ -358,9 +358,9 @@ pub fn discard( Player::B => &mut game_state.hands[1], }; gen_event!(game_state.events, Event::Discard(player.clone())); - if None == player_hand.cards.get(hand_index) { - return Err(format!("Discard index out of bounds: {}", hand_index)); - } + if None == player_hand.cards.get(hand_index) { + return Err(format!("Discard index out of bounds: {}", hand_index)); + } let card = player_hand.cards.remove(hand_index); if shadow { game_state.shadow_realm.push(card); @@ -386,7 +386,7 @@ pub fn undiscard( &mut game_state.discard_pile }; if None == pile.get(pile_index) { - return Err(format!("Discard index out of bounds: {}", pile_index)); + return Err(format!("Discard index out of bounds: {}", pile_index)); } gen_event!(game_state.events, Event::Undiscard(player.clone())); player_hand.cards.push(pile.remove(pile_index)); @@ -422,7 +422,7 @@ pub fn unkill( &mut game_state.discard_pile }; if None == pile.get(pile_index) { - let pile_name = if shadow { + let pile_name = if shadow { "shadow realm" } else { "discard pile" @@ -430,7 +430,7 @@ pub fn unkill( return Err(format!( "Transfer index out of bounds: {} ({})", pile_index, pile_name - )); + )); } let card = pile.remove(pile_index); gen_event!(game_state.events, Event::Unkill(card, shadow)); @@ -460,7 +460,7 @@ pub fn transfer_dead_card( (&mut game_state.discard_pile, &mut game_state.shadow_realm) }; - if pile_index >= source.len() { + if None == source.get(pile_index) { let direction = if shadow_to_discard { "shadow realm -> discard pile" } else {