diff options
author | Teleqraph <nyrdeveloper@gmail.com> | 2023-08-19 15:34:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-19 15:34:53 +0200 |
commit | 2101c1079f20b322a0c7a6293a4142ab617c6b4d (patch) | |
tree | 54875df5efa4c50ad71fa9d295283b402dd5e005 | |
parent | 0612e3ef4d4afd1b4058ccc1450406ed7be85ba2 (diff) |
Scripts/Spells: Update Wild Growth (#29173)
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 6eb88b3e76d..b2dff1985ea 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -114,23 +114,6 @@ enum DruidSpells SPELL_DRUID_YSERAS_GIFT_HEAL_SELF = 145109 }; -class RaidCheck -{ -public: - explicit RaidCheck(Unit const* caster) : _caster(caster) { } - - bool operator()(WorldObject* obj) const - { - if (Unit* target = obj->ToUnit()) - return !_caster->IsInRaidWith(target); - - return true; - } - -private: - Unit const* _caster; -}; - // 774 - Rejuvenation // 155777 - Rejuventation (Germination) class spell_dru_abundance : public AuraScript @@ -1764,18 +1747,14 @@ class spell_dru_wild_growth : public SpellScript void FilterTargets(std::list<WorldObject*>& targets) const { - targets.remove_if(RaidCheck(GetCaster())); - - uint32 maxTargets = uint32(GetEffectInfo(EFFECT_1).CalcValue(GetCaster())); + Unit* caster = GetCaster(); + int32 maxTargets = GetEffectInfo(EFFECT_1).CalcValue(caster); - if (AuraEffect const* treeOfLife = GetCaster()->GetAuraEffect(SPELL_DRUID_TREE_OF_LIFE, EFFECT_2)) - maxTargets += uint32(treeOfLife->GetAmount()); + if (AuraEffect const* treeOfLife = caster->GetAuraEffect(SPELL_DRUID_TREE_OF_LIFE, EFFECT_2)) + maxTargets += treeOfLife->GetAmount(); - if (targets.size() > maxTargets) - { - targets.sort(Trinity::HealthPctOrderPred()); - targets.resize(maxTargets); - } + // Note: Wild Growth became a smart heal which prioritizes players and their pets in their group before any unit outside their group. + Trinity::SelectRandomInjuredTargets(targets, maxTargets, true, caster); } void Register() override |