Merge pull request #966 from noudess/master

Idle NPC mana regen
This commit is contained in:
Michael Cook (mackal) 2020-02-05 21:17:23 -05:00 committed by GitHub
commit 2db47adf7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -526,6 +526,7 @@ RULE_INT(NPC, NPCGatePercent, 20, "% at which the NPC Will attempt to gate at")
RULE_BOOL(NPC, NPCGateNearBind, false, "Will NPC attempt to gate when near bind location?")
RULE_INT(NPC, NPCGateDistanceBind, 75, "Distance from bind before NPC will attempt to gate")
RULE_BOOL(NPC, NPCHealOnGate, true, "Will the NPC Heal on Gate")
RULE_BOOL(NPC, UseMeditateBasedManaRegen, false, "Based NPC ooc regen on Meditate skill")
RULE_REAL(NPC, NPCHealOnGateAmount, 25, "How much the npc will heal on gate if enabled")
RULE_CATEGORY_END()

View File

@ -778,7 +778,20 @@ bool NPC::Process()
}
if (GetMana() < GetMaxMana()) {
SetMana(GetMana() + mana_regen + npc_sitting_regen_bonus);
if (RuleB(NPC, UseMeditateBasedManaRegen)) {
int32 npc_idle_mana_regen_bonus = 2;
uint16 meditate_skill = GetSkill(EQEmu::skills::SkillMeditate);
if (!IsEngaged() && meditate_skill > 0) {
uint8 clevel = GetLevel();
npc_idle_mana_regen_bonus =
(((meditate_skill / 10) +
(clevel - (clevel / 4))) / 4) + 4;
}
SetMana(GetMana() + mana_regen + npc_idle_mana_regen_bonus);
}
else {
SetMana(GetMana() + mana_regen + npc_sitting_regen_bonus);
}
}
SendHPUpdate();
@ -3195,4 +3208,4 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
}
}
}
}