aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/master/2023_08_20_01_world.sql8
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp53
2 files changed, 60 insertions, 1 deletions
diff --git a/sql/updates/world/master/2023_08_20_01_world.sql b/sql/updates/world/master/2023_08_20_01_world.sql
new file mode 100644
index 00000000000..5fda07ff0c5
--- /dev/null
+++ b/sql/updates/world/master/2023_08_20_01_world.sql
@@ -0,0 +1,8 @@
+DELETE FROM `spell_proc` WHERE `SpellId` IN (392302, 392303);
+INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
+(392302,0x00,7,0x00000000,0x04000000,0x00000000,0x00000000,0x0,0x0,0x4,0x4,0x1,0x0,0x0,0,0,0,0), -- Power of the Archdruid
+(392303,0x00,7,0x00000050,0x00000000,0x00000000,0x00000000,0x0,0x0,0x0,0x2,0x403,0x0,0x0,0,0,0,0); -- Power of the Archdruid
+
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dru_power_of_the_archdruid');
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(392303, 'spell_dru_power_of_the_archdruid');
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 2c7a177105a..a9973bbf925 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -26,6 +26,7 @@
#include "Containers.h"
#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
@@ -95,6 +96,7 @@ enum DruidSpells
SPELL_DRUID_MANGLE = 33917,
SPELL_DRUID_MASS_ENTANGLEMENT = 102359,
SPELL_DRUID_MOONFIRE_DAMAGE = 164812,
+ SPELL_DRUID_POWER_OF_THE_ARCHDRUID = 392302,
SPELL_DRUID_PROWL = 5215,
SPELL_DRUID_REJUVENATION = 774,
SPELL_DRUID_REJUVENATION_GERMINATION = 155777,
@@ -1086,7 +1088,7 @@ class spell_dru_luxuriant_soil : public AuraScript
float spellRange = eventInfo.GetSpellInfo()->GetMaxRange();
std::vector<Unit*> targetList;
- Trinity::WorldObjectSpellNearbyTargetCheck check(spellRange, rejuvCaster, eventInfo.GetSpellInfo(), TARGET_CHECK_ALLY, nullptr, TARGET_OBJECT_TYPE_UNIT);
+ Trinity::WorldObjectSpellAreaTargetCheck check(spellRange, rejuvCaster, rejuvCaster, rejuvCaster, eventInfo.GetSpellInfo(), TARGET_CHECK_ALLY, nullptr, TARGET_OBJECT_TYPE_UNIT);
Trinity::UnitListSearcher searcher(rejuvCaster, targetList, check);
Cell::VisitAllObjects(rejuvCaster, searcher, spellRange);
@@ -1143,6 +1145,54 @@ class spell_dru_omen_of_clarity : public AuraScript
}
};
+// 392303 - Power of the Archdruid
+class spell_dru_power_of_the_archdruid : public AuraScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_DRUID_POWER_OF_THE_ARCHDRUID, EFFECT_0 } });
+ }
+
+ static bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo)
+ {
+ return eventInfo.GetActor()->HasAuraEffect(SPELL_DRUID_POWER_OF_THE_ARCHDRUID, EFFECT_0);
+ }
+
+ static void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
+ {
+ Unit* druid = eventInfo.GetActor();
+ Unit const* procTarget = eventInfo.GetActionTarget();
+
+ // range is EFFECT_0's BasePoints.
+ float spellRange = aurEff->GetAmount();
+
+ std::vector<Unit*> targetList;
+ Trinity::WorldObjectSpellAreaTargetCheck checker(spellRange, procTarget, druid, druid, eventInfo.GetSpellInfo(), TARGET_CHECK_ALLY, nullptr, TARGET_OBJECT_TYPE_UNIT);
+ Trinity::UnitListSearcher searcher(procTarget, targetList, checker);
+ Cell::VisitAllObjects(procTarget, searcher, spellRange);
+ std::erase(targetList, procTarget);
+
+ if (targetList.empty())
+ return;
+
+ AuraEffect const* powerOfTheArchdruidEffect = druid->GetAuraEffect(SPELL_DRUID_POWER_OF_THE_ARCHDRUID, EFFECT_0);
+
+ // max. targets is SPELL_DRUID_POWER_OF_THE_ARCHDRUID's EFFECT_0 BasePoints.
+ int32 maxTargets = powerOfTheArchdruidEffect->GetAmount();
+
+ Trinity::Containers::RandomResize(targetList, maxTargets);
+
+ for (Unit* chosenTarget : targetList)
+ druid->CastSpell(chosenTarget, eventInfo.GetProcSpell()->GetSpellInfo()->Id, aurEff);
+ }
+
+ void Register() override
+ {
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_dru_power_of_the_archdruid::CheckProc, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectProc += AuraEffectProcFn(spell_dru_power_of_the_archdruid::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+};
+
// 5215 - Prowl
class spell_dru_prowl : public spell_dru_base_transformer
{
@@ -1958,6 +2008,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_luxuriant_soil);
RegisterSpellScript(spell_dru_moonfire);
RegisterSpellScript(spell_dru_omen_of_clarity);
+ RegisterSpellScript(spell_dru_power_of_the_archdruid);
RegisterSpellScript(spell_dru_prowl);
RegisterSpellScript(spell_dru_rip);
RegisterSpellAndAuraScriptPair(spell_dru_savage_roar, spell_dru_savage_roar_aura);