Core/Creatures: Changed the spawn health field in creature table to a percentage (#29801)

This commit is contained in:
Meji
2024-03-30 20:21:28 +01:00
committed by GitHub
parent d8a82ab909
commit def601b4ff
13 changed files with 185 additions and 95 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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 { }