mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-19 21:33:15 +02:00
Merged Talent and Skill into Aura.
This commit is contained in:
parent
f819668ab0
commit
262e278377
2
SCsub
2
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")
|
||||
|
@ -120,6 +120,13 @@ void Aura::set_diminishing_category(SpellEnums::DiminishingReturnCategory dimini
|
||||
_diminishing_category = diminishingCategory;
|
||||
}
|
||||
|
||||
Ref<Spell> Aura::get_teaches_spell() const {
|
||||
return _teaches_spell;
|
||||
}
|
||||
void Aura::set_teaches_spell(const Ref<Spell> 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<Spell> value) {
|
||||
_trigger_datas[index]->set_spell(value);
|
||||
}
|
||||
|
||||
//// Talent ////
|
||||
Ref<Aura> Aura::get_talent_required_talent() const {
|
||||
return _talent_required_talent;
|
||||
}
|
||||
void Aura::set_talent_required_talent(const Ref<Aura> rank) {
|
||||
_talent_required_talent = rank;
|
||||
}
|
||||
|
||||
Ref<Spell> Aura::get_talent_required_spell() const {
|
||||
return _talent_required_talent;
|
||||
}
|
||||
void Aura::set_talent_required_spell(const Ref<Spell> 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);
|
||||
|
20
data/aura.h
20
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<Spell> get_teaches_spell() const;
|
||||
void set_teaches_spell(const Ref<Spell> 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<Spell> get_trigger_spell(int index) const;
|
||||
void set_trigger_spell(int index, const Ref<Spell> value);
|
||||
|
||||
//Talent
|
||||
Ref<Aura> get_talent_required_talent() const;
|
||||
void set_talent_required_talent(const Ref<Aura> rank);
|
||||
|
||||
Ref<Spell> get_talent_required_spell() const;
|
||||
void set_talent_required_spell(const Ref<Spell> 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<Spell> _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<Aura> _talent_required_talent;
|
||||
Ref<Spell> _talent_required_spell;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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> 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<Ref<Talent> > *DataManager::get_talents() {
|
||||
return &_talents;
|
||||
}
|
||||
|
||||
Ref<Talent> DataManager::get_talent(int talent_id) {
|
||||
ERR_FAIL_COND_V(!_talent_map.has(talent_id), Ref<Talent>(NULL));
|
||||
|
||||
return _talent_map.get(talent_id);
|
||||
}
|
||||
|
||||
Ref<Talent> DataManager::get_talent_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _talents.size(), Ref<Talent>(NULL));
|
||||
|
||||
return _talents.get(index);
|
||||
}
|
||||
|
||||
int DataManager::get_talent_count() {
|
||||
return _talents.size();
|
||||
}
|
||||
|
||||
//Craft Data
|
||||
void DataManager::add_craft_data(Ref<CraftDataAttribute> 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<ResourceInteractiveLoader> resl = rl->load_interactive(path, "Aura");
|
||||
|
||||
resl->wait();
|
||||
|
||||
Ref<Resource> s = resl->get_resource();
|
||||
|
||||
ERR_CONTINUE(!s.is_valid());
|
||||
|
||||
Ref<Talent> 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();
|
||||
|
||||
|
@ -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> aura);
|
||||
|
||||
String get_talents_folder();
|
||||
void set_talents_folder(String folder);
|
||||
Vector<Ref<Talent> > *get_talents();
|
||||
Ref<Talent> get_talent(int talent_id);
|
||||
Ref<Talent> get_talent_index(int index);
|
||||
int get_talent_count();
|
||||
void add_talent(Ref<Talent> talent);
|
||||
|
||||
String get_craft_data_folder();
|
||||
void set_craft_data_folder(String folder);
|
||||
Vector<Ref<CraftDataAttribute> > *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<Ref<Aura> > _auras;
|
||||
HashMap<int, Ref<Aura> > _aura_map;
|
||||
|
||||
String _talents_folder;
|
||||
Vector<Ref<Talent> > _talents;
|
||||
HashMap<int, Ref<Talent> > _talent_map;
|
||||
|
||||
String _craft_data_folder;
|
||||
Vector<Ref<CraftDataAttribute> > _craft_datas;
|
||||
HashMap<int, Ref<CraftDataAttribute> > _craft_data_map;
|
||||
|
@ -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() {
|
||||
}
|
24
data/skill.h
24
data/skill.h
@ -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
|
@ -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> spell) {
|
||||
_training_required_spell = spell;
|
||||
}
|
||||
|
||||
Ref<Skill> Spell::get_training_required_skill() {
|
||||
Ref<Aura> Spell::get_training_required_skill() {
|
||||
return _training_required_skill;
|
||||
}
|
||||
void Spell::set_training_required_skill(Ref<Skill> skill) {
|
||||
void Spell::set_training_required_skill(Ref<Aura> 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);
|
||||
|
@ -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<Spell> get_training_required_spell();
|
||||
void set_training_required_spell(Ref<Spell> spell);
|
||||
|
||||
Ref<Skill> get_training_required_skill();
|
||||
void set_training_required_skill(Ref<Skill> skill);
|
||||
Ref<Aura> get_training_required_skill();
|
||||
void set_training_required_skill(Ref<Aura> skill);
|
||||
|
||||
int get_training_required_skill_level();
|
||||
void set_training_required_skill_level(int value);
|
||||
@ -416,7 +415,7 @@ private:
|
||||
|
||||
int _training_cost;
|
||||
Ref<Spell> _training_required_spell;
|
||||
Ref<Skill> _training_required_skill;
|
||||
Ref<Aura> _training_required_skill;
|
||||
int _training_required_skill_level;
|
||||
};
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
#include "talent.h"
|
||||
|
||||
Ref<Talent> Talent::get_required_talent() const {
|
||||
return _required_talent;
|
||||
}
|
||||
void Talent::set_required_talent(const Ref<Talent> rank) {
|
||||
_required_talent = rank;
|
||||
}
|
||||
|
||||
Ref<Spell> Talent::get_required_spell() const {
|
||||
return _required_talent;
|
||||
}
|
||||
void Talent::set_required_spell(const Ref<Spell> spell) {
|
||||
_required_spell = spell;
|
||||
}
|
||||
|
||||
Ref<Spell> Talent::get_teaches_spell() const {
|
||||
return _teaches_spell;
|
||||
}
|
||||
void Talent::set_teaches_spell(const Ref<Spell> spell) {
|
||||
_teaches_spell = spell;
|
||||
}
|
||||
|
||||
Ref<Aura> Talent::get_apply_aura() const {
|
||||
return _aura;
|
||||
}
|
||||
void Talent::set_apply_aura(Ref<Aura> aura) {
|
||||
_aura = Ref<Aura>(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");
|
||||
}
|
@ -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<Talent> get_required_talent() const;
|
||||
void set_required_talent(const Ref<Talent> rank);
|
||||
|
||||
Ref<Spell> get_required_spell() const;
|
||||
void set_required_spell(const Ref<Spell> spell);
|
||||
|
||||
Ref<Spell> get_teaches_spell() const;
|
||||
void set_teaches_spell(const Ref<Spell> spell);
|
||||
|
||||
Ref<Aura> get_apply_aura() const;
|
||||
void set_apply_aura(Ref<Aura> aura);
|
||||
|
||||
Talent();
|
||||
~Talent();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<Talent> _required_talent;
|
||||
Ref<Spell> _required_spell;
|
||||
Ref<Spell> _teaches_spell;
|
||||
|
||||
Ref<Aura> _aura;
|
||||
};
|
||||
|
||||
#endif
|
@ -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<Variant> &talent_rows) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Talent> CharacterSpec::get_talent(const int row_index, const int culomn, const int rank) const {
|
||||
ERR_FAIL_INDEX_V(row_index, _rows.size(), Ref<Talent>(NULL));
|
||||
Ref<Aura> CharacterSpec::get_talent(const int row_index, const int culomn, const int rank) const {
|
||||
ERR_FAIL_INDEX_V(row_index, _rows.size(), Ref<Aura>(NULL));
|
||||
|
||||
if (_rows[row_index].is_valid()) {
|
||||
return _rows[row_index]->get_talent(culomn, rank);
|
||||
}
|
||||
|
||||
return Ref<Talent>(NULL);
|
||||
return Ref<Aura>(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);
|
||||
}
|
||||
|
@ -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<Variant> get_talent_rows();
|
||||
void set_talent_rows(const Vector<Variant> &auras);
|
||||
|
||||
Ref<Talent> get_talent(const int row_index, const int culomn, const int rank) const;
|
||||
Ref<Aura> get_talent(const int row_index, const int culomn, const int rank) const;
|
||||
|
||||
CharacterSpec();
|
||||
~CharacterSpec();
|
||||
|
@ -1,24 +1,24 @@
|
||||
#include "talent_row_data.h"
|
||||
|
||||
Ref<Talent> TalentRowData::get_talent_index(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, TOTAL_ENTRIES, Ref<Talent>());
|
||||
Ref<Aura> TalentRowData::get_talent_index(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, TOTAL_ENTRIES, Ref<Aura>());
|
||||
|
||||
return _talents[index];
|
||||
}
|
||||
|
||||
void TalentRowData::set_talent_index(int index, Ref<Talent> talent) {
|
||||
void TalentRowData::set_talent_index(int index, Ref<Aura> talent) {
|
||||
ERR_FAIL_INDEX(index, TOTAL_ENTRIES);
|
||||
|
||||
_talents[index] = Ref<Talent>(talent);
|
||||
_talents[index] = Ref<Aura>(talent);
|
||||
}
|
||||
|
||||
Ref<Talent> TalentRowData::get_talent(int culomn, int rank) const {
|
||||
ERR_FAIL_INDEX_V(culomn, MAX_TALENTS_IN_ROW, Ref<Talent>());
|
||||
ERR_FAIL_INDEX_V(rank, MAX_TALENTS_PER_ENTRY, Ref<Talent>());
|
||||
Ref<Aura> TalentRowData::get_talent(int culomn, int rank) const {
|
||||
ERR_FAIL_INDEX_V(culomn, MAX_TALENTS_IN_ROW, Ref<Aura>());
|
||||
ERR_FAIL_INDEX_V(rank, MAX_TALENTS_PER_ENTRY, Ref<Aura>());
|
||||
|
||||
return _talents[culomn * MAX_TALENTS_IN_ROW + rank];
|
||||
}
|
||||
void TalentRowData::set_talent(int culomn, int rank, Ref<Talent> talent) {
|
||||
void TalentRowData::set_talent(int culomn, int rank, Ref<Aura> 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<Talent> TalentRowData::get_talent_with_id(int id) {
|
||||
Ref<Aura> 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<Talent>();
|
||||
return Ref<Aura>();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<Talent> get_talent_index(int index) const;
|
||||
void set_talent_index(int index, Ref<Talent> talent);
|
||||
Ref<Aura> get_talent_index(int index) const;
|
||||
void set_talent_index(int index, Ref<Aura> talent);
|
||||
|
||||
Ref<Talent> get_talent(int culomn, int rank) const;
|
||||
void set_talent(int culomn, int rank, Ref<Talent> talent);
|
||||
Ref<Aura> get_talent(int culomn, int rank) const;
|
||||
void set_talent(int culomn, int rank, Ref<Aura> talent);
|
||||
|
||||
bool has_talent_with_id(int id);
|
||||
Ref<Talent> get_talent_with_id(int id);
|
||||
Ref<Aura> get_talent_with_id(int id);
|
||||
|
||||
TalentRowData();
|
||||
~TalentRowData();
|
||||
@ -35,7 +35,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<Talent> _talents[TOTAL_ENTRIES];
|
||||
Ref<Aura> _talents[TOTAL_ENTRIES];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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> talent = tr->get_talent(talent_culomn, i);
|
||||
Ref<Aura> 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<Talent> pt = tr->get_talent(talent_culomn, i - 1);
|
||||
Ref<Aura> pt = tr->get_talent(talent_culomn, i - 1);
|
||||
|
||||
for (int j = 0; j < sget_aura_count(); ++j) {
|
||||
Ref<AuraData> ad = sget_aura(j);
|
||||
|
@ -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<ItemTemplate>();
|
||||
ClassDB::register_class<ItemInstance>();
|
||||
ClassDB::register_class<SpellCooldownManipulationData>();
|
||||
ClassDB::register_class<Talent>();
|
||||
ClassDB::register_class<Skill>();
|
||||
ClassDB::register_class<TalentRowData>();
|
||||
|
||||
ClassDB::register_class<EntitySkill>();
|
||||
|
Loading…
Reference in New Issue
Block a user