mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Improved the virtual method binds, by a lot.
This commit is contained in:
parent
3e89bc37c9
commit
decb7c3c7d
265
data/aura.cpp
265
data/aura.cpp
@ -244,11 +244,104 @@ void Aura::sapply_simple(Entity *caster, Entity *target, float spell_scale) {
|
||||
|
||||
|
||||
void Aura::sapply(Ref<AuraApplyInfo> info) {
|
||||
if (has_method("_sapply")) {
|
||||
call_multilevel("_sapply", info);
|
||||
return;
|
||||
}
|
||||
call("_sapply", info);
|
||||
}
|
||||
|
||||
void Aura::sremove(Ref<AuraData> aura) {
|
||||
call("_sremove", aura);
|
||||
}
|
||||
|
||||
void Aura::sremove_expired(Ref<AuraData> aura) {
|
||||
call("_sremove_expired", aura);
|
||||
}
|
||||
|
||||
void Aura::supdate(Ref<AuraData> aura, float delta) {
|
||||
call("_supdate", aura, delta);
|
||||
}
|
||||
|
||||
void Aura::sdispell(Entity *target, AuraData *data) {
|
||||
}
|
||||
|
||||
void Aura::son_before_cast(Ref<SpellCastInfo> info) {
|
||||
call("_son_before_cast", info);
|
||||
}
|
||||
|
||||
void Aura::son_before_cast_target(Ref<SpellCastInfo> info) {
|
||||
call("_son_before_cast_target", info);
|
||||
}
|
||||
|
||||
void Aura::son_cast_finished(Ref<SpellCastInfo> info) {
|
||||
call("_son_cast_finished", info);
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
call("_sapply_passives_damage_receive", data);
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
call("_sapply_passives_damage_deal", data);
|
||||
}
|
||||
|
||||
void Aura::son_before_damage(Ref<SpellDamageInfo> data) {
|
||||
call("_son_before_damage", data);
|
||||
}
|
||||
|
||||
void Aura::son_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
call("_son_damage_receive", data);
|
||||
}
|
||||
|
||||
void Aura::son_hit(Ref<SpellDamageInfo> data) {
|
||||
call("_son_hit", data);
|
||||
}
|
||||
|
||||
void Aura::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
call("_son_damage_dealt", data);
|
||||
}
|
||||
|
||||
void Aura::son_remove_expired(Ref<AuraData> aura) {
|
||||
call("_son_remove_expired", aura);
|
||||
}
|
||||
|
||||
void Aura::son_remove(Ref<AuraData> aura) {
|
||||
//Debug::Log(new String("OnRemove called, Deprecated!"));
|
||||
//this->DeApply(caster, null);
|
||||
call("_son_remove", aura);
|
||||
}
|
||||
|
||||
void Aura::son_dispell(Ref<AuraData> aura) {
|
||||
call("_son_dispell", aura);
|
||||
}
|
||||
|
||||
void Aura::son_before_aura_applied(Ref<AuraData> data) {
|
||||
call("_son_before_aura_applied", data);
|
||||
}
|
||||
|
||||
void Aura::son_after_aura_applied(Ref<AuraData> data) {
|
||||
call("_son_after_aura_applied", data);
|
||||
}
|
||||
|
||||
void Aura::con_added(Entity *target, Aura *data, AuraData *aura) {
|
||||
}
|
||||
|
||||
void Aura::con_removed(Entity *target, Aura *data) {
|
||||
}
|
||||
|
||||
void Aura::con_refresh(Entity *target, Object *data, AuraData *aura) {
|
||||
}
|
||||
|
||||
void Aura::setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
call("setup_aura_data", data, info);
|
||||
}
|
||||
|
||||
void Aura::calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
call("_calculate_initial_damage", aura_data, info);
|
||||
}
|
||||
|
||||
void Aura::handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data) {
|
||||
call("_handle_aura_damage", aura_data, data);
|
||||
}
|
||||
|
||||
void Aura::_sapply(Ref<AuraApplyInfo> info) {
|
||||
Ref<Aura> aura = info->get_aura();
|
||||
|
||||
Ref<AuraData> ad(memnew(AuraData()));
|
||||
@ -257,15 +350,15 @@ void Aura::sapply(Ref<AuraApplyInfo> info) {
|
||||
info->get_target()->add_aura(ad);
|
||||
}
|
||||
|
||||
void Aura::sremove(Ref<AuraData> aura) {
|
||||
void Aura::_sremove(Ref<AuraData> aura) {
|
||||
aura->get_owner()->sremove_aura(aura);
|
||||
}
|
||||
|
||||
void Aura::sremove_expired(Ref<AuraData> aura) {
|
||||
void Aura::_sremove_expired(Ref<AuraData> aura) {
|
||||
aura->get_owner()->sremove_aura_expired(aura);
|
||||
}
|
||||
|
||||
bool Aura::supdate(Ref<AuraData> aura, float delta) {
|
||||
void Aura::_supdate(Ref<AuraData> aura, float delta) {
|
||||
|
||||
bool remove = aura->update_remaining_time(delta);
|
||||
|
||||
@ -288,112 +381,65 @@ bool Aura::supdate(Ref<AuraData> aura, float delta) {
|
||||
if (remove) {
|
||||
sremove_expired(aura);
|
||||
}
|
||||
|
||||
return remove;
|
||||
}
|
||||
|
||||
void Aura::sdispell(Entity *target, AuraData *data) {
|
||||
void Aura::_sdispell(Entity *target, AuraData *data) {
|
||||
}
|
||||
|
||||
void Aura::son_before_cast(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_son_before_cast")) {
|
||||
call_multilevel("_son_before_cast", info);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_before_cast(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
void Aura::son_before_cast_target(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_son_before_cast_target")) {
|
||||
call_multilevel("_son_before_cast_target", info);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_before_cast_target(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
void Aura::son_cast_finished(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_son_cast_finished")) {
|
||||
call_multilevel("_son_cast_finished", info);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_cast_finished(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_sapply_passives_damage_receive")) {
|
||||
call_multilevel("_sapply_passives_damage_receive", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_sapply_passives_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_sapply_passives_damage_deal")) {
|
||||
call_multilevel("_sapply_passives_damage_deal", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_sapply_passives_damage_deal(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::son_before_damage(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_son_before_damage")) {
|
||||
call_multilevel("_son_before_damage", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_before_damage(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::son_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_son_damage_receive")) {
|
||||
call_multilevel("_son_damage_receive", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_damage_receive(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::son_hit(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_son_hit")) {
|
||||
call_multilevel("_son_hit", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_hit(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_son_damage_dealt")) {
|
||||
call_multilevel("_son_damage_dealt", data);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_damage_dealt(Ref<SpellDamageInfo> data) {
|
||||
}
|
||||
|
||||
void Aura::son_remove_expired(Ref<AuraData> aura) {
|
||||
if (has_method("_son_remove_expired")) {
|
||||
call_multilevel("_son_remove_expired", aura);
|
||||
return;
|
||||
}
|
||||
void Aura::_son_remove_expired(Ref<AuraData> aura) {
|
||||
}
|
||||
|
||||
void Aura::son_remove(Ref<AuraData> aura) {
|
||||
void Aura::_son_remove(Ref<AuraData> aura) {
|
||||
//Debug::Log(new String("OnRemove called, Deprecated!"));
|
||||
//this->DeApply(caster, null);
|
||||
}
|
||||
|
||||
void Aura::son_dispell(Ref<AuraData> aura) {
|
||||
void Aura::_son_dispell(Ref<AuraData> aura) {
|
||||
}
|
||||
|
||||
void Aura::son_before_aura_applied(Ref<AuraData> data) {
|
||||
void Aura::_son_before_aura_applied(Ref<AuraData> data) {
|
||||
}
|
||||
|
||||
void Aura::son_after_aura_applied(Ref<AuraData> data) {
|
||||
void Aura::_son_after_aura_applied(Ref<AuraData> data) {
|
||||
}
|
||||
|
||||
void Aura::con_added(Entity *target, Aura *data, AuraData *aura) {
|
||||
void Aura::_con_added(Entity *target, Aura *data, AuraData *aura) {
|
||||
}
|
||||
|
||||
void Aura::con_removed(Entity *target, Aura *data) {
|
||||
void Aura::_con_removed(Entity *target, Aura *data) {
|
||||
}
|
||||
|
||||
void Aura::con_refresh(Entity *target, Object *data, AuraData *aura) {
|
||||
void Aura::_con_refresh(Entity *target, Object *data, AuraData *aura) {
|
||||
}
|
||||
|
||||
void Aura::setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
if (has_method("_setup_aura_data")) {
|
||||
call_multilevel("_setup_aura_data", data, info);
|
||||
return;
|
||||
}
|
||||
|
||||
void Aura::_setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
data->set_aura(Ref<Aura>(this));
|
||||
data->set_caster(info->get_caster());
|
||||
|
||||
@ -402,26 +448,17 @@ void Aura::setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
}
|
||||
}
|
||||
|
||||
void Aura::calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info) {
|
||||
if (has_method("_calculate_initial_damage")) {
|
||||
call_multilevel("_calculate_initial_damage", aura_data, info);
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
void Aura::_handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data) {
|
||||
data->set_damage(aura_data->get_damage());
|
||||
|
||||
if (has_method("_handle_aura_damage")) {
|
||||
call_multilevel("_handle_aura_damage", aura_data, data);
|
||||
return;
|
||||
}
|
||||
|
||||
data->get_dealer()->sdeal_damage_to(data);
|
||||
}
|
||||
|
||||
|
||||
void Aura::_validate_property(PropertyInfo &property) const {
|
||||
|
||||
String prop = property.name;
|
||||
@ -438,28 +475,75 @@ void Aura::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Aura::_bind_methods() {
|
||||
//VMethods
|
||||
BIND_VMETHOD(MethodInfo("_sapply", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_sremove", PropertyInfo(Variant::OBJECT, "aura", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_sremove_expired", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_supdate", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::REAL, "delta")));
|
||||
//BIND_VMETHOD(MethodInfo("_sdispell", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "AuraApplyInfo")));
|
||||
|
||||
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("_son_before_cast", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_before_cast_target", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_son_cast_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
|
||||
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("_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_damage_dealt", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
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_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")));
|
||||
|
||||
//virtual void _con_added(Entity * target, Aura * data, AuraData * aura);
|
||||
//virtual void _con_removed(Entity * target, Aura * data);
|
||||
//virtual void _con_refresh(Entity * target, Object * data, AuraData * aura);
|
||||
|
||||
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")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_remove_expired", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
ClassDB::bind_method(D_METHOD("sapply", "info"), &Aura::sapply);
|
||||
ClassDB::bind_method(D_METHOD("sremove", "aura"), &Aura::sremove);
|
||||
ClassDB::bind_method(D_METHOD("sremove_expired", "aura"), &Aura::sremove_expired);
|
||||
ClassDB::bind_method(D_METHOD("supdate","aura", "delta"), &Aura::supdate);
|
||||
|
||||
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("son_before_cast", "info"), &Aura::son_before_cast);
|
||||
ClassDB::bind_method(D_METHOD("son_before_cast_target", "info"), &Aura::son_before_cast_target);
|
||||
ClassDB::bind_method(D_METHOD("son_cast_finished", "info"), &Aura::son_cast_finished);
|
||||
|
||||
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_damage_dealt", "data"), &Aura::son_damage_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_dispell", "aura"), &Aura::son_dispell);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("son_before_aura_applied", "data"), &Aura::son_before_aura_applied);
|
||||
ClassDB::bind_method(D_METHOD("son_after_aura_applied", "data"), &Aura::son_after_aura_applied);
|
||||
|
||||
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);
|
||||
|
||||
//void con_added(Entity * target, Aura * data, AuraData * aura);
|
||||
//void con_removed(Entity * target, Aura * data);
|
||||
//void con_refresh(Entity * target, Object * data, AuraData * aura);
|
||||
|
||||
|
||||
//Properties
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &Aura::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &Aura::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
@ -618,7 +702,6 @@ void Aura::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_aura_stat_attribute_percent_mod", "index"), &Aura::get_aura_stat_attribute_percent_mod);
|
||||
ClassDB::bind_method(D_METHOD("set_aura_stat_attribute_percent_mod", "index", "value"), &Aura::set_aura_stat_attribute_percent_mod);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("sapply", "info"), &Aura::sapply);
|
||||
ClassDB::bind_method(D_METHOD("get_aura_stat_attribute", "index"), &Aura::get_aura_stat_attribute);
|
||||
//ClassDB::bind_method(D_METHOD("sremove", "info"), &Aura::sremove);
|
||||
//ClassDB::bind_method(D_METHOD("supdate", "info"), &Aura::supdate);
|
||||
|
84
data/aura.h
84
data/aura.h
@ -253,41 +253,75 @@ public:
|
||||
Ref<AuraStatAttribute> get_aura_stat_attribute(int index) { return _aura_stat_attributes[index]; }
|
||||
|
||||
//// SpellSystem ////
|
||||
void sdispell(Entity *target, AuraData *data);
|
||||
|
||||
void sapply_simple(Entity *caster, Entity *target, float spell_scale);
|
||||
|
||||
virtual void sapply(Ref<AuraApplyInfo> info);
|
||||
virtual void sremove(Ref<AuraData> aura);
|
||||
virtual void sremove_expired(Ref<AuraData> aura);
|
||||
virtual bool supdate(Ref<AuraData> aura, float delta);
|
||||
virtual void sdispell(Entity *target, AuraData *data);
|
||||
void sapply(Ref<AuraApplyInfo> info);
|
||||
void sremove(Ref<AuraData> aura);
|
||||
void sremove_expired(Ref<AuraData> aura);
|
||||
void supdate(Ref<AuraData> aura, float delta);
|
||||
|
||||
virtual void sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
virtual void sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
void sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
void sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void son_before_cast(Ref<SpellCastInfo> info);
|
||||
virtual void son_before_cast_target(Ref<SpellCastInfo> info);
|
||||
virtual void son_cast_finished(Ref<SpellCastInfo> info);
|
||||
void son_before_cast(Ref<SpellCastInfo> info);
|
||||
void son_before_cast_target(Ref<SpellCastInfo> info);
|
||||
void son_cast_finished(Ref<SpellCastInfo> info);
|
||||
|
||||
virtual void son_before_damage(Ref<SpellDamageInfo> data);
|
||||
virtual void son_damage_receive(Ref<SpellDamageInfo> data);
|
||||
virtual void son_hit(Ref<SpellDamageInfo> data);
|
||||
virtual void son_damage_dealt(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_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void son_remove(Ref<AuraData> aura);
|
||||
virtual void son_remove_expired(Ref<AuraData> aura);
|
||||
virtual void son_dispell(Ref<AuraData> aura);
|
||||
void son_remove(Ref<AuraData> aura);
|
||||
void son_remove_expired(Ref<AuraData> aura);
|
||||
void son_dispell(Ref<AuraData> aura);
|
||||
|
||||
virtual void son_before_aura_applied(Ref<AuraData> data);
|
||||
virtual void son_after_aura_applied(Ref<AuraData> data);
|
||||
void son_before_aura_applied(Ref<AuraData> data);
|
||||
void son_after_aura_applied(Ref<AuraData> data);
|
||||
|
||||
virtual void con_added(Entity *target, Aura *data, AuraData *aura);
|
||||
virtual void con_removed(Entity *target, Aura *data);
|
||||
virtual void con_refresh(Entity *target, Object *data, AuraData *aura);
|
||||
void con_added(Entity *target, Aura *data, AuraData *aura);
|
||||
void con_removed(Entity *target, Aura *data);
|
||||
void con_refresh(Entity *target, Object *data, AuraData *aura);
|
||||
|
||||
virtual void setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
virtual void calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
virtual void handle_aura_damage(Ref<AuraData> aura_data, 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(Ref<AuraApplyInfo> info);
|
||||
virtual void _sremove(Ref<AuraData> aura);
|
||||
virtual void _sremove_expired(Ref<AuraData> aura);
|
||||
virtual void _supdate(Ref<AuraData> aura, float delta);
|
||||
virtual void _sdispell(Entity *target, AuraData *data);
|
||||
|
||||
virtual void _sapply_passives_damage_receive(Ref<SpellDamageInfo> data);
|
||||
virtual void _sapply_passives_damage_deal(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void _son_before_cast(Ref<SpellCastInfo> info);
|
||||
virtual void _son_before_cast_target(Ref<SpellCastInfo> info);
|
||||
virtual void _son_cast_finished(Ref<SpellCastInfo> info);
|
||||
|
||||
virtual void _son_before_damage(Ref<SpellDamageInfo> data);
|
||||
virtual void _son_damage_receive(Ref<SpellDamageInfo> data);
|
||||
virtual void _son_hit(Ref<SpellDamageInfo> data);
|
||||
virtual void _son_damage_dealt(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void _son_remove(Ref<AuraData> aura);
|
||||
virtual void _son_remove_expired(Ref<AuraData> aura);
|
||||
virtual void _son_dispell(Ref<AuraData> aura);
|
||||
|
||||
virtual void _son_before_aura_applied(Ref<AuraData> data);
|
||||
virtual void _son_after_aura_applied(Ref<AuraData> data);
|
||||
|
||||
virtual void _con_added(Entity *target, Aura *data, AuraData *aura);
|
||||
virtual void _con_removed(Entity *target, Aura *data);
|
||||
virtual void _con_refresh(Entity *target, Object *data, AuraData *aura);
|
||||
|
||||
virtual void _setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info);
|
||||
virtual void _calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo> info);
|
||||
virtual void _handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> data);
|
||||
|
||||
Aura();
|
||||
~Aura();
|
||||
|
188
data/spell.cpp
188
data/spell.cpp
@ -107,21 +107,75 @@ void Spell::start_casting_triggered_simple(Entity *caster) {
|
||||
|
||||
void Spell::start_casting(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_start_casting")) {
|
||||
call_multilevel("_start_casting", info);
|
||||
call("_start_casting", info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//_start_casting(info);
|
||||
void Spell::casting_finished(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_casting_finished")) {
|
||||
call("_casting_finished", info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::casting_failed(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_casting_failed")) {
|
||||
call("_casting_failed", info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::start_casting_triggered(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_start_casting_triggered")) {
|
||||
call("_start_casting_triggered", info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::spell_hit(Entity *caster, Entity *target, Node *worldSpell, Spell *spell, float spell_scale) {
|
||||
}
|
||||
|
||||
void Spell::on_player_move(Entity *player) {
|
||||
call("_on_player_move", player);
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_started(Entity *player) {
|
||||
call("_start_casting_triggered", player);
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_success(Entity *player) {
|
||||
call("_c_on_spell_cast_success", player);
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_failed(Entity *player) {
|
||||
call("_c_on_spell_cast_failed", player);
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_ended(Entity *player) {
|
||||
call("_c_on_spell_cast_ended", player);
|
||||
}
|
||||
|
||||
void Spell::on_cast_state_changed(Entity *caster) {
|
||||
//if (IsStunned(caster)) {
|
||||
// DoCastFail(caster, true);
|
||||
//}
|
||||
}
|
||||
|
||||
void Spell::calculate_initial_damage(Ref<SpellDamageInfo> data) {
|
||||
call("_calculate_initial_damage", data);
|
||||
}
|
||||
|
||||
void Spell::handle_spell_damage(Ref<SpellDamageInfo> data) {
|
||||
call("_handle_spell_damage", data);
|
||||
}
|
||||
|
||||
void Spell::_start_casting(Ref<SpellCastInfo> info) {
|
||||
Ref<Spell> spell = info->get_spell();
|
||||
|
||||
//if !cancast reutrn
|
||||
|
||||
if (spell->get_needs_target() || spell->get_has_damage()) {
|
||||
if (!info->get_target()) {
|
||||
print_error("no target, return");
|
||||
//print_error("no target, return");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -149,7 +203,7 @@ void Spell::_start_casting(Ref<SpellCastInfo> info) {
|
||||
|
||||
if (spell->get_caster_aura_apply() != NULL) {
|
||||
Ref<AuraApplyInfo> aainfo(memnew(AuraApplyInfo(info->get_caster(), info->get_caster(), info->get_spell_scale())));
|
||||
print_error("apply");
|
||||
|
||||
spell->get_caster_aura_apply()->sapply(aainfo);
|
||||
}
|
||||
|
||||
@ -192,77 +246,52 @@ void Spell::_start_casting(Ref<SpellCastInfo> info) {
|
||||
}*/
|
||||
}
|
||||
|
||||
void Spell::casting_finished(Ref<SpellCastInfo> info) {
|
||||
if (has_method("_casting_finished")) {
|
||||
call_multilevel("_casting_finished", info);
|
||||
return;
|
||||
}
|
||||
void Spell::_casting_finished(Ref<SpellCastInfo> info) {
|
||||
|
||||
//print_error("casting_finished"); // + info->get_spell()->get_name_key());
|
||||
}
|
||||
|
||||
void Spell::casting_failed(Ref<SpellCastInfo> info) {
|
||||
print_error("casting_failed"); // + info->get_spell()->get_name_key());
|
||||
void Spell::_casting_failed(Ref<SpellCastInfo> info) {
|
||||
|
||||
}
|
||||
|
||||
void Spell::start_casting_triggered(Ref<SpellCastInfo> info) {
|
||||
print_error("start_casting_triggered"); // + info->get_spell()->get_name_key());
|
||||
void Spell::_start_casting_triggered(Ref<SpellCastInfo> info) {
|
||||
|
||||
}
|
||||
|
||||
void Spell::spell_hit(Entity *caster, Entity *target, Node *worldSpell, Spell *spell, float spell_scale) {
|
||||
void Spell::_calculate_initial_damage(Ref<SpellDamageInfo> data) {
|
||||
data->set_damage(get_damage_min());
|
||||
}
|
||||
|
||||
void Spell::on_player_move(Entity *caster) {
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_started(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_success(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_failed(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::c_on_spell_cast_ended(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::on_cast_state_changed(Entity *caster) {
|
||||
//if (IsStunned(caster)) {
|
||||
// DoCastFail(caster, true);
|
||||
//}
|
||||
}
|
||||
|
||||
void Spell::calculate_initial_damage(Ref<SpellDamageInfo> data) {
|
||||
if (has_method("_calculate_initial_damage")) {
|
||||
call_multilevel("_calculate_initial_damage", data);
|
||||
return;
|
||||
}
|
||||
|
||||
data->set_damage(300);
|
||||
}
|
||||
|
||||
void Spell::handle_spell_damage(Ref<SpellDamageInfo> data) {
|
||||
void Spell::_handle_spell_damage(Ref<SpellDamageInfo> data) {
|
||||
calculate_initial_damage(data);
|
||||
|
||||
if (has_method("_handle_spell_damage")) {
|
||||
call_multilevel("_handle_spell_damage", data);
|
||||
return;
|
||||
}
|
||||
|
||||
data->get_dealer()->sdeal_damage_to(data);
|
||||
}
|
||||
|
||||
void Spell::_on_player_move(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::_c_on_spell_cast_started(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::_c_on_spell_cast_success(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::_c_on_spell_cast_failed(Entity *player) {
|
||||
}
|
||||
|
||||
void Spell::_c_on_spell_cast_ended(Entity *player) {
|
||||
}
|
||||
|
||||
|
||||
String Spell::get_name() {
|
||||
return "stubname";
|
||||
return _spell_name;
|
||||
}
|
||||
|
||||
String Spell::get_description(int level) {
|
||||
return "stubdesc";
|
||||
return _spell_description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Spell::Spell() {
|
||||
PLAYER_HIT_RADIUS = (float)0.5;
|
||||
|
||||
@ -370,11 +399,53 @@ Spell::~Spell() {
|
||||
}
|
||||
|
||||
void Spell::_bind_methods() {
|
||||
//Virtuals
|
||||
BIND_VMETHOD(MethodInfo("_start_casting", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_start_casting_triggered", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_casting_finished", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_casting_failed", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_calculate_initial_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_handle_spell_damage", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_on_player_move", PropertyInfo(Variant::OBJECT, "player", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_c_on_spell_cast_started", PropertyInfo(Variant::OBJECT, "player", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_c_on_spell_cast_success", PropertyInfo(Variant::OBJECT, "player", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_c_on_spell_cast_failed", PropertyInfo(Variant::OBJECT, "player", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_c_on_spell_cast_ended", PropertyInfo(Variant::OBJECT, "player", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("start_casting", "info"), &Spell::start_casting);
|
||||
ClassDB::bind_method(D_METHOD("casting_finished", "info"), &Spell::casting_finished);
|
||||
ClassDB::bind_method(D_METHOD("casting_failed", "info"), &Spell::casting_failed);
|
||||
ClassDB::bind_method(D_METHOD("start_casting_triggered", "info"), &Spell::start_casting_triggered);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("on_player_move", "player"), &Spell::on_player_move);
|
||||
//ClassDB::bind_method(D_METHOD("c_on_spell_cast_started", "player"), &Spell::c_on_spell_cast_started);
|
||||
//ClassDB::bind_method(D_METHOD("c_on_spell_cast_success", "player"), &Spell::c_on_spell_cast_success);
|
||||
//ClassDB::bind_method(D_METHOD("c_on_spell_cast_failed", "player"), &Spell::c_on_spell_cast_failed);
|
||||
//ClassDB::bind_method(D_METHOD("c_on_spell_cast_ended", "player"), &Spell::c_on_spell_cast_ended);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("calculate_initial_damage", "data"), &Spell::calculate_initial_damage);
|
||||
ClassDB::bind_method(D_METHOD("handle_spell_damage", "data"), &Spell::handle_spell_damage);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_start_casting", "info"), &Spell::_start_casting);
|
||||
ClassDB::bind_method(D_METHOD("_casting_finished", "info"), &Spell::_casting_finished);
|
||||
ClassDB::bind_method(D_METHOD("_casting_failed", "info"), &Spell::_casting_failed);
|
||||
ClassDB::bind_method(D_METHOD("_start_casting_triggered", "info"), &Spell::_start_casting_triggered);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_calculate_initial_damage", "info"), &Spell::_calculate_initial_damage);
|
||||
ClassDB::bind_method(D_METHOD("_handle_spell_damage", "info"), &Spell::_handle_spell_damage);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("_on_player_move", "player"), &Spell::_on_player_move);
|
||||
//ClassDB::bind_method(D_METHOD("_c_on_spell_cast_started", "player"), &Spell::_c_on_spell_cast_started);
|
||||
//ClassDB::bind_method(D_METHOD("_c_on_spell_cast_success", "player"), &Spell::_c_on_spell_cast_success);
|
||||
//ClassDB::bind_method(D_METHOD("_c_on_spell_cast_failed", "player"), &Spell::_c_on_spell_cast_failed);
|
||||
//ClassDB::bind_method(D_METHOD("_c_on_spell_cast_ended", "player"), &Spell::_c_on_spell_cast_ended);
|
||||
|
||||
|
||||
//Properties
|
||||
ClassDB::bind_method(D_METHOD("get_spell_id"), &Spell::get_spell_id);
|
||||
ClassDB::bind_method(D_METHOD("set_spell_id", "value"), &Spell::set_spell_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_id"), "set_spell_id", "get_spell_id");
|
||||
@ -620,9 +691,6 @@ void Spell::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_spell_cooldown_mainpulation_data_count", "value"), &Spell::set_spell_cooldown_mainpulation_data_count);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_cooldown_mainpulation_data_count"), "set_spell_cooldown_mainpulation_data_count", "get_spell_cooldown_mainpulation_data_count");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("start_casting", "info"), &Spell::start_casting);
|
||||
ClassDB::bind_method(D_METHOD("_start_casting", "info"), &Spell::_start_casting);
|
||||
|
||||
BIND_ENUM_CONSTANT(TARGET_SELF);
|
||||
BIND_ENUM_CONSTANT(TARGET_ENEMY);
|
||||
BIND_ENUM_CONSTANT(TARGET_TARGET);
|
||||
|
51
data/spell.h
51
data/spell.h
@ -283,27 +283,44 @@ public:
|
||||
void casting_failed_simple(Entity *caster);
|
||||
void start_casting_triggered_simple(Entity *caster);
|
||||
|
||||
virtual void _start_casting(Ref<SpellCastInfo> info);
|
||||
|
||||
virtual void start_casting(Ref<SpellCastInfo> info);
|
||||
virtual void casting_finished(Ref<SpellCastInfo> info);
|
||||
virtual void casting_failed(Ref<SpellCastInfo> info);
|
||||
virtual void start_casting_triggered(Ref<SpellCastInfo> info);
|
||||
void start_casting(Ref<SpellCastInfo> info);
|
||||
void casting_finished(Ref<SpellCastInfo> info);
|
||||
void casting_failed(Ref<SpellCastInfo> info);
|
||||
void start_casting_triggered(Ref<SpellCastInfo> info);
|
||||
|
||||
//SpellHitInfo
|
||||
virtual void spell_hit(Entity *caster, Entity *target, Node *worldSpell, Spell *spell, float spellScale);
|
||||
virtual void on_player_move(Entity *caster);
|
||||
virtual void c_on_spell_cast_started(Entity *player);
|
||||
virtual void c_on_spell_cast_success(Entity *player);
|
||||
virtual void c_on_spell_cast_failed(Entity *player);
|
||||
virtual void c_on_spell_cast_ended(Entity *player);
|
||||
virtual void on_cast_state_changed(Entity *caster);
|
||||
|
||||
void on_player_move(Entity *player);
|
||||
void c_on_spell_cast_started(Entity *player);
|
||||
void c_on_spell_cast_success(Entity *player);
|
||||
void c_on_spell_cast_failed(Entity *player);
|
||||
void c_on_spell_cast_ended(Entity *player);
|
||||
void on_cast_state_changed(Entity *player);
|
||||
|
||||
virtual void calculate_initial_damage(Ref<SpellDamageInfo> data);
|
||||
virtual void handle_spell_damage(Ref<SpellDamageInfo> data);
|
||||
void spell_hit(Entity *caster, Entity *target, Node *worldSpell, Spell *spell, float spellScale);
|
||||
|
||||
virtual String get_name();
|
||||
virtual String get_description(int level);
|
||||
void calculate_initial_damage(Ref<SpellDamageInfo> data);
|
||||
void handle_spell_damage(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void _start_casting(Ref<SpellCastInfo> info);
|
||||
virtual void _casting_finished(Ref<SpellCastInfo> info);
|
||||
virtual void _casting_failed(Ref<SpellCastInfo> info);
|
||||
virtual void _start_casting_triggered(Ref<SpellCastInfo> info);
|
||||
|
||||
virtual void _calculate_initial_damage(Ref<SpellDamageInfo> data);
|
||||
virtual void _handle_spell_damage(Ref<SpellDamageInfo> data);
|
||||
|
||||
virtual void _on_player_move(Entity *player);
|
||||
virtual void _c_on_spell_cast_started(Entity *player);
|
||||
virtual void _c_on_spell_cast_success(Entity *player);
|
||||
virtual void _c_on_spell_cast_failed(Entity *player);
|
||||
virtual void _c_on_spell_cast_ended(Entity *player);
|
||||
|
||||
//virtual void _on_cast_state_changed(Entity *caster);
|
||||
|
||||
|
||||
String get_name();
|
||||
String get_description(int level);
|
||||
|
||||
/*
|
||||
void TriggerGlobalCooldown(Entity *player);
|
||||
|
Loading…
Reference in New Issue
Block a user