diff --git a/src/entities/mock.rs b/src/entities/mock.rs index 97a79f1..1f3a2c2 100644 --- a/src/entities/mock.rs +++ b/src/entities/mock.rs @@ -184,10 +184,22 @@ fn generate_mock_contact_book () -> ContactBook { } -/// Demo prepared spells. Currently an empty list — `Spell` is a stub. +/// Demo prepared spells: a vacant slot, two known spells, one more +/// vacant slot. The UI can fill and empty slots freely. fn generate_prepared_spells_list () -> PreparedSpells { let list = vec![ - + PreparedSpell::Vacant, + PreparedSpell::Occupied(Spell { + name: "Огненный шар".to_string(), + level: Some(3), + description: Some("Вспышка пламени в точке, радиус 6 м.".to_string()), + }), + PreparedSpell::Occupied(Spell { + name: "Магическая броня".to_string(), + level: Some(1), + description: None, + }), + PreparedSpell::Vacant, ]; PreparedSpells(list) diff --git a/src/entities/mod.rs b/src/entities/mod.rs index a035ed5..3575b8a 100644 --- a/src/entities/mod.rs +++ b/src/entities/mod.rs @@ -265,12 +265,13 @@ pub enum PreparedSpell { Occupied (Spell) } -/// A spell. Only the name exists so far; the rest is a `@TODO` -/// (see ROADMAP phase 2). -// @TODO -#[derive(Clone, Debug, Store, Serialize, Deserialize)] +/// A spell: the name plus optional level and description. +/// Optional fields keep old saved JSON (name-only spells) parseable. +#[derive(Clone, Debug, Store, Serialize, Deserialize, Default)] pub struct Spell { - pub name: String + pub name: String, + pub level: Option, + pub description: Option, } /// Hit dice: how many of the current die kind are already spent.