44 lines
802 B
Rust
44 lines
802 B
Rust
use crate::entity::{Entity, Location};
|
|
|
|
#[derive(Clone)]
|
|
pub enum ItemType {
|
|
Weapon(Weapon),
|
|
Armor(Armor),
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct Item {
|
|
pub entity: Entity,
|
|
pub name: String,
|
|
pub item_type: ItemType,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct Weapon {
|
|
pub damage_base: u32,
|
|
pub damage_dice: u32,
|
|
pub damage_sides: u32,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct Armor {
|
|
pub armor_class: u32,
|
|
}
|
|
|
|
|
|
|
|
pub struct ItemGenerator;
|
|
|
|
impl ItemGenerator {
|
|
pub fn generate_item() -> Item {
|
|
Item {
|
|
entity: Entity { id: 0, loc: Location{ x: 0, y: 0 } },
|
|
name: "Sword".to_string(),
|
|
item_type: ItemType::Weapon(Weapon {
|
|
damage_base: 0,
|
|
damage_dice: 1,
|
|
damage_sides: 6,
|
|
}),
|
|
}
|
|
}
|
|
} |