diff --git a/data/auras/aura.cpp b/data/auras/aura.cpp index 28b9132..1fb275c 100644 --- a/data/auras/aura.cpp +++ b/data/auras/aura.cpp @@ -23,6 +23,7 @@ SOFTWARE. #include "aura.h" #include "../../entities/resources/entity_resource_cost_data.h" +#include "../../singletons/entity_data_manager.h" int Aura::get_id() const { return _id; @@ -80,6 +81,13 @@ void Aura::set_rank(const int value) { _rank = value; } +bool Aura::get_scale_with_level() const { + return _scale_with_level; +} +void Aura::set_scale_with_level(const bool value) { + _scale_with_level = value; +} + String Aura::get_text_translation_key() const { return _text_translation_key; } @@ -153,13 +161,13 @@ void Aura::set_teaches_spell(const Ref &spell) { /* void Aura::SetScalingData(AbilityScalingData *scalingData) { - scalingData->getDamageCurve(); - scalingData->getAbsorbCurve(); - scalingData->getHealingCurve(); +scalingData->getDamageCurve(); +scalingData->getAbsorbCurve(); +scalingData->getHealingCurve(); }*/ /* void Aura::OnAuraAbilityScalingDataLoaded(AbilityScalingDataLoaderHelper *h) { - this->SetScalingData(h->getData()); +this->SetScalingData(h->getData()); } */ @@ -325,6 +333,7 @@ Aura::Aura() { _is_debuff = false; _hide = false; _rank = 0; + _scale_with_level = EntityDataManager::get_instance()->get_scale_spells_by_default(); _damage_enabled = false; _damage_type = 0; @@ -1571,6 +1580,10 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("set_rank", "value"), &Aura::set_rank); ADD_PROPERTY(PropertyInfo(Variant::INT, "rank"), "set_rank", "get_rank"); + ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Aura::get_scale_with_level); + ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Aura::set_scale_with_level); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level"); + ClassDB::bind_method(D_METHOD("get_aura_type"), &Aura::get_aura_type); ClassDB::bind_method(D_METHOD("set_aura_type", "value"), &Aura::set_aura_type); ADD_PROPERTY(PropertyInfo(Variant::INT, "aura_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_AURA_TYPES), "set_aura_type", "get_aura_type"); diff --git a/data/auras/aura.h b/data/auras/aura.h index 9a23ae6..c609e5c 100644 --- a/data/auras/aura.h +++ b/data/auras/aura.h @@ -85,6 +85,9 @@ public: int get_rank() const; void set_rank(const int value); + bool get_scale_with_level() const; + void set_scale_with_level(const bool value); + String get_text_translation_key() const; void set_text_translation_key(const String &value); @@ -404,6 +407,7 @@ private: String _text_description; int ability_scale_data_id; int _rank; + bool _scale_with_level; Ref _visual_spell_effects; diff --git a/data/spells/spell.cpp b/data/spells/spell.cpp index 3296d02..38e706e 100644 --- a/data/spells/spell.cpp +++ b/data/spells/spell.cpp @@ -30,6 +30,8 @@ SOFTWARE. #include "../../entities/auras/aura_data.h" +#include "../../singletons/entity_data_manager.h" + int Spell::get_id() const { return _id; } @@ -794,7 +796,7 @@ Spell::Spell() { _level = 1; _rank = 0; - _scale_with_level = true; + _scale_with_level = EntityDataManager::get_instance()->get_scale_spells_by_default(); _global_cooldown_enabled = true; _is_local_spell = false; @@ -1137,6 +1139,10 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_needs_target", "value"), &Spell::set_needs_target); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "needs_target"), "set_needs_target", "get_needs_target"); + ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Spell::get_scale_with_level); + ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Spell::set_scale_with_level); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level"); + ClassDB::bind_method(D_METHOD("get_visual_spell_effects"), &Spell::get_visual_spell_effects); ClassDB::bind_method(D_METHOD("set_visual_spell_effects", "value"), &Spell::set_visual_spell_effects); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "visual_spell_effects", PROPERTY_HINT_RESOURCE_TYPE, "SpellEffectVisual"), "set_visual_spell_effects", "get_visual_spell_effects"); @@ -1199,11 +1205,6 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("get_description", "class_level", "character_level"), &Spell::get_description); ClassDB::bind_method(D_METHOD("_get_description", "class_level", "character_level"), &Spell::_get_description); - ADD_GROUP("Scaling", "scale"); - ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Spell::get_scale_with_level); - ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Spell::set_scale_with_level); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level"); - ADD_GROUP("Cooldown", "cooldown"); ClassDB::bind_method(D_METHOD("get_cooldown"), &Spell::get_cooldown); ClassDB::bind_method(D_METHOD("set_cooldown", "value"), &Spell::set_cooldown); diff --git a/singletons/entity_data_manager.cpp b/singletons/entity_data_manager.cpp index 4a15c96..4e5b38c 100644 --- a/singletons/entity_data_manager.cpp +++ b/singletons/entity_data_manager.cpp @@ -36,26 +36,33 @@ EntityDataManager *EntityDataManager::get_instance() { return instance; } -bool EntityDataManager::get_use_spell_points() { +bool EntityDataManager::get_use_spell_points() const { return _use_spell_points; } -void EntityDataManager::set_use_spell_points(bool value) { +void EntityDataManager::set_use_spell_points(const bool value) { _use_spell_points = value; } -bool EntityDataManager::get_automatic_load() { +bool EntityDataManager::get_scale_spells_by_default() const { + return _scale_spells_by_default; +} +void EntityDataManager::set_scale_spells_by_default(const bool value) { + _scale_spells_by_default = value; +} + +bool EntityDataManager::get_automatic_load() const { return _automatic_load; } -void EntityDataManager::set_automatic_load(bool load) { +void EntityDataManager::set_automatic_load(const bool load) { _automatic_load = load; } -Ref EntityDataManager::get_skill_for_armor_type(int index) { +Ref EntityDataManager::get_skill_for_armor_type(const int index) { ERR_FAIL_INDEX_V(index, ItemEnums::ARMOR_TYPE_MAX, Ref()); return _armor_type_skills[index]; } -void EntityDataManager::set_skill_for_armor_type(int index, const Ref &aura) { +void EntityDataManager::set_skill_for_armor_type(const int index, const Ref &aura) { ERR_FAIL_INDEX(index, ItemEnums::ARMOR_TYPE_MAX); _armor_type_skills[index] = aura; @@ -954,6 +961,18 @@ void EntityDataManager::request_world_spell_spawn_deferred(const Ref get_skill_for_armor_type(int index); - void set_skill_for_armor_type(int index, const Ref &aura); + bool get_automatic_load() const; + void set_automatic_load(const bool load); + + Ref get_skill_for_armor_type(const int index); + void set_skill_for_armor_type(const int index, const Ref &aura); String get_xp_data_path(); void set_xp_data_path(String path); @@ -241,6 +244,7 @@ private: static EntityDataManager *instance; bool _use_spell_points; + bool _scale_spells_by_default; bool _automatic_load; };