diff --git a/SCsub b/SCsub index 5f516f5..5ae1176 100644 --- a/SCsub +++ b/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") diff --git a/data/aura.cpp b/data/aura.cpp index e361eae..0d0b667 100644 --- a/data/aura.cpp +++ b/data/aura.cpp @@ -321,6 +321,14 @@ void Aura::son_cast_finished_target(Ref info) { call("_son_cast_finished_target", info); } +void Aura::son_hit(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_hit")) + call("_son_hit", data); +} + + void Aura::son_before_damage(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -335,11 +343,11 @@ void Aura::son_damage_receive(Ref data) { call("_son_damage_receive", data); } -void Aura::son_hit(Ref data) { +void Aura::son_dealt_damage(Ref 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 data) { @@ -349,6 +357,35 @@ void Aura::son_damage_dealt(Ref data) { call("_son_damage_dealt", data); } + +void Aura::son_before_heal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_before_heal")) + call("_son_before_heal", data); +} + +void Aura::son_heal_receive(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_heal_receive")) + call("_son_heal_receive", data); +} + +void Aura::son_dealt_heal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_dealt_heal")) + call("_son_dealt_heal", data); +} + +void Aura::son_heal_dealt(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_heal_dealt")) + call("_son_heal_dealt", data); +} + void Aura::son_remove_expired(Ref aura) { ERR_FAIL_COND(!aura.is_valid()); @@ -405,6 +442,22 @@ void Aura::con_refresh(Ref data) { call("_con_refresh", data); } +void Aura::setup_aura_data(Ref data, Ref info) { + ERR_FAIL_COND(!data.is_valid() || !info.is_valid()); + + //always exists + call("setup_aura_data", data, info); +} + +void Aura::_setup_aura_data(Ref data, Ref info) { + data->set_aura(Ref(this)); + data->set_caster(info->get_caster()); + + if (is_damage_enabled()) { + calculate_initial_damage(data, info); + } +} + void Aura::sapply_passives_damage_receive(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -419,13 +472,6 @@ void Aura::sapply_passives_damage_deal(Ref data) { call("_sapply_passives_damage_deal", data); } -void Aura::setup_aura_data(Ref data, Ref info) { - ERR_FAIL_COND(!data.is_valid() || !info.is_valid()); - - //always exists - call("setup_aura_data", data, info); -} - void Aura::calculate_initial_damage(Ref aura_data, Ref info) { ERR_FAIL_COND(!aura_data.is_valid() || !info.is_valid()); @@ -440,6 +486,73 @@ void Aura::handle_aura_damage(Ref aura_data, Ref data call("_handle_aura_damage", aura_data, data); } + +void Aura::_sapply_passives_damage_receive(Ref data) { + +} + +void Aura::_sapply_passives_damage_deal(Ref data) { + +} + +void Aura::_calculate_initial_damage(Ref aura_data, Ref info) { + aura_data->set_damage(info->get_aura()->get_damage_min()); +} + +void Aura::_handle_aura_damage(Ref aura_data, Ref data) { + data->set_damage(aura_data->get_damage()); + + data->get_dealer()->sdeal_damage_to(data); +} + +void Aura::sapply_passives_heal_receive(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + //always exists + call("_sapply_passives_heal_receive", data); +} + +void Aura::sapply_passives_heal_deal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + //always exists + call("_sapply_passives_heal_deal", data); +} + +void Aura::_sapply_passives_heal_receive(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + //always exists + call("_sapply_passives_heal_receive", data); +} + +void Aura::_sapply_passives_heal_deal(Ref data) { +} + +void Aura::calculate_initial_heal(Ref aura_data, Ref 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 aura_data, Ref 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 aura_data, Ref info) { + aura_data->set_damage(info->get_aura()->get_damage_min()); +} + +void Aura::_handle_aura_heal(Ref aura_data, Ref data) { + data->set_heal(aura_data->get_heal()); + + data->get_dealer()->sdeal_heal_to(data); +} + void Aura::_sapply(Ref info) { Ref aura = info->get_aura(); @@ -486,24 +599,6 @@ void Aura::_supdate(Ref aura, float delta) { } } -void Aura::_setup_aura_data(Ref data, Ref info) { - data->set_aura(Ref(this)); - data->set_caster(info->get_caster()); - - if (is_damage_enabled()) { - calculate_initial_damage(data, info); - } -} - -void Aura::_calculate_initial_damage(Ref aura_data, Ref info) { - aura_data->set_damage(info->get_aura()->get_damage_min()); -} - -void Aura::_handle_aura_damage(Ref aura_data, Ref 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); diff --git a/data/aura.h b/data/aura.h index a9c6ea1..84f14c4 100644 --- a/data/aura.h +++ b/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 info); void son_cast_finished_target(Ref info); + void son_hit(Ref data); + void son_before_damage(Ref data); void son_damage_receive(Ref data); - void son_hit(Ref data); + void son_dealt_damage(Ref data); void son_damage_dealt(Ref data); + void son_before_heal(Ref data); + void son_heal_receive(Ref data); + void son_dealt_heal(Ref data); + void son_heal_dealt(Ref data); + void son_remove(Ref aura); void son_remove_expired(Ref aura); void son_remove_dispell(Ref aura); @@ -296,15 +304,30 @@ public: void con_refresh(Ref data); //Calculations / Queries + void setup_aura_data(Ref data, Ref info); + + virtual void _setup_aura_data(Ref data, Ref info); + void sapply_passives_damage_receive(Ref data); void sapply_passives_damage_deal(Ref data); - void setup_aura_data(Ref data, Ref info); void calculate_initial_damage(Ref aura_data, Ref info); void handle_aura_damage(Ref aura_data, Ref data); + virtual void _sapply_passives_damage_receive(Ref data); + virtual void _sapply_passives_damage_deal(Ref data); virtual void _calculate_initial_damage(Ref aura_data, Ref info); virtual void _handle_aura_damage(Ref aura_data, Ref data); - virtual void _setup_aura_data(Ref data, Ref info); + + void sapply_passives_heal_receive(Ref data); + void sapply_passives_heal_deal(Ref data); + void calculate_initial_heal(Ref aura_data, Ref info); + void handle_aura_heal(Ref aura_data, Ref data); + + virtual void _sapply_passives_heal_receive(Ref data); + virtual void _sapply_passives_heal_deal(Ref data); + virtual void _calculate_initial_heal(Ref aura_data, Ref info); + virtual void _handle_aura_heal(Ref aura_data, Ref data); + Aura(); ~Aura(); diff --git a/entities/entity.cpp b/entities/entity.cpp index 028e6d5..3bc32eb 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -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(get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE_REDUCTION)); _spell_damage_reduction = Ref(get_stat_enum(Stat::STAT_ID_SPELL_DAMAGE_REDUCTION)); _damage_taken = Ref(get_stat_enum(Stat::STAT_ID_DAMAGE_TAKEN)); + _heal_taken = Ref(get_stat_enum(Stat::STAT_ID_HEAL_TAKEN)); _melee_damage = Ref(get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE)); _spell_damage = Ref(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 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 data) { - ERR_FAIL_COND(!data.is_valid()); - - //serverside - for (int i = 0; i < _s_auras->size(); ++i) { - Ref ad = _s_auras->get(i); - - ad->get_aura()->son_damage_dealt(data); - } -} - void Entity::sdeal_damage_to(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -502,19 +494,50 @@ void Entity::sdeal_damage_to(Ref data) { son_damage_dealt(data); } -void Entity::take_heal(int heal, bool crit, Entity *dealer) { - /* - if (sIsDead) { +void Entity::stake_heal(Ref 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 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 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 data) { @@ -571,14 +594,18 @@ void Entity::creceiveon_damage_dealt(Ref 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 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 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 data) { void Entity::son_dealt_damage(Ref data) { ERR_FAIL_COND(!data.is_valid()); + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->son_dealt_damage(data); + } +} + +void Entity::son_damage_dealt(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + //serverside for (int i = 0; i < _s_auras->size(); ++i) { Ref ad = _s_auras->get(i); @@ -740,6 +778,47 @@ void Entity::son_dealt_damage(Ref data) { } } +void Entity::son_before_heal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->son_before_heal(data); + } +} + +void Entity::son_heal_receive(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->son_heal_receive(data); + } +} + +void Entity::son_dealt_heal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->son_dealt_heal(data); + } +} + +void Entity::son_heal_dealt(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + //serverside + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->son_heal_dealt(data); + } +} + void Entity::sapply_passives_damage_receive(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -760,6 +839,26 @@ void Entity::sapply_passives_damage_deal(Ref data) { } } +void Entity::sapply_passives_heal_receive(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->sapply_passives_heal_receive(data); + } +} + +void Entity::sapply_passives_heal_deal(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + for (int i = 0; i < _s_auras->size(); ++i) { + Ref ad = _s_auras->get(i); + + ad->get_aura()->sapply_passives_heal_deal(data); + } +} + void Entity::son_cast_finished(Ref 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); diff --git a/entities/entity.h b/entities/entity.h index 9e52528..00fc62b 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -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 get_melee_damage_reduction() { return _melee_damage_reduction; } _FORCE_INLINE_ Ref get_spell_damage_reduction() { return _spell_damage_reduction; } _FORCE_INLINE_ Ref get_damage_taken() { return _damage_taken; } + _FORCE_INLINE_ Ref get_heal_taken() { return _heal_taken; } _FORCE_INLINE_ Ref get_melee_damage() { return _melee_damage; } _FORCE_INLINE_ Ref get_spell_damage() { return _spell_damage; } @@ -225,6 +227,11 @@ public: void son_dealt_damage(Ref data); void son_damage_dealt(Ref data); + void son_before_heal(Ref data); + void son_heal_receive(Ref data); + void son_dealt_heal(Ref data); + void son_heal_dealt(Ref data); + void son_before_cast(Ref info); void son_before_cast_target(Ref info); void son_cast_finished_target(Ref info); @@ -243,6 +250,9 @@ public: void sapply_passives_damage_receive(Ref data); void sapply_passives_damage_deal(Ref data); + void sapply_passives_heal_receive(Ref data); + void sapply_passives_heal_deal(Ref 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 data); void sdeal_damage_to(Ref data); + //Heal Operations + void stake_heal(Ref data); + void sdeal_heal_to(Ref data); + //Aura Manipulation void sadd_aura(Ref aura); void sremove_aura(Ref aura); @@ -276,17 +290,19 @@ public: //Update void update_auras(float delta); + //Clientside hooks + void creceive_damage_taken(Ref data); + void creceiveon_damage_dealt(Ref data); + void creceive_heal_taken(Ref data); + void creceiveon_heal_dealt(Ref data); + //Old, hook loading update when needed void setup_on_player_moves(Entity *bopmccc, Vector *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 data); - void creceiveon_damage_dealt(Ref 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 _melee_damage_reduction; Ref _spell_damage_reduction; Ref _damage_taken; + Ref _heal_taken; Ref _melee_damage; Ref _spell_damage; diff --git a/entities/stats/stat.cpp b/entities/stats/stat.cpp index 4b60069..a00eecb 100644 --- a/entities/stats/stat.cpp +++ b/entities/stats/stat.cpp @@ -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"; diff --git a/entities/stats/stat.h b/entities/stats/stat.h index 1077e05..55a7753 100644 --- a/entities/stats/stat.h +++ b/entities/stats/stat.h @@ -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, }; diff --git a/pipelines/spell_damage_info.cpp b/pipelines/spell_damage_info.cpp index 4590424..7a19617 100644 --- a/pipelines/spell_damage_info.cpp +++ b/pipelines/spell_damage_info.cpp @@ -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); diff --git a/pipelines/spell_damage_info.h b/pipelines/spell_damage_info.h index 5875a27..083cbac 100644 --- a/pipelines/spell_damage_info.h +++ b/pipelines/spell_damage_info.h @@ -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 _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 _damage_source; + int _damage_source_id; }; VARIANT_ENUM_CAST(SpellDamageInfo::DamageSource); diff --git a/pipelines/spell_heal_info.cpp b/pipelines/spell_heal_info.cpp new file mode 100644 index 0000000..8e41320 --- /dev/null +++ b/pipelines/spell_heal_info.cpp @@ -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(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(value); + + if (!e) { + return; + } + + _receiver = e; +} + +Ref SpellHealInfo::get_heal_source() { + return _heal_source; +} + +void SpellHealInfo::set_heal_source(Ref value) { + _heal_source_type = HEAL_SOURCE_UNKNOWN; + _heal_source = value; +} + +Ref SpellHealInfo::get_spell_heal_source() { + //cast + return NULL; +} + +void SpellHealInfo::set_spell_heal_source(Ref value) { + _heal_source_type = HEAL_SOURCE_SPELL; + _heal_source = value; +} + +Ref SpellHealInfo::get_aura_heal_source() { + //cast + return NULL; +} + +void SpellHealInfo::set_aura_heal_source(Ref 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 _heal_source = Ref<; + _heal_source_id = 0; +} + +SpellHealInfo::~SpellHealInfo() { + //_dealer = NULL; + //_receiver = NULL; + //_heal_source = Ref(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); +} diff --git a/pipelines/spell_heal_info.h b/pipelines/spell_heal_info.h new file mode 100644 index 0000000..547e6d1 --- /dev/null +++ b/pipelines/spell_heal_info.h @@ -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 get_heal_source(); + void set_heal_source(Ref value); + + Ref get_spell_heal_source(); + void set_spell_heal_source(Ref value); + + Ref get_aura_heal_source(); + void set_aura_heal_source(Ref 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 _heal_source; + int _heal_source_id; +}; + +VARIANT_ENUM_CAST(SpellHealInfo::HealSource); + +#endif diff --git a/register_types.cpp b/register_types.cpp index 6347a65..be7bd97 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -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(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class();