aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeleqraph <nyrdeveloper@gmail.com>2023-08-14 00:38:23 +0200
committerGitHub <noreply@github.com>2023-08-14 00:38:23 +0200
commit0b70e7d2dc0aed641e76cd9ab577ce959f663c96 (patch)
tree205f88f739263867dce7c5d5211156901c1ad525 /src
parent95893cf53cdc9ab2ca3ec26cfd85793e63e97317 (diff)
Scripts/Spells: Implement Germination and Luxuriant Soil (#29178)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 70fe5014d81..6eb88b3e76d 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -22,8 +22,10 @@
*/
#include "ScriptMgr.h"
+#include "CellImpl.h"
#include "Containers.h"
#include "DB2Stores.h"
+#include "GridNotifiersImpl.h"
#include "Player.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
@@ -72,6 +74,7 @@ enum DruidSpells
SPELL_DRUID_FORMS_TRINKET_NONE = 37344,
SPELL_DRUID_FORMS_TRINKET_TREE = 37342,
SPELL_DRUID_GALACTIC_GUARDIAN_AURA = 213708,
+ SPELL_DRUID_GERMINATION = 155675,
SPELL_DRUID_GLYPH_OF_STARS = 114301,
SPELL_DRUID_GLYPH_OF_STARS_VISUAL = 114302,
SPELL_DRUID_GORE_PROC = 93622,
@@ -91,6 +94,8 @@ enum DruidSpells
SPELL_DRUID_MASS_ENTANGLEMENT = 102359,
SPELL_DRUID_MOONFIRE_DAMAGE = 164812,
SPELL_DRUID_PROWL = 5215,
+ SPELL_DRUID_REJUVENATION = 774,
+ SPELL_DRUID_REJUVENATION_GERMINATION = 155777,
SPELL_DRUID_REJUVENATION_T10_PROC = 70691,
SPELL_DRUID_RESTORATION_T10_2P_BONUS = 70658,
SPELL_DRUID_SAVAGE_ROAR = 62071,
@@ -733,6 +738,48 @@ class spell_dru_galactic_guardian : public AuraScript
}
};
+// 774 - Rejuvenation
+class spell_dru_germination : public SpellScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_DRUID_REJUVENATION, SPELL_DRUID_GERMINATION, SPELL_DRUID_REJUVENATION_GERMINATION });
+ }
+
+ void PickRejuvenationVariant(WorldObject*& target) const
+ {
+ Unit* caster = GetCaster();
+
+ // Germination talent.
+ if (caster->HasAura(SPELL_DRUID_GERMINATION))
+ {
+ Unit* unitTarget = target->ToUnit();
+ Aura* rejuvenationAura = unitTarget->GetAura(SPELL_DRUID_REJUVENATION, caster->GetGUID());
+ Aura* germinationAura = unitTarget->GetAura(SPELL_DRUID_REJUVENATION_GERMINATION, caster->GetGUID());
+
+ // if target doesn't have Rejuventation, cast passes through.
+ if (!rejuvenationAura)
+ return;
+
+ // if target has Rejuvenation, but not Germination, or Germination has lower remaining duration than Rejuvenation, then cast Germination
+ if (germinationAura && germinationAura->GetDuration() >= rejuvenationAura->GetDuration())
+ return;
+
+ caster->CastSpell(target, SPELL_DRUID_REJUVENATION_GERMINATION,
+ CastSpellExtraArgs(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR)
+ .SetTriggeringSpell(GetSpell()));
+
+ // prevent aura refresh (but cast must still happen to consume mana)
+ target = nullptr;
+ }
+ }
+
+ void Register() override
+ {
+ OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_dru_germination::PickRejuvenationVariant, EFFECT_0, TARGET_UNIT_TARGET_ALLY);
+ }
+};
+
// 24858 - Moonkin Form
class spell_dru_glyph_of_stars : public AuraScript
{
@@ -968,6 +1015,44 @@ class spell_dru_lunar_inspiration : public AuraScript
}
};
+// 392315 - Luxuriant Soil
+class spell_dru_luxuriant_soil : public AuraScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_DRUID_REJUVENATION });
+ }
+
+ static bool CheckProc(AuraEffect const* aurEff, ProcEventInfo const& /*eventInfo*/)
+ {
+ return roll_chance_i(aurEff->GetAmount());
+ }
+
+ void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo) const
+ {
+ Unit* rejuvCaster = GetTarget();
+
+ // let's use the ProcSpell's max. range.
+ 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::UnitListSearcher searcher(rejuvCaster, targetList, check);
+ Cell::VisitAllObjects(rejuvCaster, searcher, spellRange);
+
+ if (targetList.empty())
+ return;
+
+ rejuvCaster->CastSpell(Trinity::Containers::SelectRandomContainerElement(targetList), SPELL_DRUID_REJUVENATION, TRIGGERED_IGNORE_GCD | TRIGGERED_IGNORE_POWER_AND_REAGENT_COST | TRIGGERED_IGNORE_CAST_IN_PROGRESS);
+ }
+
+ void Register() override
+ {
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_dru_luxuriant_soil::CheckProc, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectProc += AuraEffectProcFn(spell_dru_luxuriant_soil::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+};
+
// 8921 - Moonfire
class spell_dru_moonfire : public SpellScript
{
@@ -1791,6 +1876,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_ferocious_bite);
RegisterSpellScript(spell_dru_forms_trinket);
RegisterSpellScript(spell_dru_galactic_guardian);
+ RegisterSpellScript(spell_dru_germination);
RegisterSpellScript(spell_dru_glyph_of_stars);
RegisterSpellScript(spell_dru_gore);
RegisterSpellScript(spell_dru_incapacitating_roar);
@@ -1800,6 +1886,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_item_t6_trinket);
RegisterSpellScript(spell_dru_lifebloom);
RegisterSpellScript(spell_dru_lunar_inspiration);
+ RegisterSpellScript(spell_dru_luxuriant_soil);
RegisterSpellScript(spell_dru_moonfire);
RegisterSpellScript(spell_dru_omen_of_clarity);
RegisterSpellScript(spell_dru_prowl);