2021-12-23 11:00:37 -05:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2021-12-24 10:38:44 -05:00
|
|
|
use ::serde::Deserialize;
|
2021-12-23 11:00:37 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Item {
|
|
|
|
pub name: String,
|
|
|
|
pub renderable: Option<Renderable>,
|
|
|
|
pub consumable: Option<Consumable>,
|
2021-12-23 12:05:56 -05:00
|
|
|
pub weapon: Option<Weapon>,
|
|
|
|
pub shield: Option<Shield>,
|
2021-12-23 11:00:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Renderable {
|
|
|
|
pub glyph: String,
|
|
|
|
pub fg: String,
|
|
|
|
pub bg: String,
|
|
|
|
pub order: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Consumable {
|
|
|
|
pub effects: HashMap<String, String>,
|
|
|
|
}
|
2021-12-23 12:05:56 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Weapon {
|
|
|
|
pub range: String,
|
|
|
|
pub power_bonus: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Shield {
|
|
|
|
pub defense_bonus: i32,
|
|
|
|
}
|