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

◆ AI_190_NightsEdge()

void Terraria.Projectile.AI_190_NightsEdge ( )
inlineprivate

Definition at line 34205 of file Projectile.cs.

34206 {
34207 if (localAI[0] == 0f && type == 984)
34208 {
34210 if (soundEffectInstance != null)
34211 {
34212 soundEffectInstance.Volume *= 0.65f;
34213 }
34214 }
34215 localAI[0] += 1f;
34216 Player player = Main.player[owner];
34217 float num = localAI[0] / ai[1];
34218 float num2 = ai[0];
34219 float num3 = velocity.ToRotation();
34220 float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation;
34221 rotation = num4;
34222 float num5 = 0.2f;
34223 float num6 = 1f;
34224 switch (type)
34225 {
34226 case 982:
34227 num5 = 0.6f;
34228 break;
34229 case 997:
34230 num5 = 0.6f;
34231 break;
34232 case 983:
34233 num5 = 1f;
34234 num6 = 1.2f;
34235 break;
34236 case 984:
34237 num5 = 0.6f;
34238 break;
34239 }
34240 base.Center = player.RotatedRelativePoint(player.MountedCenter) - velocity;
34241 scale = num6 + num * num5;
34242 if (type == 972)
34243 {
34244 if (Math.Abs(num2) < 0.2f)
34245 {
34246 rotation += (float)Math.PI * 4f * num2 * 10f * num;
34247 float num7 = Utils.Remap(localAI[0], 10f, ai[1] - 5f, 0f, 1f);
34248 position += velocity.SafeNormalize(Vector2.Zero) * (45f * num7);
34249 scale += num7 * 0.4f;
34250 }
34251 if (Main.rand.Next(2) == 0)
34252 {
34253 float f = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34254 Vector2 vector = base.Center + f.ToRotationVector2() * 84f * scale;
34255 if (Main.rand.Next(5) == 0)
34256 {
34257 Dust dust = Dust.NewDustPerfect(vector, 14, null, 150, default(Color), 1.4f);
34258 dust.noLight = (dust.noLightEmittence = true);
34259 }
34260 if (Main.rand.Next(2) == 0)
34261 {
34262 Dust.NewDustPerfect(vector, 27, new Vector2(player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f), 100, default(Color), 1.4f).noGravity = true;
34263 }
34264 }
34265 }
34266 if (type == 982)
34267 {
34268 float num8 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34269 Vector2 vector2 = base.Center + num8.ToRotationVector2() * 84f * scale;
34270 Vector2 vector3 = (num8 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34271 if (Main.rand.NextFloat() * 2f < Opacity)
34272 {
34273 Dust dust2 = Dust.NewDustPerfect(base.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector3 * 1f, 100, Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34274 dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34275 dust2.noGravity = true;
34276 }
34277 if (Main.rand.NextFloat() * 1.5f < Opacity)
34278 {
34279 Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, Color.White * Opacity, 1.2f * Opacity);
34280 }
34281 }
34282 if (type == 997)
34283 {
34284 float num9 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34285 _ = base.Center + num9.ToRotationVector2() * 84f * scale;
34286 Vector2 vector4 = (num9 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34287 if (Main.rand.NextFloat() * 2f < Opacity)
34288 {
34289 Dust dust3 = Dust.NewDustPerfect(base.Center + num9.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 6, vector4 * 4f, 0, default(Color), 0.4f);
34290 dust3.noGravity = true;
34291 dust3.scale = 1.4f;
34292 }
34293 }
34294 if (type == 983)
34295 {
34296 float num10 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34297 Vector2 vector5 = base.Center + num10.ToRotationVector2() * 84f * scale;
34298 Vector2 vector6 = (num10 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34299 if (Main.rand.NextFloat() < Opacity)
34300 {
34301 Dust dust4 = Dust.NewDustPerfect(base.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector6 * 1f, 100, Color.Lerp(Color.HotPink, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34302 dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34303 dust4.noGravity = true;
34304 }
34305 if (Main.rand.NextFloat() * 1.5f < Opacity)
34306 {
34307 Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, Color.White * Opacity, 1.2f * Opacity);
34308 }
34309 }
34310 if (type == 984)
34311 {
34312 float num11 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34313 Vector2 vector7 = base.Center + num11.ToRotationVector2() * 85f * scale;
34314 Vector2 vector8 = (num11 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34315 Color value = new Color(64, 220, 96);
34316 Color value2 = new Color(15, 84, 125);
34317 Lighting.AddLight(base.Center, value2.ToVector3());
34318 if (Main.rand.NextFloat() * 2f < Opacity)
34319 {
34320 Color value3 = Color.Lerp(value2, value, Utils.Remap(num, 0f, 0.6f, 0f, 1f));
34321 value3 = Color.Lerp(value3, Color.White, Utils.Remap(num, 0.6f, 0.8f, 0f, 0.5f));
34322 Dust dust5 = Dust.NewDustPerfect(base.Center + num11.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector8 * 1f, 100, Color.Lerp(value3, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34323 dust5.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34324 dust5.noGravity = true;
34325 }
34326 if (Main.rand.NextFloat() < Opacity)
34327 {
34328 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(num, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(num, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34329 Dust dust6 = Dust.NewDustPerfect(vector7, 107, vector8 * 3f, 100, default(Color) * Opacity, 0.8f * Opacity);
34330 dust6.velocity += player.velocity * 0.1f;
34331 dust6.velocity += new Vector2(player.direction, 0f);
34332 dust6.position -= dust6.velocity * 6f;
34333 }
34334 }
34335 scale *= ai[2];
34336 if (localAI[0] >= ai[1])
34337 {
34338 Kill();
34339 }
34340 }
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 Item60
Definition SoundID.cs:534
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References System.Math.Abs(), Terraria.Lighting.AddLight(), Terraria.Entity.direction, Terraria.Player.fullRotation, Microsoft.Xna.Framework.Color.Gold, Microsoft.Xna.Framework.Color.HotPink, Terraria.ID.SoundID.Item60, Microsoft.Xna.Framework.Color.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(), System.type, System.value, Terraria.Entity.velocity, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.