entities: Spell gains optional level/description; demo spells
- Spell is no longer a name-only stub: optional level and description (serde skips missing fields, so old saved JSON stays parseable) - mock: demo prepared spells — two vacant slots, Огненный шар (level 3, with description) and Магическая броня (level 1)
This commit is contained in:
parent
bb304bed6a
commit
c825b867d1
@ -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)
|
||||
|
||||
@ -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<u8>,
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
/// Hit dice: how many of the current die kind are already spent.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user