fmt: repo-wide baseline (WI-2, issue #2)
This commit is contained in:
parent
899fde8fc3
commit
337e9bcf2c
19 changed files with 847 additions and 335 deletions
|
|
@ -18,8 +18,7 @@ pub struct SpellDef {
|
|||
pub heal_max: i32,
|
||||
}
|
||||
|
||||
const SPELLS_JSON: &str =
|
||||
include_str!("../../../../skara-brae-common/data/spells/spells.json");
|
||||
const SPELLS_JSON: &str = include_str!("../../../../skara-brae-common/data/spells/spells.json");
|
||||
|
||||
pub fn load_spells() -> Vec<SpellDef> {
|
||||
serde_json::from_str(SPELLS_JSON).expect("failed to parse spells.json")
|
||||
|
|
@ -31,9 +30,10 @@ pub fn class_for_spells(class: &str) -> &str {
|
|||
|
||||
pub fn spells_for_class(class: &str, spell_level: i32) -> Vec<&'static SpellDef> {
|
||||
let spell_class = class_for_spells(class);
|
||||
ALL_SPELLS.iter().filter(|s| {
|
||||
s.caster_class == spell_class && s.spell_level <= spell_level
|
||||
}).collect()
|
||||
ALL_SPELLS
|
||||
.iter()
|
||||
.filter(|s| s.caster_class == spell_class && s.spell_level <= spell_level)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn find_spell(id: &str) -> Option<&'static SpellDef> {
|
||||
|
|
@ -63,7 +63,10 @@ pub fn max_spell_points(class: &str, level: i32) -> i32 {
|
|||
}
|
||||
|
||||
pub fn is_caster_class(class: &str) -> bool {
|
||||
matches!(class_for_spells(class), "conjurer" | "magician" | "sorcerer" | "wizard")
|
||||
matches!(
|
||||
class_for_spells(class),
|
||||
"conjurer" | "magician" | "sorcerer" | "wizard"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn caster_classes() -> &'static [&'static str] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue