mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Refactor cfp to currently_fleeing for readability
This commit is contained in:
parent
53c8d63981
commit
624c7341c5
@ -2286,7 +2286,7 @@ bool Bot::Process() {
|
||||
|
||||
BuffProcess();
|
||||
CalcRestState();
|
||||
if(curfp)
|
||||
if(currently_fleeing)
|
||||
ProcessFlee();
|
||||
|
||||
if(GetHP() < GetMaxHP())
|
||||
|
||||
@ -33,7 +33,7 @@ extern Zone* zone;
|
||||
//this is called whenever we are damaged to process possible fleeing
|
||||
void Mob::CheckFlee() {
|
||||
//if were allready fleeing, dont need to check more...
|
||||
if(flee_mode && curfp)
|
||||
if(flee_mode && currently_fleeing)
|
||||
return;
|
||||
|
||||
//dont bother if we are immune to fleeing
|
||||
@ -101,7 +101,7 @@ void Mob::ProcessFlee()
|
||||
//When ImmuneToFlee effect fades it will turn fear back on and check if it can still flee.
|
||||
if (flee_mode && (GetSpecialAbility(IMMUNE_FLEEING) || spellbonuses.ImmuneToFlee) &&
|
||||
!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||
curfp = false;
|
||||
currently_fleeing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ void Mob::ProcessFlee()
|
||||
//see if we are legitimately feared or blind now
|
||||
if (!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||
//not feared or blind... were done...
|
||||
curfp = false;
|
||||
currently_fleeing = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ void Mob::CalculateNewFearpoint()
|
||||
if(Route.size() > 0)
|
||||
{
|
||||
m_FearWalkTarget = glm::vec3(Loc.x, Loc.y, Loc.z);
|
||||
curfp = true;
|
||||
currently_fleeing = true;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
|
||||
return;
|
||||
@ -151,7 +151,7 @@ void Mob::CalculateNewFearpoint()
|
||||
|
||||
int loop = 0;
|
||||
float ranx, rany, ranz;
|
||||
curfp = false;
|
||||
currently_fleeing = false;
|
||||
while (loop < 100) //Max 100 tries
|
||||
{
|
||||
int ran = 250 - (loop*2);
|
||||
@ -164,11 +164,11 @@ void Mob::CalculateNewFearpoint()
|
||||
float fdist = ranz - GetZ();
|
||||
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
|
||||
{
|
||||
curfp = true;
|
||||
currently_fleeing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (curfp)
|
||||
if (currently_fleeing)
|
||||
m_FearWalkTarget = glm::vec3(ranx, rany, ranz);
|
||||
else //Break fear
|
||||
BuffFadeByEffect(SE_Fear);
|
||||
|
||||
@ -1428,7 +1428,7 @@ void Merc::AI_Process() {
|
||||
|
||||
if(RuleB(Combat, EnableFearPathing)) {
|
||||
CalculateNewFearpoint();
|
||||
if(curfp) {
|
||||
if(currently_fleeing) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ Mob::Mob(const char* in_name,
|
||||
targeted = 0;
|
||||
tar_ndx=0;
|
||||
tar_vector=0;
|
||||
curfp = false;
|
||||
currently_fleeing = false;
|
||||
|
||||
AI_Init();
|
||||
SetMoving(false);
|
||||
@ -371,7 +371,7 @@ Mob::Mob(const char* in_name,
|
||||
follow=0;
|
||||
follow_dist = 100; // Default Distance for Follow
|
||||
flee_mode = false;
|
||||
curfp = false;
|
||||
currently_fleeing = false;
|
||||
flee_timer.Start();
|
||||
|
||||
permarooted = (runspeed > 0) ? false : true;
|
||||
|
||||
@ -1295,7 +1295,7 @@ protected:
|
||||
|
||||
int patrol;
|
||||
glm::vec3 m_FearWalkTarget;
|
||||
bool curfp;
|
||||
bool currently_fleeing;
|
||||
|
||||
// Pathing
|
||||
//
|
||||
|
||||
@ -759,7 +759,7 @@ void Client::AI_Process()
|
||||
}
|
||||
|
||||
if(RuleB(Combat, EnableFearPathing)){
|
||||
if(curfp) {
|
||||
if(currently_fleeing) {
|
||||
if(IsRooted()) {
|
||||
//make sure everybody knows were not moving, for appearance sake
|
||||
if(IsMoving())
|
||||
@ -955,7 +955,7 @@ void Mob::AI_Process() {
|
||||
// Begin: Additions for Wiz Fear Code
|
||||
//
|
||||
if(RuleB(Combat, EnableFearPathing)){
|
||||
if(curfp) {
|
||||
if(currently_fleeing) {
|
||||
if(IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosestEntOnHateList(this)))) {
|
||||
//make sure everybody knows were not moving, for appearance sake
|
||||
if(IsMoving())
|
||||
|
||||
@ -605,7 +605,7 @@ bool NPC::Process()
|
||||
parse->EventNPC(EVENT_TICK, this, nullptr, "", 0);
|
||||
BuffProcess();
|
||||
|
||||
if(curfp)
|
||||
if(currently_fleeing)
|
||||
ProcessFlee();
|
||||
|
||||
uint32 bonus = 0;
|
||||
|
||||
@ -864,7 +864,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
}
|
||||
|
||||
CalculateNewFearpoint();
|
||||
if(curfp)
|
||||
if(currently_fleeing)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -3944,8 +3944,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
}
|
||||
|
||||
case SE_Blind:
|
||||
if (curfp && !FindType(SE_Fear))
|
||||
curfp = false;
|
||||
if (currently_fleeing && !FindType(SE_Fear))
|
||||
currently_fleeing = false;
|
||||
break;
|
||||
|
||||
case SE_Fear:
|
||||
@ -3958,8 +3958,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
CastToClient()->AI_Stop();
|
||||
}
|
||||
|
||||
if(curfp) {
|
||||
curfp = false;
|
||||
if(currently_fleeing) {
|
||||
currently_fleeing = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3974,7 +3974,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
{
|
||||
if(RuleB(Combat, EnableFearPathing)){
|
||||
if(flee_mode) {
|
||||
curfp = true;
|
||||
currently_fleeing = true;
|
||||
CheckFlee();
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user