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

◆ RandomizeInsanityShadowFor()

static void Terraria.Projectile.RandomizeInsanityShadowFor ( Entity targetEntity,
bool isHostile,
out Vector2 spawnposition,
out Vector2 spawnvelocity,
out float ai0,
out float ai1 )
inlinestatic

Definition at line 34487 of file Projectile.cs.

34488 {
34489 int num = Main.rand.Next(2) * 2 - 1;
34490 int num2 = Main.rand.Next(4);
34491 float num3 = (isHostile ? 200f : 100f);
34492 float num4 = (isHostile ? 30 : 20);
34493 float num5 = (isHostile ? 30 : 0);
34494 float num6 = Main.rand.NextFloatDirection() * (float)Math.PI * 0.125f;
34495 if (isHostile && targetEntity.velocity.X * (float)num > 0f)
34496 {
34497 num *= -1;
34498 }
34499 if (num2 == 0 && isHostile)
34500 {
34501 num4 += 10f;
34502 }
34503 spawnposition = targetEntity.Center + targetEntity.velocity * num5 + new Vector2((float)num * (0f - num3), 0f).RotatedBy(num6);
34504 spawnvelocity = new Vector2((float)num * num3 / num4, 0f).RotatedBy(num6);
34505 ai0 = 0f;
34506 ai1 = 0f;
34507 if (num2 == 1)
34508 {
34509 float num7 = (float)Math.PI * 2f * Main.rand.NextFloat();
34510 spawnposition = targetEntity.Center - num7.ToRotationVector2() * (isHostile ? num3 : (num3 * 0.5f));
34511 ai0 = 180f;
34512 ai1 = num7 - (float)Math.PI / 2f;
34513 spawnvelocity = num7.ToRotationVector2() * (isHostile ? 4 : 2);
34514 }
34515 if (num2 == 2)
34516 {
34517 float num8 = (float)Math.PI * 2f * Main.rand.NextFloat();
34518 spawnposition = targetEntity.Center - num8.ToRotationVector2() * num3;
34519 ai0 = 300f;
34520 ai1 = num8;
34521 spawnvelocity = num8.ToRotationVector2() * (isHostile ? 4 : 2);
34522 }
34523 if (num2 == 3)
34524 {
34525 float f = (float)Math.PI * 2f * Main.rand.NextFloat();
34526 float num9 = (isHostile ? 60 : 30);
34527 float num10 = (float)Math.PI / 2f / num9 * Main.rand.NextFloatDirection();
34528 spawnposition = targetEntity.Center + targetEntity.velocity * num9;
34529 Vector2 vector = f.ToRotationVector2() * (isHostile ? 8 : 3);
34530 for (int i = 0; (float)i < num9; i++)
34531 {
34533 vector = vector.RotatedBy(0f - num10);
34534 }
34536 ai0 = 390f;
34537 ai1 = num10;
34538 }
34539 }
const double PI
Definition Math.cs:16

References System.Math.PI, and Terraria.Main.rand.

Referenced by Terraria.NPC.AI_123_Deerclops(), Terraria.Player.SpawnHallucination(), and Terraria.NPC.SpawnPassiveShadowHands().