diff options
author | Hop311 <Hop3114@gmail.com> | 2024-01-02 15:40:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-02 15:40:00 +0100 |
commit | 4c8da86c3bede8834f381fa63edaa3e140131f69 (patch) | |
tree | ff3433a63e91b9239eb7226e75054314182d6c1f /src/openvic-simulation/misc/Modifier.hpp | |
parent | 66b80459c9d49895de902432bce11176b1270878 (diff) | |
parent | 5f64f983d0cead266a28791be42162c443fd2a75 (diff) |
Merge pull request #112 from OpenVicProject/script-framework
Added framework for loading all Conditions and Effects
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.hpp')
-rw-r--r-- | src/openvic-simulation/misc/Modifier.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/openvic-simulation/misc/Modifier.hpp b/src/openvic-simulation/misc/Modifier.hpp index f3a2499..033cc47 100644 --- a/src/openvic-simulation/misc/Modifier.hpp +++ b/src/openvic-simulation/misc/Modifier.hpp @@ -1,5 +1,6 @@ #pragma once +#include "openvic-simulation/scripts/ConditionScript.hpp" #include "openvic-simulation/types/IdentifierRegistry.hpp" namespace OpenVic { @@ -83,10 +84,14 @@ namespace OpenVic { friend struct ModifierManager; private: - // TODO - trigger condition + ConditionScript trigger; protected: - TriggeredModifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon); + TriggeredModifier( + std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger + ); + + bool parse_scripts(GameManager const& game_manager); public: TriggeredModifier(TriggeredModifier&&) = default; @@ -139,9 +144,13 @@ namespace OpenVic { bool add_static_modifier(std::string_view identifier, ModifierValue&& values); bool load_static_modifiers(ast::NodeCPtr root); - bool add_triggered_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon); + bool add_triggered_modifier( + std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger + ); bool load_triggered_modifiers(ast::NodeCPtr root); + bool parse_scripts(GameManager const& game_manager); + NodeTools::node_callback_t expect_validated_modifier_value_and_default( NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, ModifierEffectValidator auto effect_validator |