Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AI_066_TryInterceptingTarget()

void Terraria.Projectile.AI_066_TryInterceptingTarget ( Vector2 targetDir,
Vector2 targetVelocity,
float speed )
inlineprivate

Definition at line 34451 of file Projectile.cs.

34452 {
34453 float num = 5f;
34454 float num2 = 30f;
34455 float num3 = num2 + num;
34456 int num4 = 1;
34457 int num5 = 4;
34458 int num6 = 2;
34459 bool flag = false;
34460 if (type == 533)
34461 {
34462 num4 = 2;
34463 }
34464 if (type == 388)
34465 {
34466 num4 = 2;
34467 num2 = 40f;
34468 }
34469 targetVelocity /= (float)num4;
34470 for (float num7 = 1f; num7 <= 1.5f; num7 += 0.1f)
34471 {
34472 Utils.ChaseResults chaseResults = Utils.GetChaseResults(base.Center, speed, targetDir, targetVelocity);
34473 if (chaseResults.InterceptionHappens && chaseResults.InterceptionTime <= num3)
34474 {
34475 velocity = chaseResults.ChaserVelocity;
34476 if (flag)
34477 {
34478 int num8 = (int)Utils.Clamp((float)Math.Ceiling(chaseResults.InterceptionTime) + (float)num6, num5, num2 - 1f) / num4;
34479 float num9 = num2 / (float)num4 - (float)num8;
34480 ai[1] += num9 * (float)num4;
34481 }
34482 break;
34483 }
34484 }
34485 }
static double Ceiling(double a)
Vector2 velocity
Definition Entity.cs:16

References System.Math.Ceiling(), Terraria.Utils.GetChaseResults(), and System.type.