mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-17 18:41:29 +00:00
Added evade code to rogue mercs
This commit is contained in:
parent
f3f034d948
commit
31cc6f63d6
@ -737,7 +737,7 @@ private:
|
|||||||
bool _hasBeenSummoned;
|
bool _hasBeenSummoned;
|
||||||
glm::vec3 m_PreSummonLocation;
|
glm::vec3 m_PreSummonLocation;
|
||||||
|
|
||||||
Timer evade_timer;
|
Timer evade_timer; // can be moved to pTimers at some point
|
||||||
|
|
||||||
BotCastingRoles m_CastingRoles;
|
BotCastingRoles m_CastingRoles;
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,9 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
|||||||
SetStance(MercStanceBalanced);
|
SetStance(MercStanceBalanced);
|
||||||
rest_timer.Disable();
|
rest_timer.Disable();
|
||||||
|
|
||||||
|
if (GetClass() == ROGUE)
|
||||||
|
evade_timer.Start();
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
for (r = 0; r <= EQEmu::skills::HIGHEST_SKILL; r++) {
|
for (r = 0; r <= EQEmu::skills::HIGHEST_SKILL; r++) {
|
||||||
skills[r] = database.GetSkillCap(GetClass(), (EQEmu::skills::SkillType)r, GetLevel());
|
skills[r] = database.GetSkillCap(GetClass(), (EQEmu::skills::SkillType)r, GetLevel());
|
||||||
@ -1508,32 +1511,60 @@ void Merc::AI_Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AI_movement_timer->Check())
|
if(AI_movement_timer->Check()) {
|
||||||
{
|
if (!IsMoving()) {
|
||||||
if(!IsMoving() && GetClass() == ROGUE && !BehindMob(GetTarget(), GetX(), GetY()))
|
if (GetClass() == ROGUE) {
|
||||||
{
|
if (HasTargetReflection() && !GetTarget()->IsFeared() && !GetTarget()->IsStunned()) {
|
||||||
// Move the rogue to behind the mob
|
// Hate redux actions
|
||||||
float newX = 0;
|
if (evade_timer.Check(false)) {
|
||||||
float newY = 0;
|
// Attempt to evade
|
||||||
float newZ = 0;
|
int timer_duration = (HideReuseTime - GetSkillReuseTime(EQEmu::skills::SkillHide)) * 1000;
|
||||||
|
if (timer_duration < 0)
|
||||||
|
timer_duration = 0;
|
||||||
|
evade_timer.Start(timer_duration);
|
||||||
|
|
||||||
if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ))
|
if (zone->random.Int(0, 260) < (int)GetSkill(EQEmu::skills::SkillHide))
|
||||||
{
|
RogueEvade(GetTarget());
|
||||||
CalculateNewPosition2(newX, newY, newZ, GetRunspeed());
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
else if (GetTarget()->IsRooted()) {
|
||||||
|
// Move rogue back from rooted mob - out of combat range, if necessary
|
||||||
|
float melee_distance = GetMaxMeleeRangeToTarget(GetTarget());
|
||||||
|
float current_distance = DistanceSquared(static_cast<glm::vec3>(m_Position), static_cast<glm::vec3>(GetTarget()->GetPosition()));
|
||||||
|
|
||||||
|
if (current_distance <= melee_distance) {
|
||||||
|
float newX = 0;
|
||||||
|
float newY = 0;
|
||||||
|
float newZ = 0;
|
||||||
|
FaceTarget(GetTarget());
|
||||||
|
if (PlotPositionAroundTarget(this, newX, newY, newZ)) {
|
||||||
|
CalculateNewPosition2(newX, newY, newZ, GetRunspeed());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!BehindMob(GetTarget(), GetX(), GetY())) {
|
||||||
|
// Move the rogue to behind the mob
|
||||||
|
float newX = 0;
|
||||||
|
float newY = 0;
|
||||||
|
float newZ = 0;
|
||||||
|
if (PlotPositionAroundTarget(GetTarget(), newX, newY, newZ)) {
|
||||||
|
CalculateNewPosition2(newX, newY, newZ, GetRunspeed());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (GetClass() != ROGUE && (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize())) {
|
||||||
else if(!IsMoving() && GetClass() != ROGUE && (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize()))
|
// If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up
|
||||||
{
|
float newX = 0;
|
||||||
// If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up
|
float newY = 0;
|
||||||
float newX = 0;
|
float newZ = 0;
|
||||||
float newY = 0;
|
if (PlotPositionAroundTarget(GetTarget(), newX, newY, newZ, false) && GetArchetype() != ARCHETYPE_CASTER) {
|
||||||
float newZ = 0;
|
CalculateNewPosition2(newX, newY, newZ, GetRunspeed());
|
||||||
|
return;
|
||||||
if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ, false) && GetArchetype() != ARCHETYPE_CASTER)
|
}
|
||||||
{
|
|
||||||
CalculateNewPosition2(newX, newY, newZ, GetRunspeed());
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -290,6 +290,8 @@ protected:
|
|||||||
std::vector<MercSpell> merc_spells;
|
std::vector<MercSpell> merc_spells;
|
||||||
std::map<uint32,MercTimer> timers;
|
std::map<uint32,MercTimer> timers;
|
||||||
|
|
||||||
|
Timer evade_timer; // can be moved to pTimers at some point
|
||||||
|
|
||||||
uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1];
|
uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1];
|
||||||
uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs
|
uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs
|
||||||
uint16 d_melee_texture1; //this is an item Material value
|
uint16 d_melee_texture1; //this is an item Material value
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user