Esempio n. 1
0
        public override bool PreAI()
        {
            npc.TargetClosest(true);
            int boss = (int)npc.ai[0];

            if (boss < 0 || boss >= 200 || !Main.npc[boss].active || Main.npc[boss].type != ModContent.NPCType <TowerKeeper2>())
            {
                npc.active = false;
                return(false);
            }
            this.rot     -= 0.02f;
            npc.netUpdate = true;
            Vector2 v = Main.npc[boss].Center - npc.Center;

            v.Normalize();
            v           *= 9f;
            npc.rotation = Utils.ToRotation(v);
            NPC npc2 = Main.npc[(int)npc.ai[0]];

            npc.Center = npc2.Center + AntiarisHelper.RotateVector(new Vector2(), this.rotVec, this.rot + npc.ai[2] * 0.628f);
            npc.ai[3]++;
            if (npc.ai[3] % 10.0 == 1.0 && Main.rand.Next(2) == 0 && Main.netMode != NetmodeID.MultiplayerClient)
            {
                float   speed = (float)(3.0 + Main.rand.NextFloat() * 6.0);
                Vector2 start = Vector2.UnitY.RotatedByRandom(6.28318548202515);
                Projectile.NewProjectile(Main.npc[boss].Center.X, Main.npc[boss].Center.Y, start.X * speed, start.Y * speed, ModContent.ProjectileType <Energy>(), 15, 0.0f, Main.myPlayer, Main.npc[boss].Center.X, Main.npc[boss].Center.Y - 42f);
            }
            return(false);
        }
Esempio n. 2
0
        public override bool PreAI()
        {
            npc.TargetClosest(true);
            int boss = (int)npc.ai[0];

            if (boss < 0 || boss >= 200 || !Main.npc[boss].active || Main.npc[boss].type != mod.NPCType("TowerKeeper2"))
            {
                npc.active = false;
                return(false);
            }
            this.rot     -= 0.02f;
            npc.netUpdate = true;
            Vector2 v = Main.npc[boss].Center - npc.Center;

            v.Normalize();
            v           *= 9f;
            npc.rotation = Utils.ToRotation(v);
            NPC npc2 = Main.npc[(int)npc.ai[0]];

            npc.Center = npc2.Center + AntiarisHelper.RotateVector(new Vector2(), this.rotVec, this.rot + npc.ai[2] * 0.628f);
            return(false);
        }
Esempio n. 3
0
        public override void AI()
        {
            if (projectile.timeLeft <= 100)
            {
                projectile.alpha += 2;
            }
            this.rot -= 0.09f;
            for (var k = 0; k < 1; k++)
            {
                var dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, Color.White, 1.5f);
                Main.dust[dust].noGravity   = true;
                Main.dust[dust].velocity.X += 0.6f * -projectile.direction;
            }
            projectile.rotation += 0.05f / projectile.Opacity;
            Projectile projectile2 = Main.projectile[(int)projectile.ai[0]];

            if (!projectile2.active)
            {
                projectile.Kill();
            }
            projectile.Center    = projectile2.Center + AntiarisHelper.RotateVector(new Vector2(), this.rotVec, this.rot + projectile.ai[1] * 0.628f);
            projectile.netUpdate = true;
        }