Skip to content

Commit 9402b63

Browse files
committed
Fix some errors found in playtesting
1 parent a4a1d01 commit 9402b63

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

discord/partial_id/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ pub fn derive_partial(input: proc_macro::TokenStream) -> proc_macro::TokenStream
113113
#where_clause
114114
{
115115
#vis async fn update(&mut self, client: &crate::request::Bot) -> crate::request::Result<()> {
116-
let full: #ty = crate::request::Request::request(crate::request::HttpRequest::get(crate::resource::Endpoint::uri(&self.id)), client).await?;
117-
*self = full.into();
116+
let full: #ty #ty_generics = crate::request::Request::request(crate::request::HttpRequest::get(crate::resource::Endpoint::uri(&self.id)), client).await?;
117+
*self = ::core::convert::Into::into(full);
118118
crate::request::Result::Ok(())
119119
}
120120
#vis async fn get_field<T>(&mut self, client: &crate::request::Bot, f: fn(&Self) -> &::core::option::Option<T>) -> crate::request::Result<&T> {

src/cah/mod.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum CardData {
3434
impl CardData {
3535
fn blanks(&self) -> usize {
3636
match *self {
37-
CardData::Raw(ref s) => s.chars().filter(|&c| c == '_').count().min(1),
37+
CardData::Raw(ref s) => s.chars().filter(|&c| c == '_').count().max(1),
3838
CardData::Full { pick, .. } => pick,
3939
}
4040
}
@@ -287,6 +287,7 @@ impl Packs {
287287
let (pack, start_index) = start_indices
288288
.into_iter()
289289
.enumerate()
290+
.rev()
290291
.find(|&(_, t)| random >= t)
291292
.unwrap();
292293
let card = random - start_index;
@@ -318,6 +319,7 @@ impl Packs {
318319
let (pack, start_index) = start_indices
319320
.into_iter()
320321
.enumerate()
322+
.rev()
321323
.find(|&(_, t)| random >= t)
322324
.unwrap();
323325
let card = random - start_index;
@@ -525,10 +527,23 @@ impl Game for CAH {
525527
fn new(user: User) -> Self {
526528
CAH::Setup(setup::Setup::new(
527529
user,
528-
Packs(vec![Arc::new((
529-
"CAH Base".into(),
530-
serde_json::from_str(read_to_string("cards/base.json").unwrap().as_str()).unwrap(),
531-
))]),
530+
Packs(vec![
531+
Arc::new((
532+
"CAH Base".into(),
533+
serde_json::from_str(read_to_string("cards/base.json").unwrap().as_str())
534+
.unwrap(),
535+
)),
536+
Arc::new((
537+
"EPPgroep.".into(),
538+
serde_json::from_str(read_to_string("cards/eppgroep.json").unwrap().as_str())
539+
.unwrap(),
540+
)),
541+
Arc::new((
542+
"EPPgroep.".into(),
543+
serde_json::from_str(read_to_string("cards/eppgroep.json").unwrap().as_str())
544+
.unwrap(),
545+
)),
546+
]),
532547
))
533548
}
534549

src/game/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55
};
66

77
use async_trait::async_trait;
8-
use futures_util::future::try_join_all;
8+
use futures_util::future::{join_all, try_join_all};
99

1010
use discord::{
1111
channel::ChannelResource,
@@ -190,7 +190,7 @@ impl GameUI {
190190
Ok(())
191191
}
192192
pub async fn delete_replies(&mut self) -> Result<()> {
193-
try_join_all(self.replies.drain().map(|(_, (_, id))| id.delete(&Webhook))).await?;
193+
join_all(self.replies.drain().map(|(_, (_, id))| id.delete(&Webhook))).await;
194194
Ok(())
195195
}
196196
}

0 commit comments

Comments
 (0)