mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-15 04:32:28 +00:00
Reworked blind running around
This should be more in line with how we do current fearpath stuff and with live.
This commit is contained in:
parent
8035c6c558
commit
5ffb6bdee7
@ -2507,6 +2507,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
|||||||
newbon->BlockBehind += effect_value;
|
newbon->BlockBehind += effect_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SE_Blind:
|
||||||
|
newbon->IsBlind = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case SE_Fear:
|
case SE_Fear:
|
||||||
newbon->IsFeared = true;
|
newbon->IsFeared = true;
|
||||||
break;
|
break;
|
||||||
@ -4086,6 +4090,10 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
|
|||||||
itembonuses.BlockBehind = effect_value;
|
itembonuses.BlockBehind = effect_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SE_Blind:
|
||||||
|
spellbonuses.IsBlind = false;
|
||||||
|
break;
|
||||||
|
|
||||||
case SE_Fear:
|
case SE_Fear:
|
||||||
spellbonuses.IsFeared = false;
|
spellbonuses.IsFeared = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -294,6 +294,7 @@ struct StatBonuses {
|
|||||||
int16 ResistFearChance; //i
|
int16 ResistFearChance; //i
|
||||||
bool Fearless; //i
|
bool Fearless; //i
|
||||||
bool IsFeared; //i
|
bool IsFeared; //i
|
||||||
|
bool IsBlind; //i
|
||||||
int16 StunResist; //i
|
int16 StunResist; //i
|
||||||
int16 MeleeSkillCheck; //i
|
int16 MeleeSkillCheck; //i
|
||||||
uint8 MeleeSkillCheckSkill;
|
uint8 MeleeSkillCheckSkill;
|
||||||
|
|||||||
@ -31,12 +31,10 @@
|
|||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
|
|
||||||
#define FEAR_PATHING_DEBUG
|
#define FEAR_PATHING_DEBUG
|
||||||
|
|
||||||
|
|
||||||
//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...
|
||||||
@ -101,12 +99,13 @@ void Mob::CheckFlee() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mob::ProcessFlee()
|
||||||
void Mob::ProcessFlee() {
|
{
|
||||||
|
|
||||||
//Stop fleeing if effect is applied after they start to run.
|
//Stop fleeing if effect is applied after they start to run.
|
||||||
//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) && !spellbonuses.IsFeared){
|
if (flee_mode && (GetSpecialAbility(IMMUNE_FLEEING) || spellbonuses.ImmuneToFlee) &&
|
||||||
|
!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||||
curfp = false;
|
curfp = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -114,46 +113,42 @@ void Mob::ProcessFlee() {
|
|||||||
//see if we are still dying, if so, do nothing
|
//see if we are still dying, if so, do nothing
|
||||||
float fleeratio = GetSpecialAbility(FLEE_PERCENT);
|
float fleeratio = GetSpecialAbility(FLEE_PERCENT);
|
||||||
fleeratio = fleeratio > 0 ? fleeratio : RuleI(Combat, FleeHPRatio);
|
fleeratio = fleeratio > 0 ? fleeratio : RuleI(Combat, FleeHPRatio);
|
||||||
if(GetHPRatio() < fleeratio)
|
if (GetHPRatio() < fleeratio)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//we are not dying anymore... see what we do next
|
//we are not dying anymore... see what we do next
|
||||||
|
|
||||||
flee_mode = false;
|
flee_mode = false;
|
||||||
|
|
||||||
//see if we are legitimately feared now
|
//see if we are legitimately feared or blind now
|
||||||
if(!spellbonuses.IsFeared) {
|
if (!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||||
//not feared... were done...
|
//not feared or blind... were done...
|
||||||
curfp = false;
|
curfp = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Mob::GetFearSpeed() {
|
float Mob::GetFearSpeed()
|
||||||
if(flee_mode || is_blind) {
|
{
|
||||||
|
if (flee_mode) {
|
||||||
//we know ratio < FLEE_HP_RATIO
|
//we know ratio < FLEE_HP_RATIO
|
||||||
float speed = GetBaseRunspeed();
|
float speed = GetBaseRunspeed();
|
||||||
float ratio = GetHPRatio();
|
float ratio = GetHPRatio();
|
||||||
float multiplier = RuleR(Combat, FleeMultiplier);
|
float multiplier = RuleR(Combat, FleeMultiplier);
|
||||||
|
|
||||||
if(GetSnaredAmount() > 40)
|
if (GetSnaredAmount() > 40)
|
||||||
multiplier = multiplier / 6.0f;
|
multiplier = multiplier / 6.0f;
|
||||||
|
|
||||||
speed = speed * ratio * multiplier / 100;
|
speed = speed * ratio * multiplier / 100;
|
||||||
|
|
||||||
// A blinded mob should be pretty slow when running amuck.
|
|
||||||
if (is_blind)
|
|
||||||
{
|
|
||||||
speed = speed/3.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//NPC will eventually stop. Snares speeds this up.
|
//NPC will eventually stop. Snares speeds this up.
|
||||||
if(speed < 0.09)
|
if (speed < 0.09)
|
||||||
speed = 0.0001f;
|
speed = 0.0001f;
|
||||||
|
|
||||||
return(speed);
|
return speed;
|
||||||
}
|
}
|
||||||
return(GetRunspeed());
|
// fear and blind use their normal run speed
|
||||||
|
return GetRunspeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::CalculateNewFearpoint()
|
void Mob::CalculateNewFearpoint()
|
||||||
@ -215,17 +210,3 @@ void Mob::CalculateNewFearpoint()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,6 @@ Mob::Mob(const char* in_name,
|
|||||||
fear_walkto_y = -999999;
|
fear_walkto_y = -999999;
|
||||||
fear_walkto_z = -999999;
|
fear_walkto_z = -999999;
|
||||||
curfp = false;
|
curfp = false;
|
||||||
is_blind = false;
|
|
||||||
|
|
||||||
AI_Init();
|
AI_Init();
|
||||||
SetMoving(false);
|
SetMoving(false);
|
||||||
|
|||||||
@ -768,6 +768,7 @@ public:
|
|||||||
inline void StartFleeing() { flee_mode = true; CalculateNewFearpoint(); }
|
inline void StartFleeing() { flee_mode = true; CalculateNewFearpoint(); }
|
||||||
void ProcessFlee();
|
void ProcessFlee();
|
||||||
void CheckFlee();
|
void CheckFlee();
|
||||||
|
inline bool IsBlind() { return spellbonuses.IsBlind; }
|
||||||
|
|
||||||
inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);}
|
inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);}
|
||||||
float CalculateHeadingToTarget(float in_x, float in_y);
|
float CalculateHeadingToTarget(float in_x, float in_y);
|
||||||
@ -1190,7 +1191,6 @@ protected:
|
|||||||
float fear_walkto_y;
|
float fear_walkto_y;
|
||||||
float fear_walkto_z;
|
float fear_walkto_z;
|
||||||
bool curfp;
|
bool curfp;
|
||||||
bool is_blind;
|
|
||||||
|
|
||||||
// Pathing
|
// Pathing
|
||||||
//
|
//
|
||||||
|
|||||||
@ -1039,8 +1039,8 @@ 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 || (is_blind && !CombatRange(hate_list.GetClosest(this)))) {
|
if(curfp) {
|
||||||
if(IsRooted()) {
|
if(IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosest(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())
|
||||||
{
|
{
|
||||||
@ -1087,7 +1087,9 @@ void Mob::AI_Process() {
|
|||||||
|
|
||||||
if (engaged)
|
if (engaged)
|
||||||
{
|
{
|
||||||
if (IsRooted() || is_blind)
|
// we are prevented from getting here if we are blind and don't have a target in range
|
||||||
|
// from above, so no extra blind checks needed
|
||||||
|
if (IsRooted() || IsBlind())
|
||||||
SetTarget(hate_list.GetClosest(this));
|
SetTarget(hate_list.GetClosest(this));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1270,8 +1270,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
// this should catch the cures
|
// this should catch the cures
|
||||||
if (BeneficialSpell(spell_id) && spells[spell_id].buffduration == 0)
|
if (BeneficialSpell(spell_id) && spells[spell_id].buffduration == 0)
|
||||||
BuffFadeByEffect(SE_Blind);
|
BuffFadeByEffect(SE_Blind);
|
||||||
else
|
else if (!IsClient())
|
||||||
is_blind = true;
|
CalculateNewFearpoint();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3997,7 +3997,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SE_Blind:
|
case SE_Blind:
|
||||||
is_blind = false;
|
if (curfp && !FindType(SE_Fear))
|
||||||
|
curfp = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SE_Fear:
|
case SE_Fear:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user