mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 15:08:22 +00:00
[Regen] Implement Per Second HP Regen for NPCs (#2086)
* Implement NPC per second regen * Add hp_regen_per_second to ModifyNPCStat * Take per second regen the rest of the way * Add #npcedit hp_regen_per_second * Add db migration
This commit is contained in:
+15
-1
@@ -114,7 +114,8 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
npc_type_data->legtexture,
|
||||
npc_type_data->feettexture,
|
||||
npc_type_data->use_model,
|
||||
npc_type_data->always_aggro
|
||||
npc_type_data->always_aggro,
|
||||
npc_type_data->hp_regen_per_second
|
||||
),
|
||||
attacked_timer(CombatEventTimer_expire),
|
||||
swarm_timer(100),
|
||||
@@ -870,6 +871,12 @@ bool NPC::Process()
|
||||
}
|
||||
}
|
||||
|
||||
if (hp_regen_per_second > 0 && hp_regen_per_second_timer.Check()) {
|
||||
if (GetHP() < GetMaxHP()) {
|
||||
SetHP(GetHP() + hp_regen_per_second);
|
||||
}
|
||||
}
|
||||
|
||||
if (tic_timer.Check()) {
|
||||
parse->EventNPC(EVENT_TICK, this, nullptr, "", 0);
|
||||
BuffProcess();
|
||||
@@ -2594,6 +2601,10 @@ void NPC::ModifyNPCStat(const char *identifier, const char *new_value)
|
||||
hp_regen = atoi(val.c_str());
|
||||
return;
|
||||
}
|
||||
else if (id == "hp_regen_per_second") {
|
||||
hp_regen_per_second = strtoll(val.c_str(), nullptr, 10);
|
||||
return;
|
||||
}
|
||||
else if (id == "mana_regen") {
|
||||
mana_regen = atoi(val.c_str());
|
||||
return;
|
||||
@@ -2741,6 +2752,9 @@ float NPC::GetNPCStat(const char *identifier)
|
||||
else if (id == "hp_regen") {
|
||||
return hp_regen;
|
||||
}
|
||||
else if (id == "hp_regen_per_second") {
|
||||
return hp_regen_per_second;
|
||||
}
|
||||
else if (id == "mana_regen") {
|
||||
return mana_regen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user