From 060601afbeeeafdca0b29383f96ac74030c5c164 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 29 Jul 2020 14:31:41 +0200 Subject: [PATCH] Cleanup _sapply. --- data/auras/aura.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/data/auras/aura.cpp b/data/auras/aura.cpp index 13cfdf2..5312acb 100644 --- a/data/auras/aura.cpp +++ b/data/auras/aura.cpp @@ -967,8 +967,6 @@ String Aura::_get_description(const int class_level, const int character_level) void Aura::_sapply(Ref info) { ERR_FAIL_COND(info->target_get() == NULL || info->caster_get() == NULL || !info->get_aura().is_valid()); - Ref aura = info->get_aura(); - Ref ad = info->target_get()->aura_gets_by(info->caster_get(), _id); if (!ad.is_valid()) { @@ -979,10 +977,7 @@ void Aura::_sapply(Ref info) { Entity *owner = ad->get_owner(); for (int i = 0; i < _aura_stat_attribute_count; ++i) { - int stat_index = _aura_stat_attributes[i].stat; - owner->stat_mod_base(stat_index, _aura_stat_attributes[i].base_mod); - owner->stat_mod_bonus(stat_index, _aura_stat_attributes[i].bonus_mod); - owner->stat_mod_percent(stat_index, _aura_stat_attributes[i].percent_mod); + owner->stat_mod(_aura_stat_attributes[i].stat, _aura_stat_attributes[i].base_mod, _aura_stat_attributes[i].bonus_mod, _aura_stat_attributes[i].percent_mod); } if (_add_states != 0) { @@ -1007,10 +1002,7 @@ void Aura::_sdeapply(Ref data) { Entity *owner = data->get_owner(); for (int i = 0; i < _aura_stat_attribute_count; ++i) { - int stat_index = _aura_stat_attributes[i].stat; - owner->stat_mod_base(stat_index, -_aura_stat_attributes[i].base_mod); - owner->stat_mod_bonus(stat_index, -_aura_stat_attributes[i].bonus_mod); - owner->stat_mod_percent(stat_index, -_aura_stat_attributes[i].percent_mod); + owner->stat_mod(_aura_stat_attributes[i].stat, -_aura_stat_attributes[i].base_mod, -_aura_stat_attributes[i].bonus_mod, -_aura_stat_attributes[i].percent_mod); } if (_add_states != 0) { @@ -1127,7 +1119,7 @@ void Aura::_sapply_passives_damage_deal(Ref info) { void Aura::_calculate_initial_damage(Ref aura_data, Ref info) { int min_damage = damage_get_min(); int max_damage = damage_get_max(); - + Math::randomize(); int damage = min_damage + Math::rand() % (max_damage - min_damage); @@ -1164,7 +1156,7 @@ void Aura::_sapply_passives_heal_deal(Ref data) { void Aura::_calculate_initial_heal(Ref aura_data, Ref info) { int min_heal = heal_get_min(); int max_heal = heal_get_max(); - + Math::randomize(); int heal = min_heal + Math::rand() % (max_heal - min_heal);