2019-07-21 12:42:45 +00:00
|
|
|
use rand::{seq::SliceRandom, thread_rng};
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
pub enum Body {
|
|
|
|
Bomb,
|
|
|
|
Scarecrow,
|
2019-07-22 12:23:22 +00:00
|
|
|
Cauldron,
|
2019-07-21 23:54:31 +00:00
|
|
|
ChestVines,
|
2019-07-21 12:42:45 +00:00
|
|
|
Chest,
|
2019-07-21 23:54:31 +00:00
|
|
|
ChestDark,
|
|
|
|
ChestDemon,
|
|
|
|
ChestGold,
|
|
|
|
ChestLight,
|
|
|
|
ChestOpen,
|
|
|
|
ChestSkull,
|
|
|
|
Pumpkin1,
|
|
|
|
Pumpkin2,
|
|
|
|
Pumpkin3,
|
|
|
|
Pumpkin4,
|
|
|
|
Pumpkin5,
|
|
|
|
Campfire,
|
|
|
|
LanternGround,
|
|
|
|
LanternGroundOpen,
|
|
|
|
LanternStanding2,
|
|
|
|
LanternStanding,
|
|
|
|
PotionBlue,
|
|
|
|
PotionGreen,
|
|
|
|
PotionRed,
|
|
|
|
Crate,
|
2019-07-23 21:43:08 +00:00
|
|
|
Tent,
|
2019-07-21 12:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Body {
|
|
|
|
pub fn random() -> Self {
|
|
|
|
let mut rng = thread_rng();
|
|
|
|
*(&ALL_OBJECTS).choose(&mut rng).unwrap()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-23 11:38:56 +00:00
|
|
|
const ALL_OBJECTS: [Body; 26] = [
|
2019-07-21 23:54:31 +00:00
|
|
|
Body::Bomb,
|
|
|
|
Body::Scarecrow,
|
2019-07-22 12:23:22 +00:00
|
|
|
Body::Cauldron,
|
2019-07-21 23:54:31 +00:00
|
|
|
Body::ChestVines,
|
|
|
|
Body::Chest,
|
|
|
|
Body::ChestDark,
|
|
|
|
Body::ChestDemon,
|
|
|
|
Body::ChestGold,
|
|
|
|
Body::ChestLight,
|
|
|
|
Body::ChestOpen,
|
|
|
|
Body::ChestSkull,
|
|
|
|
Body::Pumpkin1,
|
|
|
|
Body::Pumpkin2,
|
|
|
|
Body::Pumpkin3,
|
|
|
|
Body::Pumpkin4,
|
|
|
|
Body::Pumpkin5,
|
|
|
|
Body::Campfire,
|
|
|
|
Body::LanternGround,
|
|
|
|
Body::LanternGroundOpen,
|
|
|
|
Body::LanternStanding,
|
|
|
|
Body::LanternStanding2,
|
|
|
|
Body::PotionRed,
|
|
|
|
Body::PotionBlue,
|
|
|
|
Body::PotionGreen,
|
|
|
|
Body::Crate,
|
2019-07-23 21:43:08 +00:00
|
|
|
Body::Tent,
|
2019-07-21 23:54:31 +00:00
|
|
|
];
|