mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-22 17:18:12 +01:00
Added the heal pipeline.
This commit is contained in:
parent
b16795c59c
commit
4c586d459f
1
SCsub
1
SCsub
@ -49,6 +49,7 @@ module_env.add_source_files(env.modules_sources,"data/aura_visual_effect.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"data/spell_visual_effect.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"pipelines/spell_damage_info.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"pipelines/spell_heal_info.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"entities/auras/aura_data.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"entities/entity.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"entities/player.cpp")
|
||||
|
201
data/aura.cpp
201
data/aura.cpp
@ -321,6 +321,14 @@ void Aura::son_cast_finished_target(Ref<SpellCastInfo> info) {
|
||||
call("_son_cast_finished_target", info);
|
||||
}
|
||||
|
||||
void Aura::son_hit(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_hit"))
|
||||
call("_son_hit", data);
|
||||
}
|
||||
|
||||
|
||||
void Aura::son_before_damage(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
@ -335,11 +343,11 @@ void Aura::son_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
call("_son_damage_receive", data);
|
||||
}
|
||||
|
||||
void Aura::son_hit(Ref<SpellDamageInfo> data) {
|
||||
void Aura::son_dealt_damage(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_hit"))
|
||||
call("_son_hit", data);
|
||||
if (has_method("_son_dealt_damage"))
|
||||
call("_son_dealt_damage", data);
|
||||
}
|
||||
|
||||
void Aura::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
@ -349,6 +357,35 @@ void Aura::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
call("_son_damage_dealt", data);
|
||||
}
|
||||
|
||||
|
||||
void Aura::son_before_heal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_before_heal"))
|
||||
call("_son_before_heal", data);
|
||||
}
|
||||
|
||||
void Aura::son_heal_receive(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_heal_receive"))
|
||||
call("_son_heal_receive", data);
|
||||
}
|
||||
|
||||
void Aura::son_dealt_heal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_dealt_heal"))
|
||||
call("_son_dealt_heal", data);
|
||||
}
|
||||
|
||||
void Aura::son_heal_dealt(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_son_heal_dealt"))
|
||||
call("_son_heal_dealt", data);
|
||||
}
|
||||
|
||||
void Aura::son_remove_expired(Ref<AuraData> aura) {
|
||||
ERR_FAIL_COND(!aura.is_valid());
|
||||
|
||||
@ -405,6 +442,22 @@ void Aura::con_refresh(Ref<AuraData> data) {
|
||||
call("_con_refresh", data);
|
||||
}
|
||||
|
||||
void Aura::setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
ERR_FAIL_COND(!data.is_valid() || !info.is_valid());
|
||||
|
||||
//always exists
|
||||
call("setup_aura_data", data, info);
|
||||
}
|
||||
|
||||
void Aura::_setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
data->set_aura(Ref<Aura>(this));
|
||||
data->set_caster(info->get_caster());
|
||||
|
||||
if (is_damage_enabled()) {
|
||||
calculate_initial_damage(data, info);
|
||||
}
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
@ -419,13 +472,6 @@ void Aura::sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
call("_sapply_passives_damage_deal", data);
|
||||
}
|
||||
|
||||
void Aura::setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
ERR_FAIL_COND(!data.is_valid() || !info.is_valid());
|
||||
|
||||
//always exists
|
||||
call("setup_aura_data", data, info);
|
||||
}
|
||||
|
||||
void Aura::calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
ERR_FAIL_COND(!aura_data.is_valid() || !info.is_valid());
|
||||
|
||||
@ -440,6 +486,73 @@ void Aura::handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data
|
||||
call("_handle_aura_damage", aura_data, data);
|
||||
}
|
||||
|
||||
|
||||
void Aura::_sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
void Aura::_sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
void Aura::_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
aura_data->set_damage(info->get_aura()->get_damage_min());
|
||||
}
|
||||
|
||||
void Aura::_handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data) {
|
||||
data->set_damage(aura_data->get_damage());
|
||||
|
||||
data->get_dealer()->sdeal_damage_to(data);
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_heal_receive(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//always exists
|
||||
call("_sapply_passives_heal_receive", data);
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_heal_deal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//always exists
|
||||
call("_sapply_passives_heal_deal", data);
|
||||
}
|
||||
|
||||
void Aura::_sapply_passives_heal_receive(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//always exists
|
||||
call("_sapply_passives_heal_receive", data);
|
||||
}
|
||||
|
||||
void Aura::_sapply_passives_heal_deal(Ref<SpellHealInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
ERR_FAIL_COND(!aura_data.is_valid() || !info.is_valid());
|
||||
|
||||
//always exists
|
||||
call("_calculate_initial_heal", aura_data, info);
|
||||
}
|
||||
|
||||
void Aura::handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!aura_data.is_valid() || !data.is_valid());
|
||||
|
||||
//always exists
|
||||
call("_handle_aura_heal", aura_data, data);
|
||||
}
|
||||
|
||||
void Aura::_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
aura_data->set_damage(info->get_aura()->get_damage_min());
|
||||
}
|
||||
|
||||
void Aura::_handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> data) {
|
||||
data->set_heal(aura_data->get_heal());
|
||||
|
||||
data->get_dealer()->sdeal_heal_to(data);
|
||||
}
|
||||
|
||||
void Aura::_sapply(Ref<AuraApplyInfo> info) {
|
||||
Ref<Aura> aura = info->get_aura();
|
||||
|
||||
@ -486,24 +599,6 @@ void Aura::_supdate(Ref<AuraData> aura, float delta) {
|
||||
}
|
||||
}
|
||||
|
||||
void Aura::_setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
data->set_aura(Ref<Aura>(this));
|
||||
data->set_caster(info->get_caster());
|
||||
|
||||
if (is_damage_enabled()) {
|
||||
calculate_initial_damage(data, info);
|
||||
}
|
||||
}
|
||||
|
||||
void Aura::_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
aura_data->set_damage(info->get_aura()->get_damage_min());
|
||||
}
|
||||
|
||||
void Aura::_handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data) {
|
||||
data->set_damage(aura_data->get_damage());
|
||||
|
||||
data->get_dealer()->sdeal_damage_to(data);
|
||||
}
|
||||
|
||||
void Aura::_validate_property(PropertyInfo &property) const {
|
||||
|
||||
@ -549,11 +644,18 @@ void Aura::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &Aura::son_cast_finished);
|
||||
ClassDB::bind_method(D_METHOD("son_cast_finished_target", "info"), &Aura::son_cast_finished_target);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_hit", "data"), &Aura::son_hit);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_before_damage", "data"), &Aura::son_before_damage);
|
||||
ClassDB::bind_method(D_METHOD("son_damage_receive", "data"), &Aura::son_damage_receive);
|
||||
ClassDB::bind_method(D_METHOD("son_hit", "data"), &Aura::son_hit);
|
||||
ClassDB::bind_method(D_METHOD("son_dealt_damage", "data"), &Aura::son_dealt_damage);
|
||||
ClassDB::bind_method(D_METHOD("son_damage_dealt", "data"), &Aura::son_damage_dealt);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_before_heal", "data"), &Aura::son_before_heal);
|
||||
ClassDB::bind_method(D_METHOD("son_heal_receive", "data"), &Aura::son_heal_receive);
|
||||
ClassDB::bind_method(D_METHOD("son_dealt_heal", "data"), &Aura::son_dealt_heal);
|
||||
ClassDB::bind_method(D_METHOD("son_heal_dealt", "data"), &Aura::son_heal_dealt);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_remove", "aura"), &Aura::son_remove);
|
||||
ClassDB::bind_method(D_METHOD("son_remove_expired", "aura"), &Aura::son_remove_expired);
|
||||
ClassDB::bind_method(D_METHOD("son_remove_dispell", "aura"), &Aura::son_remove_dispell);
|
||||
@ -568,14 +670,21 @@ void Aura::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_before_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_damage_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_dealt_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_damage_dealt", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_before_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_heal_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_dealt_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_heal_dealt", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_remove", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_son_remove_expired", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("son_remove_dispell", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_son_remove_dispell", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_before_aura_applied", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_son_after_aura_applied", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
@ -590,24 +699,44 @@ void Aura::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_con_refresh", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
|
||||
//Calculations / Queries
|
||||
ClassDB::bind_method(D_METHOD("setup_aura_data", "data", "info"), &Aura::setup_aura_data);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_setup_aura_data", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_setup_aura_data", "data", "info"), &Aura::_setup_aura_data);
|
||||
|
||||
//damage
|
||||
ClassDB::bind_method(D_METHOD("sapply_passives_damage_receive", "data"), &Aura::sapply_passives_damage_receive);
|
||||
ClassDB::bind_method(D_METHOD("sapply_passives_damage_deal", "data"), &Aura::sapply_passives_damage_deal);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_aura_data", "data", "info"), &Aura::setup_aura_data);
|
||||
ClassDB::bind_method(D_METHOD("calculate_initial_damage", "aura_data", "info"), &Aura::calculate_initial_damage);
|
||||
ClassDB::bind_method(D_METHOD("handle_aura_damage", "aura_data", "data"), &Aura::handle_aura_damage);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_sapply_passives_damage_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_sapply_passives_damage_deal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_setup_aura_data", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_calculate_initial_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_handle_aura_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_setup_aura_data", "data", "info"), &Aura::_setup_aura_data);
|
||||
ClassDB::bind_method(D_METHOD("_sapply_passives_damage_receive", "data"), &Aura::_sapply_passives_damage_receive);
|
||||
ClassDB::bind_method(D_METHOD("_sapply_passives_damage_deal", "data"), &Aura::_sapply_passives_damage_deal);
|
||||
ClassDB::bind_method(D_METHOD("_calculate_initial_damage", "aura_data", "info"), &Aura::_calculate_initial_damage);
|
||||
ClassDB::bind_method(D_METHOD("_handle_aura_damage", "aura_data", "data"), &Aura::_handle_aura_damage);
|
||||
|
||||
//heal
|
||||
ClassDB::bind_method(D_METHOD("sapply_passives_heal_receive", "data"), &Aura::sapply_passives_heal_receive);
|
||||
ClassDB::bind_method(D_METHOD("sapply_passives_heal_deal", "data"), &Aura::sapply_passives_heal_deal);
|
||||
ClassDB::bind_method(D_METHOD("calculate_initial_heal", "aura_data", "info"), &Aura::calculate_initial_heal);
|
||||
ClassDB::bind_method(D_METHOD("handle_aura_heal", "aura_data", "data"), &Aura::handle_aura_heal);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_sapply_passives_heal_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_sapply_passives_heal_deal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_calculate_initial_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_handle_aura_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_sapply_passives_heal_receive", "data"), &Aura::_sapply_passives_heal_receive);
|
||||
ClassDB::bind_method(D_METHOD("_sapply_passives_heal_deal", "data"), &Aura::_sapply_passives_heal_deal);
|
||||
ClassDB::bind_method(D_METHOD("_calculate_initial_heal", "aura_data", "info"), &Aura::_calculate_initial_heal);
|
||||
ClassDB::bind_method(D_METHOD("_handle_aura_heal", "aura_data", "data"), &Aura::_handle_aura_heal);
|
||||
|
||||
//Properties
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &Aura::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &Aura::set_id);
|
||||
|
29
data/aura.h
29
data/aura.h
@ -17,6 +17,7 @@
|
||||
|
||||
#include "../entities/auras/aura_data.h"
|
||||
#include "../pipelines/spell_damage_info.h"
|
||||
#include "../pipelines/spell_heal_info.h"
|
||||
#include "../spells/spell_cast_info.h"
|
||||
|
||||
class AuraApplyInfo;
|
||||
@ -278,11 +279,18 @@ public:
|
||||
void son_cast_finished(Ref<SpellCastInfo> info);
|
||||
void son_cast_finished_target(Ref<SpellCastInfo> info);
|
||||
|
||||
void son_hit(Ref<SpellDamageInfo> data);
|
||||
|
||||
void son_before_damage(Ref<SpellDamageInfo> data);
|
||||
void son_damage_receive(Ref<SpellDamageInfo> data);
|
||||
void son_hit(Ref<SpellDamageInfo> data);
|
||||
void son_dealt_damage(Ref<SpellDamageInfo> data);
|
||||
void son_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
|
||||
void son_before_heal(Ref<SpellHealInfo> data);
|
||||
void son_heal_receive(Ref<SpellHealInfo> data);
|
||||
void son_dealt_heal(Ref<SpellHealInfo> data);
|
||||
void son_heal_dealt(Ref<SpellHealInfo> data);
|
||||
|
||||
void son_remove(Ref<AuraData> aura);
|
||||
void son_remove_expired(Ref<AuraData> aura);
|
||||
void son_remove_dispell(Ref<AuraData> aura);
|
||||
@ -296,15 +304,30 @@ public:
|
||||
void con_refresh(Ref<AuraData> data);
|
||||
|
||||
//Calculations / Queries
|
||||
void setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
|
||||
virtual void _setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
|
||||
void sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
void sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
void setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
void calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
void handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void _sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
virtual void _sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
virtual void _calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
virtual void _handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data);
|
||||
virtual void _setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
|
||||
void sapply_passives_heal_receive(Ref<SpellHealInfo> data);
|
||||
void sapply_passives_heal_deal(Ref<SpellHealInfo> data);
|
||||
void calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
void handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> data);
|
||||
|
||||
virtual void _sapply_passives_heal_receive(Ref<SpellHealInfo> data);
|
||||
virtual void _sapply_passives_heal_deal(Ref<SpellHealInfo> data);
|
||||
virtual void _calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
virtual void _handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> data);
|
||||
|
||||
|
||||
Aura();
|
||||
~Aura();
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "../data/spell.h"
|
||||
#include "../entities/auras/aura_data.h"
|
||||
#include "../pipelines/spell_damage_info.h"
|
||||
#include "../pipelines/spell_heal_info.h"
|
||||
|
||||
NodePath Entity::get_character_skeleton_path() {
|
||||
return _character_skeleton_path;
|
||||
@ -318,6 +319,7 @@ Entity::Entity() {
|
||||
_melee_damage_reduction = Ref<Stat>(get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE_REDUCTION));
|
||||
_spell_damage_reduction = Ref<Stat>(get_stat_enum(Stat::STAT_ID_SPELL_DAMAGE_REDUCTION));
|
||||
_damage_taken = Ref<Stat>(get_stat_enum(Stat::STAT_ID_DAMAGE_TAKEN));
|
||||
_heal_taken = Ref<Stat>(get_stat_enum(Stat::STAT_ID_HEAL_TAKEN));
|
||||
_melee_damage = Ref<Stat>(get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE));
|
||||
_spell_damage = Ref<Stat>(get_stat_enum(Stat::STAT_ID_SPELL_DAMAGE));
|
||||
|
||||
@ -386,6 +388,7 @@ void Entity::sinitialize_stats() {
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_melee_damage_reduction());
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_spell_damage_reduction());
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_damage_taken());
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_heal_taken());
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_melee_damage());
|
||||
gets_character_class()->get_stat_data()->get_stat_for_stat(get_spell_damage());
|
||||
}
|
||||
@ -470,24 +473,13 @@ void Entity::stake_damage(Ref<SpellDamageInfo> data) {
|
||||
creceive_damage_taken(data);
|
||||
|
||||
//signal
|
||||
emit_signal("son_damage_taken", this, data);
|
||||
emit_signal("son_damage_received", this, data);
|
||||
|
||||
if (get_health()->gets_current() <= 0) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//serverside
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_damage_dealt(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::sdeal_damage_to(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
@ -502,19 +494,50 @@ void Entity::sdeal_damage_to(Ref<SpellDamageInfo> data) {
|
||||
son_damage_dealt(data);
|
||||
}
|
||||
|
||||
void Entity::take_heal(int heal, bool crit, Entity *dealer) {
|
||||
/*
|
||||
if (sIsDead) {
|
||||
void Entity::stake_heal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//serverside
|
||||
|
||||
if (gets_is_dead()) {
|
||||
return;
|
||||
}
|
||||
Stat *expr_0F = SHealth;
|
||||
expr_0F->Current += (float)(heal);
|
||||
if (SHealth->Current > SHealth->Max) {
|
||||
SHealth->Current = SHealth->Max;
|
||||
|
||||
//send it through the passive damage reductions pipeline
|
||||
sapply_passives_heal_receive(data);
|
||||
//send it through the onbeforehit handler
|
||||
son_before_heal(data);
|
||||
|
||||
son_heal_receive(data);
|
||||
|
||||
int h = get_health()->gets_current() + data->get_heal();
|
||||
|
||||
if (h > get_health()->gets_max()) {
|
||||
h = get_health()->gets_max();
|
||||
}
|
||||
if (owner->isServer) {
|
||||
SendHealTakenMessage(heal, crit, dealer);
|
||||
}*/
|
||||
|
||||
get_health()->sets_current(h);
|
||||
|
||||
//send an event to client
|
||||
creceive_heal_taken(data);
|
||||
|
||||
//signal
|
||||
emit_signal("son_heal_received", this, data);
|
||||
}
|
||||
|
||||
|
||||
void Entity::sdeal_heal_to(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//serverside
|
||||
|
||||
if (gets_is_dead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
sapply_passives_damage_deal(data);
|
||||
data->get_receiver()->stake_damage(data);
|
||||
son_damage_dealt(data);
|
||||
}
|
||||
|
||||
void Entity::die() {
|
||||
@ -561,7 +584,7 @@ void Entity::creceive_damage_taken(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//the current c health should probably be set here.
|
||||
emit_signal("con_damage_taken", this, data);
|
||||
emit_signal("con_damage_received", this, data);
|
||||
}
|
||||
|
||||
void Entity::creceiveon_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
@ -571,14 +594,18 @@ void Entity::creceiveon_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
emit_signal("con_damage_dealt", this, data);
|
||||
}
|
||||
|
||||
void Entity::creceive_heal_taken(int heal, bool crit, Entity *dealer) {
|
||||
/*
|
||||
if (CHealth->Current > CHealth->Max) {
|
||||
CHealth->Current = CHealth->Max;
|
||||
}
|
||||
if (COnHealTaken != null) {
|
||||
DELEGATE_INVOKE(COnHealTaken, heal, crit, owner, dealer);
|
||||
}*/
|
||||
void Entity::creceive_heal_taken(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//the current c health should probably be set here.
|
||||
emit_signal("con_heal_received", this, data);
|
||||
}
|
||||
|
||||
void Entity::creceiveon_heal_dealt(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//the current c health should probably be set here.
|
||||
emit_signal("con_heal_dealt", this, data);
|
||||
}
|
||||
|
||||
void Entity::creceive_died() {
|
||||
@ -733,6 +760,17 @@ void Entity::son_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
void Entity::son_dealt_damage(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_dealt_damage(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//serverside
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
@ -740,6 +778,47 @@ void Entity::son_dealt_damage(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_before_heal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_before_heal(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_heal_receive(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_heal_receive(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_dealt_heal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_dealt_heal(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_heal_dealt(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
//serverside
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->son_heal_dealt(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
@ -760,6 +839,26 @@ void Entity::sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::sapply_passives_heal_receive(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->sapply_passives_heal_receive(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::sapply_passives_heal_deal(Ref<SpellHealInfo> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
for (int i = 0; i < _s_auras->size(); ++i) {
|
||||
Ref<AuraData> ad = _s_auras->get(i);
|
||||
|
||||
ad->get_aura()->sapply_passives_heal_deal(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::son_cast_finished(Ref<SpellCastInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
@ -2234,11 +2333,16 @@ void Entity::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("starget_changed", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
ADD_SIGNAL(MethodInfo("ctarget_changed", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("son_damage_taken", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
ADD_SIGNAL(MethodInfo("con_damage_taken", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
ADD_SIGNAL(MethodInfo("son_damage_received", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
ADD_SIGNAL(MethodInfo("con_damage_received", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("con_damage_dealt", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("son_heal_received", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
ADD_SIGNAL(MethodInfo("con_heal_received", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("con_heal_dealt", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "damage_pipeline_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("scharacter_class_changed", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
ADD_SIGNAL(MethodInfo("ccharacter_class_changed", PropertyInfo(Variant::OBJECT, "Entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
@ -2276,6 +2380,11 @@ void Entity::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("son_dealt_damage", "data"), &Entity::son_dealt_damage);
|
||||
ClassDB::bind_method(D_METHOD("son_damage_dealt", "data"), &Entity::son_damage_dealt);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_before_heal", "data"), &Entity::son_before_damage);
|
||||
ClassDB::bind_method(D_METHOD("son_heal_receive", "data"), &Entity::son_damage_receive);
|
||||
ClassDB::bind_method(D_METHOD("son_dealt_heal", "data"), &Entity::son_dealt_damage);
|
||||
ClassDB::bind_method(D_METHOD("son_heal_dealt", "data"), &Entity::son_damage_dealt);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_before_cast", "info"), &Entity::son_before_cast);
|
||||
ClassDB::bind_method(D_METHOD("son_before_cast_target", "info"), &Entity::son_before_cast_target);
|
||||
ClassDB::bind_method(D_METHOD("son_cast_finished_target", "info"), &Entity::son_cast_finished_target);
|
||||
|
@ -30,6 +30,7 @@ class CharacterClass;
|
||||
class AuraData;
|
||||
class Spell;
|
||||
class SpellDamageInfo;
|
||||
class SpellHealInfo;
|
||||
class SpellCastInfo;
|
||||
class EntityCreateInfo;
|
||||
|
||||
@ -202,6 +203,7 @@ public:
|
||||
_FORCE_INLINE_ Ref<Stat> get_melee_damage_reduction() { return _melee_damage_reduction; }
|
||||
_FORCE_INLINE_ Ref<Stat> get_spell_damage_reduction() { return _spell_damage_reduction; }
|
||||
_FORCE_INLINE_ Ref<Stat> get_damage_taken() { return _damage_taken; }
|
||||
_FORCE_INLINE_ Ref<Stat> get_heal_taken() { return _heal_taken; }
|
||||
_FORCE_INLINE_ Ref<Stat> get_melee_damage() { return _melee_damage; }
|
||||
_FORCE_INLINE_ Ref<Stat> get_spell_damage() { return _spell_damage; }
|
||||
|
||||
@ -225,6 +227,11 @@ public:
|
||||
void son_dealt_damage(Ref<SpellDamageInfo> data);
|
||||
void son_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
|
||||
void son_before_heal(Ref<SpellHealInfo> data);
|
||||
void son_heal_receive(Ref<SpellHealInfo> data);
|
||||
void son_dealt_heal(Ref<SpellHealInfo> data);
|
||||
void son_heal_dealt(Ref<SpellHealInfo> data);
|
||||
|
||||
void son_before_cast(Ref<SpellCastInfo> info);
|
||||
void son_before_cast_target(Ref<SpellCastInfo> info);
|
||||
void son_cast_finished_target(Ref<SpellCastInfo> info);
|
||||
@ -243,6 +250,9 @@ public:
|
||||
void sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
void sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
|
||||
void sapply_passives_heal_receive(Ref<SpellHealInfo> data);
|
||||
void sapply_passives_heal_deal(Ref<SpellHealInfo> data);
|
||||
|
||||
//Spell operations
|
||||
void scast_spell(int spell_id);
|
||||
void crequest_spell_cast(int spell_id);
|
||||
@ -251,6 +261,10 @@ public:
|
||||
void stake_damage(Ref<SpellDamageInfo> data);
|
||||
void sdeal_damage_to(Ref<SpellDamageInfo> data);
|
||||
|
||||
//Heal Operations
|
||||
void stake_heal(Ref<SpellHealInfo> data);
|
||||
void sdeal_heal_to(Ref<SpellHealInfo> data);
|
||||
|
||||
//Aura Manipulation
|
||||
void sadd_aura(Ref<AuraData> aura);
|
||||
void sremove_aura(Ref<AuraData> aura);
|
||||
@ -276,17 +290,19 @@ public:
|
||||
//Update
|
||||
void update_auras(float delta);
|
||||
|
||||
//Clientside hooks
|
||||
void creceive_damage_taken(Ref<SpellDamageInfo> data);
|
||||
void creceiveon_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
void creceive_heal_taken(Ref<SpellHealInfo> data);
|
||||
void creceiveon_heal_dealt(Ref<SpellHealInfo> data);
|
||||
|
||||
//Old, hook loading update when needed
|
||||
void setup_on_player_moves(Entity *bopmccc, Vector<int> *sspells); //load -> remove, just store spellIds
|
||||
|
||||
//Old stuff, remove or update
|
||||
void take_heal(int heal, bool crit, Entity *dealer);
|
||||
void die();
|
||||
void resurrect();
|
||||
void creceive_resurrect();
|
||||
void creceive_damage_taken(Ref<SpellDamageInfo> data);
|
||||
void creceiveon_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
void creceive_heal_taken(int heal, bool crit, Entity *dealer);
|
||||
void creceive_died();
|
||||
void creceive_mana_changed(int amount);
|
||||
void trigger_global_cooldown();
|
||||
@ -468,6 +484,7 @@ private:
|
||||
Ref<Stat> _melee_damage_reduction;
|
||||
Ref<Stat> _spell_damage_reduction;
|
||||
Ref<Stat> _damage_taken;
|
||||
Ref<Stat> _heal_taken;
|
||||
Ref<Stat> _melee_damage;
|
||||
Ref<Stat> _spell_damage;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "stat.h"
|
||||
|
||||
const String Stat::STAT_BINDING_STRING = "Health, Speed, Mana, GCD, Haste, Agility, Strength, Stamina, Intellect, Luck, Haste Rating, Resilience, Armor, Attack Power, Spell Power, Melee Crit, Melee Crit bonus, Spell Crit, Spell Crit Bonus, Block, Parry, Damage Reduction, Melee Damage Reduction, Spell Damage Reduction, Damage Taken, Melee Damage, Spell Damage, Holy Resist, Shadow Resist, Nature Resist, Fire Resist, Frost Resist, Lightning Resist, Chaos Resist, Silence Resist, Fear Resist, None";
|
||||
const String Stat::STAT_BINDING_STRING = "Health, Speed, Mana, GCD, Haste, Agility, Strength, Stamina, Intellect, Luck, Haste Rating, Resilience, Armor, Attack Power, Spell Power, Melee Crit, Melee Crit bonus, Spell Crit, Spell Crit Bonus, Block, Parry, Damage Reduction, Melee Damage Reduction, Spell Damage Reduction, Damage Taken, Heal Taken, Melee Damage, Spell Damage, Holy Resist, Shadow Resist, Nature Resist, Fire Resist, Frost Resist, Lightning Resist, Chaos Resist, Silence Resist, Fear Resist, None";
|
||||
|
||||
const String Stat::MODIFIER_APPLY_TYPE_BINDING_STRING = "Standard, Only min modifier, Only Max modifier";
|
||||
|
||||
|
@ -84,20 +84,21 @@ public:
|
||||
STAT_ID_MELEE_DAMAGE_REDUCTION = 22,
|
||||
STAT_ID_SPELL_DAMAGE_REDUCTION = 23,
|
||||
STAT_ID_DAMAGE_TAKEN = 24,
|
||||
STAT_ID_MELEE_DAMAGE = 25,
|
||||
STAT_ID_SPELL_DAMAGE = 26,
|
||||
STAT_ID_HEAL_TAKEN = 25,
|
||||
STAT_ID_MELEE_DAMAGE = 26,
|
||||
STAT_ID_SPELL_DAMAGE = 27,
|
||||
|
||||
STAT_ID_HOLY_RESIST = 27,
|
||||
STAT_ID_SHADOW_RESIST = 28,
|
||||
STAT_ID_NATURE_RESIST = 29,
|
||||
STAT_ID_FIRE_RESIST = 30,
|
||||
STAT_ID_FROST_RESIST = 31,
|
||||
STAT_ID_LIGHTNING_RESIST = 32,
|
||||
STAT_ID_CHAOS_RESIST = 33,
|
||||
STAT_ID_SILENCE_RESIST = 34,
|
||||
STAT_ID_FEAR_RESIST = 35,
|
||||
STAT_ID_HOLY_RESIST = 28,
|
||||
STAT_ID_SHADOW_RESIST = 29,
|
||||
STAT_ID_NATURE_RESIST = 30,
|
||||
STAT_ID_FIRE_RESIST = 31,
|
||||
STAT_ID_FROST_RESIST = 32,
|
||||
STAT_ID_LIGHTNING_RESIST = 33,
|
||||
STAT_ID_CHAOS_RESIST = 34,
|
||||
STAT_ID_SILENCE_RESIST = 35,
|
||||
STAT_ID_FEAR_RESIST = 36,
|
||||
|
||||
STAT_ID_TOTAL_STATS = 36,
|
||||
STAT_ID_TOTAL_STATS = 37,
|
||||
STAT_ID_NONE = STAT_ID_TOTAL_STATS,
|
||||
};
|
||||
|
||||
|
@ -20,6 +20,14 @@ void SpellDamageInfo::set_crit(bool value) {
|
||||
_crit = value;
|
||||
}
|
||||
|
||||
int SpellDamageInfo::get_amount_absorbed() {
|
||||
return _amount_absorbed;
|
||||
}
|
||||
|
||||
void SpellDamageInfo::set_amount_absorbed(int value) {
|
||||
_amount_absorbed = value;
|
||||
}
|
||||
|
||||
SpellEnums::SpellType SpellDamageInfo::get_spell_type() {
|
||||
return _spell_type;
|
||||
}
|
||||
@ -143,6 +151,10 @@ void SpellDamageInfo::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_crit"), &SpellDamageInfo::get_crit);
|
||||
ClassDB::bind_method(D_METHOD("set_crit", "value"), &SpellDamageInfo::set_crit);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "crit"), "set_crit", "get_crit");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_amount_absorbed"), &SpellDamageInfo::get_amount_absorbed);
|
||||
ClassDB::bind_method(D_METHOD("set_amount_absorbed", "value"), &SpellDamageInfo::set_amount_absorbed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount_absorbed"), "set_amount_absorbed", "get_amount_absorbed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_spell_type"), &SpellDamageInfo::get_spell_type);
|
||||
ClassDB::bind_method(D_METHOD("set_spell_type", "value"), &SpellDamageInfo::set_spell_type);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef DAMAGE_PIPELINE_DATA_H
|
||||
#define DAMAGE_PIPELINE_DATA_H
|
||||
#ifndef SPELL_DAMAGE_INFO_H
|
||||
#define SPELL_DAMAGE_INFO_H
|
||||
|
||||
#include "../spell_enums.h"
|
||||
#include "core/reference.h"
|
||||
@ -19,17 +19,6 @@ public:
|
||||
DAMAGE_SOURCE_AURA,
|
||||
};
|
||||
|
||||
private:
|
||||
int _damage;
|
||||
int _original_damage;
|
||||
bool _crit;
|
||||
SpellEnums::SpellType _spell_type;
|
||||
Entity *_dealer;
|
||||
Entity *_receiver;
|
||||
DamageSource _damage_source_type;
|
||||
Ref<Reference> _damage_source;
|
||||
int _damage_source_id;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
@ -40,6 +29,9 @@ public:
|
||||
bool get_crit();
|
||||
void set_crit(bool value);
|
||||
|
||||
int get_amount_absorbed();
|
||||
void set_amount_absorbed(int value);
|
||||
|
||||
SpellEnums::SpellType get_spell_type();
|
||||
void set_spell_type(SpellEnums::SpellType value);
|
||||
|
||||
@ -68,6 +60,18 @@ public:
|
||||
|
||||
SpellDamageInfo();
|
||||
~SpellDamageInfo();
|
||||
|
||||
private:
|
||||
int _damage;
|
||||
int _original_damage;
|
||||
int _amount_absorbed;
|
||||
bool _crit;
|
||||
SpellEnums::SpellType _spell_type;
|
||||
Entity *_dealer;
|
||||
Entity *_receiver;
|
||||
DamageSource _damage_source_type;
|
||||
Ref<Reference> _damage_source;
|
||||
int _damage_source_id;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(SpellDamageInfo::DamageSource);
|
||||
|
184
pipelines/spell_heal_info.cpp
Normal file
184
pipelines/spell_heal_info.cpp
Normal file
@ -0,0 +1,184 @@
|
||||
#include "spell_heal_info.h"
|
||||
|
||||
#include "../data/aura.h"
|
||||
#include "../data/spell.h"
|
||||
#include "../entities/entity.h"
|
||||
|
||||
int SpellHealInfo::get_heal() {
|
||||
return _heal;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_heal(int value) {
|
||||
_heal = value;
|
||||
}
|
||||
|
||||
bool SpellHealInfo::get_crit() {
|
||||
return _crit;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_crit(bool value) {
|
||||
_crit = value;
|
||||
}
|
||||
|
||||
int SpellHealInfo::get_amount_absorbed() {
|
||||
return _amount_absorbed;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_amount_absorbed(int value) {
|
||||
_amount_absorbed = value;
|
||||
}
|
||||
|
||||
SpellEnums::SpellType SpellHealInfo::get_spell_type() {
|
||||
return _spell_type;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_spell_type(SpellEnums::SpellType value) {
|
||||
_spell_type = value;
|
||||
}
|
||||
|
||||
Entity *SpellHealInfo::get_dealer() {
|
||||
return _dealer;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_dealer(Node *value) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity *e = cast_to<Entity>(value);
|
||||
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
_dealer = e;
|
||||
}
|
||||
|
||||
Entity *SpellHealInfo::get_receiver() {
|
||||
return _receiver;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_receiver(Node *value) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity *e = cast_to<Entity>(value);
|
||||
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
_receiver = e;
|
||||
}
|
||||
|
||||
Ref<Reference> SpellHealInfo::get_heal_source() {
|
||||
return _heal_source;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_heal_source(Ref<Reference> value) {
|
||||
_heal_source_type = HEAL_SOURCE_UNKNOWN;
|
||||
_heal_source = value;
|
||||
}
|
||||
|
||||
Ref<Spell> SpellHealInfo::get_spell_heal_source() {
|
||||
//cast
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_spell_heal_source(Ref<Spell> value) {
|
||||
_heal_source_type = HEAL_SOURCE_SPELL;
|
||||
_heal_source = value;
|
||||
}
|
||||
|
||||
Ref<Aura> SpellHealInfo::get_aura_heal_source() {
|
||||
//cast
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_aura_heal_source(Ref<Aura> value) {
|
||||
_heal_source_type = HEAL_SOURCE_AURA;
|
||||
_heal_source = value;
|
||||
}
|
||||
|
||||
int SpellHealInfo::get_heal_source_id() {
|
||||
return _heal_source_id;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_heal_source_id(int value) {
|
||||
_heal_source_id = value;
|
||||
}
|
||||
|
||||
SpellHealInfo::HealSource SpellHealInfo::get_heal_source_type() {
|
||||
return _heal_source_type;
|
||||
}
|
||||
|
||||
void SpellHealInfo::set_heal_source_type(HealSource value) {
|
||||
_heal_source_type = value;
|
||||
}
|
||||
|
||||
void SpellHealInfo::reset() {
|
||||
_original_heal = -1;
|
||||
}
|
||||
|
||||
SpellHealInfo::SpellHealInfo() {
|
||||
_heal = 0;
|
||||
_original_heal = 0;
|
||||
_crit = false;
|
||||
_spell_type = SpellEnums::SPELL_TYPE_NONE;
|
||||
_dealer = NULL;
|
||||
_receiver = NULL;
|
||||
_heal_source_type = HEAL_SOURCE_UNKNOWN;
|
||||
//Ref<Reference> _heal_source = Ref<;
|
||||
_heal_source_id = 0;
|
||||
}
|
||||
|
||||
SpellHealInfo::~SpellHealInfo() {
|
||||
//_dealer = NULL;
|
||||
//_receiver = NULL;
|
||||
//_heal_source = Ref<Reference>(NULL);
|
||||
}
|
||||
|
||||
void SpellHealInfo::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_heal"), &SpellHealInfo::get_heal);
|
||||
ClassDB::bind_method(D_METHOD("set_heal", "value"), &SpellHealInfo::set_heal);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "heal"), "set_heal", "get_heal");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_crit"), &SpellHealInfo::get_crit);
|
||||
ClassDB::bind_method(D_METHOD("set_crit", "value"), &SpellHealInfo::set_crit);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "crit"), "set_crit", "get_crit");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_amount_absorbed"), &SpellHealInfo::get_amount_absorbed);
|
||||
ClassDB::bind_method(D_METHOD("set_amount_absorbed", "value"), &SpellHealInfo::set_amount_absorbed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount_absorbed"), "set_amount_absorbed", "get_amount_absorbed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_spell_type"), &SpellHealInfo::get_spell_type);
|
||||
ClassDB::bind_method(D_METHOD("set_spell_type", "value"), &SpellHealInfo::set_spell_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_type", PROPERTY_HINT_ENUM, "None, Melee, Magic"), "set_spell_type", "get_spell_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dealer"), &SpellHealInfo::get_dealer);
|
||||
ClassDB::bind_method(D_METHOD("set_dealer", "value"), &SpellHealInfo::set_dealer);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "dealer", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), "set_dealer", "get_dealer");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_receiver"), &SpellHealInfo::get_receiver);
|
||||
ClassDB::bind_method(D_METHOD("set_receiver", "value"), &SpellHealInfo::set_receiver);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "receiver", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), "set_receiver", "get_receiver");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_heal_source"), &SpellHealInfo::get_heal_source);
|
||||
ClassDB::bind_method(D_METHOD("set_heal_source", "value"), &SpellHealInfo::set_heal_source);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "heal_source", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), "set_heal_source", "get_heal_source");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_heal_source_id"), &SpellHealInfo::get_heal_source_id);
|
||||
ClassDB::bind_method(D_METHOD("set_heal_source_id", "value"), &SpellHealInfo::set_heal_source_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "heal_source_id"), "set_heal_source_id", "get_heal_source_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_heal_source_type"), &SpellHealInfo::get_heal_source_type);
|
||||
ClassDB::bind_method(D_METHOD("set_heal_source_type", "value"), &SpellHealInfo::set_heal_source_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "heal_source_type", PROPERTY_HINT_ENUM, "Unknown, Spell, Aura"), "set_heal_source_type", "get_heal_source_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("reset"), &SpellHealInfo::reset);
|
||||
|
||||
BIND_ENUM_CONSTANT(HEAL_SOURCE_UNKNOWN);
|
||||
BIND_ENUM_CONSTANT(HEAL_SOURCE_SPELL);
|
||||
BIND_ENUM_CONSTANT(HEAL_SOURCE_AURA);
|
||||
}
|
79
pipelines/spell_heal_info.h
Normal file
79
pipelines/spell_heal_info.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef SPELL_HEAL_INFO_H
|
||||
#define SPELL_HEAL_INFO_H
|
||||
|
||||
#include "../spell_enums.h"
|
||||
#include "core/reference.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class Entity;
|
||||
class Spell;
|
||||
class Aura;
|
||||
|
||||
class SpellHealInfo : public Reference {
|
||||
GDCLASS(SpellHealInfo, Reference);
|
||||
|
||||
public:
|
||||
enum HealSource {
|
||||
HEAL_SOURCE_UNKNOWN,
|
||||
HEAL_SOURCE_SPELL,
|
||||
HEAL_SOURCE_AURA,
|
||||
};
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
int get_heal();
|
||||
void set_heal(int value);
|
||||
|
||||
bool get_crit();
|
||||
void set_crit(bool value);
|
||||
|
||||
int get_amount_absorbed();
|
||||
void set_amount_absorbed(int value);
|
||||
|
||||
SpellEnums::SpellType get_spell_type();
|
||||
void set_spell_type(SpellEnums::SpellType value);
|
||||
|
||||
Entity *get_dealer();
|
||||
void set_dealer(Node *value);
|
||||
|
||||
Entity *get_receiver();
|
||||
void set_receiver(Node *value);
|
||||
|
||||
Ref<Reference> get_heal_source();
|
||||
void set_heal_source(Ref<Reference> value);
|
||||
|
||||
Ref<Spell> get_spell_heal_source();
|
||||
void set_spell_heal_source(Ref<Spell> value);
|
||||
|
||||
Ref<Aura> get_aura_heal_source();
|
||||
void set_aura_heal_source(Ref<Aura> value);
|
||||
|
||||
int get_heal_source_id();
|
||||
void set_heal_source_id(int value);
|
||||
|
||||
HealSource get_heal_source_type();
|
||||
void set_heal_source_type(HealSource value);
|
||||
|
||||
void reset();
|
||||
|
||||
SpellHealInfo();
|
||||
~SpellHealInfo();
|
||||
|
||||
private:
|
||||
int _heal;
|
||||
int _original_heal;
|
||||
int _amount_absorbed;
|
||||
bool _crit;
|
||||
SpellEnums::SpellType _spell_type;
|
||||
Entity *_dealer;
|
||||
Entity *_receiver;
|
||||
HealSource _heal_source_type;
|
||||
Ref<Reference> _heal_source;
|
||||
int _heal_source_id;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(SpellHealInfo::HealSource);
|
||||
|
||||
#endif
|
@ -35,6 +35,7 @@
|
||||
#include "data/spell_visual_effect.h"
|
||||
|
||||
#include "pipelines/spell_damage_info.h"
|
||||
#include "pipelines/spell_heal_info.h"
|
||||
|
||||
#include "entities/auras/aura_data.h"
|
||||
#include "entities/entity.h"
|
||||
@ -92,6 +93,7 @@ void register_entity_spell_system_types() {
|
||||
|
||||
|
||||
ClassDB::register_class<SpellDamageInfo>();
|
||||
ClassDB::register_class<SpellHealInfo>();
|
||||
ClassDB::register_class<AuraData>();
|
||||
|
||||
ClassDB::register_class<AuraTriggerData>();
|
||||
|
Loading…
Reference in New Issue
Block a user