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

◆ ReflectProjectile()

void Terraria.NPC.ReflectProjectile ( Projectile proj)
inline

Definition at line 58806 of file NPC.cs.

58807 {
58809 for (int i = 0; i < 3; i++)
58810 {
58811 int num = Dust.NewDust(proj.position, proj.width, proj.height, 31);
58812 Main.dust[num].velocity *= 0.3f;
58813 }
58814 proj.reflected = true;
58815 proj.hostile = true;
58816 proj.friendly = false;
58817 Vector2 vector = Main.player[proj.owner].Center - proj.Center;
58818 vector.Normalize();
58819 vector *= proj.oldVelocity.Length();
58820 proj.velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
58821 proj.velocity.Normalize();
58822 proj.velocity *= vector.Length();
58823 proj.velocity += vector * 20f;
58824 proj.velocity.Normalize();
58825 proj.velocity *= vector.Length();
58826 proj.damage /= 2;
58827 proj.damage /= 2;
58828 proj.penetrate = 1;
58829 }
static void PlaySound(int type, Vector2 position, int style=1)
static readonly LegacySoundStyle Item150
Definition SoundID.cs:714

References Terraria.Main.dust, Terraria.ID.SoundID.Item150, Terraria.Dust.NewDust(), Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, and Microsoft.Xna.Framework.Graphics.Vector2.

Referenced by Terraria.NPC.ReflectProjectiles().