logic_constructor 0.1.0

Move combat and ability logic out of code and into HOCON config — designers tweak damage, healing, and targeting in a text file; the engine parses it into typed actions and runs them against your entities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::lc_action_config::LcActionConfig;
use crate::lc_entity::LcEntity;
use crate::lc_entity_type::LcEntityType;
use crate::run::run_lca;

/// Helper struct for tying together source with an action.
#[derive(Clone)]
pub struct LcSourceWithAction<T: LcEntityType> {
    pub source: LcEntity<T>,
    pub action_config: LcActionConfig<T>,
}

impl<T: LcEntityType> LcSourceWithAction<T> {
    pub fn run(&self, target: &LcEntity<T>) {
        run_lca(&self.action_config, &self.source, target);
    }
}