mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-05 20:53:52 +00:00
update to projectile move check
This commit is contained in:
parent
e8ae28b439
commit
ad2fd9e4d5
@ -468,7 +468,8 @@ typedef struct
|
||||
float origin_x;
|
||||
float origin_y;
|
||||
float origin_z;
|
||||
float sanitycheck;
|
||||
float tlast_x;
|
||||
float tlast_y;
|
||||
uint32 ranged_id;
|
||||
uint32 ammo_id;
|
||||
int ammo_slot;
|
||||
|
||||
@ -297,7 +297,8 @@ Mob::Mob(const char* in_name,
|
||||
ProjectileAtk[i].origin_x = 0.0f;
|
||||
ProjectileAtk[i].origin_y = 0.0f;
|
||||
ProjectileAtk[i].origin_z = 0.0f;
|
||||
ProjectileAtk[i].sanitycheck = 0.0f;
|
||||
ProjectileAtk[i].tlast_x = 0.0f;
|
||||
ProjectileAtk[i].tlast_y = 0.0f;
|
||||
ProjectileAtk[i].ranged_id = 0;
|
||||
ProjectileAtk[i].ammo_id = 0;
|
||||
ProjectileAtk[i].ammo_slot = 0;
|
||||
|
||||
@ -1077,11 +1077,10 @@ void Mob::ProjectileAttack()
|
||||
Mob* target = entity_list.GetMobID(ProjectileAtk[i].target_id);
|
||||
|
||||
if (target && target->IsMoving()){ //Only recalculate hit increment if target moving
|
||||
|
||||
//Due to frequency that we need to check increment the targets position variables may not be updated even if moving. Do a simple check before calculating distance.
|
||||
float _sanitycheck = target->GetX() * target->GetY();
|
||||
if (ProjectileAtk[i].sanitycheck != _sanitycheck){
|
||||
ProjectileAtk[i].sanitycheck = _sanitycheck;
|
||||
if (ProjectileAtk[i].tlast_x != target->GetX() || ProjectileAtk[i].tlast_y != target->GetY()){
|
||||
ProjectileAtk[i].tlast_x = target->GetX();
|
||||
ProjectileAtk[i].tlast_y = target->GetY();
|
||||
float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z);
|
||||
float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4)
|
||||
ProjectileAtk[i].hit_increment = static_cast<uint16>(hit);
|
||||
@ -1103,7 +1102,8 @@ void Mob::ProjectileAttack()
|
||||
ProjectileAtk[i].origin_x = 0.0f;
|
||||
ProjectileAtk[i].origin_y = 0.0f;
|
||||
ProjectileAtk[i].origin_z = 0.0f;
|
||||
ProjectileAtk[i].sanitycheck = 0.0f;
|
||||
ProjectileAtk[i].tlast_x = 0.0f;
|
||||
ProjectileAtk[i].tlast_y = 0.0f;
|
||||
ProjectileAtk[i].ranged_id = 0;
|
||||
ProjectileAtk[i].ammo_id = 0;
|
||||
ProjectileAtk[i].ammo_slot = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user