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

◆ TransformVisuals()

void Terraria.NPC.TransformVisuals ( int oldType,
int newType )
inline

Definition at line 77816 of file NPC.cs.

77817 {
77819 if ((oldType == 158 && newType == 159) || (oldType == 159 && newType == 158))
77820 {
77822 int num = Gore.NewGore(new Vector2(position.X, position.Y - 10f), velocity, 99, scale);
77823 Main.gore[num].velocity *= 0.3f;
77824 num = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), velocity, 99, scale);
77825 Main.gore[num].velocity *= 0.3f;
77826 num = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 10f), velocity, 99, scale);
77827 Main.gore[num].velocity *= 0.3f;
77828 }
77829 else if (oldType == 478 && newType == 479)
77830 {
77831 for (int i = 0; i < 30; i++)
77832 {
77833 int num2 = Dust.NewDust(position, width, height, 238, 0f, -2f);
77834 if (Main.rand.Next(2) == 0)
77835 {
77836 Main.dust[num2].noGravity = true;
77837 }
77838 }
77839 Gore.NewGore(position, velocity, 684, scale);
77840 Gore.NewGore(position, velocity, 685, scale);
77841 Gore.NewGore(position, velocity, 686, scale);
77842 Gore.NewGore(position, velocity, 684 + Main.rand.Next(3), scale);
77843 }
77844 else if (oldType == 406 && newType == 405)
77845 {
77846 float num3 = Main.rand.Next(10, 21);
77847 float num4 = (float)Math.PI * 2f * Main.rand.NextFloat();
77848 Vector2 vector = new Vector2(22f, 22f);
77849 for (float num5 = 0f; num5 < num3; num5 += 1f)
77850 {
77851 Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 229)];
77852 Vector2 vector2 = Vector2.UnitY.RotatedBy(num5 * ((float)Math.PI * 2f) / num3 + num4);
77853 dust.position = base.Center + vector2 * vector / 2f;
77854 dust.velocity = vector2;
77855 dust.noGravity = true;
77856 dust.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77857 dust.velocity *= dust.scale;
77858 dust.fadeIn = Main.rand.NextFloat() * 2f;
77859 }
77860 }
77861 if (oldType == 428 && newType == 427)
77862 {
77863 for (int j = 0; j < 20; j++)
77864 {
77865 int num6 = Utils.SelectRandom<int>(Main.rand, 229, 240);
77866 Dust dust2 = Main.dust[Dust.NewDust(position, width, height, num6)];
77867 dust2.noGravity = true;
77868 dust2.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77869 dust2.fadeIn = 0.25f;
77870 dust2.velocity *= dust2.scale / 2f;
77871 }
77872 }
77873 if (oldType == 427 && newType == 426)
77874 {
77875 for (int k = 0; k < 30; k++)
77876 {
77877 int num7 = Utils.SelectRandom<int>(Main.rand, 229, 240, 240);
77878 Dust dust3 = Main.dust[Dust.NewDust(position, width, height, num7)];
77879 dust3.noGravity = true;
77880 dust3.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77881 dust3.fadeIn = 0.25f;
77882 dust3.velocity *= dust3.scale * 0.75f;
77883 }
77884 }
77886 }
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
Vector2 netOffset
Definition NPC.cs:103
float scale
Definition NPC.cs:493

References Terraria.Main.dust, Terraria.Main.gore, Terraria.ID.SoundID.Item8, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), System.Math.PI, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Dust.scale, Microsoft.Xna.Framework.Vector2.UnitY, and Microsoft.Xna.Framework.Graphics.Vector2.