diff options
| author | Meji <alvaro.megias@outlook.com> | 2024-03-30 20:21:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-30 20:21:28 +0100 |
| commit | def601b4ff82ec8a90af60408a87cac92fdf070d (patch) | |
| tree | 4e5de744a4712a49b1126b8270ac02d842d56e32 /src/server/scripts | |
| parent | d8a82ab909543259be7632bb1e1b256ed6bfa4c2 (diff) | |
Core/Creatures: Changed the spawn health field in creature table to a percentage (#29801)
Diffstat (limited to 'src/server/scripts')
5 files changed, 33 insertions, 14 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index ed6e2014ead..86686a52ac2 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -290,9 +290,8 @@ public: return false; } - creature->SetMaxHealth(100 + 30*lvl); - creature->SetHealth(100 + 30*lvl); creature->SetLevel(lvl); + creature->UpdateLevelDependantStats(); creature->SaveToDB(); return true; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index ee9e3cb1d07..48844dc0aa9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -84,6 +84,7 @@ struct boss_vaelastrasz : public BossAI { _Reset(); + me->SetSpawnHealth(); me->SetStandState(UNIT_STAND_STATE_DEAD); Initialize(); } @@ -93,7 +94,6 @@ struct boss_vaelastrasz : public BossAI BossAI::JustEngagedWith(who); DoCast(me, SPELL_ESSENCEOFTHERED); - me->SetHealth(me->CountPctFromMaxHealth(30)); // now drop damage requirement to be able to take loot me->ResetPlayerDamageReq(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 3b9e0f2b8de..aa44e6bb7a7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -275,19 +275,10 @@ struct boss_valithria_dreamwalker : public ScriptedAI _done = false; } - void InitializeAI() override - { - if (CreatureData const* data = me->GetCreatureData()) - if (data->curhealth) - _spawnHealth = data->curhealth; - - ScriptedAI::InitializeAI(); - } - void Reset() override { _events.Reset(); - me->SetHealth(_spawnHealth); + me->SetSpawnHealth(); me->SetReactState(REACT_PASSIVE); me->LoadCreaturesAddon(); // immune to percent heals diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index ff12c258c5e..8486d30ca9a 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5317,6 +5317,32 @@ class spell_gen_random_aggro_taunt : public SpellScript } }; +// 24931 - 100 Health +// 24959 - 500 Health +// 28838 - 1 Health +// 43645 - 1 Health +// 73342 - 1 Health +// 86562 - 1 Health +class spell_gen_set_health : public SpellScript +{ +public: + spell_gen_set_health(uint64 health) : _health(health) { } + + void HandleHit(SpellEffIndex /*effIndex*/) + { + if (GetHitUnit()->IsAlive() && _health > 0) + GetHitUnit()->SetHealth(_health); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_set_health::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + +private: + uint64 _health; +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_gen_absorb0_hitlimit1); @@ -5493,4 +5519,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_major_healing_cooldown_modifier); RegisterSpellScript(spell_gen_major_healing_cooldown_modifier_aura); RegisterSpellScript(spell_gen_random_aggro_taunt); + RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_1", 1); + RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_100", 100); + RegisterSpellScriptWithArgs(spell_gen_set_health, "spell_gen_set_health_500", 500); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index a3db8c19c6b..d2294bbd2b7 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1005,7 +1005,7 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); // expect database to have RegenHealth=0 - me->SetHealth(me->CountPctFromMaxHealth(70)); + me->SetSpawnHealth(); } void JustEngagedWith(Unit* /*who*/) override { } |
