Ejemplo n.º 1
0
        public override void AI()
        {
            Player owner = Main.player[projectile.owner];

            if (owner == null || !owner.active || owner.dead)
            {
                projectile.timeLeft = 0; return;
            }

            // Point actual hit direction based on position
            if (projectile.Center.X > owner.Center.X)
            {
                projectile.direction = 1;
            }
            else
            {
                projectile.direction = -1;
            }

            RotationToPlayer += -1f * TravelDir * MathHelper.TwoPi / 60; // 1 Full rotation per second

            projectile.Center = owner.Center;

            OrbitDistance       = owner.height - 10;
            projectile.velocity = OrbitDistance * new Vector2((float)Math.Sin(RotationToPlayer), (float)Math.Cos(RotationToPlayer));

            Rectangle hitbox;

            foreach (Projectile p in Main.projectile)
            {
                if (projectile.timeLeft <= 0)
                {
                    return;
                }
                if (p.active && p.hostile)
                {
                    for (int i = 1; i < p.MaxUpdates + 1; i++)
                    {
                        hitbox    = p.Hitbox;
                        hitbox.X += (int)p.velocity.X * i;
                        hitbox.Y += (int)p.velocity.Y * i;
                        if (hitbox.Intersects(projectile.Hitbox))
                        {
                            if (ProjFX.ReflectProjectilePlayer(p, owner))
                            {
                                projectile.timeLeft = 0;
                                projectile.Kill();
                                break;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Update(Player player, ref int buffIndex)
        {
            player.statDefense += 6;

            Vector2 position;

            for (int i = 0; i < 3; i++)
            {
                // meteoric shield effect
                float angle = Main.rand.Next((int)(-Math.PI * 10000), (int)(Math.PI * 10000)) / 10000f;
                position = ProjFX.CalculateCircleVector(player, angle, 22f);
                Dust d = Main.dust[Dust.NewDust(position, 0, 0, 6)];
                d.rotation += i * d.velocity.X;
                d.velocity  = player.velocity / 2;
                d.noGravity = true;
                d.noLight   = true;
                d.scale    *= 1.5f;
            }
        }