mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +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
@ -2472,7 +2472,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case SE_ManaAbsorbPercentDamage:
|
||||
{
|
||||
if (newbon->ManaAbsorbPercentDamage[0] < effect_value){
|
||||
@ -2493,7 +2493,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
case SE_ShieldBlock:
|
||||
newbon->ShieldBlock += effect_value;
|
||||
break;
|
||||
|
||||
|
||||
case SE_ShieldEquipHateMod:
|
||||
newbon->ShieldEquipHateMod += effect_value;
|
||||
break;
|
||||
@ -2507,6 +2507,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
|
||||
newbon->BlockBehind += effect_value;
|
||||
break;
|
||||
|
||||
case SE_Blind:
|
||||
newbon->IsBlind = true;
|
||||
break;
|
||||
|
||||
case SE_Fear:
|
||||
newbon->IsFeared = true;
|
||||
break;
|
||||
@ -4086,6 +4090,10 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
|
||||
itembonuses.BlockBehind = effect_value;
|
||||
break;
|
||||
|
||||
case SE_Blind:
|
||||
spellbonuses.IsBlind = false;
|
||||
break;
|
||||
|
||||
case SE_Fear:
|
||||
spellbonuses.IsFeared = false;
|
||||
break;
|
||||
|
||||
@ -294,6 +294,7 @@ struct StatBonuses {
|
||||
int16 ResistFearChance; //i
|
||||
bool Fearless; //i
|
||||
bool IsFeared; //i
|
||||
bool IsBlind; //i
|
||||
int16 StunResist; //i
|
||||
int16 MeleeSkillCheck; //i
|
||||
uint8 MeleeSkillCheckSkill;
|
||||
|
||||
@ -31,12 +31,10 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
extern Zone* zone;
|
||||
|
||||
#define FEAR_PATHING_DEBUG
|
||||
|
||||
|
||||
//this is called whenever we are damaged to process possible fleeing
|
||||
void Mob::CheckFlee() {
|
||||
//if were allready fleeing, dont need to check more...
|
||||
@ -55,7 +53,7 @@ void Mob::CheckFlee() {
|
||||
float ratio = GetHPRatio();
|
||||
float fleeratio = GetSpecialAbility(FLEE_PERCENT);
|
||||
fleeratio = fleeratio > 0 ? fleeratio : RuleI(Combat, FleeHPRatio);
|
||||
|
||||
|
||||
if(ratio >= fleeratio)
|
||||
return;
|
||||
|
||||
@ -101,12 +99,13 @@ void Mob::CheckFlee() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mob::ProcessFlee() {
|
||||
void Mob::ProcessFlee()
|
||||
{
|
||||
|
||||
//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.
|
||||
if(flee_mode && (GetSpecialAbility(IMMUNE_FLEEING) || spellbonuses.ImmuneToFlee) && !spellbonuses.IsFeared){
|
||||
if (flee_mode && (GetSpecialAbility(IMMUNE_FLEEING) || spellbonuses.ImmuneToFlee) &&
|
||||
!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||
curfp = false;
|
||||
return;
|
||||
}
|
||||
@ -114,46 +113,42 @@ void Mob::ProcessFlee() {
|
||||
//see if we are still dying, if so, do nothing
|
||||
float fleeratio = GetSpecialAbility(FLEE_PERCENT);
|
||||
fleeratio = fleeratio > 0 ? fleeratio : RuleI(Combat, FleeHPRatio);
|
||||
if(GetHPRatio() < fleeratio)
|
||||
if (GetHPRatio() < fleeratio)
|
||||
return;
|
||||
|
||||
//we are not dying anymore... see what we do next
|
||||
|
||||
flee_mode = false;
|
||||
|
||||
//see if we are legitimately feared now
|
||||
if(!spellbonuses.IsFeared) {
|
||||
//not feared... were done...
|
||||
//see if we are legitimately feared or blind now
|
||||
if (!spellbonuses.IsFeared && !spellbonuses.IsBlind) {
|
||||
//not feared or blind... were done...
|
||||
curfp = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float Mob::GetFearSpeed() {
|
||||
if(flee_mode || is_blind) {
|
||||
float Mob::GetFearSpeed()
|
||||
{
|
||||
if (flee_mode) {
|
||||
//we know ratio < FLEE_HP_RATIO
|
||||
float speed = GetBaseRunspeed();
|
||||
float ratio = GetHPRatio();
|
||||
float multiplier = RuleR(Combat, FleeMultiplier);
|
||||
|
||||
if(GetSnaredAmount() > 40)
|
||||
if (GetSnaredAmount() > 40)
|
||||
multiplier = multiplier / 6.0f;
|
||||
|
||||
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.
|
||||
if(speed < 0.09)
|
||||
if (speed < 0.09)
|
||||
speed = 0.0001f;
|
||||
|
||||
return(speed);
|
||||
|
||||
return speed;
|
||||
}
|
||||
return(GetRunspeed());
|
||||
// fear and blind use their normal run speed
|
||||
return GetRunspeed();
|
||||
}
|
||||
|
||||
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_z = -999999;
|
||||
curfp = false;
|
||||
is_blind = false;
|
||||
|
||||
AI_Init();
|
||||
SetMoving(false);
|
||||
|
||||
@ -768,6 +768,7 @@ public:
|
||||
inline void StartFleeing() { flee_mode = true; CalculateNewFearpoint(); }
|
||||
void ProcessFlee();
|
||||
void CheckFlee();
|
||||
inline bool IsBlind() { return spellbonuses.IsBlind; }
|
||||
|
||||
inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);}
|
||||
float CalculateHeadingToTarget(float in_x, float in_y);
|
||||
@ -1190,7 +1191,6 @@ protected:
|
||||
float fear_walkto_y;
|
||||
float fear_walkto_z;
|
||||
bool curfp;
|
||||
bool is_blind;
|
||||
|
||||
// Pathing
|
||||
//
|
||||
|
||||
@ -1039,8 +1039,8 @@ void Mob::AI_Process() {
|
||||
// Begin: Additions for Wiz Fear Code
|
||||
//
|
||||
if(RuleB(Combat, EnableFearPathing)){
|
||||
if(curfp || (is_blind && !CombatRange(hate_list.GetClosest(this)))) {
|
||||
if(IsRooted()) {
|
||||
if(curfp) {
|
||||
if(IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosest(this)))) {
|
||||
//make sure everybody knows were not moving, for appearance sake
|
||||
if(IsMoving())
|
||||
{
|
||||
@ -1087,7 +1087,9 @@ void Mob::AI_Process() {
|
||||
|
||||
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));
|
||||
else
|
||||
{
|
||||
|
||||
@ -1270,8 +1270,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
||||
// this should catch the cures
|
||||
if (BeneficialSpell(spell_id) && spells[spell_id].buffduration == 0)
|
||||
BuffFadeByEffect(SE_Blind);
|
||||
else
|
||||
is_blind = true;
|
||||
else if (!IsClient())
|
||||
CalculateNewFearpoint();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3997,7 +3997,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
}
|
||||
|
||||
case SE_Blind:
|
||||
is_blind = false;
|
||||
if (curfp && !FindType(SE_Fear))
|
||||
curfp = false;
|
||||
break;
|
||||
|
||||
case SE_Fear:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user