broken-battle/src/equipment/comp.rs
2023-08-14 15:50:27 -05:00

134 lines
4.3 KiB
Rust

use crate::statistics::StatBlock;
#[derive(Debug, Clone)]
pub struct Comp {
id: String, // Unique Item ID
name: String, // Display Name
slots: u8, // Spell slots, between 1 and 10
mstorage: u8, // Spell storage, powers of 2, 16-128 (MiB)
gstorage: u8, // Program storage, powers of 2, 8-32 (GiB)
stat_mods: StatBlock, // Bufs/debufs
flavor: String, // Flavortext
description: String, // Description text
}
impl Comp {
pub fn new() -> Self {
Self {
id: String::from("COMP_BLANK"),
name: String::from("Basic DMD"),
slots: 1,
mstorage: 16,
gstorage: 8,
stat_mods: StatBlock::new_zero(),
flavor: String::from("A basic bitch digital magick device"),
description: String::from(
"One spell slot, 16MiB of spell storage, and 8GiB of program storage",
),
}
}
pub fn id(self) -> String {
self.id
}
pub fn name(self) -> String {
self.name
}
pub fn slots(self) -> u8 {
self.slots
}
pub fn spell_storage(self) -> u8 {
self.mstorage
}
pub fn program_storage(self) -> u8 {
self.gstorage
}
pub fn stat_mods(self) -> StatBlock {
self.stat_mods
}
pub fn description(self) -> String {
self.description
}
pub fn flavor(self) -> String {
self.flavor
}
// Low teir gear
pub fn cef_8080() -> Self {
Self {
id: String::from("COMP_CEF_8080"),
name: String::from("CEF 8080"),
slots: 1,
mstorage: 16,
gstorage: 8,
stat_mods: StatBlock::new_zero(),
flavor: String::from("Mass produced garbage."),
description: String::from(
"One spell slot, 16MiB of spell storage, and 8GiB of program storage.",
),
}
}
pub fn chiba_e3() -> Self {
let mut stat_mods = StatBlock::new_zero();
stat_mods.set_intellect(1);
Self {
id: String::from("COMP_CHIBA_E3"),
name: String::from("Chiba E3"),
slots: 1,
mstorage: 16,
gstorage: 8,
stat_mods,
flavor: String::from("Handmade with love by Gideon Chiba, good luck out there trainee!"),
description: String::from("+1 Intellect, 1 spell slot, 16MiB of spell storage, 8GiB of program storage."),
}
}
pub fn spiceworks_v3() -> Self {
let mut stat_mods = StatBlock::new_zero();
stat_mods.set_magick(1);
Self {
id: String::from("COMP_SPICE_V3"),
name: String::from("Spiceworks V3"),
slots: 2,
mstorage: 16,
gstorage: 8,
stat_mods,
flavor: String::from("A heart is scratched into the side."),
description: String::from("+1 Magick, 2 spell slots, 16MiB of spell storage, 8GiB of program storage."),
}
}
// Mid teir gear
pub fn chiba_d35() -> Self {
let mut mods = StatBlock::new_zero();
mods.set_intellect(3);
Self {
id: String::from("COMP_CHIBA_D35"),
name: String::from("Chiba D35"),
slots: 6,
mstorage: 64,
gstorage: 16,
stat_mods: mods,
flavor: String::from("The hottest new offering from Gideon Chiba's handcrafted digital magick devices"),
description: String::from("+3 Intellect, six spell slots, 64MiB of spell storage, and 16GiB of program storage"),
}
}
pub fn cef_8081() -> Self {
Self {
id: String::from("COMP_CEF_8081"),
name: String::from("CEF 8081"),
slots: 5,
mstorage: 128,
gstorage: 16,
stat_mods: StatBlock::new_zero(),
flavor: String::from("Mass produced garbage."),
description: String::from("Five spell slots, 128MiB of spell storage, and 16GiB of program storage."),
}
}
// Gear Sets for AI unit generation
pub fn low_level_opts() -> [Self; 3] {
[Self::cef_8080(), Self::chiba_e3(), Self::spiceworks_v3()]
}
pub fn mid_level_opts() -> [Self; 2] {
[Self::chiba_d35(), Self::cef_8081()]
}
}