Esempio n. 1
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];
            int    Dustid = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X * -0.4f, projectile.velocity.Y * -0.4f, 0, Color.White, 1f);

            Main.dust[Dustid].noGravity = true;
            if (player.dead || !player.active)
            {
                player.ClearBuff(mod.BuffType("FireballMinion"));
            }
            if (player.HasBuff(mod.BuffType("FireballMinion")))
            {
                projectile.timeLeft = 2;
            }
            int target = DavesUtils.FindNearestTargettableNPC(projectile);

            if (player.MinionAttackTargetNPC > -1 && Main.npc[player.MinionAttackTargetNPC].CanBeChasedBy(this))
            {
                OrbitTarget(player.MinionAttackTargetNPC); projectile.ai[1]++; Shoot(player.MinionAttackTargetNPC); return;
            }
            else if (target > -1)
            {
                Shoot(target);
            }
            OrbitTarget();
        }
Esempio n. 2
0
        private void Move()
        {
            int target = DavesUtils.FindNearestTargettableNPC(projectile);

            if (target != -1)
            {
                float   speed     = 15f;
                Vector2 MoveTo    = Main.npc[target].Center - projectile.Center;
                float   magnitude = MoveTo.Length();
                if (magnitude > speed)
                {
                    MoveTo *= speed / magnitude;
                }
                projectile.velocity = (projectile.velocity * 20f + MoveTo) / 21f;
            }
        }
Esempio n. 3
0
        private void Move()
        {
            int target = DavesUtils.FindNearestTargettableNPC(projectile);

            if (target > -1)
            {
                projectile.tileCollide = false;
                float   speed     = 15f;
                Vector2 moveTo    = Main.npc[target].Center - projectile.Center;
                float   magnitude = moveTo.Length();
                if (magnitude > speed)
                {
                    moveTo *= speed / magnitude;
                    projectile.velocity = moveTo;
                }
            }
        }
Esempio n. 4
0
        public override void AI()
        {
            if (projectile.localAI[0] == 0 && projectile.owner == Main.myPlayer)
            {
                int target = DavesUtils.FindNearestTargettableNPC(projectile, 200);
                if (target != -1)
                {
                    projectile.velocity = Vector2.Normalize(Main.npc[target].Center - projectile.Center) * 10f;
                }
                Vector2 desiredPos = projectile.Center + DavesUtils.Rotate(Vector2.Normalize(projectile.velocity) * 100f, Main.rand.NextFloat(-1f, 1f));
                projectile.ai[0]      = desiredPos.X;
                projectile.ai[1]      = desiredPos.Y;
                projectile.netUpdate  = true;
                projectile.localAI[0] = 1;
            }
            MoveTo();
            int dustid = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("ShadeDust"));

            Main.dust[dustid].noGravity = true;
        }
Esempio n. 5
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            Animate();
            int target = DavesUtils.FindNearestTargettableNPC(projectile, 1000, true);

            projectile.ai[0] = DetectPhase(target);
            if (projectile.ai[0] == 0)
            {
                MoveTo(projectile.Center + new Vector2(0, 100));
            }
            else if (projectile.ai[0] == 1)
            {
                MoveTo(Main.npc[target].Center);
            }
            else
            {
                projectile.timeLeft = 160;
                if (projectile.ai[0] == 4 && projectile.velocity.Y == 0)
                {
                    projectile.velocity.Y -= 8;
                }
                else
                {
                    projectile.velocity.Y += 0.5f;
                    bool  left         = projectile.ai[0] == 2;
                    float maxSpeed     = 8f * player.GetModPlayer <DRGNPlayer>().antSpeedMult;
                    float acceleration = 0.2f * player.GetModPlayer <DRGNPlayer>().antSpeedMult;
                    projectile.velocity.X = projectile.velocity.X + (left ? acceleration * (projectile.velocity.Y < 0 ? 2 : 1) : -acceleration * (projectile.velocity.Y > 0 ? 2 : 1));
                    if (projectile.velocity.X > maxSpeed)
                    {
                        projectile.velocity.X = maxSpeed;
                    }
                    if (projectile.velocity.Y > maxSpeed)
                    {
                        projectile.velocity.Y = maxSpeed;
                    }
                }
            }
        }
Esempio n. 6
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            Animate();
            HandleBuffs(player);
            int target = DavesUtils.FindNearestTargettableNPC(projectile, 1200, true);

            projectile.ai[0] = DetectPhase(target);
            if (projectile.ai[0] == 0)
            {
                MoveTo(player.Center);
            }
            else if (projectile.ai[0] == 1)
            {
                MoveTo(Main.npc[target].Center);
            }
            else
            {
                if (projectile.ai[0] == 4 && projectile.velocity.Y == 0)
                {
                    projectile.velocity.Y -= 16;
                }
                else
                {
                    projectile.velocity.Y += 0.5f;
                    bool  left     = projectile.ai[0] == 2;
                    float maxSpeed = 16f;
                    projectile.velocity.X = projectile.velocity.X + (left ? 0.5f * (projectile.velocity.Y < 0 ? 2 : 1) : -0.5f * (projectile.velocity.Y > 0 ? 2 : 1));
                    if (projectile.velocity.X > maxSpeed)
                    {
                        projectile.velocity.X = maxSpeed;
                    }
                    if (projectile.velocity.Y > maxSpeed)
                    {
                        projectile.velocity.Y = maxSpeed;
                    }
                }
            }
        }