flatland-client-ui 0.2.15

Engine-agnostic play client UI state (world grid, input, presentation)
Documentation
//! Rotation preset editor helpers shared by gfx (and archived TUI).

use flatland_protocol::RotationPreset;

/// Open-kit abilities available in the picker (progression gating deferred).
pub const EDITOR_ABILITIES: &[&str] = &[
    "unarmed",
    "short_sword_slash",
    "iron_sword_slash",
    "bow_shot",
    "arrow_shot",
    "fireball",
    "cone_frost",
    "frost_nova",
    "poison_dart",
    "heal_touch",
];

const BUILTIN_PRESET_IDS: &[&str] = &["melee", "ranged", "spells"];

pub fn preset_deletable(id: &str) -> bool {
    !BUILTIN_PRESET_IDS.contains(&id)
}

pub fn next_custom_preset(presets: &[RotationPreset]) -> RotationPreset {
    let mut n = 1u32;
    loop {
        let id = format!("custom_{n}");
        if !presets.iter().any(|p| p.id == id) {
            return RotationPreset {
                id,
                label: format!("Custom {n}"),
                abilities: Vec::new(),
            };
        }
        n += 1;
    }
}