From ac18bda70f049e0ec71a8a84402f8ddbe0ea37c4 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 12 Jan 2022 17:54:01 +0100 Subject: [PATCH] Added permanent option for auras. Also added is_aura helper check. --- data/spells/spell.cpp | 17 +++++++++++++++-- data/spells/spell.h | 7 ++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/data/spells/spell.cpp b/data/spells/spell.cpp index 9dd98be..e71ba0c 100644 --- a/data/spells/spell.cpp +++ b/data/spells/spell.cpp @@ -28,9 +28,9 @@ SOFTWARE. #include "../items/craft_recipe.h" #include "../../entities/auras/aura_data.h" -#include "../auras/aura_group.h" -#include "../../infos/aura_infos.h" #include "../../entities/data/entity_data.h" +#include "../../infos/aura_infos.h" +#include "../auras/aura_group.h" #include "../../singletons/ess.h" @@ -537,6 +537,13 @@ void Spell::set_training_required_skill_level(const int value) { // Aura +bool Spell::aura_get_permanent() const { + return _aura_permanent; +} +void Spell::aura_set_permanent(const bool value) { + _aura_permanent = value; +} + float Spell::aura_get_time() const { return _aura_time; } @@ -1711,6 +1718,7 @@ Spell::Spell() { _projectile_use_speed = false; _projectile_speed = 0; + _aura_permanent = false; _aura_ability_scale_data_id = 1; _aura_time = 0; _aura_tick = 0; @@ -2864,6 +2872,10 @@ void Spell::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "training_required_skill_level"), "set_training_required_skill_level", "get_training_required_skill_level"); ADD_GROUP("Aura", "aura"); + ClassDB::bind_method(D_METHOD("aura_get_permanent"), &Spell::aura_get_permanent); + ClassDB::bind_method(D_METHOD("aura_set_permanent", "value"), &Spell::aura_set_permanent); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "aura_permanent"), "aura_set_permanent", "aura_get_permanent"); + ClassDB::bind_method(D_METHOD("aura_get_time"), &Spell::aura_get_time); ClassDB::bind_method(D_METHOD("aura_set_time", "value"), &Spell::aura_set_time); ADD_PROPERTY(PropertyInfo(Variant::REAL, "aura_time"), "aura_set_time", "aura_get_time"); @@ -3110,6 +3122,7 @@ void Spell::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "aura_stat_attribute_" + itos(i) + "/percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "aura_stat_attribute_set_percent_mod", "aura_stat_attribute_get_percent_mod", i); } + ClassDB::bind_method(D_METHOD("is_aura"), &Spell::is_aura); ClassDB::bind_method(D_METHOD("aura_is_talent"), &Spell::aura_is_talent); BIND_ENUM_CONSTANT(TARGET_SELF); diff --git a/data/spells/spell.h b/data/spells/spell.h index c36f5df..894136a 100644 --- a/data/spells/spell.h +++ b/data/spells/spell.h @@ -298,6 +298,10 @@ public: int get_training_required_skill_level() const; void set_training_required_skill_level(const int value); + //Auras + bool aura_get_permanent() const; + void aura_set_permanent(const bool value); + float aura_get_time() const; void aura_set_time(const float value); @@ -590,6 +594,7 @@ public: void aura_calculate_initial_heal(Ref aura_data, Ref info); void handle_aura_heal(Ref aura_data, Ref info); + _FORCE_INLINE_ bool is_aura() const { return _aura_permanent || (_aura_time > CMP_EPSILON); } _FORCE_INLINE_ bool aura_is_talent() const { return _aura_type == SpellEnums::AURA_TYPE_TALENT; } String get_name_translated() const; @@ -764,7 +769,7 @@ private: int _training_required_skill_level; //Aura - + bool _aura_permanent; float _aura_time; float _aura_tick; Ref _aura_group;