diff --git a/data/sql/updates/pending_db_world/rev_1732070236293413533.sql b/data/sql/updates/pending_db_world/rev_1732070236293413533.sql new file mode 100644 index 000000000..ba7f70206 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1732070236293413533.sql @@ -0,0 +1,38 @@ +-- +-- NPC_LYNX +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 24143) AND (`source_type` = 0) AND (`id` IN (4,5)); +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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(24143, 0, 4, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 43615, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Spirit of the Lynx - On Just Summoned - Cast \'Halazzi Transform\''), +(24143, 0, 5, 0, 0, 0, 100, 0, 2000, 5000, 0, 0, 0, 0, 11, 42466, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Spirit of the Lynx - In Combat - Cast \'Cosmetic - Zul`Aman Spirit Effect\''); + +-- merge if lynx <20% hp +UPDATE `smart_scripts` SET `event_param1` = 0, `comment` = 'Spirit of the Lynx - Between 0-20% Health - Do Action ID 0' WHERE (`entryorguid` = 24143) AND (`source_type` = 0) AND (`id` = 3); + +-- 43615 Halazzi Transform +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 1) AND (`SourceEntry` = 43615) AND (`ConditionTypeOrReference` = 31); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 43615, 0, 0, 31, 0, 3, 23577, 0, 0, 0, 0, '', 'Target Halazzi'); + +-- server side SetHealth spells +UPDATE `spell_dbc` SET `ImplicitTargetA_1`=1, `Effect_1`=77, `EffectBasePoints_1`=74, `EffectDieSides_1`=1, `Name_Lang_enUS`='SetHealth (75%)' WHERE `ID`=43536; +UPDATE `spell_dbc` SET `ImplicitTargetA_1`=1, `Effect_1`=77, `EffectBasePoints_1`=49, `EffectDieSides_1`=1, `Name_Lang_enUS`='SetHealth (50%)' WHERE `ID`=43537; +UPDATE `spell_dbc` SET `ImplicitTargetA_1`=1, `Effect_1`=77, `EffectBasePoints_1`=24, `EffectDieSides_1`=1, `Name_Lang_enUS`='SetHealth (25%)' WHERE `ID`=43538; + +DELETE FROM `spell_script_names` WHERE `spell_id` IN (43536, 43537, 43538) AND `ScriptName`='spell_gen_set_health'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(43536, 'spell_gen_set_health'), +(43537, 'spell_gen_set_health'), +(43538, 'spell_gen_set_health'); + +-- copy all the lynx text to human text +DELETE FROM `creature_text` WHERE (`CreatureID` = 24144); +INSERT INTO `creature_text` VALUES +(24144, 0, 0, 'Get on ya knees and bow.... to da fang and claw!', 14, 0, 100, 0, 0, 12020, 23612, 0, 'Halazzi - SAY_AGGRO'), +(24144, 1, 0, 'You can fight da power!', 14, 0, 100, 0, 0, 12026, 0, 0, 'Halazzi - SAY_KILL'), +(24144, 1, 1, 'Ya all gonna fail!', 14, 0, 100, 0, 0, 12027, 23614, 0, 'Halazzi - SAY_KILL'), +(24144, 2, 0, 'Me gonna carve ya now!', 14, 0, 100, 0, 0, 12023, 23615, 0, 'Halazzi - SAY_SABER'), +(24144, 2, 1, 'You gonna leave in pieces!', 14, 0, 100, 0, 0, 12024, 23616, 0, 'Halazzi - SAY_SABER'), +(24144, 3, 0, 'I fight wit untamed spirit....', 14, 0, 100, 0, 0, 12021, 0, 0, 'Halazzi - SAY_SPLIT'), +(24144, 4, 0, 'Spirit, come back to me!', 14, 0, 100, 0, 0, 12022, 22964, 0, 'Halazzi - SAY_MERGE'), +(24144, 5, 0, 'Chaga... chokajinn.', 14, 0, 100, 0, 0, 12028, 0, 0, 'Halazzi - SAY_DEATH'); + diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 4524cd4a7..ca4ec88d5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -27,56 +27,61 @@ enum Spells SPELL_FRENZY = 43139, SPELL_FLAMESHOCK = 43303, SPELL_EARTHSHOCK = 43305, - SPELL_TRANSFORM_SPLIT = 43142, - SPELL_TRANSFORM_SPLIT2 = 43573, - SPELL_TRANSFORM_MERGE = 43271, SPELL_SUMMON_LYNX = 43143, SPELL_SUMMON_TOTEM = 43302, SPELL_BERSERK = 45078, SPELL_LYNX_FRENZY = 43290, // Used by Spirit Lynx - SPELL_SHRED_ARMOR = 43243 // Used by Spirit Lynx + SPELL_SHRED_ARMOR = 43243, // Used by Spirit Lynx + SPELL_TRANSFORM_DUMMY = 43615, // Used by Spirit Lynx + + SPELL_TRANSFIGURE = 44054, + SPELL_TRANSFORM_TO_LYNX_75 = 43145, + SPELL_TRANSFORM_TO_LYNX_50 = 43271, + SPELL_TRANSFORM_TO_LYNX_25 = 43272 }; enum UniqueEvents { - EVENT_BERSERK = 0 + EVENT_BERSERK = 0 }; enum Hal_CreatureIds { - NPC_TOTEM = 24224 + NPC_HALAZZI_TROLL = 24144, // dummy creature - used to update model, stats + NPC_TOTEM = 24224 }; enum PhaseHalazzi { - PHASE_NONE = 0, - PHASE_LYNX = 1, - PHASE_SPLIT = 2, - PHASE_HUMAN = 3, - PHASE_MERGE = 4, - PHASE_ENRAGE = 5 + PHASE_NONE = 0, + PHASE_LYNX = 1, + PHASE_SPLIT = 2, + PHASE_HUMAN = 3, + PHASE_MERGE = 4, + PHASE_ENRAGE = 5 }; enum Yells { - SAY_AGGRO = 0, - SAY_KILL = 1, - SAY_SABER = 2, - SAY_SPLIT = 3, - SAY_MERGE = 4, - SAY_DEATH = 5 + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_SABER = 2, + SAY_SPLIT = 3, + SAY_MERGE = 4, + SAY_DEATH = 5 }; enum Groups { - GROUP_LYNX = 0, - GROUP_HUMAN = 1, - GROUP_MERGE = 2 + GROUP_LYNX = 0, + GROUP_HUMAN = 1, + GROUP_MERGE = 3, + GROUP_SPLIT = 4 }; enum Actions { - ACTION_MERGE = 0 + ACTION_MERGE = 0 }; struct boss_halazzi : public BossAI @@ -91,15 +96,12 @@ struct boss_halazzi : public BossAI void Reset() override { + me->UpdateEntry(NPC_HALAZZI); BossAI::Reset(); _transformCount = 0; - _healthCheckPercentage = 0; _phase = PHASE_NONE; - _lynxFormHealth = me->GetMaxHealth(); - _healthPortion = _lynxFormHealth/4; - _humanFormHealth = (me->GetMaxHealth())/0.66666666; EnterPhase(PHASE_LYNX); - DoCastSelf(SPELL_DUAL_WIELD, true); + SetInvincibility(true); } void JustSummoned(Creature* summon) override @@ -120,30 +122,27 @@ struct boss_halazzi : public BossAI EnterPhase(PHASE_LYNX); } - void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override { - if (damage >= me->GetHealth() && _phase != PHASE_ENRAGE) - damage = 0; - else + BossAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask); + + if (_phase == PHASE_LYNX || _phase == PHASE_ENRAGE) { - if (_phase == PHASE_LYNX || _phase == PHASE_ENRAGE) - { - _healthCheckPercentage = 25 * (3 - _transformCount); - if (!HealthAbovePct(_healthCheckPercentage)) - EnterPhase(PHASE_SPLIT); - } - else if (_phase == PHASE_HUMAN) - { - if (!HealthAbovePct(20)) - EnterPhase(PHASE_MERGE); - } + uint32 _healthCheckPercentage = 25 * (3 - _transformCount); + if (!HealthAbovePct(_healthCheckPercentage)) + EnterPhase(PHASE_SPLIT); + } + else if (_phase == PHASE_HUMAN) + { + if (!HealthAbovePct(20)) + EnterPhase(PHASE_MERGE); } } void SpellHit(Unit*, SpellInfo const* spell) override { - if (spell->Id == SPELL_TRANSFORM_SPLIT2) - EnterPhase(PHASE_HUMAN); + if (spell->Id == SPELL_TRANSFORM_DUMMY) + me->UpdateEntry(NPC_HALAZZI_TROLL); } void AttackStart(Unit* who) override @@ -156,17 +155,42 @@ struct boss_halazzi : public BossAI { switch (nextPhase) { - case PHASE_LYNX: case PHASE_ENRAGE: + SetInvincibility(false); + scheduler.Schedule(12s, GROUP_LYNX, [this](TaskContext context) + { + DoCastSelf(SPELL_SUMMON_TOTEM); + context.Repeat(20s); + }); + [[fallthrough]]; + case PHASE_LYNX: + { if (_phase == PHASE_MERGE) { - DoCastSelf(SPELL_TRANSFORM_MERGE, true); - me->RemoveAurasDueToSpell(SPELL_TRANSFORM_SPLIT2); + DoCastSelf(SPELL_TRANSFIGURE, true); me->ResumeChasingVictim(); } summons.DespawnAll(); - me->SetMaxHealth(_lynxFormHealth); - me->SetHealth(_lynxFormHealth - _healthPortion * _transformCount); + + if (_transformCount) + { + me->UpdateEntry(NPC_HALAZZI); + switch (_transformCount) + { + case 1: + DoCastSelf(SPELL_TRANSFORM_TO_LYNX_75, true); + break; + case 2: + DoCastSelf(SPELL_TRANSFORM_TO_LYNX_50, true); + break; + case 3: + DoCastSelf(SPELL_TRANSFORM_TO_LYNX_25, true); + break; + default: + break; + } + } + scheduler.CancelGroup(GROUP_MERGE); scheduler.Schedule(16s, GROUP_LYNX, [this](TaskContext context) { @@ -179,15 +203,18 @@ struct boss_halazzi : public BossAI context.Repeat(30s); }); break; + } case PHASE_SPLIT: Talk(SAY_SPLIT); - DoCastSelf(SPELL_TRANSFORM_SPLIT, true); - break; + DoCastSelf(SPELL_TRANSFIGURE, true); + scheduler.Schedule(3s, GROUP_SPLIT, [this](TaskContext /*context*/) + { + DoCastSelf(SPELL_SUMMON_LYNX, true); + }); + nextPhase = PHASE_HUMAN; + [[fallthrough]]; case PHASE_HUMAN: scheduler.CancelGroup(GROUP_MERGE); - DoCastSelf(SPELL_SUMMON_LYNX, true); - me->SetMaxHealth(_humanFormHealth); - me->SetHealth(_humanFormHealth); scheduler.CancelGroup(GROUP_LYNX); scheduler.Schedule(10s, GROUP_HUMAN, [this](TaskContext context) { @@ -255,11 +282,7 @@ struct boss_halazzi : public BossAI Talk(SAY_DEATH); } private: - uint32 _lynxFormHealth; - uint32 _humanFormHealth; - uint32 _healthPortion; uint8 _transformCount; - uint32 _healthCheckPercentage; PhaseHalazzi _phase; }; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index cd916620e..04986c8c6 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5298,6 +5298,28 @@ class spell_gen_steal_weapon : public AuraScript } }; +// 43536 - Serverside - SetHealth (75%) +// 43537 - Serverside - SetHealth (50%) +// 43538 - Serverside - SetHealth (25%) +class spell_gen_set_health : public SpellScript +{ + PrepareSpellScript(spell_gen_set_health); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + uint32 value = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + target->SetHealth(target->CountPctFromMaxHealth(value)); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_set_health::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_silithyst); @@ -5455,4 +5477,5 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_consumption); RegisterSpellScript(spell_gen_sober_up); RegisterSpellScript(spell_gen_steal_weapon); + RegisterSpellScript(spell_gen_set_health); }