Added more states
+ clippy + fmt
This commit is contained in:
+104
-17
@@ -2,8 +2,7 @@ use crate::config::GlobalData;
|
||||
use crate::error::Error;
|
||||
use j_db::database::Database;
|
||||
use j_db::model::JdbModel;
|
||||
use rand::distributions::Standard;
|
||||
use rand::prelude::Distribution;
|
||||
use rand::distributions::{Distribution, Standard};
|
||||
use rand::{thread_rng, Rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::guild::Emoji;
|
||||
@@ -40,15 +39,15 @@ pub fn draw_dancing(emoji: &Emoji) -> String {
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_tax_fraud(emoji: &Emoji) -> String {
|
||||
pub fn draw_frankenstein(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push(":blue_square::page_with_curl:");
|
||||
msg.push(":blue_square::alembic:");
|
||||
msg.emoji(emoji);
|
||||
msg.push_line(":blue_square::blue_square:");
|
||||
msg.push_line(":microscope::test_tube:");
|
||||
msg.push_line(":green_square::green_square::green_square::green_square::green_square:");
|
||||
|
||||
msg.build()
|
||||
@@ -68,6 +67,48 @@ pub fn draw_sick(emoji: &Emoji) -> String {
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_magic(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push(":blue_square::tophat:");
|
||||
msg.emoji(emoji);
|
||||
msg.push_line(":magic_wand::rabbit2:");
|
||||
msg.push_line(":green_square::green_square::green_square::green_square::green_square:");
|
||||
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_resonance_cascade(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":blue_square::blue_square::orange_square::blue_square::blue_square:");
|
||||
msg.push_line(":yellow_circle::zap::black_large_square::zap::yellow_circle:");
|
||||
msg.push_line(":blue_square::blue_square::zap::blue_square::blue_square:");
|
||||
msg.push(":blue_square::gun:");
|
||||
msg.emoji(emoji);
|
||||
msg.push_line(":gem::blue_square:");
|
||||
msg.push_line(":green_square::green_square::green_square::green_square::green_square:");
|
||||
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_tax_fraud(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push(":blue_square::page_with_curl:");
|
||||
msg.emoji(emoji);
|
||||
msg.push_line(":blue_square::blue_square:");
|
||||
msg.push_line(":green_square::green_square::green_square::green_square::green_square:");
|
||||
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_sleep(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
@@ -82,6 +123,32 @@ pub fn draw_sleep(emoji: &Emoji) -> String {
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_mining(emoji: &Emoji) -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":black_medium_square::black_medium_square::black_medium_square::black_medium_square::black_medium_square:");
|
||||
msg.push_line(":black_medium_square::black_medium_square::black_medium_square::black_medium_square::black_medium_square:");
|
||||
msg.push_line(":black_medium_square::black_medium_square::black_medium_square::black_medium_square::black_medium_square:");
|
||||
msg.push(":black_medium_square::pick:");
|
||||
msg.emoji(emoji);
|
||||
msg.push_line(":gem::black_medium_square:");
|
||||
msg.push_line(":brown_square::brown_square::brown_square::brown_square::brown_square:");
|
||||
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_gone() -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":blue_square::blue_square::blue_square::blue_square::blue_square:");
|
||||
msg.push_line(":green_square::green_square::green_square::green_square::green_square:");
|
||||
|
||||
msg.build()
|
||||
}
|
||||
|
||||
pub fn draw_dead() -> String {
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
@@ -116,6 +183,28 @@ pub enum LilFrenState {
|
||||
Sick,
|
||||
Dancing,
|
||||
Sleep,
|
||||
Magic,
|
||||
AttemptingToCircumventDeath,
|
||||
AttemptingToNotCauseAResonanceCascade,
|
||||
Mining,
|
||||
PhasedIntoYourReality,
|
||||
}
|
||||
|
||||
impl Distribution<LilFrenState> for Standard {
|
||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> LilFrenState {
|
||||
match rng.gen_range(0..10) {
|
||||
0 => LilFrenState::Standing,
|
||||
1 => LilFrenState::TaxFraud,
|
||||
2 => LilFrenState::Sick,
|
||||
3 => LilFrenState::Dancing,
|
||||
4 => LilFrenState::Sleep,
|
||||
5 => LilFrenState::Magic,
|
||||
6 => LilFrenState::AttemptingToCircumventDeath,
|
||||
7 => LilFrenState::AttemptingToNotCauseAResonanceCascade,
|
||||
8 => LilFrenState::Mining,
|
||||
_ => LilFrenState::PhasedIntoYourReality,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialOrd, PartialEq)]
|
||||
@@ -126,18 +215,6 @@ pub enum AliveState {
|
||||
DiedOfThirst,
|
||||
}
|
||||
|
||||
impl Distribution<LilFrenState> for Standard {
|
||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> LilFrenState {
|
||||
match rng.gen_range(0..100) {
|
||||
0..=30 => LilFrenState::Standing,
|
||||
31..=40 => LilFrenState::TaxFraud,
|
||||
41..=50 => LilFrenState::Sick,
|
||||
51..=70 => LilFrenState::Dancing,
|
||||
_ => LilFrenState::Sleep,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct LilFren {
|
||||
id: Option<u64>,
|
||||
@@ -207,6 +284,11 @@ impl LilFren {
|
||||
LilFrenState::Sick => (-0.005, -0.005, -0.001),
|
||||
LilFrenState::Dancing => (-0.005, -0.008, 0.01),
|
||||
LilFrenState::Sleep => (-0.001, -0.002, 0.00),
|
||||
LilFrenState::Magic => (-0.002, -0.002, 0.001),
|
||||
LilFrenState::AttemptingToCircumventDeath => (-0.002, -0.002, 0.001),
|
||||
LilFrenState::AttemptingToNotCauseAResonanceCascade => (-0.004, -0.004, 0.004),
|
||||
LilFrenState::Mining => (-0.006, -0.006, 0.001),
|
||||
LilFrenState::PhasedIntoYourReality => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
lil_fren.hunger = (lil_fren.hunger + hunger_diff * self.metabolism).clamp(-1.0, 1.0);
|
||||
@@ -244,6 +326,11 @@ impl LilFren {
|
||||
LilFrenState::Sick => draw_sick(emoji),
|
||||
LilFrenState::Dancing => draw_dancing(emoji),
|
||||
LilFrenState::Sleep => draw_sleep(emoji),
|
||||
LilFrenState::Magic => draw_magic(emoji),
|
||||
LilFrenState::AttemptingToCircumventDeath => draw_frankenstein(emoji),
|
||||
LilFrenState::AttemptingToNotCauseAResonanceCascade => draw_resonance_cascade(emoji),
|
||||
LilFrenState::Mining => draw_mining(emoji),
|
||||
LilFrenState::PhasedIntoYourReality => draw_gone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user