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

◆ AI_191_TrueNightsEdge()

void Terraria.Projectile.AI_191_TrueNightsEdge ( )
inlineprivate

Definition at line 34032 of file Projectile.cs.

34033 {
34034 float num = 50f;
34035 float num2 = 15f;
34036 float num3 = ai[1] + num;
34037 float num4 = num3 + num2;
34038 float num5 = 77f;
34039 if (type == 985)
34040 {
34041 num = 0f;
34042 num3 = ai[1];
34043 num4 = ai[1] + 25f;
34044 num5 = num4;
34045 }
34046 if (localAI[0] == 0f && type == 973)
34047 {
34049 }
34050 localAI[0] += 1f;
34051 if (type == 985 && localAI[1] == 1f)
34052 {
34053 localAI[0] += 2f;
34054 }
34055 if (type == 973 && damage == 0 && localAI[0] < MathHelper.Lerp(num3, num4, 0.5f))
34056 {
34057 localAI[0] += 6f;
34058 }
34059 Opacity = Utils.Remap(localAI[0], 0f, ai[1], 0f, 1f) * Utils.Remap(localAI[0], num3, num4, 1f, 0f);
34060 if (localAI[0] >= num4)
34061 {
34062 localAI[1] = 1f;
34063 Kill();
34064 return;
34065 }
34066 Player player = Main.player[owner];
34067 float fromValue = localAI[0] / ai[1];
34068 float num6 = Utils.Remap(localAI[0], ai[1] * 0.4f, num4, 0f, 1f);
34069 direction = (spriteDirection = (int)ai[0]);
34070 if (type == 973)
34071 {
34072 int num7 = 3;
34073 if (damage != 0 && localAI[0] >= num5 + (float)num7)
34074 {
34075 damage = 0;
34076 }
34077 if (damage != 0)
34078 {
34079 int num8 = 80;
34080 bool flag = false;
34081 float num9 = velocity.ToRotation();
34082 for (float num10 = -1f; num10 <= 1f; num10 += 0.5f)
34083 {
34084 Vector2 position = base.Center + (num9 + num10 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num8 * 0.5f * scale;
34085 Vector2 position2 = base.Center + (num9 + num10 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num8 * scale;
34086 if (!Collision.SolidTiles(base.Center, 0, 0) && Collision.CanHit(position, 0, 0, position2, 0, 0))
34087 {
34088 flag = true;
34089 break;
34090 }
34091 }
34092 if (!flag)
34093 {
34094 damage = 0;
34095 }
34096 }
34097 fromValue = localAI[0] / ai[1];
34098 localAI[1] += 1f;
34099 num6 = Utils.Remap(localAI[1], ai[1] * 0.4f, num4, 0f, 1f);
34100 base.Center = player.RotatedRelativePoint(player.MountedCenter) - velocity + velocity * num6 * num6 * num5;
34101 rotation += ai[0] * ((float)Math.PI * 2f) * (4f + Opacity * 4f) / 90f;
34102 scale = Utils.Remap(localAI[0], ai[1] + 2f, num4, 1.12f, 1f) * ai[2];
34103 float f = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34104 Vector2 vector = base.Center + f.ToRotationVector2() * 84f * scale;
34105 if (Main.rand.Next(5) == 0)
34106 {
34107 Dust dust = Dust.NewDustPerfect(vector, 14, null, 150, default(Color), 1.4f);
34108 dust.noLight = (dust.noLightEmittence = true);
34109 }
34110 for (int i = 0; (float)i < 3f * Opacity; i++)
34111 {
34112 Vector2 vector2 = velocity.SafeNormalize(Vector2.UnitX);
34113 int num11 = ((Main.rand.NextFloat() < Opacity) ? 75 : 27);
34114 Dust dust2 = Dust.NewDustPerfect(vector, num11, velocity * 0.2f + vector2 * 3f, 100, default(Color), 1.4f);
34115 dust2.noGravity = true;
34116 dust2.customData = Opacity * 0.2f;
34117 }
34118 }
34119 if (type != 985)
34120 {
34121 return;
34122 }
34123 ownerHitCheck = localAI[0] <= 6f;
34124 if (localAI[0] >= MathHelper.Lerp(num3, num4, 0.65f))
34125 {
34126 damage = 0;
34127 }
34128 float fromValue2 = 1f - (1f - num6) * (1f - num6);
34129 rotation = velocity.ToRotation();
34130 scale = Utils.Remap(fromValue2, 0f, 1f, 1.5f, 1f) * ai[2];
34131 num6 = Utils.Remap(localAI[0], ai[1] / 2f, num4, 0f, 1f);
34132 Opacity = Utils.Remap(localAI[0], 0f, ai[1] * 0.5f, 0f, 1f) * Utils.Remap(localAI[0], num4 - 12f, num4, 1f, 0f);
34133 if (velocity.Length() > 8f)
34134 {
34135 velocity *= 0.94f;
34136 new Vector2(32f, 32f);
34137 float num12 = Utils.Remap(fromValue, 0.7f, 1f, 110f, 110f);
34138 if (localAI[1] == 0f)
34139 {
34140 bool flag2 = false;
34141 for (float num13 = -1f; num13 <= 1f; num13 += 0.5f)
34142 {
34143 Vector2 position3 = base.Center + (rotation + num13 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num12 * 0.5f * scale;
34144 Vector2 position4 = base.Center + (rotation + num13 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num12 * scale;
34145 if (Collision.CanHit(position3, 0, 0, position4, 0, 0))
34146 {
34147 flag2 = true;
34148 break;
34149 }
34150 }
34151 if (!flag2)
34152 {
34153 localAI[1] = 1f;
34154 }
34155 }
34156 if (localAI[1] == 1f && velocity.Length() > 8f)
34157 {
34158 velocity *= 0.8f;
34159 }
34160 if (localAI[1] == 1f)
34161 {
34162 velocity *= 0.88f;
34163 }
34164 }
34165 float num14 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.9f;
34166 Vector2 vector3 = base.Center + num14.ToRotationVector2() * 85f * scale;
34167 (num14 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34168 Color value = new Color(64, 220, 96);
34169 Color value2 = new Color(15, 84, 125);
34170 Lighting.AddLight(base.Center + rotation.ToRotationVector2() * 85f * scale, value.ToVector3());
34171 for (int j = 0; j < 3; j++)
34172 {
34173 if (Main.rand.NextFloat() < Opacity + 0.1f)
34174 {
34175 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(fromValue, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(fromValue, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34176 Dust dust3 = Dust.NewDustPerfect(vector3, 107, velocity * 0.7f, 100, default(Color) * Opacity, 0.8f * Opacity);
34177 dust3.scale *= 0.7f;
34178 dust3.velocity += player.velocity * 0.1f;
34179 dust3.position -= dust3.velocity * 6f;
34180 }
34181 }
34182 if (damage == 0)
34183 {
34184 localAI[0] += 3f;
34185 velocity *= 0.76f;
34186 }
34187 if (localAI[0] < 10f && (localAI[1] == 1f || damage == 0))
34188 {
34189 localAI[0] += 1f;
34190 velocity *= 0.85f;
34191 for (int k = 0; k < 4; k++)
34192 {
34193 float num15 = Main.rand.NextFloatDirection();
34194 float num16 = 1f - Math.Abs(num15);
34195 num14 = rotation + num15 * ((float)Math.PI / 2f) * 0.9f;
34196 vector3 = base.Center + num14.ToRotationVector2() * 85f * scale;
34197 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(fromValue, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(fromValue, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34198 Dust dust4 = Dust.NewDustPerfect(vector3, 107, velocity.RotatedBy(num15 * ((float)Math.PI / 4f)) * 0.2f * Main.rand.NextFloat(), 100, default(Color), 1.4f * num16);
34199 dust4.velocity += player.velocity * 0.1f;
34200 dust4.position -= dust4.velocity * Main.rand.NextFloat() * 3f;
34201 }
34202 }
34203 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Abs(double value)
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References System.Math.Abs(), Terraria.Lighting.AddLight(), Terraria.Collision.CanHit(), Terraria.ID.SoundID.Item8, Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Player.MountedCenter, Terraria.Dust.NewDustPerfect(), System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Utils.Remap(), Terraria.Player.RotatedRelativePoint(), Terraria.Collision.SolidTiles(), System.type, Microsoft.Xna.Framework.Vector2.UnitX, System.value, and Microsoft.Xna.Framework.Color.White.