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