From 262e27837778f4d8756a1a1cc2d1c054822539e5 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 6 Oct 2019 18:19:04 +0200 Subject: [PATCH] Merged Talent and Skill into Aura. --- SCsub | 2 - data/aura.cpp | 60 +++++++++++++++++++ data/aura.h | 20 +++++-- data/data_manager.cpp | 96 ------------------------------- data/data_manager.h | 15 ----- data/skill.cpp | 12 ---- data/skill.h | 24 -------- data/spell.cpp | 7 +-- data/spell.h | 7 +-- data/talent.cpp | 59 ------------------- data/talent.h | 41 ------------- entities/data/character_spec.cpp | 10 ++-- entities/data/character_spec.h | 4 +- entities/data/talent_row_data.cpp | 22 +++---- entities/data/talent_row_data.h | 16 +++--- entities/entity.cpp | 12 ++-- register_types.cpp | 4 -- 17 files changed, 112 insertions(+), 299 deletions(-) delete mode 100644 data/skill.cpp delete mode 100644 data/skill.h delete mode 100644 data/talent.cpp delete mode 100644 data/talent.h diff --git a/SCsub b/SCsub index 505a2d2..3842e86 100644 --- a/SCsub +++ b/SCsub @@ -12,8 +12,6 @@ module_env.add_source_files(env.modules_sources,"spell_enums.cpp") module_env.add_source_files(env.modules_sources,"item_enums.cpp") module_env.add_source_files(env.modules_sources,"data/aura.cpp") -module_env.add_source_files(env.modules_sources,"data/talent.cpp") -module_env.add_source_files(env.modules_sources,"data/skill.cpp") module_env.add_source_files(env.modules_sources,"data/talent_rank_data.cpp") module_env.add_source_files(env.modules_sources,"data/data_manager.cpp") module_env.add_source_files(env.modules_sources,"data/xp_data.cpp") diff --git a/data/aura.cpp b/data/aura.cpp index 340c372..b602b32 100644 --- a/data/aura.cpp +++ b/data/aura.cpp @@ -120,6 +120,13 @@ void Aura::set_diminishing_category(SpellEnums::DiminishingReturnCategory dimini _diminishing_category = diminishingCategory; } +Ref Aura::get_teaches_spell() const { + return _teaches_spell; +} +void Aura::set_teaches_spell(const Ref spell) { + _teaches_spell = spell; +} + void Aura::set(int id, float time, int auraGroup) { this->set_id(id); this->set_time(time); @@ -291,6 +298,29 @@ Aura::Aura() { } Aura::~Aura() { + _icon.unref(); + + _teaches_spell.unref(); + + _visual_spell_effects.unref(); + _spell_projectile_data.unref(); + _world_effect_data.unref(); + + _damage_scaling_curve.unref(); + _absorb_scaling_curve.unref(); + _heal_scaling_curve.unref(); + + for (int i = 0; i < MAX_TRIGGER_DATA; ++i) { + _trigger_datas[i].unref(); + } + + for (int i = 0; i < MAX_AURA_STATS; ++i) { + _aura_stat_attributes[i].unref(); + } + + _talent_required_talent.unref(); + _talent_required_spell.unref(); + } ////// Triggers /////// @@ -341,6 +371,21 @@ void Aura::set_trigger_spell(int index, const Ref value) { _trigger_datas[index]->set_spell(value); } +//// Talent //// +Ref Aura::get_talent_required_talent() const { + return _talent_required_talent; +} +void Aura::set_talent_required_talent(const Ref rank) { + _talent_required_talent = rank; +} + +Ref Aura::get_talent_required_spell() const { + return _talent_required_talent; +} +void Aura::set_talent_required_spell(const Ref spell) { + _talent_required_spell = spell; +} + ////// Aura Stat Attributes ////// int Aura::get_aura_stat_attribute_count() const { @@ -1306,6 +1351,10 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("set_world_effect_data", "value"), &Aura::set_world_effect_data); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_effect_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldEffectData"), "set_world_effect_data", "get_world_effect_data"); + ClassDB::bind_method(D_METHOD("get_teaches_spell"), &Aura::get_teaches_spell); + ClassDB::bind_method(D_METHOD("set_teaches_spell", "next_rank"), &Aura::set_teaches_spell); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "teaches_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_teaches_spell", "get_teaches_spell"); + ADD_GROUP("Damage", "damage"); //Damage ClassDB::bind_method(D_METHOD("is_damage_enabled"), &Aura::is_damage_enabled); @@ -1393,6 +1442,17 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("set_supress_states", "value"), &Aura::set_supress_states); ADD_PROPERTY(PropertyInfo(Variant::INT, "states_supress", PROPERTY_HINT_FLAGS, EntityEnums::BINDING_STRING_ENTITY_STATE_TYPES), "set_supress_states", "get_supress_states"); + //// Talents //// + ADD_GROUP("Talent", "talent"); + ClassDB::bind_method(D_METHOD("get_talent_required_talent"), &Aura::get_talent_required_talent); + ClassDB::bind_method(D_METHOD("set_talent_required_talent", "next_rank"), &Aura::set_talent_required_talent); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "talent_required_talent", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_talent_required_talent", "get_talent_required_talent"); + + ClassDB::bind_method(D_METHOD("get_talent_required_spell"), &Aura::get_talent_required_spell); + ClassDB::bind_method(D_METHOD("set_talent_required_spell", "next_rank"), &Aura::set_talent_required_spell); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "talent_required_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_talent_required_spell", "get_talent_required_spell"); + + //// Triggers //// ADD_GROUP("Triggers", "trigger"); ClassDB::bind_method(D_METHOD("get_trigger_count"), &Aura::get_trigger_count); diff --git a/data/aura.h b/data/aura.h index cbd632d..ae58820 100644 --- a/data/aura.h +++ b/data/aura.h @@ -82,16 +82,14 @@ public: float get_heal_scale_for_level(int level); float get_absorb_scale_for_level(int level); void set(int id, float time, int auraGroup); + + Ref get_teaches_spell() const; + void set_teaches_spell(const Ref spell); // AnimationCurve* getDamageLevelScaling(); // AnimationCurve* getAbsorbLevelScaling(); // AnimationCurve* getHealLevelScaling(); - // void SetScalingData(AbilityScalingData* scalingData); - - // static void FromJSON(Aura* ada, JsonReader* r); - // static void ToJSON(Aura* ada, JsonWriter* w); - //Damage bool is_damage_enabled(); void set_damage_enabled(bool value); @@ -176,6 +174,13 @@ public: Ref get_trigger_spell(int index) const; void set_trigger_spell(int index, const Ref value); + //Talent + Ref get_talent_required_talent() const; + void set_talent_required_talent(const Ref rank); + + Ref get_talent_required_spell() const; + void set_talent_required_spell(const Ref spell); + //AuraStatAttributes int get_aura_stat_attribute_count() const; void set_aura_stat_attribute_count(int count); @@ -393,6 +398,7 @@ private: SpellEnums::AuraType _aura_type; bool _is_debuff; bool _hide; + Ref _teaches_spell; String _aura_name; String _aura_description; @@ -435,6 +441,10 @@ private: static const int DIMINISHING_RETURN_ROOT_AURA_ID = 1; static const int DIMINISHING_RETURN_TIME = 15; + + //Talent + Ref _talent_required_talent; + Ref _talent_required_spell; }; #endif diff --git a/data/data_manager.cpp b/data/data_manager.cpp index 144eff1..261e9c6 100644 --- a/data/data_manager.cpp +++ b/data/data_manager.cpp @@ -4,7 +4,6 @@ #include "aura.h" #include "craft_data_attribute.h" #include "spell.h" -#include "talent.h" DataManager *DataManager::instance; @@ -139,40 +138,6 @@ int DataManager::get_aura_count() { return _auras.size(); } -//Talents -void DataManager::add_talent(Ref talent) { - ERR_FAIL_COND(!talent.is_valid()); - - _talents.push_back(talent); - _talent_map.set(talent->get_id(), talent); -} - -String DataManager::get_talents_folder() { - return _talents_folder; -} -void DataManager::set_talents_folder(String folder) { - _talents_folder = folder; -} -Vector > *DataManager::get_talents() { - return &_talents; -} - -Ref DataManager::get_talent(int talent_id) { - ERR_FAIL_COND_V(!_talent_map.has(talent_id), Ref(NULL)); - - return _talent_map.get(talent_id); -} - -Ref DataManager::get_talent_index(int index) { - ERR_FAIL_INDEX_V(index, _talents.size(), Ref(NULL)); - - return _talents.get(index); -} - -int DataManager::get_talent_count() { - return _talents.size(); -} - //Craft Data void DataManager::add_craft_data(Ref cda) { ERR_FAIL_COND(!cda.is_valid()); @@ -310,7 +275,6 @@ void DataManager::load_all() { load_xp_data(); load_spells(); load_auras(); - load_talents(); load_characters(); load_craft_datas(); load_item_templates(); @@ -418,45 +382,6 @@ void DataManager::load_auras() { } } -void DataManager::load_talents() { - _Directory dir; - - ERR_FAIL_COND(_talents_folder.ends_with("/")); - - if (dir.open(_talents_folder) == OK) { - - dir.list_dir_begin(); - - String filename = dir.get_next(); - - while (filename != "") { - if (!dir.current_is_dir()) { - String path = _talents_folder + "/" + filename; - - _ResourceLoader *rl = _ResourceLoader::get_singleton(); - - Ref resl = rl->load_interactive(path, "Aura"); - - resl->wait(); - - Ref s = resl->get_resource(); - - ERR_CONTINUE(!s.is_valid()); - - Ref talent = s; - - ERR_CONTINUE(!talent.is_valid()); - - add_talent(talent); - } - - filename = dir.get_next(); - } - } else { - print_error("An error occurred when trying to access the path."); - } -} - void DataManager::load_characters() { _Directory dir; @@ -670,12 +595,6 @@ void DataManager::list_auras() { } } -void DataManager::list_talents() { - for (int i = 0; i < _talents.size(); ++i) { - print_error(itos(i) + ": " + _talents.get(i)->get_aura_name()); - } -} - void DataManager::list_craft_data() { for (int i = 0; i < _craft_datas.size(); ++i) { print_error(itos(i) + ": " + _craft_datas.get(i)->get_name()); @@ -742,16 +661,6 @@ void DataManager::_bind_methods() { ClassDB::bind_method(D_METHOD("get_aura_index", "index"), &DataManager::get_aura_index); ClassDB::bind_method(D_METHOD("get_aura_count"), &DataManager::get_aura_count); - //Talent - ClassDB::bind_method(D_METHOD("get_talents_folder"), &DataManager::get_talents_folder); - ClassDB::bind_method(D_METHOD("set_talents_folder", "folder"), &DataManager::set_talents_folder); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "talents_folder"), "set_talents_folder", "get_talents_folder"); - - ClassDB::bind_method(D_METHOD("add_talent", "spell"), &DataManager::add_talent); - ClassDB::bind_method(D_METHOD("get_talent", "id"), &DataManager::get_talent); - ClassDB::bind_method(D_METHOD("get_talent_index", "index"), &DataManager::get_talent_index); - ClassDB::bind_method(D_METHOD("get_talent_count"), &DataManager::get_talent_count); - //Craft Data ClassDB::bind_method(D_METHOD("get_craft_data_folder"), &DataManager::get_craft_data_folder); ClassDB::bind_method(D_METHOD("set_craft_data_folder", "folder"), &DataManager::set_craft_data_folder); @@ -797,7 +706,6 @@ void DataManager::_bind_methods() { ClassDB::bind_method(D_METHOD("load_xp_data"), &DataManager::load_xp_data); ClassDB::bind_method(D_METHOD("load_spells"), &DataManager::load_spells); ClassDB::bind_method(D_METHOD("load_auras"), &DataManager::load_auras); - ClassDB::bind_method(D_METHOD("load_talents"), &DataManager::load_talents); ClassDB::bind_method(D_METHOD("load_characters"), &DataManager::load_characters); ClassDB::bind_method(D_METHOD("load_craft_datas"), &DataManager::load_craft_datas); ClassDB::bind_method(D_METHOD("load_item_templates"), &DataManager::load_item_templates); @@ -808,7 +716,6 @@ void DataManager::_bind_methods() { ClassDB::bind_method(D_METHOD("list_characters"), &DataManager::list_characters); ClassDB::bind_method(D_METHOD("list_spells"), &DataManager::list_spells); ClassDB::bind_method(D_METHOD("list_auras"), &DataManager::list_auras); - ClassDB::bind_method(D_METHOD("list_talents"), &DataManager::list_talents); ClassDB::bind_method(D_METHOD("list_craft_data"), &DataManager::list_craft_data); ClassDB::bind_method(D_METHOD("list_item_templates"), &DataManager::list_item_templates); ClassDB::bind_method(D_METHOD("list_mob_datas"), &DataManager::list_mob_datas); @@ -833,9 +740,6 @@ DataManager::~DataManager() { _auras.clear(); _aura_map.clear(); - _talents.clear(); - _talent_map.clear(); - _craft_datas.clear(); _craft_data_map.clear(); diff --git a/data/data_manager.h b/data/data_manager.h index f2c9fcc..7670c4b 100644 --- a/data/data_manager.h +++ b/data/data_manager.h @@ -17,7 +17,6 @@ class Aura; class Spell; -class Talent; class EntityData; class CraftDataAttribute; class ItemTemplate; @@ -56,14 +55,6 @@ public: int get_aura_count(); void add_aura(Ref aura); - String get_talents_folder(); - void set_talents_folder(String folder); - Vector > *get_talents(); - Ref get_talent(int talent_id); - Ref get_talent_index(int index); - int get_talent_count(); - void add_talent(Ref talent); - String get_craft_data_folder(); void set_craft_data_folder(String folder); Vector > *get_craft_datas(); @@ -100,7 +91,6 @@ public: void load_xp_data(); void load_spells(); void load_auras(); - void load_talents(); void load_characters(); void load_craft_datas(); void load_item_templates(); @@ -110,7 +100,6 @@ public: void list_characters(); void list_spells(); void list_auras(); - void list_talents(); void list_craft_data(); void list_item_templates(); void list_mob_datas(); @@ -142,10 +131,6 @@ private: Vector > _auras; HashMap > _aura_map; - String _talents_folder; - Vector > _talents; - HashMap > _talent_map; - String _craft_data_folder; Vector > _craft_datas; HashMap > _craft_data_map; diff --git a/data/skill.cpp b/data/skill.cpp deleted file mode 100644 index c294e70..0000000 --- a/data/skill.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "skill.h" - -Skill::Skill() { - set_aura_type(SpellEnums::AURA_TYPE_SKILL); - set_hide(true); -} - -Skill::~Skill() { -} - -void Skill::_bind_methods() { -} diff --git a/data/skill.h b/data/skill.h deleted file mode 100644 index 939bb7c..0000000 --- a/data/skill.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SKILL_H -#define SKILL_H - -#include "core/resource.h" -#include "core/ustring.h" - -#include "aura.h" - -class Skill : public Aura { - GDCLASS(Skill, Aura); - -public: - - Skill(); - ~Skill(); - -protected: - static void _bind_methods(); - -private: - -}; - -#endif diff --git a/data/spell.cpp b/data/spell.cpp index 61cf935..df4147c 100644 --- a/data/spell.cpp +++ b/data/spell.cpp @@ -1,7 +1,6 @@ #include "spell.h" #include "aura.h" -#include "skill.h" int Spell::get_spell_id() { return _spell_id; @@ -530,10 +529,10 @@ void Spell::set_training_required_spell(Ref spell) { _training_required_spell = spell; } -Ref Spell::get_training_required_skill() { +Ref Spell::get_training_required_skill() { return _training_required_skill; } -void Spell::set_training_required_skill(Ref skill) { +void Spell::set_training_required_skill(Ref skill) { _training_required_skill = skill; } @@ -1149,7 +1148,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("get_training_required_skill"), &Spell::get_training_required_skill); ClassDB::bind_method(D_METHOD("set_training_required_skill", "curve"), &Spell::set_training_required_skill); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "training_required_skill", PROPERTY_HINT_RESOURCE_TYPE, "Skill"), "set_training_required_skill", "get_training_required_skill"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "training_required_skill", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_training_required_skill", "get_training_required_skill"); ClassDB::bind_method(D_METHOD("get_training_required_skill_level"), &Spell::get_training_required_skill_level); ClassDB::bind_method(D_METHOD("set_training_required_skill_level", "value"), &Spell::set_training_required_skill_level); diff --git a/data/spell.h b/data/spell.h index 3ed525a..5cc5b92 100644 --- a/data/spell.h +++ b/data/spell.h @@ -23,7 +23,6 @@ class Entity; class Aura; class SpellCastInfo; class Spell; -class Skill; enum TargetRelationType { TARGET_SELF = 1 << 0, @@ -290,8 +289,8 @@ public: Ref get_training_required_spell(); void set_training_required_spell(Ref spell); - Ref get_training_required_skill(); - void set_training_required_skill(Ref skill); + Ref get_training_required_skill(); + void set_training_required_skill(Ref skill); int get_training_required_skill_level(); void set_training_required_skill_level(int value); @@ -416,7 +415,7 @@ private: int _training_cost; Ref _training_required_spell; - Ref _training_required_skill; + Ref _training_required_skill; int _training_required_skill_level; }; diff --git a/data/talent.cpp b/data/talent.cpp deleted file mode 100644 index fcad947..0000000 --- a/data/talent.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "talent.h" - -Ref Talent::get_required_talent() const { - return _required_talent; -} -void Talent::set_required_talent(const Ref rank) { - _required_talent = rank; -} - -Ref Talent::get_required_spell() const { - return _required_talent; -} -void Talent::set_required_spell(const Ref spell) { - _required_spell = spell; -} - -Ref Talent::get_teaches_spell() const { - return _teaches_spell; -} -void Talent::set_teaches_spell(const Ref spell) { - _teaches_spell = spell; -} - -Ref Talent::get_apply_aura() const { - return _aura; -} -void Talent::set_apply_aura(Ref aura) { - _aura = Ref(aura); -} - -Talent::Talent() { - set_aura_type(SpellEnums::AURA_TYPE_TALENT); - set_hide(true); -} - -Talent::~Talent() { - _required_talent.unref(); - _required_spell.unref(); - _teaches_spell.unref(); - _aura.unref(); -} - -void Talent::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_required_talent"), &Talent::get_required_talent); - ClassDB::bind_method(D_METHOD("set_required_talent", "next_rank"), &Talent::set_required_talent); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "required_talent", PROPERTY_HINT_RESOURCE_TYPE, "Talent"), "set_required_talent", "get_required_talent"); - - ClassDB::bind_method(D_METHOD("get_required_spell"), &Talent::get_required_spell); - ClassDB::bind_method(D_METHOD("set_required_spell", "next_rank"), &Talent::set_required_spell); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "required_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_required_spell", "get_required_spell"); - - ClassDB::bind_method(D_METHOD("get_teaches_spell"), &Talent::get_teaches_spell); - ClassDB::bind_method(D_METHOD("set_teaches_spell", "next_rank"), &Talent::set_teaches_spell); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "teaches_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_teaches_spell", "get_teaches_spell"); - - ClassDB::bind_method(D_METHOD("get_apply_aura"), &Talent::get_apply_aura); - ClassDB::bind_method(D_METHOD("set_apply_aura", "value"), &Talent::set_apply_aura); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "apply_aura", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_apply_aura", "get_apply_aura"); -} diff --git a/data/talent.h b/data/talent.h deleted file mode 100644 index e8ef9bc..0000000 --- a/data/talent.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef TALENT_H -#define TALENT_H - -#include "core/resource.h" -#include "core/ustring.h" - -#include "aura.h" - -class Spell; - -class Talent : public Aura { - GDCLASS(Talent, Aura); - -public: - Ref get_required_talent() const; - void set_required_talent(const Ref rank); - - Ref get_required_spell() const; - void set_required_spell(const Ref spell); - - Ref get_teaches_spell() const; - void set_teaches_spell(const Ref spell); - - Ref get_apply_aura() const; - void set_apply_aura(Ref aura); - - Talent(); - ~Talent(); - -protected: - static void _bind_methods(); - -private: - Ref _required_talent; - Ref _required_spell; - Ref _teaches_spell; - - Ref _aura; -}; - -#endif diff --git a/entities/data/character_spec.cpp b/entities/data/character_spec.cpp index 7d921a9..a4060d1 100644 --- a/entities/data/character_spec.cpp +++ b/entities/data/character_spec.cpp @@ -1,6 +1,6 @@ #include "character_spec.h" -#include "../../data/talent.h" +#include "../../data/aura.h" int CharacterSpec::get_spec_id() { return _spec_id; @@ -50,14 +50,14 @@ void CharacterSpec::set_talent_rows(const Vector &talent_rows) { } } -Ref CharacterSpec::get_talent(const int row_index, const int culomn, const int rank) const { - ERR_FAIL_INDEX_V(row_index, _rows.size(), Ref(NULL)); +Ref CharacterSpec::get_talent(const int row_index, const int culomn, const int rank) const { + ERR_FAIL_INDEX_V(row_index, _rows.size(), Ref(NULL)); if (_rows[row_index].is_valid()) { return _rows[row_index]->get_talent(culomn, rank); } - return Ref(NULL); + return Ref(NULL); } @@ -89,6 +89,4 @@ void CharacterSpec::_bind_methods() { ClassDB::bind_method(D_METHOD("get_talent_rows"), &CharacterSpec::get_talent_rows); ClassDB::bind_method(D_METHOD("set_talent_rows", "auras"), &CharacterSpec::set_talent_rows); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "talent_rows", PROPERTY_HINT_NONE, "17/17:TalentRowData", PROPERTY_USAGE_DEFAULT, "TalentRowData"), "set_talent_rows", "get_talent_rows"); - - ClassDB::bind_method(D_METHOD("get_talent", "row_index", "index"), &CharacterSpec::get_talent); } diff --git a/entities/data/character_spec.h b/entities/data/character_spec.h index 2ec967d..f8dca38 100644 --- a/entities/data/character_spec.h +++ b/entities/data/character_spec.h @@ -8,7 +8,7 @@ #include "talent_row_data.h" class TalentRowData; -class Talent; +class Aura; class CharacterSpec : public Resource { GDCLASS(CharacterSpec, Resource); @@ -28,7 +28,7 @@ public: Vector get_talent_rows(); void set_talent_rows(const Vector &auras); - Ref get_talent(const int row_index, const int culomn, const int rank) const; + Ref get_talent(const int row_index, const int culomn, const int rank) const; CharacterSpec(); ~CharacterSpec(); diff --git a/entities/data/talent_row_data.cpp b/entities/data/talent_row_data.cpp index 9cff061..a96cd35 100644 --- a/entities/data/talent_row_data.cpp +++ b/entities/data/talent_row_data.cpp @@ -1,24 +1,24 @@ #include "talent_row_data.h" -Ref TalentRowData::get_talent_index(int index) const { - ERR_FAIL_INDEX_V(index, TOTAL_ENTRIES, Ref()); +Ref TalentRowData::get_talent_index(int index) const { + ERR_FAIL_INDEX_V(index, TOTAL_ENTRIES, Ref()); return _talents[index]; } -void TalentRowData::set_talent_index(int index, Ref talent) { +void TalentRowData::set_talent_index(int index, Ref talent) { ERR_FAIL_INDEX(index, TOTAL_ENTRIES); - _talents[index] = Ref(talent); + _talents[index] = Ref(talent); } -Ref TalentRowData::get_talent(int culomn, int rank) const { - ERR_FAIL_INDEX_V(culomn, MAX_TALENTS_IN_ROW, Ref()); - ERR_FAIL_INDEX_V(rank, MAX_TALENTS_PER_ENTRY, Ref()); +Ref TalentRowData::get_talent(int culomn, int rank) const { + ERR_FAIL_INDEX_V(culomn, MAX_TALENTS_IN_ROW, Ref()); + ERR_FAIL_INDEX_V(rank, MAX_TALENTS_PER_ENTRY, Ref()); return _talents[culomn * MAX_TALENTS_IN_ROW + rank]; } -void TalentRowData::set_talent(int culomn, int rank, Ref talent) { +void TalentRowData::set_talent(int culomn, int rank, Ref talent) { ERR_FAIL_INDEX(culomn, MAX_TALENTS_IN_ROW); ERR_FAIL_INDEX(rank, MAX_TALENTS_PER_ENTRY); @@ -34,13 +34,13 @@ bool TalentRowData::has_talent_with_id(int id) { return false; } -Ref TalentRowData::get_talent_with_id(int id) { +Ref TalentRowData::get_talent_with_id(int id) { for (int i = 0; i < TOTAL_ENTRIES; ++i) { if (_talents[i].is_valid() && _talents[i]->get_id() == id) return _talents[i]; } - return Ref(); + return Ref(); } TalentRowData::TalentRowData() { @@ -63,7 +63,7 @@ void TalentRowData::_bind_methods() { for (int i = 0; i < MAX_TALENTS_IN_ROW; ++i) { for (int j = 0; j < MAX_TALENTS_PER_ENTRY; ++j) { - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "Talent_" + itos(i) + "_" + itos(j), PROPERTY_HINT_RESOURCE_TYPE, "Talent", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_talent_index", "get_talent_index", i * MAX_TALENTS_IN_ROW + j); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "Talent_" + itos(i) + "_" + itos(j), PROPERTY_HINT_RESOURCE_TYPE, "Aura", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_talent_index", "get_talent_index", i * MAX_TALENTS_IN_ROW + j); } } diff --git a/entities/data/talent_row_data.h b/entities/data/talent_row_data.h index a3f8be5..f88b1c7 100644 --- a/entities/data/talent_row_data.h +++ b/entities/data/talent_row_data.h @@ -4,22 +4,22 @@ #include "core/reference.h" #include "core/ustring.h" -#include "../../data/talent.h" +#include "../../data/aura.h" -class Talent; +class Aura; class TalentRowData : public Resource { GDCLASS(TalentRowData, Resource); public: - Ref get_talent_index(int index) const; - void set_talent_index(int index, Ref talent); + Ref get_talent_index(int index) const; + void set_talent_index(int index, Ref talent); - Ref get_talent(int culomn, int rank) const; - void set_talent(int culomn, int rank, Ref talent); + Ref get_talent(int culomn, int rank) const; + void set_talent(int culomn, int rank, Ref talent); bool has_talent_with_id(int id); - Ref get_talent_with_id(int id); + Ref get_talent_with_id(int id); TalentRowData(); ~TalentRowData(); @@ -35,7 +35,7 @@ protected: static void _bind_methods(); private: - Ref _talents[TOTAL_ENTRIES]; + Ref _talents[TOTAL_ENTRIES]; }; #endif diff --git a/entities/entity.cpp b/entities/entity.cpp index 5fdaa5f..d9a0cdd 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -3373,7 +3373,7 @@ void Entity::_sreceive_talent_learn_request(int spec_index, int talent_row, int ERR_FAIL_COND(!tr.is_valid()); for (int i = 0; i < TalentRowData::MAX_TALENTS_PER_ENTRY; ++i) { - Ref talent = tr->get_talent(talent_culomn, i); + Ref talent = tr->get_talent(talent_culomn, i); if (!talent.is_valid()) return; @@ -3383,20 +3383,20 @@ void Entity::_sreceive_talent_learn_request(int spec_index, int talent_row, int if (hass_talent(talent_id)) continue; - if (talent->get_required_talent().is_valid()) { - if (!hass_talent(talent->get_required_talent()->get_id())) { + if (talent->get_talent_required_talent().is_valid()) { + if (!hass_talent(talent->get_talent_required_talent()->get_id())) { return; } } - if (talent->get_required_spell().is_valid()) { - if (!hass_spell(talent->get_required_spell())) { + if (talent->get_talent_required_spell().is_valid()) { + if (!hass_spell(talent->get_talent_required_spell())) { return; } } if (i > 0) { - Ref pt = tr->get_talent(talent_culomn, i - 1); + Ref pt = tr->get_talent(talent_culomn, i - 1); for (int j = 0; j < sget_aura_count(); ++j) { Ref ad = sget_aura(j); diff --git a/register_types.cpp b/register_types.cpp index 36184a7..0044908 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -6,8 +6,6 @@ #include "data/aura.h" #include "data/aura_stat_attribute.h" #include "data/data_manager.h" -#include "data/talent.h" -#include "data/skill.h" #include "data/xp_data.h" #include "data/item_stat_modifier.h" #include "data/item_template_stat_modifier.h" @@ -138,8 +136,6 @@ void register_entity_spell_system_types() { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class();