Skip to main content

dotzuki_engine/
render_data.rs

1use std::fmt::Debug;
2
3/// Provides render-time string and metadata lookups for game entities.
4///
5/// This trait abstracts the display layer so that the UI and renderer
6/// can query move names, item names, species names, and move metadata
7/// without depending on concrete data types. This enables the engine
8/// to remain generic across different RPG games.
9pub trait RenderData {
10    /// The type representing a move (ability/skill) in the game.
11    type Move: Copy + Eq + Debug;
12
13    /// The type representing an item in the game.
14    type Item: Copy + Eq + Debug;
15
16    /// The type representing a species (monster/character type) in the game.
17    type Species: Copy + Eq + Debug;
18
19    /// Returns the display name of a move.
20    fn move_name(&self, m: Self::Move) -> &str;
21
22    /// Returns the PP (power points) for a move as `(current_max, base_max)`.
23    ///
24    /// Some moves have PP that can be boosted beyond their base value
25    /// (e.g., via PP Up items), so both values are returned.
26    fn move_pp(&self, m: Self::Move) -> (u8, u8);
27
28    /// Returns the type ID (element/attribute) of a move.
29    fn move_type(&self, m: Self::Move) -> u8;
30
31    /// Returns the display name of an item.
32    fn item_name(&self, i: Self::Item) -> &str;
33
34    /// Returns the display name of a species.
35    fn species_name(&self, s: Self::Species) -> &str;
36}