Switched to using POST, bugfixes📨

This commit is contained in:
Seoxi Ryouko
2025-02-28 07:49:21 -06:00
parent 066a9472ac
commit e0eb67b299
3 changed files with 58 additions and 56 deletions

View File

@ -176,7 +176,9 @@ pub fn yoink(game_state: &mut GameState, deck_index: usize, player: Player) {
id: game_state.events.len(),
event: Event::Yoink(player.clone()),
});
player_hand.cards.push(game_state.deck.remove(deck_index).unwrap());
player_hand
.cards
.push(game_state.deck.remove(deck_index).unwrap());
}
pub fn yoink_mill(game_state: &mut GameState, deck_index: usize, shadow: bool) {
@ -190,7 +192,6 @@ pub fn yoink_mill(game_state: &mut GameState, deck_index: usize, shadow: bool) {
} else {
game_state.discard_pile.push(card);
}
}
pub fn shuffle(game_state: &mut GameState, player: Player) {

View File

@ -26,7 +26,7 @@ fn get_events(game_state_arc: &State<ArcMutexGameState>) -> String {
format!("{}", game::get_events(&game_state))
}
#[get("/<uuid>/shuffle")]
#[post("/<uuid>/shuffle")]
fn shuffle(
uuid: Uuid,
game_state_arc: &State<ArcMutexGameState>,
@ -42,7 +42,7 @@ fn shuffle(
Ok(format!("Deck Shuffled!"))
}
#[get("/<uuid>/pass")]
#[post("/<uuid>/pass")]
fn pass(
uuid: Uuid,
game_state_arc: &State<ArcMutexGameState>,
@ -58,7 +58,7 @@ fn pass(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/bounce/<play_id>")]
#[post("/<uuid>/bounce/<play_id>")]
fn bounce(
uuid: Uuid,
play_id: Uuid,
@ -75,7 +75,7 @@ fn bounce(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/move/<play_id>/<x>/<y>")]
#[post("/<uuid>/move/<play_id>/<x>/<y>")]
fn move_card(
uuid: Uuid,
play_id: Uuid,
@ -94,7 +94,7 @@ fn move_card(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/tap/<play_id>")]
#[post("/<uuid>/tap/<play_id>")]
fn tap(
uuid: Uuid,
play_id: Uuid,
@ -111,7 +111,7 @@ fn tap(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/play/<index>")]
#[post("/<uuid>/play/<index>")]
fn play(
uuid: Uuid,
index: usize,
@ -128,7 +128,7 @@ fn play(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/unkill/<index>")]
#[post("/<uuid>/unkill/<index>")]
fn unkill(
uuid: Uuid,
index: usize,
@ -145,7 +145,7 @@ fn unkill(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/unbanish/<index>")]
#[post("/<uuid>/unbanish/<index>")]
fn unbanish(
uuid: Uuid,
index: usize,
@ -162,7 +162,7 @@ fn unbanish(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/discard/<index>")]
#[post("/<uuid>/discard/<index>")]
fn discard(
uuid: Uuid,
index: usize,
@ -179,7 +179,7 @@ fn discard(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/forget/<index>")]
#[post("/<uuid>/forget/<index>")]
fn forget(
uuid: Uuid,
index: usize,
@ -196,7 +196,7 @@ fn forget(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/kill/<play_id>")]
#[post("/<uuid>/kill/<play_id>")]
fn kill(
uuid: Uuid,
play_id: Uuid,
@ -213,7 +213,7 @@ fn kill(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/banish/<play_id>")]
#[post("/<uuid>/banish/<play_id>")]
fn banish(
uuid: Uuid,
play_id: Uuid,
@ -230,7 +230,7 @@ fn banish(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/unshadow/<index>")]
#[post("/<uuid>/unshadow/<index>")]
fn unshadow(
uuid: Uuid,
index: usize,
@ -247,7 +247,7 @@ fn unshadow(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/yoink/<index>")]
#[post("/<uuid>/yoink/<index>")]
fn yoink(
uuid: Uuid,
index: usize,
@ -264,7 +264,7 @@ fn yoink(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/yoink_mill/<index>")]
#[post("/<uuid>/yoink_mill/<index>")]
fn yoink_mill(
uuid: Uuid,
index: usize,
@ -281,7 +281,7 @@ fn yoink_mill(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/yoink_xmill/<index>")]
#[post("/<uuid>/yoink_xmill/<index>")]
fn yoink_xmill(
uuid: Uuid,
index: usize,
@ -298,7 +298,7 @@ fn yoink_xmill(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/undiscard/<index>")]
#[post("/<uuid>/undiscard/<index>")]
fn undiscard(
uuid: Uuid,
index: usize,
@ -315,7 +315,7 @@ fn undiscard(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/remember/<index>")]
#[post("/<uuid>/remember/<index>")]
fn remember(
uuid: Uuid,
index: usize,
@ -332,7 +332,7 @@ fn remember(
Ok(format!("{}", game::get_events(&game_state)))
}
#[get("/<uuid>/shadow/<index>")]
#[post("/<uuid>/shadow/<index>")]
fn shadow(
uuid: Uuid,
index: usize,
@ -367,7 +367,7 @@ fn get_state(
))
}
#[get("/<uuid>/get_deck")]
#[post("/<uuid>/get_deck")]
fn get_deck(
uuid: Uuid,
game_state_arc: &State<ArcMutexGameState>,
@ -385,7 +385,7 @@ fn get_deck(
))
}
#[get("/<uuid>/untap_all")]
#[post("/<uuid>/untap_all")]
fn untap_all(
uuid: Uuid,
game_state_arc: &State<ArcMutexGameState>,
@ -404,7 +404,7 @@ fn untap_all(
))
}
#[get("/<uuid>/draw/<count>")]
#[post("/<uuid>/draw/<count>")]
fn draw(
uuid: Uuid,
count: usize,
@ -424,7 +424,7 @@ fn draw(
))
}
#[get("/<uuid>/fade/<index>")]
#[post("/<uuid>/fade/<index>")]
fn fade(
uuid: Uuid,
index: usize,
@ -444,7 +444,7 @@ fn fade(
))
}
#[get("/<uuid>/fade-bottom/<index>")]
#[post("/<uuid>/fade-bottom/<index>")]
fn fade_bottom(
uuid: Uuid,
index: usize,
@ -464,7 +464,7 @@ fn fade_bottom(
))
}
#[get("/<uuid>/life/<count>")]
#[post("/<uuid>/life/<count>")]
fn life(
uuid: Uuid,
count: i32,