mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Ahnkahet: rescript Ahn'kahar Spell Flinger SAI + spell scripts + spelldifficulty_dbc entries
This commit is contained in:
20
sql/updates/world/3.3.5/2021_08_19_01_world.sql
Normal file
20
sql/updates/world/3.3.5/2021_08_19_01_world.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Ahn'kahar Spell Flinger
|
||||
SET @ENTRY := 30278;
|
||||
DELETE FROM `smart_scripts` WHERE `entryOrGuid` = @ENTRY AND `source_type` = 0;
|
||||
UPDATE `creature_template` SET `AIName` = "SmartAI", `ScriptName` = "" WHERE `entry` = @ENTRY;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 1000, 2000, 23000, 27000, 11, 56698, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 23 - 27 seconds (1 - 2s initially) - Self: Cast spell Shadow Blast (56698) on Victim (flags: combat move)"),
|
||||
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 5000, 8000, 13000, 16000, 11, 56702, 64, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Every 13 - 16 seconds (5 - 8s initially) - Self: Cast spell Shadow Sickle (56702) on Self (flags: combat move)");
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (56698, 59102, 56702, 59103);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(56698, 'spell_shadow_blast'),
|
||||
(59102, 'spell_shadow_blast'),
|
||||
(56702, 'spell_shadow_sickle'),
|
||||
(59103, 'spell_shadow_sickle');
|
||||
|
||||
DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (56698, 56701, 56702);
|
||||
INSERT INTO `spelldifficulty_dbc` (`id`, `spellid0`, `spellid1`) VALUES
|
||||
(56698, 56698, 59102),
|
||||
(56701, 56701, 59104),
|
||||
(56702, 56702, 59103);
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user