Exemple #1
0
        public override void AI()
        {
            if (projectile.timeLeft == 599)
            {
                int y = (int)projectile.Center.Y / 16 - 34;
                for (int k = 0; k < 58; k++)
                {
                    int x = (int)projectile.Center.X / 16 + 22 + k;
                    ValidPoints.Add(new Point16(x, y));
                }
            }
            projectile.ai[1]++;
            projectile.Center = Main.npc.FirstOrDefault(n => n.modNPC is MainBody).Center;

            //collision
            for (int k = 0; k < 100; k++)
            {
                Vector2   pos  = projectile.position + new Vector2(0, -10 * k);
                Rectangle rect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y - k * 10, 60, 10);

                if (Main.tile[(int)pos.X / 16 + 2, (int)pos.Y / 16].active() || Main.tile[(int)pos.X / 16 - 2, (int)pos.Y / 16].active())
                {
                    break;
                }
                foreach (Player player in Main.player.Where(n => n.active && n.Hitbox.Intersects(rect)))
                {
                    player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " got lasered to death by a squid..."), 50, 0);
                }
            }
        }
        public override void AI()
        {
            if (projectile.timeLeft == 175)
            {
                ValidPoints.Add(new Point16((int)projectile.Center.X / 16 + 11, (int)projectile.Center.Y / 16));
            }

            projectile.ai[1]   += 0.1f;
            projectile.rotation = projectile.velocity.ToRotation() + 1.57f;

            float sin   = 1 + (float)Math.Sin(projectile.ai[1]);
            float cos   = 1 + (float)Math.Cos(projectile.ai[1]);
            Color color = new Color(0.5f + cos * 0.2f, 0.8f, 0.5f + sin * 0.2f);

            Lighting.AddLight(projectile.Center, color.ToVector3() * 0.6f);

            Dust d = Dust.NewDustPerfect(projectile.Center, 264, -projectile.velocity * 0.5f, 0, color, 1.4f);

            d.noGravity = true;
            d.rotation  = Main.rand.NextFloat(6.28f);
        }
        public override void AI()
        {
            if (projectile.timeLeft == 599 || Main.expertMode && projectile.timeLeft == 449)
            {
                int y = (int)projectile.Center.Y / 16 - 31;

                for (int k = 0; k < 58; k++)
                {
                    int x = (int)projectile.Center.X / 16 + 22 + k;
                    ValidPoints.Add(new Point16(x, y));
                }
            }

            projectile.ai[1]++;

            projectile.Center = Main.npc.FirstOrDefault(n => n.modNPC is SquidBoss).Center;

            //collision
            int height = 0;

            for (int k = 0; k < 45; k++)
            {
                Vector2 pos = projectile.position + new Vector2(0, -16 * k);
                height += 16;

                if (Main.tile[(int)pos.X / 16 + 2, (int)pos.Y / 16 - 4].active() || Main.tile[(int)pos.X / 16 - 2, (int)pos.Y / 16 - 4].active())
                {
                    break;
                }
            }

            Rectangle rect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y - height, projectile.width, height);

            foreach (Player player in Main.player.Where(n => n.active && n.Hitbox.Intersects(rect)))
            {
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " got lasered to death by a squid..."), 50, 0);
            }
        }