Merged Spell with Aura. I kept the method of applying auras the same for now, eventually spell will do it automatically.

This commit is contained in:
Relintai 2022-01-12 15:53:35 +01:00
parent 5ac0fb6604
commit e14ba1e368
36 changed files with 2234 additions and 4218 deletions

1
SCsub
View File

@ -23,7 +23,6 @@ sources = [
"spell_enums.cpp",
"item_enums.cpp",
"data/auras/aura.cpp",
"data/auras/aura_group.cpp",
"data/items/item_instance.cpp",

View File

@ -16,7 +16,6 @@ def get_doc_classes():
"ESS",
"AuraGroup",
"Aura",
"CraftRecipeHelper",
"CraftRecipe",
"EquipmentData",

File diff suppressed because it is too large Load Diff

View File

@ -1,470 +0,0 @@
/*
Copyright (c) 2019-2021 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_H
#define AURA_H
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#else
#include "core/resource.h"
#endif
#include "scene/resources/curve.h"
#include "scene/resources/texture.h"
#include "aura_group.h"
#include "../../entity_enums.h"
#include "../../spell_enums.h"
#include "../../entities/entity.h"
#include "../../infos/aura_infos.h"
#include "../../entities/auras/aura_data.h"
#include "../../infos/spell_cast_info.h"
#include "../../pipelines/spell_damage_info.h"
#include "../../pipelines/spell_heal_info.h"
#include "../spells/spell_effect_visual.h"
class AuraApplyInfo;
class AuraScript;
class Entity;
class SpellCastInfo;
class EntityResourceCostData;
class Spell;
class Aura : public Resource {
GDCLASS(Aura, Resource);
public:
int get_id() const;
void set_id(const int value);
int get_rank() const;
void set_rank(const int value);
Ref<Texture> get_icon();
void set_icon(const Ref<Texture> &value);
float aura_get_time() const;
void aura_set_time(const float value);
Ref<AuraGroup> aura_get_aura_group();
void aura_set_aura_group(const Ref<AuraGroup> &value);
bool aura_get_is_debuff() const;
void aura_set_is_debuff(const bool value);
float aura_get_tick() const;
void aura_set_tick(const float value);
SpellEnums::AuraType aura_get_aura_type() const;
void aura_set_aura_type(const SpellEnums::AuraType value);
bool aura_get_scale_with_level() const;
void aura_set_scale_with_level(const bool value);
String aura_get_text_translation_key() const;
void aura_set_text_translation_key(const String &value);
String aura_get_text_description() const;
void aura_set_text_description(const String description);
bool aura_get_hide() const;
void aura_set_hide(const bool value);
Ref<SpellEffectVisual> aura_get_visual_spell_effects();
void aura_set_visual_spell_effects(const Ref<SpellEffectVisual> &value);
int aura_get_ability_scale_data_id() const;
void aura_set_ability_scale_data_id(const int value);
float aura_damage_get_scale_for_level(int level) const;
float aura_heal_get_scale_for_level(int level) const;
float aura_absorb_get_scale_for_level(int level) const;
Ref<Spell> aura_get_teaches_spell();
void aura_set_teaches_spell(const Ref<Spell> &spell);
//Damage
bool aura_damage_get_enabled() const;
void aura_damage_set_enabled(const bool value);
int aura_damage_get_type() const;
void aura_damage_set_type(const int value);
int aura_damage_get_min() const;
void aura_damage_set_min(const int value);
int aura_damage_get_max() const;
void aura_damage_set_max(const int value);
bool aura_damage_get_can_crit() const;
void aura_damage_set_can_crit(const bool value);
void aura_damage_set(const int min, const int max, const bool can_crit);
//Absorb
bool aura_absorb_get_enabled() const;
void aura_absorb_set_enabled(const bool value);
int aura_absorb_damage_get_type() const;
void aura_absorb_damage_set_type(const int value);
int aura_absorb_get_min() const;
void aura_absorb_set_min(const int value);
int aura_absorb_get_max() const;
void aura_absorb_set_max(const int value);
//Heal
bool aura_heal_get_enabled() const;
void aura_heal_set_enabled(const bool value);
int aura_heal_get_min() const;
void aura_heal_set_min(const int value);
int aura_heal_get_max() const;
void aura_heal_set_max(const int value);
bool aura_heal_get_can_crit() const;
void aura_heal_set_can_crit(const bool value);
void aura_heal_set(const int min, const int max, const bool can_crit);
//Dispells
bool aura_dispell_get_enabled() const;
void aura_dispell_set_enabled(const bool value);
int aura_dispell_get_count_min() const;
void aura_dispell_set_count_min(const int value);
int aura_dispell_get_count_max() const;
void aura_dispell_set_count_max(const int value);
int aura_dispell_get_aura_types() const;
void aura_dispell_set_aura_types(const int value);
//Resources
Ref<EntityResourceCostData> aura_get_resource_cost();
void aura_set_resource_cost(const Ref<EntityResourceCostData> &value);
Ref<EntityResourceCostData> aura_get_resource_give();
void aura_set_resource_give(const Ref<EntityResourceCostData> &value);
Ref<Curve> aura_damage_get_scaling_curve() { return _aura_damage_scaling_curve; }
void aura_damage_set_scaling_curve(const Ref<Curve> &curve) { _aura_damage_scaling_curve = curve; }
Ref<Curve> aura_heal_get_scaling_curve() { return _aura_heal_scaling_curve; }
void aura_heal_set_scaling_curve(const Ref<Curve> &curve) { _aura_heal_scaling_curve = curve; }
Ref<Curve> aura_absorb_get_scaling_curve() { return _aura_absorb_scaling_curve; }
void aura_absorb_set_scaling_curve(const Ref<Curve> &curve) { _aura_absorb_scaling_curve = curve; }
//states
int aura_get_add_states() const { return _aura_add_states; }
void aura_set_add_states(const int value) { _aura_add_states = value; }
int aura_get_remove_effects_with_states() const { return _aura_remove_effects_with_states; }
void aura_set_remove_effects_with_states(const int value) { _aura_remove_effects_with_states = value; }
int aura_get_supress_states() const { return _aura_supress_states; }
void aura_set_supress_states(const int value) { _aura_supress_states = value; }
//DiminishingReturns
bool aura_diminishing_return_enabled_get() const;
void aura_diminishing_return_enabled_set(const bool value);
int aura_diminishing_return_category_get() const;
void aura_diminishing_return_category_set(const int value);
//Triggers
int aura_trigger_get_count() const;
void aura_trigger_set_count(const int count);
SpellEnums::TriggerNotificationType aura_trigger_get_notification_type(const int index) const;
void aura_trigger_set_notification_type(const int index, const SpellEnums::TriggerNotificationType value);
int aura_trigger_get_notification_data(const int index) const;
void aura_trigger_set_notification_data(const int index, const int value);
SpellEnums::TriggerType aura_trigger_get_trigger_type(const int index) const;
void aura_trigger_set_trigger_type(const int index, const SpellEnums::TriggerType value);
float aura_trigger_get_trigger_type_data(const int index) const;
void aura_trigger_set_trigger_type_data(const int index, const float value);
Ref<Spell> aura_trigger_get_spell(const int index) const;
void aura_trigger_set_spell(const int index, const Ref<Spell> &value);
//Talent
Ref<Aura> aura_get_talent_required_talent() const;
void aura_set_talent_required_talent(const Ref<Aura> rank);
Ref<Spell> aura_get_talent_required_spell() const;
void aura_set_talent_required_spell(const Ref<Spell> spell);
//AuraStatAttributes
int aura_stat_attribute_get_count() const;
void aura_stat_attribute_set_count(int count);
int aura_stat_attribute_get_stat(int index) const;
void aura_stat_attribute_set_stat(int index, const int value);
float aura_stat_attribute_get_base_mod(int index) const;
void aura_stat_attribute_set_base_mod(int index, float value);
float aura_stat_attribute_get_bonus_mod(int index) const;
void aura_stat_attribute_set_bonus_mod(int index, float value);
float aura_stat_attribute_get_percent_mod(int index) const;
void aura_stat_attribute_set_percent_mod(int index, float value);
//// SpellSystem ////
//Commands, c++ only
void aura_sapply_simple(Entity *caster, Entity *target, float spell_scale);
//Commands
void aura_sapply(Ref<AuraApplyInfo> info);
void aura_sdeapply(Ref<AuraData> info);
void aura_sadd(Ref<AuraData> aura);
void aura_sremove(Ref<AuraData> aura);
void aura_removes_expired(Ref<AuraData> aura);
void aura_removes_dispell(Ref<AuraData> aura);
void aura_supdate(Ref<AuraData> aura, float delta);
//EventHandlers
void notification_saura(int what, Ref<AuraData> data);
void notification_sheal(int what, Ref<AuraData> aura, Ref<SpellHealInfo> data);
void notification_scast(int what, Ref<AuraData> aura, Ref<SpellCastInfo> info);
void notification_sdamage(int what, Ref<AuraData> aura, Ref<SpellDamageInfo> data);
void son_remove(Ref<AuraData> aura);
void son_remove_expired(Ref<AuraData> aura);
void son_remove_dispell(Ref<AuraData> aura);
void notification_sdeath(Ref<AuraData> data);
void notification_scooldown_added(Ref<AuraData> data, int id, float value);
void notification_scooldown_removed(Ref<AuraData> data, int id, float value);
void notification_scategory_cooldown_added(Ref<AuraData> data, int id, float value);
void notification_scategory_cooldown_removed(Ref<AuraData> data, int id, float value);
void notification_sgcd_started(Ref<AuraData> data, float gcd);
void notification_sgcd_finished(Ref<AuraData> data);
void son_physics_process(Ref<AuraData> data);
void notification_sxp_gained(Ref<AuraData> data, int value);
void notification_slevel_up(Ref<AuraData> data, int value);
void notification_sentity_resource_added(Ref<AuraData> data, Ref<EntityResource> resource);
void notification_sentity_resource_removed(Ref<AuraData> data, Ref<EntityResource> resource);
//Clientside Event Handlers
void notification_caura(int what, Ref<AuraData> data);
void notification_cheal(int what, Ref<AuraData> aura, Ref<SpellHealInfo> data);
void notification_ccast(int what, Ref<AuraData> aura, Ref<SpellCastInfo> info);
void notification_cdamage(int what, Ref<AuraData> aura, Ref<SpellDamageInfo> data);
void notification_cdeath(Ref<AuraData> data);
void notification_ccooldown_added(Ref<AuraData> data, int id, float value);
void notification_ccooldown_removed(Ref<AuraData> data, int id, float value);
void notification_ccategory_cooldown_added(Ref<AuraData> data, int id, float value);
void notification_ccategory_cooldown_removed(Ref<AuraData> data, int id, float value);
void notification_cgcd_started(Ref<AuraData> data, float gcd);
void notification_cgcd_finished(Ref<AuraData> data);
void notification_cxp_gained(Ref<AuraData> data, int value);
void notification_clevel_up(Ref<AuraData> data, int value);
void notification_centity_resource_added(Ref<AuraData> data, Ref<EntityResource> resource);
void notification_centity_resource_removed(Ref<AuraData> data, Ref<EntityResource> resource);
//Equipment
bool equip_should_deny(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item);
void equip_son_success(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_son_fail(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_con_success(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_con_fail(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
//Calculations / Queries
void setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
void aura_sapply_passives_damage_receive(Ref<SpellDamageInfo> info);
void aura_sapply_passives_damage_deal(Ref<SpellDamageInfo> info);
void aura_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
void handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> info);
void aura_sapply_passives_heal_receive(Ref<SpellHealInfo> info);
void aura_sapply_passives_heal_deal(Ref<SpellHealInfo> info);
void aura_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
void handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info);
_FORCE_INLINE_ bool aura_is_talent() const { return _aura_type == SpellEnums::AURA_TYPE_TALENT; }
String aura_get_name_translated() const;
String aura_get_description(const int class_level, const int character_level);
String _aura_get_description(const int class_level, const int character_level);
Aura();
~Aura();
protected:
virtual void _aura_sapply(Ref<AuraApplyInfo> info);
virtual void _aura_sdeapply(Ref<AuraData> info);
virtual void _aura_sadd(Ref<AuraData> aura);
virtual void _aura_sremove(Ref<AuraData> aura);
virtual void _aura_removes_expired(Ref<AuraData> aura);
virtual void _aura_removes_dispell(Ref<AuraData> aura);
virtual void _aura_supdate(Ref<AuraData> aura, float delta);
virtual void _setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
virtual void _aura_sapply_passives_damage_receive(Ref<SpellDamageInfo> info);
virtual void _aura_sapply_passives_damage_deal(Ref<SpellDamageInfo> info);
virtual void _aura_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
virtual void _handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> info);
virtual void _aura_sapply_passives_heal_receive(Ref<SpellHealInfo> info);
virtual void _aura_sapply_passives_heal_deal(Ref<SpellHealInfo> info);
virtual void _aura_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
virtual void _handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info);
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> spell;
AuraTriggerData() {
notification_type = SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA;
trigger_type = SpellEnums::TRIGGER_TYPE_NONE;
notification_data = 0;
trigger_type_data = 0;
}
};
struct AuraStatAttribute {
int stat;
float base_mod;
float bonus_mod;
float percent_mod;
AuraStatAttribute() {
stat = 0;
base_mod = 0;
bonus_mod = 0;
percent_mod = 0;
}
};
private:
enum {
MAX_AURA_STATS = 5, //Increase if necessary, should be enough for now
MAX_TRIGGER_DATA = 5,
};
int _id;
int _rank;
Ref<Texture> _icon;
float _aura_time;
float _aura_tick;
Ref<AuraGroup> _aura_group;
SpellEnums::AuraType _aura_type;
bool _aura_is_debuff;
bool _aura_hide;
Ref<Spell> _aura_teaches_spell;
String _aura_text_translation_key;
String _aura_text_description;
int _aura_ability_scale_data_id;
bool _aura_scale_with_level;
Ref<SpellEffectVisual> _aura_visual_spell_effects;
bool _aura_damage_enabled;
int _aura_damage_type;
int _aura_damage_min;
int _aura_damage_max;
bool _aura_damage_can_crit;
Ref<Curve> _aura_damage_scaling_curve;
bool _aura_absorb_enabled;
int _aura_absorb_damage_type;
int _aura_absorb_min;
int _aura_absorb_max;
Ref<Curve> _aura_absorb_scaling_curve;
bool _aura_heal_enabled;
int _aura_heal_min;
int _aura_heal_max;
bool _aura_heal_can_crit;
Ref<Curve> _aura_heal_scaling_curve;
bool _aura_dispell_enabled;
int _aura_dispell_count_min;
int _aura_dispell_count_max;
int _aura_dispell_aura_types;
Ref<EntityResourceCostData> _aura_resource_cost;
Ref<EntityResourceCostData> _aura_resource_give;
int _aura_add_states;
int _aura_remove_effects_with_states;
int _aura_supress_states;
int _aura_trigger_count;
AuraTriggerData _aura_trigger_datas[MAX_TRIGGER_DATA];
int _aura_stat_attribute_count;
AuraStatAttribute _aura_stat_attributes[MAX_AURA_STATS];
bool _aura_diminishing_return_enabled;
int _aura_diminishing_return_category;
//Talent
Ref<Aura> _aura_talent_required_talent;
Ref<Spell> _aura_talent_required_spell;
};
#endif

View File

@ -23,7 +23,6 @@ SOFTWARE.
#include "item_template.h"
#include "../../entities/data/entity_class_data.h"
#include "../auras/aura.h"
#include "../spells/spell.h"
#include "item_instance.h"
@ -220,22 +219,22 @@ void ItemTemplate::set_num_auras(int value) {
_auras.resize(value);
}
Ref<Aura> ItemTemplate::get_aura(const int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>());
Ref<Spell> ItemTemplate::get_aura(const int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Spell>());
return _auras[index];
}
void ItemTemplate::set_aura(const int index, const Ref<Aura> &aura) {
void ItemTemplate::set_aura(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.set(index, Ref<Aura>(aura));
_auras.set(index, Ref<Spell>(aura));
}
Vector<Variant> ItemTemplate::get_auras() {
VARIANT_ARRAY_GET(_auras);
}
void ItemTemplate::set_auras(const Vector<Variant> &auras) {
VARIANT_ARRAY_SET(auras, _auras, Aura);
VARIANT_ARRAY_SET(auras, _auras, Spell);
}
//Required Skills
@ -243,12 +242,12 @@ int ItemTemplate::get_num_required_skills() const {
return _required_skills.size();
}
Ref<Aura> ItemTemplate::get_required_skill(const int index) {
ERR_FAIL_INDEX_V(index, _required_skills.size(), Ref<Aura>());
Ref<Spell> ItemTemplate::get_required_skill(const int index) {
ERR_FAIL_INDEX_V(index, _required_skills.size(), Ref<Spell>());
return _required_skills.get(index);
}
void ItemTemplate::set_required_skill(const int index, const Ref<Aura> &aura) {
void ItemTemplate::set_required_skill(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _required_skills.size());
_required_skills.set(index, aura);
@ -258,7 +257,7 @@ Vector<Variant> ItemTemplate::get_required_skills() {
VARIANT_ARRAY_GET(_required_skills);
}
void ItemTemplate::set_required_skills(const Vector<Variant> &skills) {
VARIANT_ARRAY_SET(skills, _required_skills, Aura);
VARIANT_ARRAY_SET(skills, _required_skills, Spell);
}
//use spell
@ -537,7 +536,7 @@ void ItemTemplate::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_auras"), &ItemTemplate::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "auras"), &ItemTemplate::set_auras);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Aura", PROPERTY_USAGE_DEFAULT, "Aura"), "set_auras", "get_auras");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras");
//// Required Skills ////
ClassDB::bind_method(D_METHOD("get_num_required_skills"), &ItemTemplate::get_num_required_skills);
@ -547,7 +546,7 @@ void ItemTemplate::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_required_skills"), &ItemTemplate::get_required_skills);
ClassDB::bind_method(D_METHOD("set_required_skills", "auras"), &ItemTemplate::set_required_skills);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "required_skills", PROPERTY_HINT_NONE, "17/17:Aura", PROPERTY_USAGE_DEFAULT, "Aura"), "set_required_skills", "get_required_skills");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "required_skills", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_required_skills", "get_required_skills");
//Use spell
ClassDB::bind_method(D_METHOD("get_use_spell"), &ItemTemplate::get_use_spell);

View File

@ -39,7 +39,6 @@ SOFTWARE.
#include "model_visual.h"
class ItemInstance;
class Aura;
class Spell;
class EntityClassData;
@ -122,8 +121,8 @@ public:
int get_num_auras() const;
void set_num_auras(const int value);
Ref<Aura> get_aura(const int index);
void set_aura(const int index, const Ref<Aura> &aura);
Ref<Spell> get_aura(const int index);
void set_aura(const int index, const Ref<Spell> &aura);
Vector<Variant> get_auras();
void set_auras(const Vector<Variant> &auras);
@ -131,8 +130,8 @@ public:
//Required Skills
int get_num_required_skills() const;
Ref<Aura> get_required_skill(const int index);
void set_required_skill(const int index, const Ref<Aura> &skills);
Ref<Spell> get_required_skill(const int index);
void set_required_skill(const int index, const Ref<Spell> &skills);
Vector<Variant> get_required_skills();
void set_required_skills(const Vector<Variant> &grants_spells);
@ -186,7 +185,7 @@ public:
public:
struct SkillEntry {
Ref<Aura> aura;
Ref<Spell> aura;
int level;
};
@ -253,8 +252,8 @@ private:
Vector<Ref<Spell> > _teaches_spells;
Vector<Ref<Spell> > _grants_spells;
Vector<Ref<Aura> > _auras;
Vector<Ref<Aura> > _required_skills;
Vector<Ref<Spell> > _auras;
Vector<Ref<Spell> > _required_skills;
Ref<Spell> _use_spell;
int _charges;
bool _consumed;

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "entity_species_data.h"
#include "../auras/aura.h"
#include "../spells/spell.h"
#include "../../singletons/ess.h"
@ -116,17 +115,17 @@ void EntitySpeciesData::set_spells(const Vector<Variant> &spells) {
//Auras
Ref<Aura> EntitySpeciesData::get_aura(const int index) const {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>());
Ref<Spell> EntitySpeciesData::get_aura(const int index) const {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Spell>());
return _auras.get(index);
}
void EntitySpeciesData::set_aura(const int index, const Ref<Aura> &aura) {
void EntitySpeciesData::set_aura(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.set(index, aura);
}
void EntitySpeciesData::add_aura(const Ref<Aura> &aura) {
void EntitySpeciesData::add_aura(const Ref<Spell> &aura) {
_auras.push_back(aura);
}
void EntitySpeciesData::remove_aura(const int index) {
@ -145,7 +144,7 @@ Vector<Variant> EntitySpeciesData::get_auras() {
void EntitySpeciesData::set_auras(const Vector<Variant> &auras) {
_auras.clear();
for (int i = 0; i < auras.size(); i++) {
Ref<Aura> aura = Ref<Aura>(auras[i]);
Ref<Spell> aura = Ref<Spell>(auras[i]);
_auras.push_back(aura);
}
@ -229,5 +228,5 @@ void EntitySpeciesData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_auras"), &EntitySpeciesData::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "auras"), &EntitySpeciesData::set_auras);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Aura", PROPERTY_USAGE_DEFAULT, "Aura"), "set_auras", "get_auras");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras");
}

View File

@ -40,7 +40,6 @@ SOFTWARE.
#include "species_model_data.h"
class Spell;
class Aura;
class EntitySpeciesData : public Resource {
GDCLASS(EntitySpeciesData, Resource);
@ -78,9 +77,9 @@ public:
void set_spells(const Vector<Variant> &spells);
//Auras
Ref<Aura> get_aura(const int index) const;
void set_aura(const int index, const Ref<Aura> &aura);
void add_aura(const Ref<Aura> &aura);
Ref<Spell> get_aura(const int index) const;
void set_aura(const int index, const Ref<Spell> &aura);
void add_aura(const Ref<Spell> &aura);
void remove_aura(const int index);
int get_aura_count() const;
@ -104,7 +103,7 @@ private:
Vector<Ref<SpeciesModelData> > _model_datas;
Vector<Ref<Spell> > _spells;
Vector<Ref<Aura> > _auras;
Vector<Ref<Spell> > _auras;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -33,16 +33,15 @@ SOFTWARE.
#include "scene/resources/texture.h"
#include "../../entity_enums.h"
#include "../../spell_enums.h"
#include "../../infos/spell_cast_info.h"
#include "../../entities/entity.h"
#include "../../entity_enums.h"
#include "../../infos/aura_infos.h"
#include "../../infos/spell_cast_info.h"
#include "../../spell_enums.h"
#include "spell_effect_visual.h"
class Entity;
class Aura;
class SpellCastInfo;
class Spell;
class CraftRecipe;
@ -50,6 +49,10 @@ class EntityResourceCostData;
class EntitySkillData;
class SpellDamageInfo;
class SpellHealInfo;
class AuraData;
class AuraGroup;
class AuraApplyInfo;
class EntityResource;
enum TargetRelationType {
TARGET_SELF = 1 << 0,
@ -149,8 +152,8 @@ public:
int spells_cast_on_caster_num_get() const;
void spells_cast_on_caster_num_set(const int value);
Ref<Aura> spell_cast_on_caster_get(const int index);
void spell_cast_on_caster_set(const int index, const Ref<Aura> &spell);
Ref<Spell> spell_cast_on_caster_get(const int index);
void spell_cast_on_caster_set(const int index, const Ref<Spell> &spell);
Vector<Variant> spells_cast_on_caster_get();
void spells_cast_on_caster_set(const Vector<Variant> &spells);
@ -159,8 +162,8 @@ public:
int spells_cast_on_target_num_get() const;
void spells_cast_on_target_num_set(const int value);
Ref<Aura> spell_cast_on_target_get(const int index);
void spell_cast_on_target_set(const int index, const Ref<Aura> &spell);
Ref<Spell> spell_cast_on_target_get(const int index);
void spell_cast_on_target_set(const int index, const Ref<Spell> &spell);
Vector<Variant> spells_cast_on_target_get();
void spells_cast_on_target_set(const Vector<Variant> &target_aura_applys);
@ -169,8 +172,8 @@ public:
int on_learn_cast_spells_num_get() const;
void on_learn_cast_spells_num_set(const int value);
Ref<Aura> spell_cast_on_learn_get(const int index);
void spell_cast_on_learn_set(const int index, const Ref<Aura> &spell);
Ref<Spell> spell_cast_on_learn_get(const int index);
void spell_cast_on_learn_set(const int index, const Ref<Spell> &spell);
Vector<Variant> spells_cast_on_learn_get();
void spells_cast_on_learn_set(const Vector<Variant> &spells);
@ -295,6 +298,181 @@ public:
int get_training_required_skill_level() const;
void set_training_required_skill_level(const int value);
float aura_get_time() const;
void aura_set_time(const float value);
Ref<AuraGroup> aura_get_aura_group();
void aura_set_aura_group(const Ref<AuraGroup> &value);
bool aura_get_is_debuff() const;
void aura_set_is_debuff(const bool value);
float aura_get_tick() const;
void aura_set_tick(const float value);
SpellEnums::AuraType aura_get_aura_type() const;
void aura_set_aura_type(const SpellEnums::AuraType value);
bool aura_get_scale_with_level() const;
void aura_set_scale_with_level(const bool value);
String aura_get_text_translation_key() const;
void aura_set_text_translation_key(const String &value);
String aura_get_text_description() const;
void aura_set_text_description(const String description);
bool aura_get_hide() const;
void aura_set_hide(const bool value);
Ref<SpellEffectVisual> aura_get_visual_spell_effects();
void aura_set_visual_spell_effects(const Ref<SpellEffectVisual> &value);
int aura_get_ability_scale_data_id() const;
void aura_set_ability_scale_data_id(const int value);
float aura_damage_get_scale_for_level(int level) const;
float aura_heal_get_scale_for_level(int level) const;
float aura_absorb_get_scale_for_level(int level) const;
Ref<Spell> aura_get_teaches_spell();
void aura_set_teaches_spell(const Ref<Spell> &spell);
//Damage
bool aura_damage_get_enabled() const;
void aura_damage_set_enabled(const bool value);
int aura_damage_get_type() const;
void aura_damage_set_type(const int value);
int aura_damage_get_min() const;
void aura_damage_set_min(const int value);
int aura_damage_get_max() const;
void aura_damage_set_max(const int value);
bool aura_damage_get_can_crit() const;
void aura_damage_set_can_crit(const bool value);
void aura_damage_set(const int min, const int max, const bool can_crit);
//Absorb
bool aura_absorb_get_enabled() const;
void aura_absorb_set_enabled(const bool value);
int aura_absorb_damage_get_type() const;
void aura_absorb_damage_set_type(const int value);
int aura_absorb_get_min() const;
void aura_absorb_set_min(const int value);
int aura_absorb_get_max() const;
void aura_absorb_set_max(const int value);
//Heal
bool aura_heal_get_enabled() const;
void aura_heal_set_enabled(const bool value);
int aura_heal_get_min() const;
void aura_heal_set_min(const int value);
int aura_heal_get_max() const;
void aura_heal_set_max(const int value);
bool aura_heal_get_can_crit() const;
void aura_heal_set_can_crit(const bool value);
void aura_heal_set(const int min, const int max, const bool can_crit);
//Dispells
bool aura_dispell_get_enabled() const;
void aura_dispell_set_enabled(const bool value);
int aura_dispell_get_count_min() const;
void aura_dispell_set_count_min(const int value);
int aura_dispell_get_count_max() const;
void aura_dispell_set_count_max(const int value);
int aura_dispell_get_aura_types() const;
void aura_dispell_set_aura_types(const int value);
//Resources
Ref<EntityResourceCostData> aura_get_resource_cost();
void aura_set_resource_cost(const Ref<EntityResourceCostData> &value);
Ref<EntityResourceCostData> aura_get_resource_give();
void aura_set_resource_give(const Ref<EntityResourceCostData> &value);
Ref<Curve> aura_damage_get_scaling_curve() { return _aura_damage_scaling_curve; }
void aura_damage_set_scaling_curve(const Ref<Curve> &curve) { _aura_damage_scaling_curve = curve; }
Ref<Curve> aura_heal_get_scaling_curve() { return _aura_heal_scaling_curve; }
void aura_heal_set_scaling_curve(const Ref<Curve> &curve) { _aura_heal_scaling_curve = curve; }
Ref<Curve> aura_absorb_get_scaling_curve() { return _aura_absorb_scaling_curve; }
void aura_absorb_set_scaling_curve(const Ref<Curve> &curve) { _aura_absorb_scaling_curve = curve; }
//states
int aura_get_add_states() const { return _aura_add_states; }
void aura_set_add_states(const int value) { _aura_add_states = value; }
int aura_get_remove_effects_with_states() const { return _aura_remove_effects_with_states; }
void aura_set_remove_effects_with_states(const int value) { _aura_remove_effects_with_states = value; }
int aura_get_supress_states() const { return _aura_supress_states; }
void aura_set_supress_states(const int value) { _aura_supress_states = value; }
//DiminishingReturns
bool aura_diminishing_return_enabled_get() const;
void aura_diminishing_return_enabled_set(const bool value);
int aura_diminishing_return_category_get() const;
void aura_diminishing_return_category_set(const int value);
//Triggers
int aura_trigger_get_count() const;
void aura_trigger_set_count(const int count);
SpellEnums::TriggerNotificationType aura_trigger_get_notification_type(const int index) const;
void aura_trigger_set_notification_type(const int index, const SpellEnums::TriggerNotificationType value);
int aura_trigger_get_notification_data(const int index) const;
void aura_trigger_set_notification_data(const int index, const int value);
SpellEnums::TriggerType aura_trigger_get_trigger_type(const int index) const;
void aura_trigger_set_trigger_type(const int index, const SpellEnums::TriggerType value);
float aura_trigger_get_trigger_type_data(const int index) const;
void aura_trigger_set_trigger_type_data(const int index, const float value);
Ref<Spell> aura_trigger_get_spell(const int index) const;
void aura_trigger_set_spell(const int index, const Ref<Spell> &value);
//Talent
Ref<Spell> aura_get_talent_required_talent() const;
void aura_set_talent_required_talent(const Ref<Spell> rank);
Ref<Spell> aura_get_talent_required_spell() const;
void aura_set_talent_required_spell(const Ref<Spell> spell);
//AuraStatAttributes
int aura_stat_attribute_get_count() const;
void aura_stat_attribute_set_count(int count);
int aura_stat_attribute_get_stat(int index) const;
void aura_stat_attribute_set_stat(int index, const int value);
float aura_stat_attribute_get_base_mod(int index) const;
void aura_stat_attribute_set_base_mod(int index, float value);
float aura_stat_attribute_get_bonus_mod(int index) const;
void aura_stat_attribute_set_bonus_mod(int index, float value);
float aura_stat_attribute_get_percent_mod(int index) const;
void aura_stat_attribute_set_percent_mod(int index, float value);
//// Spell Script ////
float PLAYER_HIT_RADIUS;
@ -303,6 +481,7 @@ public:
void cast_starts_simple(Entity *caster, float spell_scale);
void cast_interrupts_simple(Entity *caster);
void cast_starts_triggered_simple(Entity *caster);
void aura_sapply_simple(Entity *caster, Entity *target, float spell_scale);
//Commands
void cast_starts(Ref<SpellCastInfo> info);
@ -310,16 +489,82 @@ public:
void cast_interrupts(Ref<SpellCastInfo> info);
void cast_finishs(Ref<SpellCastInfo> info);
void aura_sapply(Ref<AuraApplyInfo> info);
void aura_sdeapply(Ref<AuraData> info);
void aura_sadd(Ref<AuraData> aura);
void aura_sremove(Ref<AuraData> aura);
void aura_removes_expired(Ref<AuraData> aura);
void aura_removes_dispell(Ref<AuraData> aura);
void aura_supdate(Ref<AuraData> aura, float delta);
//eventhandlers
void son_cast_player_moved(Ref<SpellCastInfo> info);
void son_cast_damage_received(Ref<SpellCastInfo> info);
void son_spell_hit(Ref<SpellCastInfo> info);
void son_physics_process(Ref<SpellCastInfo> info, float delta);
void notification_saura(int what, Ref<AuraData> data);
void notification_sheal(int what, Ref<AuraData> aura, Ref<SpellHealInfo> data);
void notification_aura_scast(int what, Ref<AuraData> aura, Ref<SpellCastInfo> info);
void notification_sdamage(int what, Ref<AuraData> aura, Ref<SpellDamageInfo> data);
void son_remove(Ref<AuraData> aura);
void son_remove_expired(Ref<AuraData> aura);
void son_remove_dispell(Ref<AuraData> aura);
void notification_sdeath(Ref<AuraData> data);
void notification_scooldown_added(Ref<AuraData> data, int id, float value);
void notification_scooldown_removed(Ref<AuraData> data, int id, float value);
void notification_scategory_cooldown_added(Ref<AuraData> data, int id, float value);
void notification_scategory_cooldown_removed(Ref<AuraData> data, int id, float value);
void notification_sgcd_started(Ref<AuraData> data, float gcd);
void notification_sgcd_finished(Ref<AuraData> data);
void son_physics_process_aura(Ref<AuraData> data);
void notification_sxp_gained(Ref<AuraData> data, int value);
void notification_slevel_up(Ref<AuraData> data, int value);
void notification_sentity_resource_added(Ref<AuraData> data, Ref<EntityResource> resource);
void notification_sentity_resource_removed(Ref<AuraData> data, Ref<EntityResource> resource);
//Clientside Event Handlers
void notification_scast(int what, Ref<SpellCastInfo> info);
void notification_ccast(int what, Ref<SpellCastInfo> info);
void notification_caura(int what, Ref<AuraData> data);
void notification_cheal(int what, Ref<AuraData> aura, Ref<SpellHealInfo> data);
void notification_aura_ccast(int what, Ref<AuraData> aura, Ref<SpellCastInfo> info);
void notification_cdamage(int what, Ref<AuraData> aura, Ref<SpellDamageInfo> data);
void notification_cdeath(Ref<AuraData> data);
void notification_ccooldown_added(Ref<AuraData> data, int id, float value);
void notification_ccooldown_removed(Ref<AuraData> data, int id, float value);
void notification_ccategory_cooldown_added(Ref<AuraData> data, int id, float value);
void notification_ccategory_cooldown_removed(Ref<AuraData> data, int id, float value);
void notification_cgcd_started(Ref<AuraData> data, float gcd);
void notification_cgcd_finished(Ref<AuraData> data);
void notification_cxp_gained(Ref<AuraData> data, int value);
void notification_clevel_up(Ref<AuraData> data, int value);
void notification_centity_resource_added(Ref<AuraData> data, Ref<EntityResource> resource);
void notification_centity_resource_removed(Ref<AuraData> data, Ref<EntityResource> resource);
//Equipment
bool equip_should_deny(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item);
void equip_son_success(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_son_fail(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_con_success(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
void equip_con_fail(Ref<AuraData> data, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
//Calculations / Queries
void calculate_initial_damage(Ref<SpellDamageInfo> data);
void handle_spell_damage(Ref<SpellDamageInfo> data);
@ -333,10 +578,28 @@ public:
void handle_gcd(Ref<SpellCastInfo> info);
void handle_cooldown(Ref<SpellCastInfo> info);
void setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
void aura_sapply_passives_damage_receive(Ref<SpellDamageInfo> info);
void aura_sapply_passives_damage_deal(Ref<SpellDamageInfo> info);
void aura_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
void handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> info);
void aura_sapply_passives_heal_receive(Ref<SpellHealInfo> info);
void aura_sapply_passives_heal_deal(Ref<SpellHealInfo> info);
void aura_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
void handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info);
_FORCE_INLINE_ bool aura_is_talent() const { return _aura_type == SpellEnums::AURA_TYPE_TALENT; }
String get_name_translated() const;
String get_description(const int class_level, const int character_level);
String _get_description(const int class_level, const int character_level);
String aura_get_name_translated() const;
String aura_get_description(const int class_level, const int character_level);
String _aura_get_description(const int class_level, const int character_level);
Spell();
~Spell();
@ -356,10 +619,65 @@ protected:
virtual void _handle_projectile(Ref<SpellCastInfo> info);
virtual void _handle_effect(Ref<SpellCastInfo> info);
virtual void _aura_sapply(Ref<AuraApplyInfo> info);
virtual void _aura_sdeapply(Ref<AuraData> info);
virtual void _aura_sadd(Ref<AuraData> aura);
virtual void _aura_sremove(Ref<AuraData> aura);
virtual void _aura_removes_expired(Ref<AuraData> aura);
virtual void _aura_removes_dispell(Ref<AuraData> aura);
virtual void _aura_supdate(Ref<AuraData> aura, float delta);
virtual void _setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
virtual void _aura_sapply_passives_damage_receive(Ref<SpellDamageInfo> info);
virtual void _aura_sapply_passives_damage_deal(Ref<SpellDamageInfo> info);
virtual void _aura_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
virtual void _handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> info);
virtual void _aura_sapply_passives_heal_receive(Ref<SpellHealInfo> info);
virtual void _aura_sapply_passives_heal_deal(Ref<SpellHealInfo> info);
virtual void _aura_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
virtual void _handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info);
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
protected:
struct AuraTriggerData {
SpellEnums::TriggerNotificationType notification_type;
int notification_data;
SpellEnums::TriggerType trigger_type;
float trigger_type_data;
Ref<Spell> spell;
AuraTriggerData() {
notification_type = SpellEnums::TRIGGER_NOTIFICATION_TYPE_AURA;
trigger_type = SpellEnums::TRIGGER_TYPE_NONE;
notification_data = 0;
trigger_type_data = 0;
}
};
struct AuraStatAttribute {
int stat;
float base_mod;
float bonus_mod;
float percent_mod;
AuraStatAttribute() {
stat = 0;
base_mod = 0;
bonus_mod = 0;
percent_mod = 0;
}
};
private:
enum {
MAX_AURA_STATS = 5, //Increase if necessary, should be enough for now
MAX_TRIGGER_DATA = 5,
};
int _id;
int _spell_type;
SpellEnums::SpellCategory _spell_category;
@ -369,9 +687,9 @@ private:
SpellTargetType _target_type;
TargetRelationType _target_relation_type;
Vector<Ref<Aura> > _spells_cast_on_caster;
Vector<Ref<Aura> > _spells_cast_on_target;
Vector<Ref<Aura> > _on_learn_cast_spells;
Vector<Ref<Spell>> _spells_cast_on_caster;
Vector<Ref<Spell>> _spells_cast_on_target;
Vector<Ref<Spell>> _on_learn_cast_spells;
int _level;
int _rank;
@ -444,6 +762,69 @@ private:
Ref<Spell> _training_required_spell;
Ref<EntitySkillData> _training_required_skill;
int _training_required_skill_level;
//Aura
float _aura_time;
float _aura_tick;
Ref<AuraGroup> _aura_group;
SpellEnums::AuraType _aura_type;
bool _aura_is_debuff;
bool _aura_hide;
Ref<Spell> _aura_teaches_spell;
String _aura_text_translation_key;
String _aura_text_description;
int _aura_ability_scale_data_id;
bool _aura_scale_with_level;
Ref<SpellEffectVisual> _aura_visual_spell_effects;
bool _aura_damage_enabled;
int _aura_damage_type;
int _aura_damage_min;
int _aura_damage_max;
bool _aura_damage_can_crit;
Ref<Curve> _aura_damage_scaling_curve;
bool _aura_absorb_enabled;
int _aura_absorb_damage_type;
int _aura_absorb_min;
int _aura_absorb_max;
Ref<Curve> _aura_absorb_scaling_curve;
bool _aura_heal_enabled;
int _aura_heal_min;
int _aura_heal_max;
bool _aura_heal_can_crit;
Ref<Curve> _aura_heal_scaling_curve;
bool _aura_dispell_enabled;
int _aura_dispell_count_min;
int _aura_dispell_count_max;
int _aura_dispell_aura_types;
Ref<EntityResourceCostData> _aura_resource_cost;
Ref<EntityResourceCostData> _aura_resource_give;
int _aura_add_states;
int _aura_remove_effects_with_states;
int _aura_supress_states;
int _aura_trigger_count;
AuraTriggerData _aura_trigger_datas[MAX_TRIGGER_DATA];
int _aura_stat_attribute_count;
AuraStatAttribute _aura_stat_attributes[MAX_AURA_STATS];
bool _aura_diminishing_return_enabled;
int _aura_diminishing_return_category;
//Talent
Ref<Spell> _aura_talent_required_talent;
Ref<Spell> _aura_talent_required_spell;
};
#endif

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "ess_resource_db.h"
#include "../data/auras/aura.h"
#include "../data/items/craft_recipe.h"
#include "../data/species/entity_species_data.h"
#include "../data/spells/spell.h"
@ -30,12 +29,12 @@ SOFTWARE.
#include "../entities/resources/entity_resource.h"
#include "../entities/skills/entity_skill_data.h"
Ref<Aura> ESSResourceDB::get_skill_for_armor_type(const int index) {
ERR_FAIL_INDEX_V(index, ItemEnums::ARMOR_TYPE_MAX, Ref<Aura>());
Ref<Spell> ESSResourceDB::get_skill_for_armor_type(const int index) {
ERR_FAIL_INDEX_V(index, ItemEnums::ARMOR_TYPE_MAX, Ref<Spell>());
return _armor_type_skills[index];
}
void ESSResourceDB::set_skill_for_armor_type(const int index, const Ref<Aura> &aura) {
void ESSResourceDB::set_skill_for_armor_type(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, ItemEnums::ARMOR_TYPE_MAX);
_armor_type_skills[index] = aura;
@ -89,18 +88,6 @@ Ref<Spell> ESSResourceDB::get_spell_path(const StringName &path) {
return get_spell(spell_path_to_id(path));
}
void ESSResourceDB::add_aura(Ref<Aura> aura) {
if (!aura.is_valid())
return;
_aura_id_to_path.set(aura->get_id(), aura->get_path());
_aura_path_to_id.set(aura->get_path(), aura->get_id());
}
Ref<Aura> ESSResourceDB::get_aura_path(const StringName &path) {
return get_aura(aura_path_to_id(path));
}
void ESSResourceDB::add_craft_recipe(Ref<CraftRecipe> cda) {
if (!cda.is_valid())
return;
@ -181,17 +168,6 @@ int ESSResourceDB::spell_path_to_id(const StringName &path) const {
return _spell_path_to_id[path];
}
StringName ESSResourceDB::aura_id_to_path(const int id) const {
ERR_FAIL_COND_V(!_aura_id_to_path.has(id), StringName());
return _aura_id_to_path[id];
}
int ESSResourceDB::aura_path_to_id(const StringName &path) const {
ERR_FAIL_COND_V(!_aura_path_to_id.has(path), 0);
return _aura_path_to_id[path];
}
StringName ESSResourceDB::craft_recipe_id_to_path(const int id) const {
ERR_FAIL_COND_V(!_craft_recipe_id_to_path.has(id), StringName());
@ -248,10 +224,6 @@ void ESSResourceDB::add_entity_resource_db(Ref<ESSResourceDB> other) {
add_spell(other->get_spell_index(i));
}
for (int i = 0; i < other->get_aura_count(); ++i) {
add_aura(other->get_aura_index(i));
}
for (int i = 0; i < other->get_craft_recipe_count(); ++i) {
add_craft_recipe(other->get_craft_recipe_index(i));
}
@ -286,9 +258,6 @@ ESSResourceDB::~ESSResourceDB() {
_spell_path_to_id.clear();
_spell_id_to_path.clear();
_aura_path_to_id.clear();
_aura_id_to_path.clear();
_craft_recipe_path_to_id.clear();
_craft_recipe_id_to_path.clear();
@ -304,7 +273,7 @@ void ESSResourceDB::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_skill_for_armor_type", "index", "aura"), &ESSResourceDB::set_skill_for_armor_type);
for (int i = 0; i < ItemEnums::ARMOR_TYPE_MAX; ++i) {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "skill_for_armor_type_" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_skill_for_armor_type", "get_skill_for_armor_type", i);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "skill_for_armor_type_" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_skill_for_armor_type", "get_skill_for_armor_type", i);
}
//EntityResource
@ -355,18 +324,6 @@ void ESSResourceDB::_bind_methods() {
ClassDB::bind_method(D_METHOD("spell_id_to_path", "id"), &ESSResourceDB::spell_id_to_path);
ClassDB::bind_method(D_METHOD("spell_path_to_id", "path"), &ESSResourceDB::spell_path_to_id);
//Aura
ClassDB::bind_method(D_METHOD("add_aura", "spell"), &ESSResourceDB::add_aura);
ClassDB::bind_method(D_METHOD("get_aura", "id"), &ESSResourceDB::get_aura);
ClassDB::bind_method(D_METHOD("get_aura_index", "index"), &ESSResourceDB::get_aura_index);
ClassDB::bind_method(D_METHOD("get_aura_count"), &ESSResourceDB::get_aura_count);
ClassDB::bind_method(D_METHOD("get_auras"), &ESSResourceDB::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "recipe"), &ESSResourceDB::set_auras);
ClassDB::bind_method(D_METHOD("get_aura_path", "path"), &ESSResourceDB::get_aura_path);
ClassDB::bind_method(D_METHOD("aura_id_to_path", "id"), &ESSResourceDB::aura_id_to_path);
ClassDB::bind_method(D_METHOD("aura_path_to_id", "path"), &ESSResourceDB::aura_path_to_id);
//Craft Data
ClassDB::bind_method(D_METHOD("add_craft_recipe", "craft_recipe"), &ESSResourceDB::add_craft_recipe);
ClassDB::bind_method(D_METHOD("get_craft_recipe", "craft_recipe_id"), &ESSResourceDB::get_craft_recipe);

View File

@ -43,7 +43,6 @@ SOFTWARE.
#include "../item_enums.h"
class Aura;
class Spell;
class EntityData;
class CraftRecipe;
@ -58,8 +57,8 @@ class ESSResourceDB : public Resource {
GDCLASS(ESSResourceDB, Resource);
public:
Ref<Aura> get_skill_for_armor_type(const int index);
void set_skill_for_armor_type(const int index, const Ref<Aura> &aura);
Ref<Spell> get_skill_for_armor_type(const int index);
void set_skill_for_armor_type(const int index, const Ref<Spell> &aura);
virtual Ref<EntityResource> get_entity_resource(int class_id) = 0;
virtual Ref<EntityResource> get_entity_resource_index(int index) = 0;
@ -105,17 +104,6 @@ public:
StringName spell_id_to_path(const int id) const;
int spell_path_to_id(const StringName &path) const;
virtual Ref<Aura> get_aura(int aura_id) = 0;
virtual Ref<Aura> get_aura_index(int index) = 0;
virtual int get_aura_count() = 0;
virtual void add_aura(Ref<Aura> aura);
virtual Vector<Variant> get_auras() const = 0;
virtual void set_auras(const Vector<Variant> &data) = 0;
Ref<Aura> get_aura_path(const StringName &path);
StringName aura_id_to_path(const int id) const;
int aura_path_to_id(const StringName &path) const;
virtual Ref<CraftRecipe> get_craft_recipe(int craft_id) = 0;
virtual Ref<CraftRecipe> get_craft_recipe_index(int index) = 0;
virtual int get_craft_recipe_count() = 0;
@ -161,7 +149,7 @@ public:
protected:
static void _bind_methods();
Ref<Aura> _armor_type_skills[ItemEnums::ARMOR_TYPE_MAX];
Ref<Spell> _armor_type_skills[ItemEnums::ARMOR_TYPE_MAX];
HashMap<int, StringName> _entity_resources_id_to_path;
HashMap<StringName, int> _entity_resources_path_to_id;
@ -175,9 +163,6 @@ protected:
HashMap<int, StringName> _spell_id_to_path;
HashMap<StringName, int> _spell_path_to_id;
HashMap<int, StringName> _aura_id_to_path;
HashMap<StringName, int> _aura_path_to_id;
HashMap<int, StringName> _craft_recipe_id_to_path;
HashMap<StringName, int> _craft_recipe_path_to_id;

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "ess_resource_db_folders.h"
#include "../data/auras/aura.h"
#include "../data/items/craft_recipe.h"
#include "../data/species/entity_species_data.h"
#include "../data/spells/spell.h"
@ -113,8 +112,6 @@ void ESSResourceDBFolders::add_resource(const Ref<Resource> &resource) {
add_entity_data(resource);
} else if (cls == "Spell") {
add_spell(resource);
} else if (cls == "Aura") {
add_aura(resource);
} else if (cls == "CraftRecipe") {
add_craft_recipe(resource);
} else if (cls == "ItemTemplate") {

View File

@ -51,7 +51,6 @@ SOFTWARE.
#include "../defines.h"
class Aura;
class Spell;
class EntityData;
class CraftRecipe;

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "ess_resource_db_map.h"
#include "../data/auras/aura.h"
#include "../data/items/craft_recipe.h"
#include "../data/species/entity_species_data.h"
#include "../data/spells/spell.h"
@ -179,46 +178,6 @@ void ESSResourceDBMap::set_spells(const Vector<Variant> &data) {
}
}
void ESSResourceDBMap::add_aura(Ref<Aura> aura) {
ERR_FAIL_COND(!aura.is_valid());
_auras.push_back(aura);
_aura_map.set(aura->get_id(), aura);
_aura_id_to_path.set(aura->get_id(), aura->get_path());
_aura_path_to_id.set(aura->get_path(), aura->get_id());
}
Ref<Aura> ESSResourceDBMap::get_aura(int aura_id) {
ERR_FAIL_COND_V_MSG(!_aura_map.has(aura_id), Ref<Aura>(), "Could not find Aura! Id:" + String::num(aura_id));
return _aura_map.get(aura_id);
}
Ref<Aura> ESSResourceDBMap::get_aura_index(int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>());
return _auras.get(index);
}
int ESSResourceDBMap::get_aura_count() {
return _auras.size();
}
Vector<Variant> ESSResourceDBMap::get_auras() const {
VARIANT_ARRAY_GET(_auras);
}
void ESSResourceDBMap::set_auras(const Vector<Variant> &data) {
_auras.clear();
_aura_map.clear();
for (int i = 0; i < data.size(); i++) {
Ref<Aura> d = Ref<Aura>(data[i]);
ERR_CONTINUE(!d.is_valid());
add_aura(d);
}
}
//Craft Data
void ESSResourceDBMap::add_craft_recipe(Ref<CraftRecipe> cda) {
ERR_FAIL_COND(!cda.is_valid());
@ -352,9 +311,6 @@ ESSResourceDBMap::~ESSResourceDBMap() {
_spells.clear();
_spell_map.clear();
_auras.clear();
_aura_map.clear();
_craft_recipes.clear();
_craft_recipe_map.clear();

View File

@ -51,7 +51,6 @@ SOFTWARE.
#include "../defines.h"
class Aura;
class Spell;
class EntityData;
class CraftRecipe;
@ -94,13 +93,6 @@ public:
Vector<Variant> get_spells() const;
void set_spells(const Vector<Variant> &data);
Ref<Aura> get_aura(int aura_id);
Ref<Aura> get_aura_index(int index);
int get_aura_count();
void add_aura(Ref<Aura> aura);
Vector<Variant> get_auras() const;
void set_auras(const Vector<Variant> &data);
Ref<CraftRecipe> get_craft_recipe(int craft_id);
Ref<CraftRecipe> get_craft_recipe_index(int index);
int get_craft_recipe_count();
@ -141,9 +133,6 @@ private:
Vector<Ref<Spell> > _spells;
HashMap<int, Ref<Spell> > _spell_map;
Vector<Ref<Aura> > _auras;
HashMap<int, Ref<Aura> > _aura_map;
Vector<Ref<CraftRecipe> > _craft_recipes;
HashMap<int, Ref<CraftRecipe> > _craft_recipe_map;

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "ess_resource_db_static.h"
#include "../data/auras/aura.h"
#include "../data/items/craft_recipe.h"
#include "../data/species/entity_species_data.h"
#include "../data/spells/spell.h"
@ -174,44 +173,6 @@ void ESSResourceDBStatic::set_spells(const Vector<Variant> &data) {
}
}
void ESSResourceDBStatic::add_aura(Ref<Aura> aura) {
if (_remap_ids && aura.is_valid())
aura->set_id(_auras.size());
_auras.push_back(aura);
ESSResourceDB::add_aura(aura);
}
Ref<Aura> ESSResourceDBStatic::get_aura(int id) {
if (id < 0 || id >= _auras.size())
return Ref<Aura>();
return _auras.get(id);
}
Ref<Aura> ESSResourceDBStatic::get_aura_index(int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>());
return _auras.get(index);
}
int ESSResourceDBStatic::get_aura_count() {
return _auras.size();
}
Vector<Variant> ESSResourceDBStatic::get_auras() const {
VARIANT_ARRAY_GET(_auras);
}
void ESSResourceDBStatic::set_auras(const Vector<Variant> &data) {
_auras.clear();
for (int i = 0; i < data.size(); i++) {
Ref<Aura> d = Ref<Aura>(data[i]);
add_aura(d);
}
}
//Craft Data
void ESSResourceDBStatic::add_craft_recipe(Ref<CraftRecipe> cda) {
if (_remap_ids && cda.is_valid())
@ -327,7 +288,6 @@ void ESSResourceDBStatic::clear() {
_entity_skills.clear();
_entity_datas.clear();
_spells.clear();
_auras.clear();
_craft_recipes.clear();
_item_templates.clear();
_entity_species_datas.clear();
@ -342,7 +302,6 @@ ESSResourceDBStatic::~ESSResourceDBStatic() {
_entity_skills.clear();
_entity_datas.clear();
_spells.clear();
_auras.clear();
_craft_recipes.clear();
_item_templates.clear();
_entity_species_datas.clear();
@ -357,7 +316,6 @@ void ESSResourceDBStatic::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_skills", PROPERTY_HINT_NONE, "17/17:EntitySkillData", PROPERTY_USAGE_DEFAULT, "EntitySkillData"), "set_entity_skills", "get_entity_skills");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Aura", PROPERTY_USAGE_DEFAULT, "Aura"), "set_auras", "get_auras");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "craft_recipes", PROPERTY_HINT_NONE, "17/17:CraftRecipe", PROPERTY_USAGE_DEFAULT, "CraftRecipe"), "set_craft_recipes", "get_craft_recipes");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "item_templates", PROPERTY_HINT_NONE, "17/17:ItemTemplate", PROPERTY_USAGE_DEFAULT, "ItemTemplate"), "set_item_templates", "get_item_templates");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_species_datas", PROPERTY_HINT_NONE, "17/17:EntitySpeciesData", PROPERTY_USAGE_DEFAULT, "EntitySpeciesData"), "set_entity_species_datas", "get_entity_species_datas");

View File

@ -37,7 +37,6 @@ SOFTWARE.
#include "../defines.h"
class Aura;
class Spell;
class EntityData;
class CraftRecipe;
@ -89,13 +88,6 @@ public:
Vector<Variant> get_spells() const;
void set_spells(const Vector<Variant> &data);
Ref<Aura> get_aura(int aura_id);
Ref<Aura> get_aura_index(int index);
int get_aura_count();
void add_aura(Ref<Aura> aura);
Vector<Variant> get_auras() const;
void set_auras(const Vector<Variant> &data);
Ref<CraftRecipe> get_craft_recipe(int craft_id);
Ref<CraftRecipe> get_craft_recipe_index(int index);
int get_craft_recipe_count();
@ -132,7 +124,6 @@ private:
Vector<Ref<EntitySkillData> > _entity_skills;
Vector<Ref<EntityData> > _entity_datas;
Vector<Ref<Spell> > _spells;
Vector<Ref<Aura> > _auras;
Vector<Ref<CraftRecipe> > _craft_recipes;
Vector<Ref<ItemTemplate> > _item_templates;
Vector<Ref<EntitySpeciesData> > _entity_species_datas;

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,6 @@ SOFTWARE.
#include "../../infos/spell_cast_info.h"
#include "../../data/auras/aura.h"
#include "../../data/items/item_instance.h"
#include "../../entities/auras/aura_data.h"
#include "../../entities/resources/entity_resource.h"

View File

@ -24,7 +24,7 @@ SOFTWARE.
#include "core/version.h"
#include "../../data/auras/aura.h"
#include "../../data/spells/spell.h"
#include "../../database/ess_resource_db.h"
#include "../../singletons/ess.h"
#include "../entity.h"
@ -156,7 +156,7 @@ void AuraData::spell_scale_set(float value) {
_spell_scale = value;
}
Ref<Aura> AuraData::get_aura() {
Ref<Spell> AuraData::get_aura() {
//if (_aura == NULL) {
//TODO fix!
//_aura = Auras::getInstance()->GetData(get_aura_id());
@ -165,7 +165,7 @@ Ref<Aura> AuraData::get_aura() {
return _aura;
}
void AuraData::set_aura(Ref<Aura> aura) {
void AuraData::set_aura(Ref<Spell> aura) {
_aura = aura;
if (aura.is_valid())
@ -325,7 +325,7 @@ void AuraData::_from_dict(const Dictionary &dict) {
_aura_group = dict.get("aura_group", 0);
//int aura_id = dict.get("aura_id", 0);
_aura = ESS::get_singleton()->get_resource_db()->get_aura_path(_aura_path);
_aura = ESS::get_singleton()->get_resource_db()->get_spell_path(_aura_path);
_is_timed = dict.get("is_timed", true);
_damage = dict.get("damage", 0);

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "../../spell_enums.h"
class Aura;
class Spell;
class Entity;
class AuraData : public Resource {
@ -68,8 +68,8 @@ public:
float spell_scale_get();
void spell_scale_set(float value);
Ref<Aura> get_aura();
void set_aura(Ref<Aura> aura);
Ref<Spell> get_aura();
void set_aura(Ref<Spell> aura);
void refresh(float remaining);
@ -125,7 +125,7 @@ private:
NodePath _caster_path;
float _spell_scale;
int _aura_group;
Ref<Aura> _aura;
Ref<Spell> _aura;
bool _is_timed;
int _damage;

View File

@ -22,7 +22,7 @@ SOFTWARE.
#include "character_spec.h"
#include "../../data/auras/aura.h"
#include "../../data/spells/spell.h"
#include "../../defines.h"
@ -88,14 +88,14 @@ Vector<Variant> CharacterSpec::get_talents() {
return r;
}
Ref<Aura> CharacterSpec::get_talent(const int row, const int column, const int rank) {
ERR_FAIL_INDEX_V(row, _rows.size(), Ref<Aura>());
ERR_FAIL_INDEX_V(column, _rows[row].size(), Ref<Aura>());
ERR_FAIL_INDEX_V(rank, _rows[row][column].size(), Ref<Aura>());
Ref<Spell> CharacterSpec::get_talent(const int row, const int column, const int rank) {
ERR_FAIL_INDEX_V(row, _rows.size(), Ref<Spell>());
ERR_FAIL_INDEX_V(column, _rows[row].size(), Ref<Spell>());
ERR_FAIL_INDEX_V(rank, _rows[row][column].size(), Ref<Spell>());
return _rows[row][column][rank];
}
void CharacterSpec::set_talent(const int row, const int column, const int rank, const Ref<Aura> &talent) {
void CharacterSpec::set_talent(const int row, const int column, const int rank, const Ref<Spell> &talent) {
ERR_FAIL_INDEX(row, _rows.size());
ERR_FAIL_INDEX(column, _rows[row].size());
ERR_FAIL_INDEX(rank, _rows[row][column].size());
@ -107,7 +107,7 @@ bool CharacterSpec::has_talent_with_id(const int id) {
for (int i = 0; i < _rows.size(); ++i) {
for (int j = 0; j < _rows[i].size(); ++j) {
for (int k = 0; k < _rows[i][j].size(); ++k) {
const Ref<Aura> a = _rows[i][j][k];
const Ref<Spell> a = _rows[i][j][k];
if (a.is_valid() && a->get_id() == id)
return true;
@ -118,11 +118,11 @@ bool CharacterSpec::has_talent_with_id(const int id) {
return false;
}
Ref<Aura> CharacterSpec::get_talent_with_id(const int id) {
Ref<Spell> CharacterSpec::get_talent_with_id(const int id) {
for (int i = 0; i < _rows.size(); ++i) {
for (int j = 0; j < _rows[i].size(); ++j) {
for (int k = 0; k < _rows[i][j].size(); ++k) {
const Ref<Aura> a = _rows[i][j][k];
const Ref<Spell> a = _rows[i][j][k];
if (a.is_valid() && a->get_id() == id)
return a;
@ -130,7 +130,7 @@ Ref<Aura> CharacterSpec::get_talent_with_id(const int id) {
}
}
return Ref<Aura>();
return Ref<Spell>();
}
CharacterSpec::CharacterSpec() {
@ -254,7 +254,7 @@ void CharacterSpec::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT, "row_" + itos(i) + "/column_" + itos(j) + "/size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED));
for (int k = 0; k < _rows[i][j].size(); ++k) {
p_list->push_back(PropertyInfo(Variant::OBJECT, "row_" + itos(i) + "/column_" + itos(j) + "/entry_" + itos(k), PROPERTY_HINT_RESOURCE_TYPE, "Aura", PROPERTY_USAGE_DEFAULT));
p_list->push_back(PropertyInfo(Variant::OBJECT, "row_" + itos(i) + "/column_" + itos(j) + "/entry_" + itos(k), PROPERTY_HINT_RESOURCE_TYPE, "Spell", PROPERTY_USAGE_DEFAULT));
}
}
}

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "core/ustring.h"
#endif
class Aura;
class Spell;
class CharacterSpec : public Resource {
GDCLASS(CharacterSpec, Resource);
@ -55,11 +55,11 @@ public:
Vector<Variant> get_talents();
Ref<Aura> get_talent(const int row, const int column, const int rank);
void set_talent(const int row, const int column, const int rank, const Ref<Aura> &talent);
Ref<Spell> get_talent(const int row, const int column, const int rank);
void set_talent(const int row, const int column, const int rank, const Ref<Spell> &talent);
bool has_talent_with_id(const int id);
Ref<Aura> get_talent_with_id(const int id);
Ref<Spell> get_talent_with_id(const int id);
CharacterSpec();
~CharacterSpec();
@ -72,7 +72,7 @@ protected:
private:
int _id;
Vector<Vector<Vector<Ref<Aura> > > > _rows;
Vector<Vector<Vector<Ref<Spell> > > > _rows;
};
#endif

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "entity_class_data.h"
#include "../../data/auras/aura.h"
#include "../../data/items/craft_recipe.h"
#include "../../data/items/item_instance.h"
#include "../../data/spells/spell.h"
@ -216,12 +215,12 @@ void EntityClassData::set_num_auras(int value) {
_auras.resize(value);
}
Ref<Aura> EntityClassData::get_aura(int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Aura>());
Ref<Spell> EntityClassData::get_aura(int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Spell>());
return _auras[index];
}
void EntityClassData::set_aura(int index, Ref<Aura> aura) {
void EntityClassData::set_aura(int index, Ref<Spell> aura) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.set(index, aura);
@ -233,7 +232,7 @@ Vector<Variant> EntityClassData::get_auras() {
void EntityClassData::set_auras(const Vector<Variant> &auras) {
_auras.clear();
for (int i = 0; i < auras.size(); i++) {
Ref<Aura> aura = Ref<Aura>(auras[i]);
Ref<Spell> aura = Ref<Spell>(auras[i]);
_auras.push_back(aura);
}
@ -462,7 +461,7 @@ void EntityClassData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_auras"), &EntityClassData::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "auras"), &EntityClassData::set_auras);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Aura", PROPERTY_USAGE_DEFAULT, "Aura"), "set_auras", "get_auras");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras");
//Vendor
ClassDB::bind_method(D_METHOD("get_vendor_item_data"), &EntityClassData::get_vendor_item_data);

View File

@ -49,7 +49,6 @@ SOFTWARE.
#include "../resources/entity_resource.h"
class Aura;
class Spell;
class Entity;
class ItemInstance;
@ -128,8 +127,8 @@ public:
int get_num_auras();
void set_num_auras(int value);
Ref<Aura> get_aura(int index);
void set_aura(int index, Ref<Aura> aura);
Ref<Spell> get_aura(int index);
void set_aura(int index, Ref<Spell> aura);
Vector<Variant> get_auras();
void set_auras(const Vector<Variant> &auras);
@ -193,7 +192,7 @@ private:
Vector<Ref<CharacterSpec> > _specs;
Vector<Ref<Spell> > _spells;
Vector<Ref<Spell> > _start_spells;
Vector<Ref<Aura> > _auras;
Vector<Ref<Spell> > _auras;
Ref<VendorItemData> _vendor_item_data;
Ref<VendorItemData> _spell_train_data;

View File

@ -22,7 +22,6 @@ SOFTWARE.
#include "entity_data.h"
#include "../../data/auras/aura.h"
#include "../../data/spells/spell.h"
#include "../../infos/spell_cast_info.h"
#include "../entity.h"

View File

@ -51,7 +51,6 @@ SOFTWARE.
#include "../ai/entity_ai.h"
class Aura;
class Spell;
class Entity;
class CharacterSpec;

View File

@ -26,7 +26,6 @@ SOFTWARE.
#include "../singletons/ess.h"
#include "../singletons/profile_manager.h"
#include "../data/auras/aura.h"
#include "../data/species/entity_species_data.h"
#include "../data/spells/spell.h"
#include "../entities/auras/aura_data.h"
@ -151,6 +150,20 @@ SOFTWARE.
\
emit_signal(signal, what, __VA_ARGS__);
#define NOTIFICATION_AURA_DIFF_IMPLS(func, aura_func, signal, what, ...) \
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) \
_s_ai->func(what, __VA_ARGS__); \
\
if (has_method("_" #func)) \
call("_" #func, what, __VA_ARGS__); \
\
for (int i = 0; i < _s_auras.size(); ++i) { \
Ref<AuraData> ad = _s_auras.get(i); \
ad->get_aura()->aura_func(what, ad, __VA_ARGS__); \
} \
\
emit_signal(signal, what, __VA_ARGS__);
#define NOTIFICATION_AURA_IMPLC(func, signal, what, ...) \
if (has_method("_" #func)) \
call("_" #func, what, __VA_ARGS__); \
@ -723,7 +736,7 @@ void Entity::_setup() {
}
for (int i = 0; i < cc->get_num_auras(); ++i) {
Ref<Aura> a = cc->get_aura(i);
Ref<Spell> a = cc->get_aura(i);
if (a.is_valid()) {
a->aura_sapply_simple(this, this, 1.0);
@ -3176,7 +3189,7 @@ void Entity::notification_sheal(int what, Ref<SpellHealInfo> info) {
void Entity::notification_scast(int what, Ref<SpellCastInfo> info) {
ERR_FAIL_COND(!info.is_valid());
NOTIFICATION_AURA_IMPLS(notification_scast, "notification_scast", what, info);
NOTIFICATION_AURA_DIFF_IMPLS(notification_scast, notification_aura_scast, "notification_scast", what, info);
}
void Entity::notification_sdamage(int what, Ref<SpellDamageInfo> info) {
ERR_FAIL_COND(!info.is_valid());
@ -3241,7 +3254,7 @@ void Entity::son_physics_process(float delta) {
for (int i = 0; i < _s_auras.size(); ++i) {
Ref<AuraData> ad = _s_auras.get(i);
ad->get_aura()->son_physics_process(ad);
ad->get_aura()->son_physics_process_aura(ad);
}
if (_physics_process_scis.size() > 0) {
@ -3677,7 +3690,7 @@ void Entity::notification_ccast(int what, Ref<SpellCastInfo> info) {
for (int i = 0; i < _c_auras.size(); ++i) {
Ref<AuraData> ad = _c_auras.get(i);
ad->get_aura()->notification_ccast(what, ad, info);
ad->get_aura()->notification_aura_ccast(what, ad, info);
}
if (has_method("_notification_ccast"))
@ -3742,7 +3755,7 @@ void Entity::cast_starts(Ref<SpellCastInfo> info) {
for (int i = 0; i < _s_auras.size(); ++i) {
Ref<AuraData> ad = _s_auras.get(i);
ad->get_aura()->notification_scast(SpellEnums::NOTIFICATION_CAST_STARTED, ad, info);
ad->get_aura()->notification_aura_scast(SpellEnums::NOTIFICATION_CAST_STARTED, ad, info);
}
_s_spell_cast_info->is_casting_set(true);
@ -4746,7 +4759,7 @@ void Entity::_class_talent_sreceive_learn_request(int spec_index, int class_tale
ERR_FAIL_COND(!spec.is_valid());
for (int i = 0; i < spec->get_num_ranks(class_talent_row, class_talent_culomn); ++i) {
Ref<Aura> class_talent = spec->get_talent(class_talent_row, class_talent_culomn, i);
Ref<Spell> class_talent = spec->get_talent(class_talent_row, class_talent_culomn, i);
if (!class_talent.is_valid())
return;
@ -4769,7 +4782,7 @@ void Entity::_class_talent_sreceive_learn_request(int spec_index, int class_tale
}
if (i > 0) {
Ref<Aura> pt = spec->get_talent(class_talent_row, class_talent_culomn, i - 1);
Ref<Spell> pt = spec->get_talent(class_talent_row, class_talent_culomn, i - 1);
for (int j = 0; j < aura_gets_count(); ++j) {
Ref<AuraData> ad = aura_gets(j);
@ -4993,7 +5006,7 @@ void Entity::_character_talent_sreceive_learn_request(int spec_index, int charac
ERR_FAIL_COND(!spec.is_valid());
for (int i = 0; i < spec->get_num_ranks(character_talent_row, character_talent_culomn); ++i) {
Ref<Aura> character_talent = spec->get_talent(character_talent_row, character_talent_culomn, i);
Ref<Spell> character_talent = spec->get_talent(character_talent_row, character_talent_culomn, i);
if (!character_talent.is_valid())
return;
@ -5016,7 +5029,7 @@ void Entity::_character_talent_sreceive_learn_request(int spec_index, int charac
}
if (i > 0) {
Ref<Aura> pt = spec->get_talent(character_talent_row, character_talent_culomn, i - 1);
Ref<Spell> pt = spec->get_talent(character_talent_row, character_talent_culomn, i - 1);
for (int j = 0; j < aura_gets_count(); ++j) {
Ref<AuraData> ad = aura_gets(j);

View File

@ -22,7 +22,7 @@ SOFTWARE.
#include "aura_infos.h"
#include "../data/auras/aura.h"
#include "../data/spells/spell.h"
Entity *AuraApplyInfo::caster_get() const {
return _caster;
@ -76,11 +76,11 @@ void AuraApplyInfo::spell_scale_set(float value) {
_spell_scale = value;
}
Ref<Aura> AuraApplyInfo::get_aura() const {
return Ref<Aura>(_aura);
Ref<Spell> AuraApplyInfo::get_aura() const {
return Ref<Spell>(_aura);
}
void AuraApplyInfo::set_aura(Ref<Aura> aura) {
void AuraApplyInfo::set_aura(Ref<Spell> aura) {
_aura = (*aura);
}
@ -91,7 +91,7 @@ AuraApplyInfo::AuraApplyInfo() {
_aura = NULL;
}
AuraApplyInfo::AuraApplyInfo(Entity *caster, Entity *target, float spell_scale, Aura *aura) {
AuraApplyInfo::AuraApplyInfo(Entity *caster, Entity *target, float spell_scale, Spell *aura) {
_caster = caster;
_target = target;
_spell_scale = spell_scale;
@ -120,5 +120,5 @@ void AuraApplyInfo::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_aura"), &AuraApplyInfo::get_aura);
ClassDB::bind_method(D_METHOD("set_aura", "aura"), &AuraApplyInfo::set_aura);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_aura", "get_aura");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_aura", "get_aura");
}

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include "../entities/entity.h"
class Entity;
class Aura;
class Spell;
class AuraApplyInfo : public Reference {
GDCLASS(AuraApplyInfo, Reference);
@ -51,11 +51,11 @@ public:
float spell_scale_get() const;
void spell_scale_set(float value);
Ref<Aura> get_aura() const;
void set_aura(Ref<Aura> aura);
Ref<Spell> get_aura() const;
void set_aura(Ref<Spell> aura);
AuraApplyInfo();
AuraApplyInfo(Entity *_caster, Entity *_target, float _spell_scale, Aura *_aura);
AuraApplyInfo(Entity *_caster, Entity *_target, float _spell_scale, Spell *_aura);
AuraApplyInfo(Entity *_caster, Entity *_target, float _spell_scale);
protected:
@ -65,7 +65,7 @@ private:
Entity *_caster;
Entity *_target;
float _spell_scale;
Aura *_aura;
Spell *_aura;
};
#endif

View File

@ -24,7 +24,6 @@ SOFTWARE.
#include "core/version.h"
#include "../data/auras/aura.h"
#include "../data/spells/spell.h"
#include "../database/ess_resource_db.h"
#include "../entities/entity.h"
@ -132,11 +131,11 @@ void SpellDamageInfo::spell_source_set(const Ref<Spell> &value) {
_damage_source_id = value->get_id();
}
Ref<Aura> SpellDamageInfo::aura_source_get() {
return Ref<Aura>(_damage_source);
Ref<Spell> SpellDamageInfo::aura_source_get() {
return Ref<Spell>(_damage_source);
}
void SpellDamageInfo::aura_source_set(const Ref<Aura> &value) {
void SpellDamageInfo::aura_source_set(const Ref<Spell> &value) {
_damage_source_type = DAMAGE_SOURCE_AURA;
_damage_source = value;
@ -174,7 +173,7 @@ void SpellDamageInfo::resolve_references(Node *owner) {
if (_damage_source_type == DAMAGE_SOURCE_SPELL) {
_damage_source = ESS::get_singleton()->get_resource_db()->get_spell(_damage_source_id);
} else if (_damage_source_type == DAMAGE_SOURCE_AURA) {
_damage_source = ESS::get_singleton()->get_resource_db()->get_aura(_damage_source_id);
_damage_source = ESS::get_singleton()->get_resource_db()->get_spell(_damage_source_id);
}
}

View File

@ -36,7 +36,6 @@ SOFTWARE.
class Entity;
class Spell;
class Aura;
class SpellDamageInfo : public Reference {
GDCLASS(SpellDamageInfo, Reference);
@ -81,8 +80,8 @@ public:
Ref<Spell> spell_source_get();
void spell_source_set(const Ref<Spell> &value);
Ref<Aura> aura_source_get();
void aura_source_set(const Ref<Aura> &value);
Ref<Spell> aura_source_get();
void aura_source_set(const Ref<Spell> &value);
int source_get_id() const;
void source_set_id(const int value);

View File

@ -24,7 +24,6 @@ SOFTWARE.
#include "core/version.h"
#include "../data/auras/aura.h"
#include "../data/spells/spell.h"
#include "../database/ess_resource_db.h"
#include "../entities/entity.h"
@ -133,11 +132,11 @@ void SpellHealInfo::spell_source_set(const Ref<Spell> &value) {
_heal_source_id = value->get_id();
}
Ref<Aura> SpellHealInfo::aura_source_get() {
return Ref<Aura>(_heal_source);
Ref<Spell> SpellHealInfo::aura_source_get() {
return Ref<Spell>(_heal_source);
}
void SpellHealInfo::aura_source_set(const Ref<Aura> &value) {
void SpellHealInfo::aura_source_set(const Ref<Spell> &value) {
_heal_source_type = HEAL_SOURCE_AURA;
_heal_source = value;
@ -175,7 +174,7 @@ void SpellHealInfo::resolve_references(Node *owner) {
if (_heal_source_type == HEAL_SOURCE_SPELL) {
_heal_source = ESS::get_singleton()->get_resource_db()->get_spell(_heal_source_id);
} else if (_heal_source_type == HEAL_SOURCE_AURA) {
_heal_source = ESS::get_singleton()->get_resource_db()->get_aura(_heal_source_id);
_heal_source = ESS::get_singleton()->get_resource_db()->get_spell(_heal_source_id);
}
}
@ -277,7 +276,7 @@ void SpellHealInfo::_bind_methods() {
ClassDB::bind_method(D_METHOD("aura_source_get"), &SpellHealInfo::aura_source_get);
ClassDB::bind_method(D_METHOD("aura_source_set", "value"), &SpellHealInfo::aura_source_set);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura_source", PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "aura_source_set", "aura_source_get");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "aura_source", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "aura_source_set", "aura_source_get");
ClassDB::bind_method(D_METHOD("source_get_id"), &SpellHealInfo::source_get_id);
ClassDB::bind_method(D_METHOD("source_set_id", "value"), &SpellHealInfo::source_set_id);

View File

@ -36,7 +36,6 @@ SOFTWARE.
class Entity;
class Spell;
class Aura;
class SpellHealInfo : public Reference {
GDCLASS(SpellHealInfo, Reference);
@ -84,8 +83,8 @@ public:
Ref<Spell> spell_source_get();
void spell_source_set(const Ref<Spell> &value);
Ref<Aura> aura_source_get();
void aura_source_set(const Ref<Aura> &value);
Ref<Spell> aura_source_get();
void aura_source_set(const Ref<Spell> &value);
int source_get_id() const;
void source_set_id(const int value);

View File

@ -27,7 +27,6 @@ SOFTWARE.
#include "singletons/ess.h"
#include "data/auras/aura.h"
#include "data/auras/aura_group.h"
#include "data/items/equipment_data.h"
@ -153,7 +152,6 @@ void register_entity_spell_system_types() {
ClassDB::register_class<CraftRecipe>();
ClassDB::register_class<Spell>();
ClassDB::register_class<Aura>();
ClassDB::register_class<AuraGroup>();
ClassDB::register_class<EntityData>();