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

◆ AI_171_HallowBossRainbowStreak()

void Terraria.Projectile.AI_171_HallowBossRainbowStreak ( )
inlineprivate

Definition at line 37435 of file Projectile.cs.

37436 {
37437 bool flag = false;
37438 bool flag2 = false;
37439 float num = 140f;
37440 float num2 = 30f;
37441 float num3 = 0.98f;
37442 float value = 0.05f;
37443 float value2 = 0.1f;
37444 float num4 = 30f;
37445 if (type == 931)
37446 {
37447 num = 180f;
37448 num2 = 20f;
37449 num4 = 30f;
37450 num3 = 0.97f;
37451 value = 0.075f;
37452 value2 = 0.125f;
37453 if (timeLeft == 238)
37454 {
37455 int num5 = alpha;
37456 alpha = 0;
37458 alpha = num5;
37459 for (int i = 0; i < 3; i++)
37460 {
37461 Dust dust = Dust.NewDustPerfect(base.Center, 267, Main.rand.NextVector2CircularEdge(3f, 3f) * (Main.rand.NextFloat() * 0.5f + 0.5f), 0, fairyQueenWeaponsColor);
37462 dust.scale *= 1.2f;
37463 dust.noGravity = true;
37464 }
37465 }
37466 }
37467 if ((float)timeLeft > num)
37468 {
37469 flag = true;
37470 }
37471 else if ((float)timeLeft > num2)
37472 {
37473 flag2 = true;
37474 }
37475 if (flag)
37476 {
37477 float num6 = (float)Math.Cos((float)whoAmI % 6f / 6f + position.X / 320f + position.Y / 160f);
37478 velocity *= num3;
37479 velocity = velocity.RotatedBy(num6 * ((float)Math.PI * 2f) * 0.125f * 1f / 30f);
37480 }
37481 if (friendly)
37482 {
37483 int num7 = (int)ai[0];
37484 if (Main.npc.IndexInRange(num7) && !Main.npc[num7].CanBeChasedBy(this))
37485 {
37486 num7 = -1;
37487 ai[0] = -1f;
37488 netUpdate = true;
37489 }
37490 if (num7 == -1)
37491 {
37493 if (num8 != -1)
37494 {
37495 num7 = num8;
37496 ai[0] = num8;
37497 netUpdate = true;
37498 }
37499 }
37500 }
37501 if (flag2)
37502 {
37503 int num9 = (int)ai[0];
37505 if (hostile && Main.player.IndexInRange(num9))
37506 {
37507 Player player = Main.player[num9];
37508 value3 = DirectionTo(player.Center) * num4;
37509 }
37510 if (friendly)
37511 {
37512 if (Main.npc.IndexInRange(num9))
37513 {
37514 if (timeLeft < 10)
37515 {
37516 timeLeft = 10;
37517 }
37518 NPC nPC = Main.npc[num9];
37519 value3 = DirectionTo(nPC.Center) * num4;
37520 }
37521 else
37522 {
37523 timeLeft--;
37524 }
37525 }
37526 float amount = MathHelper.Lerp(value, value2, Utils.GetLerpValue(num, 30f, timeLeft, clamped: true));
37528 if (type == 931)
37529 {
37530 velocity *= MathHelper.Lerp(0.85f, 1f, Utils.GetLerpValue(0f, 90f, timeLeft, clamped: true));
37531 }
37532 }
37533 Opacity = Utils.GetLerpValue(240f, 220f, timeLeft, clamped: true);
37534 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
37535 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Cos(double d)
const double PI
Definition Math.cs:16
Vector2 velocity
Definition Entity.cs:16
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
Color GetFairyQueenWeaponsColor(float alphaChannelMultiplier=1f, float lerpToWhite=0f, float? rawHueOverride=null)
int FindTargetWithLineOfSight(float maxRange=800f)
static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:255

References Terraria.Entity.Center, System.Math.Cos(), Terraria.Utils.GetLerpValue(), Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Dust.NewDustPerfect(), Terraria.Main.npc, System.Math.PI, Terraria.Main.player, Terraria.Main.rand, Microsoft.Xna.Framework.Vector2.SmoothStep(), System.type, and System.value.