#ifndef AURA_H #define AURA_H #include "core/resource.h" #include "scene/resources/curve.h" #include "scene/resources/texture.h" #include "../entity_enums.h" #include "../spell_enums.h" #include "../entities/entity.h" #include "../entities/stats/stat.h" #include "../spells/aura_infos.h" #include "aura_stat_attribute.h" #include "aura_trigger_data.h" #include "../entities/auras/aura_data.h" #include "../pipelines/spell_damage_info.h" #include "../spells/spell_cast_info.h" class AuraApplyInfo; class AuraScript; class Entity; class SpellCastInfo; class Aura : public Resource { GDCLASS(Aura, Resource); public: int get_id() { return id; } void set_id(int value) { id = value; } String get_aura_name() { return _aura_name; } void set_aura_name(String name) { _aura_name = name; } Ref get_icon() { return _icon; } void set_icon(Ref value) { _icon = Ref(value); } float get_time() { return time; } void set_time(float value) { time = value; } int get_aura_group() { return aura_group; } void set_aura_group(int value) { aura_group = value; } int get_ability_scale_data_id() { return ability_scale_data_id; } void set_ability_scale_data_id(int value) { ability_scale_data_id = value; } float get_damage_scale_for_level(int level); float get_heal_scale_for_level(int level); float get_absorb_scale_for_level(int level); void set(int id, float time, int auraGroup); // AnimationCurve* getDamageLevelScaling(); // AnimationCurve* getAbsorbLevelScaling(); // AnimationCurve* getHealLevelScaling(); // void SetScalingData(AbilityScalingData* scalingData); // static void FromJSON(Aura* ada, JsonReader* r); // static void ToJSON(Aura* ada, JsonWriter* w); //Damage bool is_damage_enabled() { return _damage_enabled; } void set_damage_enabled(bool value) { _damage_enabled = value; } int get_damage_type() { return _damage_type; } void set_damage_type(int value) { _damage_type = value; } int get_damage_min() { return _damage_min; } void set_damage_min(int value) { _damage_min = value; } int get_damage_max() { return _damage_max; } void set_damage_max(int value) { _damage_max = value; } float get_damage_tick() { return _damage_tick; } void set_damage_tick(float value) { _damage_tick = value; } bool get_damage_can_crit() { return _damage_can_crit; } void set_damage_can_crit(bool value) { _damage_can_crit = value; } void set_damage(int min, int max, float tick, bool can_crit); //Absorb bool is_absorb_enabled() { return _absorb_enabled; } void set_absorb_enabled(bool value) { _absorb_enabled = value; } int get_absorb_damage_type() { return _absorb_damage_type; } void set_absorb_damage_type(int value) { _absorb_damage_type = value; } int get_absorb_min() { return _absorb_min; } void set_absorb_min(int value) { _absorb_min = value; } int get_absorb_max() { return _absorb_max; } void set_absorb_max(int value) { _absorb_max = value; } //Heal bool is_heal_enabled() { return _heal_enabled; } void set_heal_enabled(bool value) { _heal_enabled = value; } int get_heal_min() { return _heal_min; } void set_heal_min(int value) { _heal_min = value; } int get_heal_max() { return _heal_max; } void set_heal_max(int value) { _heal_max = value; } float get_heal_tick() { return _heal_tick; } void set_heal_tick(float value) { _heal_tick = value; } bool get_heal_can_crit() { return _heal_can_crit; } void set_heal_can_crit(bool value) { _heal_can_crit = value; } void set_heal(int min, int max, float tick, bool can_crit); Ref get_damage_scaling_curve() { return _damage_scaling_curve; } void set_damage_scaling_curve(Ref curve) { _damage_scaling_curve = curve; } Ref get_heal_scaling_curve() { return _heal_scaling_curve; } void set_heal_scaling_curve(Ref curve) { _heal_scaling_curve = curve; } Ref get_absorb_scaling_curve() { return _absorb_scaling_curve; } void set_absorb_scaling_curve(Ref curve) { _absorb_scaling_curve = curve; } //states int get_add_states() { return _add_states; } void set_add_states(int value) { _add_states = value; } int get_remove_effects_with_states() { return _remove_effects_with_states; } void set_remove_effects_with_states(int value) { _remove_effects_with_states = value; } int get_supress_states() { return _supress_states; } void set_supress_states(int value) { _supress_states = value; } //DiminishingReturns SpellEnums::DiminishingReturnCategory get_diminishing_category(); void set_diminishing_category(SpellEnums::DiminishingReturnCategory diminishingCategory); //Triggers int get_trigger_count() const; void set_trigger_count(int count); SpellEnums::TriggerEvents get_trigger_event(int index) const; void set_trigger_event(int index, const SpellEnums::TriggerEvents value); Ref get_trigger_aura(int index) const; void set_trigger_aura(int index, const Ref value); Ref get_trigger_spell(int index) const; void set_trigger_spell(int index, const Ref value); //AuraStatAttributes int get_aura_stat_attribute_count() const; void set_aura_stat_attribute_count(int count); Stat::StatId get_aura_stat_attribute_stat(int index) const; void set_aura_stat_attribute_stat(int index, const Stat::StatId value); float get_aura_stat_attribute_base_mod(int index) const; void set_aura_stat_attribute_base_mod(int index, float value); float get_aura_stat_attribute_bonus_mod(int index) const; void set_aura_stat_attribute_bonus_mod(int index, float value); float get_aura_stat_attribute_percent_mod(int index) const; void set_aura_stat_attribute_percent_mod(int index, float value); Ref get_aura_stat_attribute(int index) { return _aura_stat_attributes[index]; } //// SpellSystem //// //Commands, c++ only void sapply_simple(Entity *caster, Entity *target, float spell_scale); //Commands void sapply(Ref info); void sremove(Ref aura); void sremove_expired(Ref aura); void sremove_dispell(Ref aura); void supdate(Ref aura, float delta); virtual void _sapply(Ref info); virtual void _sremove(Ref aura); virtual void _sremove_expired(Ref aura); virtual void _supdate(Ref aura, float delta); virtual void _sremove_dispell(Ref aura); //EventHandlers void son_before_cast(Ref info); void son_before_cast_target(Ref info); void son_cast_started(Ref info); void son_cast_failed(Ref info); void son_cast_finished(Ref info); void son_cast_finished_target(Ref info); void son_before_damage(Ref data); void son_damage_receive(Ref data); void son_hit(Ref data); void son_damage_dealt(Ref data); void son_remove(Ref aura); void son_remove_expired(Ref aura); void son_remove_dispell(Ref aura); void son_before_aura_applied(Ref data); void son_after_aura_applied(Ref data); //Clientside Event Handlers void con_added(Ref data); void con_removed(Ref data); void con_refresh(Ref data); //Calculations / Queries 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 _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); Aura(); ~Aura(); /* void RemoveAura(WorldEntity *caster); bool ShouldApplyModifiers(WorldEntity *target); bool BasicAuraUpdate(WorldEntity *target, AuraData *data); bool ShouldApplyModifiers(WorldEntity *target, float refreshTo); bool ShouldApplyModifiers(WorldEntity *target, float refreshTo, WorldEntity *caster, float spellScale); bool ShouldRemoveModifiers(WorldEntity *target); void RefreshDamageCountAuraDiminished(WorldEntity *target, float refreshTo, WorldEntity *caster, DiminishingReturnAuraData::DiminishingReturnCategory diminsihingType, DamageCountAuraData *aura); void AddAuraDataToTarget(WorldEntity *target, AuraData *data); void AddAuraDataToTarget(WorldEntity *target, WorldEntity *caster, float duration, float spellScale); void AddOrRefreshDamageAuraDataToTarget(WorldEntity *target, WorldEntity *caster, float spellScale, float duration, float tick, int damage); void AddOrRefreshHealAuraDataToTarget(WorldEntity *target, WorldEntity *caster, float spellScale, float duration, float tick, int heal); void AddOrRefreshShieldAuraDataToTarget(WorldEntity *target, WorldEntity *caster, float spellScale, float duration, int absorb); void AddOrRefreshDiminishingReturnAura(WorldEntity *target, DiminishingReturnAuraData::DiminishingReturnCategory diminishingCategory); void AddStatModifier(WorldEntity *target, int stat, float maxMod, float percentMod); void RemoveStatModifier(WorldEntity *target, int stat); void AddState(WorldEntity *target, StateData::StateType state); void RemoveState(WorldEntity *target, StateData::StateType state); void RemovethisAura(WorldEntity *target); AuraData *TargetHasCastersAura(WorldEntity *target, WorldEntity *caster); AuraData *TargetHasAura(WorldEntity *target); int CalculateDamage(WorldEntity *caster, WorldEntity *target, float spellScale); int CalculateHeal(WorldEntity *caster, WorldEntity *target, float spellScale); int CalculateAbsorb(WorldEntity *caster, WorldEntity *target, float spellScale); void UpdateDamageCountAura(WorldEntity *target, AuraData *aura, int damage, float breakHealthPercent); bool UpdateDamageAura(WorldEntity *target, AuraData *data); bool UpdateDamageAuraTickBool(WorldEntity *target, AuraData *data); bool UpdateHealAura(WorldEntity *target, AuraData *data); void AbsorbPOnBeforeDamage(SpellDamageInfo *data, AuraData *aura); void DealDamage(WorldEntity *target, DamageAuraData *data); void DealDamage(WorldEntity *target, DamageAuraData *data, int damage); void DealDamage(WorldEntity *target, WorldEntity *caster, int damage); void DealDamageWithoutOnHit(WorldEntity *target, WorldEntity *caster, int damage); void Heal(WorldEntity *target, HealAuraData *data); void Heal(WorldEntity *target, HealAuraData *data, int heal); void Heal(WorldEntity *target, AuraData *data, int heal); DiminishingReturnAuraData *GetDiminishingReturnAuraDataFor(WorldEntity *target, DiminishingReturnAuraData::DiminishingReturnCategory type); float GetDiminishedTime(WorldEntity *target, DiminishingReturnAuraData::DiminishingReturnCategory diminsihingType, float time); void AddEffect(WorldEntity *player, EffectPoints bodyPart, Quaternion *rotation =); void AddEffect(WorldEntity *player, GameObject *effectPrefab, EffectPoints bodyPart, Quaternion *rotation =); void RemoveEffect(WorldEntity *player, EffectPoints bodyPart); void RemoveActiveGroupAuras(WorldEntity *target); float GetDiminishedTime(WorldEntity *target, DiminishingReturnAuraData *aura, float time); int GetAuraIdForDiminishingReturn(DiminishingReturnAuraData::DiminishingReturnCategory type); AuraData *getAuraData(WorldEntity *target, int pAuraId); void ApplyAura(int auraId, WorldEntity *caster, WorldEntity *target, float spellScale); bool IsZero(float x);*/ //generic // void ApplyEffect(Entity* target); // void RemoveEffect(Entity* target); // void ApplyModifiers(Entity* target); // void RemoveModifiers(Entity* target); // bool hasModifiers; protected: static void _bind_methods(); void _validate_property(PropertyInfo &property) const; private: enum { MAX_AURA_STATS = 5, //Increase if necessary, should be enough for now MAX_TRIGGER_DATA = 5, }; int id; String _aura_name; float time; int aura_group; Ref _icon; int ability_scale_data_id; bool _damage_enabled; int _damage_type; int _damage_min; int _damage_max; float _damage_tick; bool _damage_can_crit; Ref _damage_scaling_curve; bool _absorb_enabled; int _absorb_damage_type; int _absorb_min; int _absorb_max; Ref _absorb_scaling_curve; bool _heal_enabled; int _heal_min; int _heal_max; float _heal_tick; bool _heal_can_crit; Ref _heal_scaling_curve; int _add_states; int _remove_effects_with_states; int _supress_states; int _trigger_count; Ref _trigger_datas[MAX_TRIGGER_DATA]; int _aura_stat_attribute_count; Ref _aura_stat_attributes[MAX_AURA_STATS]; SpellEnums::DiminishingReturnCategory _diminishing_category; static const int DIMINISHING_RETURN_ROOT_AURA_ID = 1; static const int DIMINISHING_RETURN_TIME = 15; #if ENTITY_MEM_TOOLS static int allocs; #endif }; #endif