diff --git a/config.py b/config.py index cd8a20d..04e6dea 100644 --- a/config.py +++ b/config.py @@ -17,7 +17,6 @@ def get_doc_classes(): "AuraGroup", "AuraStatAttribute", - "AuraTriggerData", "Aura", "CraftRecipeHelper", "CraftRecipe", diff --git a/data/auras/aura.cpp b/data/auras/aura.cpp index a0945af..9222e42 100644 --- a/data/auras/aura.cpp +++ b/data/auras/aura.cpp @@ -362,9 +362,6 @@ Aura::Aura() { } _trigger_count = 0; - for (int i = 0; i < MAX_TRIGGER_DATA; ++i) { - _trigger_datas[i] = Ref(memnew(AuraTriggerData())); - } } Aura::~Aura() { @@ -379,7 +376,7 @@ Aura::~Aura() { _heal_scaling_curve.unref(); for (int i = 0; i < MAX_TRIGGER_DATA; ++i) { - _trigger_datas[i].unref(); + _trigger_datas[i].spell.unref(); } for (int i = 0; i < MAX_AURA_STATS; ++i) { @@ -392,50 +389,74 @@ Aura::~Aura() { ////// Triggers /////// -int Aura::get_trigger_count() const { +int Aura::trigger_get_count() const { return _trigger_count; } -void Aura::set_trigger_count(int count) { +void Aura::trigger_set_count(const int count) { ERR_FAIL_COND(count < 0 || count > MAX_TRIGGER_DATA); _trigger_count = count; } -SpellEnums::TriggerEvents Aura::get_trigger_event(int index) const { - ERR_FAIL_INDEX_V(index, _trigger_count, SpellEnums::TRIGGER_NONE); +SpellEnums::TriggerNotificationType Aura::trigger_get_notification_type(const int index) const { + ERR_FAIL_INDEX_V(index, _trigger_count, SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA); - return _trigger_datas[index]->get_trigger_event(); + return _trigger_datas[index].notification_type; } -void Aura::set_trigger_event(int index, const SpellEnums::TriggerEvents value) { +void Aura::trigger_set_notification_type(const int index, const SpellEnums::TriggerNotificationType value) { ERR_FAIL_COND(index < 0 || index > _trigger_count); - _trigger_datas[index]->set_trigger_event(value); + _trigger_datas[index].notification_type = value; } -Ref Aura::get_trigger_aura(int index) const { - ERR_FAIL_INDEX_V(index, _trigger_count, Ref(NULL)); +int Aura::trigger_get_notification_data(const int index) const { + ERR_FAIL_INDEX_V(index, _trigger_count, 0); - return _trigger_datas[index]->get_aura(); + return _trigger_datas[index].notification_data; } -void Aura::set_trigger_aura(int index, const Ref value) { +void Aura::trigger_set_notification_data(const int index, const int value) { ERR_FAIL_COND(index < 0 || index > _trigger_count); - _trigger_datas[index]->set_aura(value); + _trigger_datas[index].notification_data = value; } -Ref Aura::get_trigger_spell(int index) const { - ERR_FAIL_INDEX_V(index, _trigger_count, Ref(NULL)); +SpellEnums::TriggerType Aura::trigger_get_trigger_type(const int index) const { + ERR_FAIL_INDEX_V(index, _trigger_count, SpellEnums::TRIGGER_TYPE_NONE); - return _trigger_datas[index]->get_spell(); + return _trigger_datas[index].trigger_type; } -void Aura::set_trigger_spell(int index, const Ref value) { +void Aura::trigger_set_trigger_type(const int index, const SpellEnums::TriggerType value) { ERR_FAIL_COND(index < 0 || index > _trigger_count); - _trigger_datas[index]->set_spell(value); + _trigger_datas[index].trigger_type = value; +} + +float Aura::trigger_get_trigger_type_data(const int index) const { + ERR_FAIL_INDEX_V(index, _trigger_count, 0); + + return _trigger_datas[index].trigger_type_data; +} + +void Aura::trigger_set_trigger_type_data(const int index, const float value) { + ERR_FAIL_COND(index < 0 || index > _trigger_count); + + _trigger_datas[index].trigger_type_data = value; +} + +Ref Aura::trigger_get_spell(const int index) const { + ERR_FAIL_INDEX_V(index, _trigger_count, Ref()); + + return _trigger_datas[index].spell; +} + +void Aura::trigger_set_spell(const int index, const Ref &value) { + ERR_FAIL_COND(index < 0 || index > _trigger_count); + + _trigger_datas[index].spell = value; } //// Talent //// @@ -455,54 +476,54 @@ void Aura::set_talent_required_spell(const Ref spell) { ////// Aura Stat Attributes ////// -int Aura::get_aura_stat_attribute_count() const { +int Aura::stat_attribute_get_count() const { return _aura_stat_attribute_count; } -void Aura::set_aura_stat_attribute_count(int count) { +void Aura::stat_attribute_set_count(int count) { ERR_FAIL_COND(count < 0 || count > MAX_AURA_STATS); _aura_stat_attribute_count = count; } -int Aura::get_aura_stat_attribute_stat(int index) const { +int Aura::stat_attribute_get_stat(int index) const { ERR_FAIL_INDEX_V(index, MAX_AURA_STATS, 0); return _aura_stat_attributes[index]->get_stat(); } -void Aura::set_aura_stat_attribute_stat(int index, const int value) { +void Aura::stat_attribute_set_stat(int index, const int value) { ERR_FAIL_INDEX(index, MAX_AURA_STATS); _aura_stat_attributes[index]->set_stat(value); } -float Aura::get_aura_stat_attribute_base_mod(int index) const { +float Aura::stat_attribute_get_base_mod(int index) const { ERR_FAIL_INDEX_V(index, MAX_AURA_STATS, 0); return _aura_stat_attributes[index]->get_base_mod(); } -void Aura::set_aura_stat_attribute_base_mod(int index, float value) { +void Aura::stat_attribute_set_base_mod(int index, float value) { ERR_FAIL_INDEX(index, MAX_AURA_STATS); _aura_stat_attributes[index]->set_base_mod(value); } -float Aura::get_aura_stat_attribute_bonus_mod(int index) const { +float Aura::stat_attribute_get_bonus_mod(int index) const { ERR_FAIL_INDEX_V(index, MAX_AURA_STATS, 0); return _aura_stat_attributes[index]->get_bonus_mod(); } -void Aura::set_aura_stat_attribute_bonus_mod(int index, float value) { +void Aura::stat_attribute_set_bonus_mod(int index, float value) { ERR_FAIL_INDEX(index, MAX_AURA_STATS); _aura_stat_attributes[index]->set_bonus_mod(value); } -float Aura::get_aura_stat_attribute_percent_mod(int index) const { +float Aura::stat_attribute_get_percent_mod(int index) const { ERR_FAIL_INDEX_V(index, MAX_AURA_STATS, 0); return _aura_stat_attributes[index]->get_percent_mod(); } -void Aura::set_aura_stat_attribute_percent_mod(int index, float value) { +void Aura::stat_attribute_set_percent_mod(int index, float value) { ERR_FAIL_INDEX(index, MAX_AURA_STATS); _aura_stat_attributes[index]->set_percent_mod(value); @@ -1171,10 +1192,105 @@ void Aura::_validate_property(PropertyInfo &property) const { if (property.name.ends_with("stat")) property.hint_string = ESS::get_singleton()->stat_get_string(); - } else if (prop.begins_with("Trigger_")) { + } else if (prop.begins_with("trigger_")) { + if (prop.ends_with("count")) + return; + int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int(); if (frame >= _trigger_count) { property.usage = 0; + } else { + if (prop.ends_with("notification_data")) { + switch (_trigger_datas[frame].notification_type) { + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA: + property.hint = PROPERTY_HINT_ENUM; + property.hint_string = SpellEnums::BINDING_STRING_NOTIFICATION_AURAS; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_DAMAGE: + property.hint = PROPERTY_HINT_ENUM; + property.hint_string = SpellEnums::BINDING_STRING_NOTIFICATION_DAMAGES; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_HEAL: + property.hint = PROPERTY_HINT_ENUM; + property.hint_string = SpellEnums::BINDING_STRING_NOTIFICATION_HEALS; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CAST: + property.hint = PROPERTY_HINT_ENUM; + property.hint_string = SpellEnums::BINDING_STRING_NOTIFICATION_CASTS; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_DEATH: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_COOLDOWN_ADDED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_COOLDOWN_REMOVED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_ADDED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_REMOVED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_GCD_STARTED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_GCD_FINISHED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_XP_GAINED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CLASS_LEVELUP: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CHARACTER_LEVELUP: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_ADDED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_REMOVED: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA_CUSTOM: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_DAMAGE_CUSTOM: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_HEAL_CUSTOM: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CAST_CUSTOM: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + case SpellEnums::TRIGGER_NOTIFICATION_TYPE_CUSTOM: + property.hint = PROPERTY_HINT_NONE; + property.hint_string = ""; + break; + default: + break; + } + } } } } @@ -1574,52 +1690,60 @@ void Aura::_bind_methods() { //// Triggers //// ADD_GROUP("Triggers", "trigger"); - ClassDB::bind_method(D_METHOD("get_trigger_count"), &Aura::get_trigger_count); - ClassDB::bind_method(D_METHOD("set_trigger_count", "count"), &Aura::set_trigger_count); + ClassDB::bind_method(D_METHOD("trigger_get_count"), &Aura::trigger_get_count); + ClassDB::bind_method(D_METHOD("trigger_set_count", "count"), &Aura::trigger_set_count); - ClassDB::bind_method(D_METHOD("get_trigger_event", "index"), &Aura::get_trigger_event); - ClassDB::bind_method(D_METHOD("set_trigger_event", "index", "value"), &Aura::set_trigger_event); + ClassDB::bind_method(D_METHOD("trigger_get_notification_type", "index"), &Aura::trigger_get_notification_type); + ClassDB::bind_method(D_METHOD("trigger_set_notification_type", "index", "value"), &Aura::trigger_set_notification_type); - ClassDB::bind_method(D_METHOD("get_trigger_aura", "index"), &Aura::get_trigger_aura); - ClassDB::bind_method(D_METHOD("set_trigger_aura", "index", "value"), &Aura::set_trigger_aura); + ClassDB::bind_method(D_METHOD("trigger_get_notification_data", "index"), &Aura::trigger_get_notification_data); + ClassDB::bind_method(D_METHOD("trigger_set_notification_data", "index", "value"), &Aura::trigger_set_notification_data); - ClassDB::bind_method(D_METHOD("get_trigger_spell", "index"), &Aura::get_trigger_spell); - ClassDB::bind_method(D_METHOD("set_trigger_spell", "index", "value"), &Aura::set_trigger_spell); + ClassDB::bind_method(D_METHOD("trigger_get_trigger_type", "index"), &Aura::trigger_get_trigger_type); + ClassDB::bind_method(D_METHOD("trigger_set_trigger_type", "index", "value"), &Aura::trigger_set_trigger_type); - ADD_PROPERTY(PropertyInfo(Variant::INT, "trigger_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_TRIGGER_DATA), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_trigger_count", "get_trigger_count"); + ClassDB::bind_method(D_METHOD("trigger_get_trigger_type_data", "index"), &Aura::trigger_get_trigger_type_data); + ClassDB::bind_method(D_METHOD("trigger_set_trigger_type_data", "index", "value"), &Aura::trigger_set_trigger_type_data); + + ClassDB::bind_method(D_METHOD("trigger_get_spell", "index"), &Aura::trigger_get_spell); + ClassDB::bind_method(D_METHOD("trigger_set_spell", "index", "value"), &Aura::trigger_set_spell); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "trigger_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_TRIGGER_DATA), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "trigger_set_count", "trigger_get_count"); for (int i = 0; i < MAX_TRIGGER_DATA; i++) { - ADD_PROPERTYI(PropertyInfo(Variant::INT, "Trigger_" + itos(i) + "/event", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TRIGGER_EVENTS, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_trigger_event", "get_trigger_event", i); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "Trigger_" + itos(i) + "/aura", PROPERTY_HINT_RESOURCE_TYPE, "Aura", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_trigger_aura", "get_trigger_aura", i); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "Trigger_" + itos(i) + "/spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_trigger_spell", "get_trigger_spell", i); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "trigger_" + itos(i) + "/notification_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TRIGGER_NOTIFICATION_TYPE, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "trigger_set_notification_type", "trigger_get_notification_type", i); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "trigger_" + itos(i) + "/notification_data"), "trigger_set_notification_data", "trigger_get_notification_data", i); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "trigger_" + itos(i) + "/trigger_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TRIGGER_TYPE), "trigger_set_trigger_type", "trigger_get_trigger_type", i); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "trigger_" + itos(i) + "/trigger_type_data"), "trigger_set_trigger_type_data", "trigger_get_trigger_type_data", i); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "trigger_" + itos(i) + "/spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell", PROPERTY_USAGE_DEFAULT), "trigger_set_spell", "trigger_get_spell", i); } ADD_GROUP("Attributes", "attribute"); //AuraStatAttributes - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_count"), &Aura::get_aura_stat_attribute_count); - ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_count", "count"), &Aura::set_aura_stat_attribute_count); + ClassDB::bind_method(D_METHOD("stat_attribute_get_count"), &Aura::stat_attribute_get_count); + ClassDB::bind_method(D_METHOD("stat_attribute_set_count", "count"), &Aura::stat_attribute_set_count); - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_stat", "index"), &Aura::get_aura_stat_attribute_stat); - ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_stat", "index", "value"), &Aura::set_aura_stat_attribute_stat); + ClassDB::bind_method(D_METHOD("stat_attribute_get_stat", "index"), &Aura::stat_attribute_get_stat); + ClassDB::bind_method(D_METHOD("stat_attribute_set_stat", "index", "value"), &Aura::stat_attribute_set_stat); - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_base_mod", "index"), &Aura::get_aura_stat_attribute_base_mod); - ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_base_mod", "index", "value"), &Aura::set_aura_stat_attribute_base_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_get_base_mod", "index"), &Aura::stat_attribute_get_base_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_set_base_mod", "index", "value"), &Aura::stat_attribute_set_base_mod); - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_bonus_mod", "index"), &Aura::get_aura_stat_attribute_bonus_mod); - ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_bonus_mod", "index", "value"), &Aura::set_aura_stat_attribute_bonus_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_get_bonus_mod", "index"), &Aura::stat_attribute_get_bonus_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_set_bonus_mod", "index", "value"), &Aura::stat_attribute_set_bonus_mod); - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_percent_mod", "index"), &Aura::get_aura_stat_attribute_percent_mod); - ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_percent_mod", "index", "value"), &Aura::set_aura_stat_attribute_percent_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_get_percent_mod", "index"), &Aura::stat_attribute_get_percent_mod); + ClassDB::bind_method(D_METHOD("stat_attribute_set_percent_mod", "index", "value"), &Aura::stat_attribute_set_percent_mod); - ClassDB::bind_method(D_METHOD("get_aura_stat_attribute", "index"), &Aura::get_aura_stat_attribute); + ClassDB::bind_method(D_METHOD("stat_attribute_get", "index"), &Aura::stat_attribute_get); - ADD_PROPERTY(PropertyInfo(Variant::INT, "attribute_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_AURA_STATS), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_aura_stat_attribute_count", "get_aura_stat_attribute_count"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "attribute_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_AURA_STATS), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "stat_attribute_set_count", "stat_attribute_get_count"); for (int i = 0; i < MAX_AURA_STATS; i++) { - ADD_PROPERTYI(PropertyInfo(Variant::INT, "StatModAttribute_" + itos(i) + "/stat", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_aura_stat_attribute_stat", "get_aura_stat_attribute_stat", i); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_aura_stat_attribute_base_mod", "get_aura_stat_attribute_base_mod", i); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_aura_stat_attribute_bonus_mod", "get_aura_stat_attribute_bonus_mod", i); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_aura_stat_attribute_percent_mod", "get_aura_stat_attribute_percent_mod", i); + ADD_PROPERTYI(PropertyInfo(Variant::INT, "StatModAttribute_" + itos(i) + "/stat", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_attribute_set_stat", "stat_attribute_get_stat", i); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_attribute_set_base_mod", "stat_attribute_get_base_mod", i); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_attribute_set_bonus_mod", "stat_attribute_get_bonus_mod", i); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "StatModAttribute_" + itos(i) + "/percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_attribute_set_percent_mod", "stat_attribute_get_percent_mod", i); } ClassDB::bind_method(D_METHOD("is_talent"), &Aura::is_talent); diff --git a/data/auras/aura.h b/data/auras/aura.h index 791cd64..c291743 100644 --- a/data/auras/aura.h +++ b/data/auras/aura.h @@ -36,7 +36,6 @@ SOFTWARE. #include "../../infos/aura_infos.h" #include "aura_stat_attribute.h" -#include "aura_trigger_data.h" #include "../../entities/auras/aura_data.h" #include "../../infos/spell_cast_info.h" @@ -54,6 +53,8 @@ class Entity; class SpellCastInfo; class EntityResourceCostData; +class Spell; + class Aura : public Resource { GDCLASS(Aura, Resource); @@ -198,17 +199,23 @@ public: void set_diminishing_category(const SpellEnums::DiminishingReturnCategory diminishingCategory); //Triggers - int get_trigger_count() const; - void set_trigger_count(int count); + int trigger_get_count() const; + void trigger_set_count(const int count); - SpellEnums::TriggerEvents get_trigger_event(int index) const; - void set_trigger_event(int index, const SpellEnums::TriggerEvents value); + SpellEnums::TriggerNotificationType trigger_get_notification_type(const int index) const; + void trigger_set_notification_type(const int index, const SpellEnums::TriggerNotificationType value); - Ref get_trigger_aura(int index) const; - void set_trigger_aura(int index, const Ref value); + int trigger_get_notification_data(const int index) const; + void trigger_set_notification_data(const int index, const int value); - Ref get_trigger_spell(int index) const; - void set_trigger_spell(int index, const Ref value); + SpellEnums::TriggerType trigger_get_trigger_type(const int index) const; + void trigger_set_trigger_type(const int index, const SpellEnums::TriggerType value); + + float trigger_get_trigger_type_data(const int index) const; + void trigger_set_trigger_type_data(const int index, const float value); + + Ref trigger_get_spell(const int index) const; + void trigger_set_spell(const int index, const Ref &value); //Talent Ref get_talent_required_talent() const; @@ -218,22 +225,22 @@ public: void set_talent_required_spell(const Ref spell); //AuraStatAttributes - int get_aura_stat_attribute_count() const; - void set_aura_stat_attribute_count(int count); + int stat_attribute_get_count() const; + void stat_attribute_set_count(int count); - int get_aura_stat_attribute_stat(int index) const; - void set_aura_stat_attribute_stat(int index, const int value); + int stat_attribute_get_stat(int index) const; + void stat_attribute_set_stat(int index, const int value); - float get_aura_stat_attribute_base_mod(int index) const; - void set_aura_stat_attribute_base_mod(int index, float value); + float stat_attribute_get_base_mod(int index) const; + void stat_attribute_set_base_mod(int index, float value); - float get_aura_stat_attribute_bonus_mod(int index) const; - void set_aura_stat_attribute_bonus_mod(int index, float value); + float stat_attribute_get_bonus_mod(int index) const; + void stat_attribute_set_bonus_mod(int index, float value); - float get_aura_stat_attribute_percent_mod(int index) const; - void set_aura_stat_attribute_percent_mod(int index, float value); + float stat_attribute_get_percent_mod(int index) const; + void stat_attribute_set_percent_mod(int index, float value); - Ref get_aura_stat_attribute(int index) { return _aura_stat_attributes[index]; } + Ref stat_attribute_get(int index) { return _aura_stat_attributes[index]; } //// SpellSystem //// @@ -357,6 +364,22 @@ protected: static void _bind_methods(); void _validate_property(PropertyInfo &property) const; +protected: + struct AuraTriggerData { + SpellEnums::TriggerNotificationType notification_type; + int notification_data; + SpellEnums::TriggerType trigger_type; + float trigger_type_data; + Ref spell; + + AuraTriggerData() { + notification_type = SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA; + trigger_type = SpellEnums::TRIGGER_TYPE_NONE; + notification_data = 0; + trigger_type_data = 0; + } + }; + private: enum { MAX_AURA_STATS = 5, //Increase if necessary, should be enough for now @@ -413,7 +436,7 @@ private: int _supress_states; int _trigger_count; - Ref _trigger_datas[MAX_TRIGGER_DATA]; + AuraTriggerData _trigger_datas[MAX_TRIGGER_DATA]; int _aura_stat_attribute_count; Ref _aura_stat_attributes[MAX_AURA_STATS]; diff --git a/data/auras/aura_trigger_data.cpp b/data/auras/aura_trigger_data.cpp deleted file mode 100644 index ff5bb27..0000000 --- a/data/auras/aura_trigger_data.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2019-2020 Péter Magyar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -#include "aura_trigger_data.h" diff --git a/data/auras/aura_trigger_data.h b/data/auras/aura_trigger_data.h deleted file mode 100644 index 9f3d4e3..0000000 --- a/data/auras/aura_trigger_data.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright (c) 2019-2020 Péter Magyar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -#ifndef AURA_TRIGGER_DATA_H -#define AURA_TRIGGER_DATA_H - -#include "core/reference.h" - -#include "../../spell_enums.h" -#include "../spells/spell.h" -#include "aura.h" - -class Spell; - -class AuraTriggerData : public Reference { - GDCLASS(AuraTriggerData, Reference); - -public: - SpellEnums::TriggerEvents get_trigger_event() const { return _trigger_event; } - void set_trigger_event(const SpellEnums::TriggerEvents trigger_event) { _trigger_event = trigger_event; } - - Ref get_aura() const { return _aura; } - void set_aura(const Ref aura) { _aura = aura; } - - Ref get_spell() const { return _spell; } - void set_spell(const Ref spell) { _spell = spell; } - -protected: - static void _bind_methods() { - ClassDB::bind_method(D_METHOD("get_trigger_event"), &AuraTriggerData::get_trigger_event); - ClassDB::bind_method(D_METHOD("set_trigger_event", "value"), &AuraTriggerData::set_trigger_event); - ADD_PROPERTY(PropertyInfo(Variant::INT, "trigger_event", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TRIGGER_EVENTS), "set_trigger_event", "get_trigger_event"); - - ClassDB::bind_method(D_METHOD("get_aura"), &AuraTriggerData::get_aura); - ClassDB::bind_method(D_METHOD("set_aura", "value"), &AuraTriggerData::set_aura); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_aura", "get_aura"); - - ClassDB::bind_method(D_METHOD("get_spell"), &AuraTriggerData::get_spell); - ClassDB::bind_method(D_METHOD("set_spell", "value"), &AuraTriggerData::set_aura); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_spell", "get_spell"); - } - -private: - SpellEnums::TriggerEvents _trigger_event; - Ref _aura; - Ref _spell; -}; - -#endif diff --git a/doc_classes/Aura.xml b/doc_classes/Aura.xml index 00b4577..555abe4 100644 --- a/doc_classes/Aura.xml +++ b/doc_classes/Aura.xml @@ -1143,7 +1143,7 @@ - + @@ -1151,7 +1151,7 @@ - + @@ -1159,7 +1159,7 @@ - + @@ -1167,7 +1167,7 @@ - + @@ -1175,7 +1175,7 @@ - + @@ -1199,7 +1199,7 @@ - + @@ -1207,7 +1207,7 @@ - + @@ -1215,7 +1215,7 @@ - + @@ -1321,7 +1321,7 @@ - + @@ -1331,7 +1331,7 @@ - + @@ -1341,7 +1341,7 @@ - + @@ -1351,7 +1351,7 @@ - + @@ -1385,7 +1385,7 @@ - + @@ -1395,7 +1395,7 @@ - + @@ -1405,7 +1405,7 @@ - + @@ -1845,7 +1845,7 @@ - + @@ -1919,7 +1919,7 @@ - + diff --git a/doc_classes/AuraTriggerData.xml b/doc_classes/AuraTriggerData.xml deleted file mode 100644 index 83ee800..0000000 --- a/doc_classes/AuraTriggerData.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - [Aura] effect trigger information. Not yet complete. - - - - - - - - - - - - - - - - - - diff --git a/register_types.cpp b/register_types.cpp index 7aebbf4..42b207b 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -91,7 +91,6 @@ SOFTWARE. #include "entities/entity.h" #include "data/auras/aura_stat_attribute.h" -#include "data/auras/aura_trigger_data.h" #include "drag_and_drop/es_drag_and_drop.h" @@ -212,8 +211,6 @@ void register_entity_spell_system_types() { ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); - //entities ClassDB::register_class(); ClassDB::register_class(); diff --git a/spell_enums.cpp b/spell_enums.cpp index b6acd11..81adf7a 100644 --- a/spell_enums.cpp +++ b/spell_enums.cpp @@ -31,3 +31,10 @@ const String SpellEnums::BINDING_STRING_AURA_TYPES = "None,Magic,Poison,Physical const String SpellEnums::BINDING_STRING_AURA_FLAG_TYPES = "Magic,Poison,Physical,Curse,Bleed,Talent,Skill"; const String SpellEnums::BINDING_STRING_COLLIDER_TYPE = "None,Sphere,Box"; const String SpellEnums::BINDING_STRING_TARGET_TYPE = "None,Node,Bone ID,Coords"; +const String SpellEnums::BINDING_STRING_TRIGGER_TYPE = "None,Percent,PPM"; +const String SpellEnums::BINDING_STRING_TRIGGER_NOTIFICATION_TYPE = "Aura,Damage,Heal,Cast,Death,Cooldown Added,Cooldown Removed,Category CooldownAdded,Category CooldownRemoved,GCD Started,GCD Removed,XP Gained,Class Levelup,Character Levelup,Entity Resource Added,Entity Resource Removed,Aura Custom,Damage Custom,Heal Custom,Cast Custom,Custom"; + +const String SpellEnums::BINDING_STRING_NOTIFICATION_AURAS = "Before Applied,After Applied,Applied,Added,Removed,Refreshed"; +const String SpellEnums::BINDING_STRING_NOTIFICATION_DAMAGES = "Before Hit,Hit,Before Damage,Receive,Dealt Damage,Damage Dealt,Damage"; +const String SpellEnums::BINDING_STRING_NOTIFICATION_HEALS = "Heal Hit,Before Heal,Receive,Dealt Heal,Heal Dealt"; +const String SpellEnums::BINDING_STRING_NOTIFICATION_CASTS = "Before,Before Cast Target,Finished Target,Finished,Started,Failed,Success,Interrupted,Delayed"; diff --git a/spell_enums.h b/spell_enums.h index 3485818..4d85512 100644 --- a/spell_enums.h +++ b/spell_enums.h @@ -38,6 +38,13 @@ public: static const String BINDING_STRING_AURA_FLAG_TYPES; static const String BINDING_STRING_COLLIDER_TYPE; static const String BINDING_STRING_TARGET_TYPE; + static const String BINDING_STRING_TRIGGER_TYPE; + static const String BINDING_STRING_TRIGGER_NOTIFICATION_TYPE; + + static const String BINDING_STRING_NOTIFICATION_AURAS; + static const String BINDING_STRING_NOTIFICATION_DAMAGES; + static const String BINDING_STRING_NOTIFICATION_HEALS; + static const String BINDING_STRING_NOTIFICATION_CASTS; enum DamageType { DAMAGE_TYPE_NONE = 0, @@ -79,21 +86,6 @@ public: DIMINISHING_RETURN_CATEGORY_STUN, }; - enum TriggerEvents { - TRIGGER_NONE, - TRIGGER_AURA_EVENT_S_ON_BEFORE_DAMAGE, - TRIGGER_AURA_EVENT_S_ON_DAMAGE_RECEIVE, - TRIGGER_AURA_EVENT_S_ON_HIT, - TRIGGER_AURA_EVENT_S_ON_DAMAGE_DEALT, - TRIGGER_AURA_EVENT_S_ON_AURA_REMOVE, - TRIGGER_AURA_EVENT_S_ON_AURA_DISPELL, - TRIGGER_AURA_EVENT_S_ON_BEFORE_AURA_APPLIED, - TRIGGER_AURA_EVENT_S_ON_AFTER_AURA_APPLIED, - TRIGGER_AURA_EVENT_C_ON_AURA_ADDED, - TRIGGER_AURA_EVENT_C_ON_AURA_REMOVED, - TRIGGER_AURA_EVENT_C_ON_AURA_REFRESHED, - }; - enum AuraType { AURA_TYPE_NONE = 0, AURA_TYPE_MAGIC = 1 << 0, @@ -118,6 +110,36 @@ public: TARGET_TYPE_COORDS, }; + enum TriggerType { + TRIGGER_TYPE_NONE = 0, + TRIGGER_TYPE_PERCENT, + TRIGGER_TYPE_PPM, + }; + + enum TriggerNotificationType { + TRIGGER_NOTIFICATION_TYPE_AURA = 0, + TRIGGER_NOTIFICATION_TYPE_DAMAGE, + TRIGGER_NOTIFICATION_TYPE_HEAL, + TRIGGER_NOTIFICATION_TYPE_CAST, + TRIGGER_NOTIFICATION_TYPE_DEATH, + TRIGGER_NOTIFICATION_TYPE_COOLDOWN_ADDED, + TRIGGER_NOTIFICATION_TYPE_COOLDOWN_REMOVED, + TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_ADDED, + TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_REMOVED, + TRIGGER_NOTIFICATION_TYPE_GCD_STARTED, + TRIGGER_NOTIFICATION_TYPE_GCD_FINISHED, + TRIGGER_NOTIFICATION_TYPE_XP_GAINED, + TRIGGER_NOTIFICATION_TYPE_CLASS_LEVELUP, + TRIGGER_NOTIFICATION_TYPE_CHARACTER_LEVELUP, + TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_ADDED, + TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_REMOVED, + TRIGGER_NOTIFICATION_TYPE_AURA_CUSTOM, + TRIGGER_NOTIFICATION_TYPE_DAMAGE_CUSTOM, + TRIGGER_NOTIFICATION_TYPE_HEAL_CUSTOM, + TRIGGER_NOTIFICATION_TYPE_CAST_CUSTOM, + TRIGGER_NOTIFICATION_TYPE_CUSTOM, + }; + enum { NOTIFICATION_AURA_BEFORE_APPLIED = 0, NOTIFICATION_AURA_AFTER_APPLIED, @@ -193,19 +215,6 @@ protected: BIND_ENUM_CONSTANT(DIMINISHING_RETURN_CATEGORY_ROOT); BIND_ENUM_CONSTANT(DIMINISHING_RETURN_CATEGORY_STUN); - BIND_ENUM_CONSTANT(TRIGGER_NONE); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_BEFORE_DAMAGE); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_DAMAGE_RECEIVE); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_HIT); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_DAMAGE_DEALT); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_AURA_REMOVE); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_AURA_DISPELL); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_BEFORE_AURA_APPLIED); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_S_ON_AFTER_AURA_APPLIED); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_ADDED); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_REMOVED); - BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_REFRESHED); - BIND_ENUM_CONSTANT(AURA_TYPE_NONE); BIND_ENUM_CONSTANT(AURA_TYPE_MAGIC); BIND_ENUM_CONSTANT(AURA_TYPE_POISON); @@ -224,6 +233,32 @@ protected: BIND_ENUM_CONSTANT(TARGET_TYPE_BONE_ID); BIND_ENUM_CONSTANT(TARGET_TYPE_COORDS); + BIND_ENUM_CONSTANT(TRIGGER_TYPE_NONE); + BIND_ENUM_CONSTANT(TRIGGER_TYPE_PERCENT); + BIND_ENUM_CONSTANT(TRIGGER_TYPE_PPM); + + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_AURA); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_DAMAGE); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_HEAL); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CAST); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_DEATH); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_COOLDOWN_ADDED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_COOLDOWN_REMOVED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_ADDED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CATEGORY_COOLDOWN_REMOVED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_GCD_STARTED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_GCD_FINISHED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_XP_GAINED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CLASS_LEVELUP); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CHARACTER_LEVELUP); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_ADDED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_ENTITY_RESOURCE_REMOVED); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_AURA_CUSTOM); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_DAMAGE_CUSTOM); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_HEAL_CUSTOM); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CAST_CUSTOM); + BIND_ENUM_CONSTANT(TRIGGER_NOTIFICATION_TYPE_CUSTOM); + BIND_CONSTANT(NOTIFICATION_AURA_BEFORE_APPLIED); BIND_CONSTANT(NOTIFICATION_AURA_AFTER_APPLIED); BIND_CONSTANT(NOTIFICATION_AURA_APPLIED); @@ -259,10 +294,11 @@ protected: VARIANT_ENUM_CAST(SpellEnums::SpellType); VARIANT_ENUM_CAST(SpellEnums::SpellCategory); VARIANT_ENUM_CAST(SpellEnums::DiminishingReturnCategory); -VARIANT_ENUM_CAST(SpellEnums::TriggerEvents); VARIANT_ENUM_CAST(SpellEnums::DamageType); VARIANT_ENUM_CAST(SpellEnums::AuraType); VARIANT_ENUM_CAST(SpellEnums::ColliderType); VARIANT_ENUM_CAST(SpellEnums::TargetType); +VARIANT_ENUM_CAST(SpellEnums::TriggerNotificationType); +VARIANT_ENUM_CAST(SpellEnums::TriggerType); #endif