mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
AoE rewrite and bug fixes
Rewrote aoe checks for cone and line aoes and added minimum distance values Added height checks for commands Fixed combo effects repeating for every target hit by AoE attacks Fixed teleport sometimes not raising (I think) Fixed gear checks in some command scripts
This commit is contained in:
parent
8c5375f609
commit
cf30eef39e
34 changed files with 483 additions and 330 deletions
|
@ -105,17 +105,17 @@ namespace FFXIVClassic.Common
|
|||
return newVec;
|
||||
}
|
||||
|
||||
public bool IsWithinCircle(Vector3 centre, float radius)
|
||||
public bool IsWithinCircle(Vector3 center, float maxRadius, float minRadius)
|
||||
{
|
||||
if (this.X == centre.X && this.Z == centre.Z)
|
||||
if (this.X == center.X && this.Z == center.Z)
|
||||
return true;
|
||||
|
||||
float diffX = centre.X - this.X;
|
||||
float diffZ = centre.Z - this.Z;
|
||||
float diffX = center.X - this.X;
|
||||
float diffZ = center.Z - this.Z;
|
||||
|
||||
float distance = (float)Math.Sqrt((diffX * diffX) + (diffZ * diffZ));
|
||||
float distance = Utils.XZDistance(center.X, center.Z, X, Z);
|
||||
|
||||
return distance < radius;
|
||||
return distance <= maxRadius && distance >= minRadius;
|
||||
}
|
||||
|
||||
public bool IsWithinBox(Vector3 upperLeftCorner, Vector3 lowerRightCorner)
|
||||
|
@ -127,5 +127,19 @@ namespace FFXIVClassic.Common
|
|||
lowerRightCorner.Y >= this.Y &&
|
||||
lowerRightCorner.Z >= this.Z;
|
||||
}
|
||||
|
||||
//Checks if this vector is in a cone, note it doesn't check for distance
|
||||
public bool IsWithinCone(Vector3 coneCenter, float coneRotation, float coneAngle)
|
||||
{
|
||||
float angleToTarget = GetAngle(coneCenter, this);
|
||||
float halfAngleOfAoe = (float) (coneAngle * Math.PI / 2);
|
||||
float rotationToAdd = coneRotation + halfAngleOfAoe;
|
||||
|
||||
//This is the angle relative to the lower angle of the cone
|
||||
angleToTarget = (angleToTarget + rotationToAdd - (0.5f * (float)Math.PI)) % (2 * (float) Math.PI);
|
||||
|
||||
//If the relative angle is less than the total angle of the cone, the target is inside the cone
|
||||
return angleToTarget >= 0 && angleToTarget <= (coneAngle * Math.PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue