Scripts/Ahnkahet: rescript Ahn'kahar Spell Flinger SAI + spell scripts + spelldifficulty_dbc entries

This commit is contained in:
ccrs
2021-08-19 18:20:50 +02:00
parent 50ab4254a3
commit 57fe05f270
3 changed files with 75 additions and 0 deletions

View File

@@ -78,6 +78,11 @@ enum AKGameObjectIds
GO_SPHERE_2 = 193094
};
enum AKSpellIds
{
SPELL_SHADOW_SICKLE_TRIGGERED = 56701,
};
template <class AI, class T>
inline AI* GetAhnKahetAI(T* obj)
{

View File

@@ -24,6 +24,7 @@
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "SpellMgr.h"
DoorData const doorData[] =
{
@@ -169,6 +170,55 @@ class spell_combined_toxins : public AuraScript
}
};
// 56698, 59102 - Shadow Blast
class spell_shadow_blast : public SpellScript
{
PrepareSpellScript(spell_shadow_blast);
void HandleDamageCalc(SpellEffIndex effIndex)
{
Unit* target = GetHitUnit();
if (!target)
return;
SetHitDamage(target->GetMaxHealth() * GetSpellInfo()->Effects[effIndex].BasePoints / 100);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_shadow_blast::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
// 56702, 59103 - Shadow Sickle
class spell_shadow_sickle : public AuraScript
{
PrepareAuraScript(spell_shadow_sickle);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SHADOW_SICKLE_TRIGGERED });
}
void HandlePeriodic(AuraEffect const* aurEff)
{
Unit* owner = GetUnitOwner();
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SHADOW_SICKLE_TRIGGERED, owner);
if (!spellId)
return;
if (owner->IsAIEnabled())
if (Unit* target = owner->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 40.f))
owner->CastSpell(target, spellId, CastSpellExtraArgs(aurEff).SetTriggerFlags(TriggerCastFlags::TRIGGERED_FULL_MASK));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_sickle::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_instance_ahnkahet()
{
new instance_ahnkahet();