Made condition more consistent📄

This commit is contained in:
Seoxi Ryouko
2025-03-02 07:56:35 -06:00
parent 159126e7ca
commit 67cc148bb8

View File

@ -358,9 +358,9 @@ pub fn discard(
Player::B => &mut game_state.hands[1], Player::B => &mut game_state.hands[1],
}; };
gen_event!(game_state.events, Event::Discard(player.clone())); gen_event!(game_state.events, Event::Discard(player.clone()));
if None == player_hand.cards.get(hand_index) { if None == player_hand.cards.get(hand_index) {
return Err(format!("Discard index out of bounds: {}", hand_index)); return Err(format!("Discard index out of bounds: {}", hand_index));
} }
let card = player_hand.cards.remove(hand_index); let card = player_hand.cards.remove(hand_index);
if shadow { if shadow {
game_state.shadow_realm.push(card); game_state.shadow_realm.push(card);
@ -386,7 +386,7 @@ pub fn undiscard(
&mut game_state.discard_pile &mut game_state.discard_pile
}; };
if None == pile.get(pile_index) { 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())); gen_event!(game_state.events, Event::Undiscard(player.clone()));
player_hand.cards.push(pile.remove(pile_index)); player_hand.cards.push(pile.remove(pile_index));
@ -422,7 +422,7 @@ pub fn unkill(
&mut game_state.discard_pile &mut game_state.discard_pile
}; };
if None == pile.get(pile_index) { if None == pile.get(pile_index) {
let pile_name = if shadow { let pile_name = if shadow {
"shadow realm" "shadow realm"
} else { } else {
"discard pile" "discard pile"
@ -460,7 +460,7 @@ pub fn transfer_dead_card(
(&mut game_state.discard_pile, &mut game_state.shadow_realm) (&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 { let direction = if shadow_to_discard {
"shadow realm -> discard pile" "shadow realm -> discard pile"
} else { } else {