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

◆ EmitEnchantmentVisualsAt()

void Terraria.Projectile.EmitEnchantmentVisualsAt ( Vector2 boxPosition,
int boxWidth,
int boxHeight )
inline

Definition at line 14914 of file Projectile.cs.

14915 {
14916 Player player = Main.player[owner];
14917 if (player.frostBurn && (melee || ranged) && friendly && !hostile && !noEnchantments && Main.rand.Next(2 * (1 + extraUpdates)) == 0)
14918 {
14919 int num = Dust.NewDust(boxPosition, boxWidth, boxHeight, 135, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2f);
14920 Main.dust[num].noGravity = true;
14921 Main.dust[num].velocity *= 0.7f;
14922 Main.dust[num].velocity.Y -= 0.5f;
14923 }
14924 if (melee && player.magmaStone && !noEnchantments && Main.rand.Next(3) != 0)
14925 {
14926 int num2 = Dust.NewDust(new Vector2(boxPosition.X - 4f, boxPosition.Y - 4f), boxWidth + 8, boxHeight + 8, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
14927 if (Main.rand.Next(2) == 0)
14928 {
14929 Main.dust[num2].scale = 1.5f;
14930 }
14931 Main.dust[num2].noGravity = true;
14932 Main.dust[num2].velocity.X *= 2f;
14933 Main.dust[num2].velocity.Y *= 2f;
14934 }
14935 if ((!melee && !ProjectileID.Sets.IsAWhip[type]) || player.meleeEnchant <= 0 || noEnchantments)
14936 {
14937 return;
14938 }
14939 if (player.meleeEnchant == 1 && Main.rand.Next(3) == 0)
14940 {
14941 int num3 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 171, 0f, 0f, 100);
14942 Main.dust[num3].noGravity = true;
14943 Main.dust[num3].fadeIn = 1.5f;
14944 Main.dust[num3].velocity *= 0.25f;
14945 }
14946 if (player.meleeEnchant == 1)
14947 {
14948 if (Main.rand.Next(3) == 0)
14949 {
14950 int num4 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 171, 0f, 0f, 100);
14951 Main.dust[num4].noGravity = true;
14952 Main.dust[num4].fadeIn = 1.5f;
14953 Main.dust[num4].velocity *= 0.25f;
14954 }
14955 }
14956 else if (player.meleeEnchant == 2)
14957 {
14958 if (Main.rand.Next(2) == 0)
14959 {
14960 int num5 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 75, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
14961 Main.dust[num5].noGravity = true;
14962 Main.dust[num5].velocity *= 0.7f;
14963 Main.dust[num5].velocity.Y -= 0.5f;
14964 }
14965 }
14966 else if (player.meleeEnchant == 3)
14967 {
14968 if (Main.rand.Next(2) == 0)
14969 {
14970 int num6 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
14971 Main.dust[num6].noGravity = true;
14972 Main.dust[num6].velocity *= 0.7f;
14973 Main.dust[num6].velocity.Y -= 0.5f;
14974 }
14975 }
14976 else if (player.meleeEnchant == 4)
14977 {
14978 int num7 = 0;
14979 if (Main.rand.Next(2) == 0)
14980 {
14981 num7 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.1f);
14982 Main.dust[num7].noGravity = true;
14983 Main.dust[num7].velocity.X /= 2f;
14984 Main.dust[num7].velocity.Y /= 2f;
14985 }
14986 }
14987 else if (player.meleeEnchant == 5)
14988 {
14989 if (Main.rand.Next(2) == 0)
14990 {
14991 int num8 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 169, 0f, 0f, 100);
14992 Main.dust[num8].velocity.X += direction;
14993 Main.dust[num8].velocity.Y += 0.2f;
14994 Main.dust[num8].noGravity = true;
14995 }
14996 }
14997 else if (player.meleeEnchant == 6)
14998 {
14999 if (Main.rand.Next(2) == 0)
15000 {
15001 int num9 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 135, 0f, 0f, 100);
15002 Main.dust[num9].velocity.X += direction;
15003 Main.dust[num9].velocity.Y += 0.2f;
15004 Main.dust[num9].noGravity = true;
15005 }
15006 }
15007 else if (player.meleeEnchant == 7)
15008 {
15010 if (vector.Length() > 4f)
15011 {
15012 vector *= 4f / vector.Length();
15013 }
15014 if (Main.rand.Next(20) == 0)
15015 {
15016 int num10 = Main.rand.Next(139, 143);
15017 int num11 = Dust.NewDust(boxPosition, boxWidth, boxHeight, num10, vector.X, vector.Y, 0, default(Color), 1.2f);
15018 Main.dust[num11].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15019 Main.dust[num11].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15020 Main.dust[num11].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
15021 Main.dust[num11].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
15022 Main.dust[num11].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
15023 }
15024 if (Main.rand.Next(40) == 0)
15025 {
15026 int num12 = Main.rand.Next(276, 283);
15027 int num13 = Gore.NewGore(position, vector, num12);
15028 Main.gore[num13].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15029 Main.gore[num13].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15030 Main.gore[num13].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
15031 Main.gore[num13].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
15032 Main.gore[num13].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
15033 }
15034 }
15035 else if (player.meleeEnchant == 8 && Main.rand.Next(4) == 0)
15036 {
15037 int num14 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 46, 0f, 0f, 100);
15038 Main.dust[num14].noGravity = true;
15039 Main.dust[num14].fadeIn = 1.5f;
15040 Main.dust[num14].velocity *= 0.25f;
15041 }
15042 }
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14

References Terraria.Entity.direction, Terraria.Main.dust, Terraria.Projectile.extraUpdates, Terraria.Projectile.friendly, Terraria.Player.frostBurn, Terraria.Main.gore, Terraria.Projectile.hostile, Terraria.ID.ProjectileID.Sets.IsAWhip, Terraria.Player.magmaStone, Terraria.Projectile.melee, Terraria.Player.meleeEnchant, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), Terraria.Projectile.noEnchantments, Terraria.Projectile.owner, Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, Terraria.Projectile.ranged, Terraria.Projectile.type, Terraria.Entity.velocity, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Projectile.UpdateEnchantmentVisuals().