[Bots] Cleanup Fast Rest Regen (#2626)

This commit is contained in:
Aeadoin 2022-12-07 17:21:50 -05:00 committed by GitHub
parent 88e8b25fa1
commit 86af0f0759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 38 deletions

View File

@ -2147,16 +2147,12 @@ bool Bot::Process()
SpellProcess();
if(tic_timer.Check()) {
if (tic_timer.Check()) {
// 6 seconds, or whatever the rule is set to has passed, send this position to everyone to avoid ghosting
if(!IsMoving() && !IsEngaged()) {
if(IsSitting()) {
if (!rest_timer.Enabled()) {
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
if (!IsEngaged()) {
if (!rest_timer.Enabled()) {
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
}
@ -2277,25 +2273,21 @@ void Bot::SpellProcess() {
}
void Bot::BotMeditate(bool isSitting) {
if(isSitting) {
if(GetManaRatio() < 99.0f || GetHPRatio() < 99.0f) {
if (!IsEngaged() && !IsSitting())
if (isSitting) {
if (GetManaRatio() < 99.0f || GetHPRatio() < 99.0f) {
if (!IsEngaged() && !IsSitting()) {
Sit();
}
} else {
if(IsSitting())
if (IsSitting()) {
Stand();
}
}
} else {
if(IsSitting())
if (IsSitting()) {
Stand();
}
}
if(IsSitting()) {
if(!rest_timer.Enabled())
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
else
rest_timer.Disable();
}
void Bot::BotRangedAttack(Mob* other) {

View File

@ -1269,13 +1269,11 @@ bool Merc::Process()
if(tic_timer.Check())
{
//6 seconds, or whatever the rule is set to has passed, send this position to everyone to avoid ghosting
if(!IsMoving() && !IsEngaged())
if (!IsEngaged())
{
SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0);
if(IsSitting()) {
if(!rest_timer.Enabled()) {
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
if (!rest_timer.Enabled()) {
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
}
@ -4305,33 +4303,27 @@ void Merc::MercMeditate(bool isSitting) {
{
return;
}
if(isSitting) {
if (isSitting) {
// If the merc is a caster and has less than 99% mana while its not engaged, he needs to sit to meditate
if(GetManaRatio() < 99.0f)
if (GetManaRatio() < 99.0f)
{
if(!IsSitting())
if(!IsSitting()) {
Sit();
}
}
else
{
if(IsSitting())
if (IsSitting()) {
Stand();
}
}
}
else
{
if(IsSitting())
if (IsSitting()) {
Stand();
}
if(IsSitting()) {
if(!rest_timer.Enabled()) {
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
}
}
else {
rest_timer.Disable();
}
}