Example #1
0
        private void Dash()
        {
            var close = PlayerHelper.Closest(npc.Center, float.MaxValue);

            if (close != -1)
            {
                Player plr = Main.player[close];
                if (Vector2.Distance(npc.Center, plr.Center) < 800)
                {
                    npc.velocity.X = 14 * -npc.spriteDirection;
                    Vector2 svel  = VectorHelper.FromTo(npc.Center, plr.Center, 5);
                    int     count = 3;

                    const float cir = MathHelper.TwoPi;
                    float       one = cir / (count * 15);
                    for (int i = -count / 2; i < count / 2 + 1; i++)
                    {
                        Vector2    vel = (svel.ToRotation() + (one * i)).ToRotationVector2() * 18;
                        Projectile p   = Projectile.NewProjectileDirect(npc.Center, vel, mod.ProjectileType("PhoenixFeather"), npc.damage / 2, 1.5f, Main.myPlayer);
                        p.hostile  = true;
                        p.friendly = false;
                    }
                }
            }
        }