-Added type to auras, and an is debuff flag.

-Moved getter and setter implementations from the Aura header to the cpp file.
-Now SpellEnums is properly registered.
This commit is contained in:
Relintai 2019-05-28 01:08:11 +02:00
parent 5692eec91e
commit 575871678e
5 changed files with 258 additions and 151 deletions

View File

@ -1,8 +1,67 @@
#include "aura.h"
#if ENTITY_MEM_TOOLS
int Aura::allocs = 0;
#endif
int Aura::get_id() {
return id;
}
void Aura::set_id(int value) {
id = value;
}
Ref<Texture> Aura::get_icon() {
return _icon;
}
void Aura::set_icon(Ref<Texture> value) {
_icon = Ref<Texture>(value);
}
float Aura::get_time() {
return time;
}
void Aura::set_time(float value) {
time = value;
}
int Aura::get_aura_group() {
return aura_group;
}
void Aura::set_aura_group(int value) {
aura_group = value;
}
bool Aura::get_is_debuff() {
return _is_debuff;
}
void Aura::set_is_debuff(bool value) {
_is_debuff = value;
}
SpellEnums::AuraType Aura::get_aura_type() {
return _aura_type;
}
void Aura::set_aura_type(SpellEnums::AuraType value) {
_aura_type = value;
}
String Aura::get_aura_name() {
return _aura_name;
}
void Aura::set_aura_name(String name) {
_aura_name = name;
}
String Aura::get_aura_description() {
return _aura_description;
}
void Aura::set_aura_description(String description) {
_aura_description = description;
}
int Aura::get_ability_scale_data_id() {
return ability_scale_data_id;
}
void Aura::set_ability_scale_data_id(int value) {
ability_scale_data_id = value;
}
/*
AnimationCurve *Aura::getDamageLevelScaling() {
@ -66,6 +125,50 @@ void Aura::OnAuraAbilityScalingDataLoaded(AbilityScalingDataLoaderHelper *h) {
}
*/
//Damage
bool Aura::is_damage_enabled() {
return _damage_enabled;
}
void Aura::set_damage_enabled(bool value) {
_damage_enabled = value;
}
int Aura::get_damage_type() {
return _damage_type;
}
void Aura::set_damage_type(int value) {
_damage_type = value;
}
int Aura::get_damage_min() {
return _damage_min;
}
void Aura::set_damage_min(int value) {
_damage_min = value;
}
int Aura::get_damage_max() {
return _damage_max;
}
void Aura::set_damage_max(int value) {
_damage_max = value;
}
float Aura::get_damage_tick() {
return _damage_tick;
}
void Aura::set_damage_tick(float value) {
_damage_tick = value;
}
bool Aura::get_damage_can_crit() {
return _damage_can_crit;
}
void Aura::set_damage_can_crit(bool value) {
_damage_can_crit = value;
}
void Aura::set_damage(int min, int max, float tick, bool can_crit) {
set_damage_enabled(true);
set_damage_min(min);
@ -74,6 +177,72 @@ void Aura::set_damage(int min, int max, float tick, bool can_crit) {
set_damage_can_crit(can_crit);
}
//Absorb
bool Aura::is_absorb_enabled() {
return _absorb_enabled;
}
void Aura::set_absorb_enabled(bool value) {
_absorb_enabled = value;
}
int Aura::get_absorb_damage_type() {
return _absorb_damage_type;
}
void Aura::set_absorb_damage_type(int value) {
_absorb_damage_type = value;
}
int Aura::get_absorb_min() {
return _absorb_min;
}
void Aura::set_absorb_min(int value) {
_absorb_min = value;
}
int Aura::get_absorb_max() {
return _absorb_max;
}
void Aura::set_absorb_max(int value) {
_absorb_max = value;
}
//Heal
bool Aura::is_heal_enabled() {
return _heal_enabled;
}
void Aura::set_heal_enabled(bool value) {
_heal_enabled = value;
}
int Aura::get_heal_min() {
return _heal_min;
}
void Aura::set_heal_min(int value) {
_heal_min = value;
}
int Aura::get_heal_max() {
return _heal_max;
}
void Aura::set_heal_max(int value) {
_heal_max = value;
}
float Aura::get_heal_tick() {
return _heal_tick;
}
void Aura::set_heal_tick(float value) {
_heal_tick = value;
}
bool Aura::get_heal_can_crit() {
return _heal_can_crit;
}
void Aura::set_heal_can_crit(bool value) {
_heal_can_crit = value;
}
void Aura::set_heal(int min, int max, float tick, bool can_crit) {
set_heal_enabled(true);
set_heal_min(min);
@ -86,6 +255,8 @@ Aura::Aura() {
ability_scale_data_id = 1;
id = 0;
time = 0;
_aura_type = SpellEnums::AURA_TYPE_NONE;
_is_debuff = false;
aura_group = 0;
_damage_enabled = false;
@ -119,18 +290,9 @@ Aura::Aura() {
for (int i = 0; i < MAX_TRIGGER_DATA; ++i) {
_trigger_datas[i] = Ref<AuraTriggerData>(memnew(AuraTriggerData()));
}
#if ENTITY_MEM_TOOLS
Aura::allocs++;
print_error("Aura alloc " + String::num(Aura::allocs));
#endif
}
Aura::~Aura() {
#if ENTITY_MEM_TOOLS
Aura::allocs--;
print_error("Aura dealloc " + String::num(Aura::allocs));
#endif
}
////// Triggers ///////
@ -750,6 +912,14 @@ void Aura::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time", "value"), &Aura::set_time);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "time"), "set_time", "get_time");
ClassDB::bind_method(D_METHOD("get_is_debuff"), &Aura::get_is_debuff);
ClassDB::bind_method(D_METHOD("set_is_debuff", "value"), &Aura::set_is_debuff);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_debuff"), "set_is_debuff", "get_is_debuff");
ClassDB::bind_method(D_METHOD("get_aura_type"), &Aura::get_aura_type);
ClassDB::bind_method(D_METHOD("set_aura_type", "value"), &Aura::set_aura_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "aura_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_AURA_TYPES), "set_aura_type", "get_aura_type");
ClassDB::bind_method(D_METHOD("get_aura_group"), &Aura::get_aura_group);
ClassDB::bind_method(D_METHOD("set_aura_group", "value"), &Aura::set_aura_group);
ADD_PROPERTY(PropertyInfo(Variant::INT, "aura_group"), "set_aura_group", "get_aura_group");

View File

@ -29,54 +29,32 @@ class Aura : public Resource {
GDCLASS(Aura, Resource);
public:
int get_id() {
return id;
}
void set_id(int value) {
id = value;
}
int get_id();
void set_id(int value);
String get_aura_name() {
return _aura_name;
}
void set_aura_name(String name) {
_aura_name = name;
}
Ref<Texture> get_icon();
void set_icon(Ref<Texture> value);
String get_aura_description() {
return _aura_description;
}
void set_aura_description(String description) {
_aura_description = description;
}
float get_time();
void set_time(float value);
Ref<Texture> get_icon() {
return _icon;
}
void set_icon(Ref<Texture> value) {
_icon = Ref<Texture>(value);
}
int get_aura_group();
void set_aura_group(int value);
float get_time() {
return time;
}
void set_time(float value) {
time = value;
}
bool get_is_debuff();
void set_is_debuff(bool value);
int get_aura_group() {
return aura_group;
}
void set_aura_group(int value) {
aura_group = value;
}
SpellEnums::AuraType get_aura_type();
void set_aura_type(SpellEnums::AuraType value);
int get_ability_scale_data_id() {
return ability_scale_data_id;
}
void set_ability_scale_data_id(int value) {
ability_scale_data_id = value;
}
String get_aura_name();
void set_aura_name(String name);
String get_aura_description();
void set_aura_description(String description);
int get_ability_scale_data_id();
void set_ability_scale_data_id(int value);
float get_damage_scale_for_level(int level);
float get_heal_scale_for_level(int level);
@ -93,116 +71,56 @@ public:
// static void ToJSON(Aura* ada, JsonWriter* w);
//Damage
bool is_damage_enabled() {
return _damage_enabled;
}
void set_damage_enabled(bool value) {
_damage_enabled = value;
}
bool is_damage_enabled();
void set_damage_enabled(bool value);
int get_damage_type() {
return _damage_type;
}
int get_damage_type();
void set_damage_type(int value) {
_damage_type = value;
}
void set_damage_type(int value);
int get_damage_min() {
return _damage_min;
}
void set_damage_min(int value) {
_damage_min = value;
}
int get_damage_min();
void set_damage_min(int value);
int get_damage_max() {
return _damage_max;
}
void set_damage_max(int value) {
_damage_max = value;
}
int get_damage_max();
void set_damage_max(int value);
float get_damage_tick() {
return _damage_tick;
}
void set_damage_tick(float value) {
_damage_tick = value;
}
float get_damage_tick();
void set_damage_tick(float value);
bool get_damage_can_crit() {
return _damage_can_crit;
}
void set_damage_can_crit(bool value) {
_damage_can_crit = value;
}
bool get_damage_can_crit();
void set_damage_can_crit(bool value);
void set_damage(int min, int max, float tick, bool can_crit);
//Absorb
bool is_absorb_enabled() {
return _absorb_enabled;
}
void set_absorb_enabled(bool value) {
_absorb_enabled = value;
}
bool is_absorb_enabled();
void set_absorb_enabled(bool value);
int get_absorb_damage_type() {
return _absorb_damage_type;
}
int get_absorb_damage_type();
void set_absorb_damage_type(int value) {
_absorb_damage_type = value;
}
void set_absorb_damage_type(int value);
int get_absorb_min() {
return _absorb_min;
}
void set_absorb_min(int value) {
_absorb_min = value;
}
int get_absorb_min();
void set_absorb_min(int value);
int get_absorb_max() {
return _absorb_max;
}
void set_absorb_max(int value) {
_absorb_max = value;
}
int get_absorb_max();
void set_absorb_max(int value);
//Heal
bool is_heal_enabled() {
return _heal_enabled;
}
void set_heal_enabled(bool value) {
_heal_enabled = value;
}
bool is_heal_enabled();
void set_heal_enabled(bool value);
int get_heal_min() {
return _heal_min;
}
void set_heal_min(int value) {
_heal_min = value;
}
int get_heal_min();
void set_heal_min(int value);
int get_heal_max() {
return _heal_max;
}
void set_heal_max(int value) {
_heal_max = value;
}
int get_heal_max();
void set_heal_max(int value);
float get_heal_tick() {
return _heal_tick;
}
void set_heal_tick(float value) {
_heal_tick = value;
}
float get_heal_tick();
void set_heal_tick(float value);
bool get_heal_can_crit() {
return _heal_can_crit;
}
void set_heal_can_crit(bool value) {
_heal_can_crit = value;
}
bool get_heal_can_crit();
void set_heal_can_crit(bool value);
void set_heal(int min, int max, float tick, bool can_crit);
@ -405,13 +323,16 @@ private:
};
int id;
String _aura_name;
String _aura_description;
float time;
int aura_group;
Ref<Texture> _icon;
int ability_scale_data_id;
SpellEnums::AuraType _aura_type;
bool _is_debuff;
String _aura_name;
String _aura_description;
int ability_scale_data_id;
bool _damage_enabled;
int _damage_type;
int _damage_min;
@ -447,10 +368,6 @@ private:
static const int DIMINISHING_RETURN_ROOT_AURA_ID = 1;
static const int DIMINISHING_RETURN_TIME = 15;
#if ENTITY_MEM_TOOLS
static int allocs;
#endif
};
#endif

View File

@ -53,9 +53,11 @@
#include "utility/entity_create_info.h"
#include "utility/cooldown.h"
#include "utility/cooldown.h"
#include "utility/category_cooldown.h"
void register_entity_spell_system_types() {
ClassDB::register_class<SpellEnums>();
//data
ClassDB::register_class<Icon>();

View File

@ -4,3 +4,4 @@ const String SpellEnums::BINDING_STRING_SPELL_TYPES = "None, Melee, Holy, Shadow
const String SpellEnums::BINDING_STRING_DIMINISHING_RETURN_CATEGORIES = "None, Root, Stun";
const String SpellEnums::BINDING_STRING_TRIGGER_EVENTS = "None, S On Before Damage, S On Damage Receive, S On Hit, S On Damage Dealt, S Aura Remove, S Aura Dispell, S On Before Aura Applied, S On After Aura Applied, C On Aura Added, C On Aura Removed, C On Aura Refreshed";
const String SpellEnums::BINDING_STRING_DAMAGE_TYPES = "None, Melee, Holy, Shadow, Nature, Fire, Frost, Lightning, Chaos";
const String SpellEnums::BINDING_STRING_AURA_TYPES = "None, Magic, Poison, Physical, Curse, Bleed";

View File

@ -11,6 +11,7 @@ public:
static const String BINDING_STRING_DIMINISHING_RETURN_CATEGORIES;
static const String BINDING_STRING_TRIGGER_EVENTS;
static const String BINDING_STRING_DAMAGE_TYPES;
static const String BINDING_STRING_AURA_TYPES;
enum DamageType {
DAMAGE_TYPE_NONE = 0,
@ -57,6 +58,14 @@ public:
TRIGGER_AURA_EVENT_C_ON_AURA_REFRESHED,
};
enum AuraType {
AURA_TYPE_NONE = 0,
AURA_TYPE_MAGIC = 1,
AURA_TYPE_POISON = 2,
AURA_TYPE_PHYSICAL = 3,
AURA_TYPE_CURSE = 4,
AURA_TYPE_BLEED = 5,
};
SpellEnums() {}
@ -98,6 +107,13 @@ protected:
BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_ADDED);
BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_REMOVED);
BIND_ENUM_CONSTANT(TRIGGER_AURA_EVENT_C_ON_AURA_REFRESHED);
BIND_ENUM_CONSTANT(AURA_TYPE_NONE);
BIND_ENUM_CONSTANT(AURA_TYPE_MAGIC);
BIND_ENUM_CONSTANT(AURA_TYPE_POISON);
BIND_ENUM_CONSTANT(AURA_TYPE_PHYSICAL);
BIND_ENUM_CONSTANT(AURA_TYPE_CURSE);
BIND_ENUM_CONSTANT(AURA_TYPE_BLEED);
}
};
@ -105,5 +121,6 @@ VARIANT_ENUM_CAST(SpellEnums::SpellType);
VARIANT_ENUM_CAST(SpellEnums::DiminishingReturnCategory);
VARIANT_ENUM_CAST(SpellEnums::TriggerEvents);
VARIANT_ENUM_CAST(SpellEnums::DamageType);
VARIANT_ENUM_CAST(SpellEnums::AuraType);
#endif