From 008bf34a341d6abac6a1d25bf627b09d6a65e220 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 11 Sep 2019 11:01:30 +0200 Subject: [PATCH] Added 2 more events. --- data/aura.cpp | 29 +++++++++++- data/aura.h | 5 ++- entities/data/entity_data.cpp | 24 +++++++++- entities/data/entity_data.h | 2 + entities/entity.cpp | 78 +++++++++++++++++++++++++++++++-- entities/entity.h | 12 +++-- pipelines/spell_damage_info.cpp | 20 +++++---- pipelines/spell_damage_info.h | 4 ++ pipelines/spell_heal_info.cpp | 11 +++++ pipelines/spell_heal_info.h | 3 ++ 10 files changed, 166 insertions(+), 22 deletions(-) diff --git a/data/aura.cpp b/data/aura.cpp index 6a48e89..1dbac10 100644 --- a/data/aura.cpp +++ b/data/aura.cpp @@ -501,6 +501,14 @@ void Aura::son_cast_finished_target(Ref aura, Ref info) call("_son_cast_finished_target", aura, info); } +void Aura::son_before_damage_hit(Ref aura, Ref data) { + ERR_FAIL_COND(!aura.is_valid()); + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_before_damage_hit")) + call("_son_before_damage_hit", aura, data); +} + void Aura::son_hit(Ref aura, Ref data) { ERR_FAIL_COND(!aura.is_valid()); ERR_FAIL_COND(!data.is_valid()); @@ -541,6 +549,14 @@ void Aura::son_damage_dealt(Ref aura, Ref data) { call("_son_damage_dealt", aura, data); } +void Aura::son_before_heal_hit(Ref aura, Ref data) { + ERR_FAIL_COND(!aura.is_valid()); + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_before_heal_hit")) + call("_son_before_heal_hit", aura, data); +} + void Aura::son_before_heal(Ref aura, Ref data) { ERR_FAIL_COND(!aura.is_valid()); ERR_FAIL_COND(!data.is_valid()); @@ -644,6 +660,13 @@ void Aura::son_gcd_finished(Ref data) { call("_son_gcd_finished", data); } +void Aura::son_physics_process(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_gcd_finished")) + call("_son_gcd_finished", data); +} + void Aura::con_cast_failed(Ref data, Ref info) { if (has_method("_con_cast_failed")) call("_con_cast_failed", data, info); @@ -1013,13 +1036,14 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_finished", "aura", "info"), &Aura::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_finished_target", "aura", "info"), &Aura::son_cast_finished_target); + ClassDB::bind_method(D_METHOD("son_before_damage_hit", "aura", "data"), &Aura::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "aura", "data"), &Aura::son_hit); - ClassDB::bind_method(D_METHOD("son_before_damage", "aura", "data"), &Aura::son_before_damage); ClassDB::bind_method(D_METHOD("son_damage_receive", "aura", "data"), &Aura::son_damage_receive); ClassDB::bind_method(D_METHOD("son_dealt_damage", "aura", "data"), &Aura::son_dealt_damage); ClassDB::bind_method(D_METHOD("son_damage_dealt", "aura", "data"), &Aura::son_damage_dealt); + ClassDB::bind_method(D_METHOD("son_before_heal_hit", "aura", "data"), &Aura::son_before_heal_hit); ClassDB::bind_method(D_METHOD("son_before_heal", "aura", "data"), &Aura::son_before_heal); ClassDB::bind_method(D_METHOD("son_heal_receive", "aura", "data"), &Aura::son_heal_receive); ClassDB::bind_method(D_METHOD("son_dealt_heal", "aura", "data"), &Aura::son_dealt_heal); @@ -1050,13 +1074,14 @@ void Aura::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); BIND_VMETHOD(MethodInfo("_son_cast_finished_target", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo"))); + BIND_VMETHOD(MethodInfo("_son_before_damage_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); - BIND_VMETHOD(MethodInfo("_son_before_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_damage_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_dealt_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_damage_dealt", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); + BIND_VMETHOD(MethodInfo("_son_before_heal_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_before_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_heal_receive", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_dealt_heal", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); diff --git a/data/aura.h b/data/aura.h index 58395fd..740f354 100644 --- a/data/aura.h +++ b/data/aura.h @@ -224,13 +224,14 @@ public: void son_cast_finished(Ref aura, Ref info); void son_cast_finished_target(Ref aura, Ref info); + void son_before_damage_hit(Ref aura, Ref data); void son_hit(Ref aura, Ref data); - void son_before_damage(Ref aura, Ref data); void son_damage_receive(Ref aura, Ref data); void son_dealt_damage(Ref aura, Ref data); void son_damage_dealt(Ref aura, Ref data); + void son_before_heal_hit(Ref aura, Ref data); void son_before_heal(Ref aura, Ref data); void son_heal_receive(Ref aura, Ref data); void son_dealt_heal(Ref aura, Ref data); @@ -253,6 +254,8 @@ public: void son_gcd_started(Ref data, float gcd); void son_gcd_finished(Ref data); + + void son_physics_process(Ref data); //Clientside Event Handlers void con_cast_failed(Ref data, Ref info); diff --git a/entities/data/entity_data.cpp b/entities/data/entity_data.cpp index 5b84b20..bdd160e 100644 --- a/entities/data/entity_data.cpp +++ b/entities/data/entity_data.cpp @@ -350,6 +350,15 @@ void EntityData::son_cast_finished_target(Ref info) { _inherits->son_cast_finished_target(info); } +void EntityData::son_before_damage_hit(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_before_damage_hit")) + call("_son_before_damage_hit", data); + else if (_inherits.is_valid()) + _inherits->son_before_damage_hit(data); +} + void EntityData::son_hit(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -395,6 +404,15 @@ void EntityData::son_damage_dealt(Ref data) { _inherits->son_damage_dealt(data); } +void EntityData::son_before_heal_hit(Ref data) { + ERR_FAIL_COND(!data.is_valid()); + + if (has_method("_son_before_heal_hit")) + call("_son_before_heal_hit", data); + else if (_inherits.is_valid()) + _inherits->son_before_heal_hit(data); +} + void EntityData::son_before_heal(Ref data) { ERR_FAIL_COND(!data.is_valid()); @@ -798,13 +816,14 @@ void EntityData::_bind_methods() { ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &EntityData::son_cast_finished); ClassDB::bind_method(D_METHOD("son_cast_finished_target", "info"), &EntityData::son_cast_finished_target); + ClassDB::bind_method(D_METHOD("son_before_damage_hit", "data"), &EntityData::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "data"), &EntityData::son_hit); - ClassDB::bind_method(D_METHOD("son_before_damage", "data"), &EntityData::son_before_damage); ClassDB::bind_method(D_METHOD("son_damage_receive", "data"), &EntityData::son_damage_receive); ClassDB::bind_method(D_METHOD("son_dealt_damage", "data"), &EntityData::son_dealt_damage); ClassDB::bind_method(D_METHOD("son_damage_dealt", "data"), &EntityData::son_damage_dealt); + ClassDB::bind_method(D_METHOD("son_before_heal_hit", "data"), &EntityData::son_before_heal_hit); ClassDB::bind_method(D_METHOD("son_before_heal", "data"), &EntityData::son_before_heal); ClassDB::bind_method(D_METHOD("son_heal_receive", "data"), &EntityData::son_heal_receive); ClassDB::bind_method(D_METHOD("son_dealt_heal", "data"), &EntityData::son_dealt_heal); @@ -831,13 +850,14 @@ void EntityData::_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_before_damage_hit", 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_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_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_hit", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); 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"))); diff --git a/entities/data/entity_data.h b/entities/data/entity_data.h index 17606f1..e356eff 100644 --- a/entities/data/entity_data.h +++ b/entities/data/entity_data.h @@ -127,12 +127,14 @@ public: void son_cast_started(Ref info); void son_cast_failed(Ref info); + void son_before_damage_hit(Ref data); void son_hit(Ref data); void son_before_damage(Ref data); void son_damage_receive(Ref data); void son_dealt_damage(Ref data); void son_damage_dealt(Ref data); + void son_before_heal_hit(Ref data); void son_before_heal(Ref data); void son_heal_receive(Ref data); void son_dealt_heal(Ref data); diff --git a/entities/entity.cpp b/entities/entity.cpp index 46ffb02..fa7a9b0 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -651,12 +651,22 @@ void Entity::stake_damage(Ref info) { return; } + son_before_damage_hit(info); + + if (info->get_immune()) { + SEND_RPC(rpc("con_damage_dealt", info), con_damage_dealt(info)); + return; + } + //send it through the passive damage reductions pipeline sapply_passives_damage_receive(info); + //send it through the onbeforehit handler son_before_damage(info); + //send it throug the onhit pipeliine son_hit(info); + son_damage_receive(info); int h = get_health()->gets_current() - info->get_damage(); @@ -712,9 +722,17 @@ void Entity::stake_heal(Ref info) { if (gets_is_dead()) { return; } + + son_before_heal_hit(info); + + if (info->get_immune()) { + SEND_RPC(rpc("con_heal_dealt", info), con_heal_dealt(info)); + return; + } //send it through the passive damage reductions pipeline sapply_passives_heal_receive(info); + //send it through the onbeforehit handler son_before_heal(info); @@ -880,6 +898,23 @@ void Entity::son_before_cast_target(Ref info) { } } +void Entity::son_before_damage_hit(Ref info) { + ERR_FAIL_COND(!info.is_valid()); + + if (_s_entity_data.is_valid()) { + _s_entity_data->son_before_damage_hit(info); + } + + if (has_method("_son_before_damage_hit")) + call("_son_before_damage_hit", info); + + for (int i = 0; i < _s_auras.size(); ++i) { + Ref ad = _s_auras.get(i); + + ad->get_aura()->son_before_damage_hit(ad, info); + } +} + void Entity::son_hit(Ref info) { ERR_FAIL_COND(!info.is_valid()); @@ -966,6 +1001,23 @@ void Entity::son_damage_dealt(Ref info) { } } +void Entity::son_before_heal_hit(Ref info) { + ERR_FAIL_COND(!info.is_valid()); + + if (_s_entity_data.is_valid()) { + _s_entity_data->son_before_heal_hit(info); + } + + if (has_method("_son_before_heal_hit")) + call("_son_before_heal_hit", info); + + for (int i = 0; i < _s_auras.size(); ++i) { + Ref ad = _s_auras.get(i); + + ad->get_aura()->son_before_heal_hit(ad, info); + } +} + void Entity::son_before_heal(Ref info) { ERR_FAIL_COND(!info.is_valid()); @@ -1281,6 +1333,17 @@ void Entity::con_gcd_finished() { } } +void Entity::son_physics_process() { + //if (has_method("_son_category_cooldown_removed")) + // call("_son_category_cooldown_removed", category_cooldown); + + for (int i = 0; i < _s_auras.size(); ++i) { + Ref ad = _s_auras.get(i); + + ad->get_aura()->son_physics_process(ad); + } +} + void Entity::sadd_aura(Ref aura) { ERR_FAIL_COND(!aura.is_valid()); @@ -2689,6 +2752,9 @@ void Entity::_notification(int p_what) { case NOTIFICATION_PROCESS: { update(get_process_delta_time()); } break; + case NOTIFICATION_PHYSICS_PROCESS: { + son_physics_process(); + }break; case NOTIFICATION_EXIT_TREE: { } break; @@ -2759,6 +2825,7 @@ void Entity::_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_before_damage_hit", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_hit", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_before_damage", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); @@ -2766,6 +2833,7 @@ void Entity::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_dealt_damage", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); BIND_VMETHOD(MethodInfo("_son_damage_dealt", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo"))); + BIND_VMETHOD(MethodInfo("_son_before_heal_hit", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_before_heal", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_heal_receive", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); BIND_VMETHOD(MethodInfo("_son_dealt_heal", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo"))); @@ -2782,16 +2850,18 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("son_before_aura_applied", "data"), &Entity::son_before_aura_applied); ClassDB::bind_method(D_METHOD("son_after_aura_applied", "data"), &Entity::son_after_aura_applied); + ClassDB::bind_method(D_METHOD("son_before_damage_hit", "data"), &Entity::son_before_damage_hit); ClassDB::bind_method(D_METHOD("son_hit", "data"), &Entity::son_hit); ClassDB::bind_method(D_METHOD("son_before_damage", "data"), &Entity::son_before_damage); ClassDB::bind_method(D_METHOD("son_damage_receive", "data"), &Entity::son_damage_receive); 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_heal_hit", "data"), &Entity::son_before_heal_hit); + ClassDB::bind_method(D_METHOD("son_before_heal", "data"), &Entity::son_before_heal); + ClassDB::bind_method(D_METHOD("son_heal_receive", "data"), &Entity::son_heal_receive); + ClassDB::bind_method(D_METHOD("son_dealt_heal", "data"), &Entity::son_dealt_heal); + ClassDB::bind_method(D_METHOD("son_heal_dealt", "data"), &Entity::son_heal_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); diff --git a/entities/entity.h b/entities/entity.h index 16a7ef7..f84531f 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -257,12 +257,14 @@ public: void son_before_aura_applied(Ref data); void son_after_aura_applied(Ref data); - void son_hit(Ref info); + void son_before_damage_hit(Ref info); + void son_hit(Ref info); void son_before_damage(Ref info); void son_damage_receive(Ref info); void son_dealt_damage(Ref info); void son_damage_dealt(Ref info); + void son_before_heal_hit(Ref info); void son_before_heal(Ref info); void son_heal_receive(Ref info); void son_dealt_heal(Ref info); @@ -282,11 +284,13 @@ public: void son_category_cooldown_added(Ref category_cooldown); void son_category_cooldown_removed(Ref category_cooldown); - + void son_gcd_started(); void son_gcd_finished(); void con_gcd_started(); void con_gcd_finished(); + + void son_physics_process(); //Clientside EventHandlers void con_cast_failed(Ref info); @@ -317,7 +321,7 @@ public: void sapply_passives_heal_receive(Ref info); void sapply_passives_heal_deal(Ref info); - + //Spell operations void scast_spell(int spell_id); void crequest_spell_cast(int spell_id); @@ -346,7 +350,7 @@ public: void caura_refreshed(Ref aura); void sremove_auras_with_group(int aura_group); - + //NOTE: No reason for shas_aura_by, just query it, and check for null. int sget_aura_count(); Ref sget_aura(int index); diff --git a/pipelines/spell_damage_info.cpp b/pipelines/spell_damage_info.cpp index 5be872b..1429996 100644 --- a/pipelines/spell_damage_info.cpp +++ b/pipelines/spell_damage_info.cpp @@ -4,10 +4,16 @@ #include "../data/spell.h" #include "../data/aura.h" +bool SpellDamageInfo::get_immune() { + return _crit; +} +void SpellDamageInfo::set_immune(bool value) { + _crit = value; +} + int SpellDamageInfo::get_damage() { return _damage; } - void SpellDamageInfo::set_damage(int value) { _damage = value; } @@ -15,7 +21,6 @@ void SpellDamageInfo::set_damage(int value) { bool SpellDamageInfo::get_crit() { return _crit; } - void SpellDamageInfo::set_crit(bool value) { _crit = value; } @@ -23,7 +28,6 @@ void SpellDamageInfo::set_crit(bool value) { int SpellDamageInfo::get_amount_absorbed() { return _amount_absorbed; } - void SpellDamageInfo::set_amount_absorbed(int value) { _amount_absorbed = value; } @@ -31,7 +35,6 @@ void SpellDamageInfo::set_amount_absorbed(int value) { SpellEnums::SpellType SpellDamageInfo::get_spell_type() { return _spell_type; } - void SpellDamageInfo::set_spell_type(SpellEnums::SpellType value) { _spell_type = value; } @@ -39,11 +42,9 @@ void SpellDamageInfo::set_spell_type(SpellEnums::SpellType value) { Entity *SpellDamageInfo::get_dealer() { return _dealer; } - void SpellDamageInfo::set_dealer(Entity *value) { _dealer = value; } - void SpellDamageInfo::set_dealer_bind(Node *value) { if (!value) { return; @@ -61,11 +62,9 @@ void SpellDamageInfo::set_dealer_bind(Node *value) { Entity *SpellDamageInfo::get_receiver() { return _receiver; } - void SpellDamageInfo::set_receiver(Entity *value) { _receiver = value; } - void SpellDamageInfo::set_receiver_bind(Node *value) { if (!value) { return; @@ -83,7 +82,6 @@ void SpellDamageInfo::set_receiver_bind(Node *value) { Ref SpellDamageInfo::get_damage_source() { return _damage_source; } - void SpellDamageInfo::set_damage_source(Ref value) { _damage_source_type = DAMAGE_SOURCE_UNKNOWN; _damage_source = value; @@ -152,6 +150,10 @@ SpellDamageInfo::~SpellDamageInfo() { } void SpellDamageInfo::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_immune"), &SpellDamageInfo::get_immune); + ClassDB::bind_method(D_METHOD("set_immune", "value"), &SpellDamageInfo::set_immune); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "immune"), "set_immune", "get_immune"); + ClassDB::bind_method(D_METHOD("get_damage"), &SpellDamageInfo::get_damage); ClassDB::bind_method(D_METHOD("set_damage", "value"), &SpellDamageInfo::set_damage); ADD_PROPERTY(PropertyInfo(Variant::INT, "damage"), "set_damage", "get_damage"); diff --git a/pipelines/spell_damage_info.h b/pipelines/spell_damage_info.h index 54ac95d..1ece0a4 100644 --- a/pipelines/spell_damage_info.h +++ b/pipelines/spell_damage_info.h @@ -23,6 +23,9 @@ protected: static void _bind_methods(); public: + bool get_immune(); + void set_immune(bool value); + int get_damage(); void set_damage(int value); @@ -64,6 +67,7 @@ public: ~SpellDamageInfo(); private: + bool _immune; int _damage; int _original_damage; int _amount_absorbed; diff --git a/pipelines/spell_heal_info.cpp b/pipelines/spell_heal_info.cpp index 8e41320..aea08cf 100644 --- a/pipelines/spell_heal_info.cpp +++ b/pipelines/spell_heal_info.cpp @@ -4,6 +4,13 @@ #include "../data/spell.h" #include "../entities/entity.h" +bool SpellHealInfo::get_immune() { + return _crit; +} +void SpellHealInfo::set_immune(bool value) { + _crit = value; +} + int SpellHealInfo::get_heal() { return _heal; } @@ -140,6 +147,10 @@ SpellHealInfo::~SpellHealInfo() { } void SpellHealInfo::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_immune"), &SpellHealInfo::get_immune); + ClassDB::bind_method(D_METHOD("set_immune", "value"), &SpellHealInfo::set_immune); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "immune"), "set_immune", "get_immune"); + 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"); diff --git a/pipelines/spell_heal_info.h b/pipelines/spell_heal_info.h index 547e6d1..30c97dd 100644 --- a/pipelines/spell_heal_info.h +++ b/pipelines/spell_heal_info.h @@ -23,6 +23,9 @@ protected: static void _bind_methods(); public: + bool get_immune(); + void set_immune(bool value); + int get_heal(); void set_heal(int value);