Пример #1
0
 public override void AI()
 {
     npc.noGravity     = true;
     npc.noTileCollide = true;
     for (int m = 0; m < 2; m++)
     {
         BaseAI.AIEye(npc, ref npc.ai, false, true, 0.13f, 0.08f, 2f, 1.1f, 1.2f, 1.2f);
         BaseAI.Look(npc, 1);
     }
 }
Пример #2
0
        public override void AI()
        {
            npc.noGravity = true;
            npc.TargetClosest(true);

            for (int m = npc.oldPos.Length - 1; m > 0; m--)
            {
                npc.oldPos[m] = npc.oldPos[m - 1];
            }
            npc.oldPos[0] = npc.position;

            BaseAI.AIEye(npc, ref npc.ai, false, true, .2f, .1f, 7, 3);
            BaseAI.Look(npc, 0);
        }
Пример #3
0
        public override void AI()
        {
            npc.TargetClosest(true);
            Player player = Main.player[npc.target];

            BaseAI.AIEye(npc, ref npc.ai, false, true, 0.2f, 0.16f, 6f, 2f);
            BaseAI.Look(npc, 1);

            if (npc.ai[3] >= 120)
            {
                FireMagic(npc);
                npc.ai[3] = 0;
            }

            if (player.Center.X < npc.Center.X)
            {
                npc.direction = npc.spriteDirection = -1;
            }
            else
            {
                npc.direction = npc.spriteDirection = 1;
            }
        }
Пример #4
0
        public override void AI()
        {
            if (Main.expertMode)
            {
                damage = npc.damage / 4;
            }
            else
            {
                damage = npc.damage / 2;
            }
            if (!NPC.AnyNPCs(ModContent.NPCType <Sagittarius>()))
            {
                npc.life = 0;
            }

            npc.noGravity = true;

            if (npc.alpha > 0)
            {
                npc.dontTakeDamage = true;
                npc.chaseable      = false;
            }
            else
            {
                npc.dontTakeDamage = false;
                npc.chaseable      = true;
            }

            if (body == -1)
            {
                int npcID = BaseAI.GetNPC(npc.Center, mod.NPCType("Sagittarius"), 400f, null);
                if (npcID >= 0)
                {
                    body = npcID;
                }
            }
            if (body == -1)
            {
                return;
            }
            NPC sagittarius = Main.npc[body];

            if (sagittarius == null || sagittarius.life <= 0 || !sagittarius.active || sagittarius.type != mod.NPCType("Sagittarius"))
            {
                BaseAI.KillNPCWithLoot(npc); return;
            }

            Player player = Main.player[sagittarius.target];


            pos = sagittarius.Center;



            for (int m = npc.oldPos.Length - 1; m > 0; m--)
            {
                npc.oldPos[m] = npc.oldPos[m - 1];
            }
            npc.oldPos[0] = npc.position;

            int probeNumber = ((Sagittarius)sagittarius.modNPC).ProbeCount;

            if (rotValue == -1f)
            {
                rotValue = npc.ai[0] % probeNumber * ((float)Math.PI * 2f / probeNumber);
            }
            rotValue += 0.04f;
            while (rotValue > (float)Math.PI * 2f)
            {
                rotValue -= (float)Math.PI * 2f;
            }

            npc.alpha = (int)Sagittarius.MovementType[1];

            int aiTimerFire = 0;

            shootAI[0]++;

            if (npc.ai[0] == 1 || npc.ai[0] == 4 || npc.ai[0] == 7 || npc.ai[0] == 10)
            {
                aiTimerFire = 50;
            }
            if (npc.ai[0] == 2 || npc.ai[0] == 5 || npc.ai[0] == 8 || npc.ai[0] == 11)
            {
                aiTimerFire = 100;
            }
            if (npc.ai[0] == 3 || npc.ai[0] == 6 || npc.ai[0] == 9 || npc.ai[0] == 12)
            {
                aiTimerFire = 150;
            }


            if (shootAI[0] >= 150)
            {
                shootAI[0] = 0;
            }

            if (Sagittarius.MovementType[0] == 0)
            {
                for (int m = npc.oldPos.Length - 1; m > 0; m--)
                {
                    npc.oldPos[m] = npc.oldPos[m - 1];
                }
                npc.oldPos[0] = npc.position;

                npc.Center = BaseUtility.RotateVector(sagittarius.Center, sagittarius.Center + new Vector2(140, 0f), rotValue);

                if (shootAI[0] == aiTimerFire)
                {
                    if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, player.width, player.height))
                    {
                        Vector2 fireTarget = npc.Center;
                        float   rot        = BaseUtility.RotationTo(npc.Center, player.Center);
                        fireTarget = BaseUtility.RotateVector(npc.Center, fireTarget, rot);
                        BaseAI.FireProjectile(player.Center, fireTarget, mod.ProjType("SagProj"), damage, 0f, 4f);
                    }
                }
            }
            if (Sagittarius.MovementType[0] == 1)
            {
                BaseAI.AIEye(npc, ref npc.ai, false, true, .2f, .1f, 6, 6, 0, 0);
            }
            else if (Sagittarius.MovementType[0] == 2)
            {
                for (int m = npc.oldPos.Length - 1; m > 0; m--)
                {
                    npc.oldPos[m] = npc.oldPos[m - 1];
                }
                npc.oldPos[0] = npc.position;

                npc.Center = BaseUtility.RotateVector(sagittarius.Center, sagittarius.Center + new Vector2(140, 0f), rotValue);
            }
            else if (Sagittarius.MovementType[0] == 3)
            {
                npc.Center = BaseUtility.RotateVector(player.Center, player.Center + new Vector2(260, 0f), rotValue);
                if (shootAI[0] == aiTimerFire)
                {
                    if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height))
                    {
                        Vector2 fireTarget = npc.Center;
                        float   rot        = BaseUtility.RotationTo(npc.Center, player.Center);
                        fireTarget = BaseUtility.RotateVector(npc.Center, fireTarget, rot);
                        BaseAI.FireProjectile(player.Center, fireTarget, mod.ProjType("SagProj"), damage, 0f, 4f);
                    }
                }
            }
            else if (Sagittarius.MovementType[0] == 4)
            {
                for (int m = npc.oldPos.Length - 1; m > 0; m--)
                {
                    npc.oldPos[m] = npc.oldPos[m - 1];
                }
                npc.oldPos[0] = npc.position;

                npc.Center = BaseUtility.RotateVector(sagittarius.Center, sagittarius.Center + new Vector2(140, 0f), rotValue);
            }
            else if (Sagittarius.MovementType[0] == 5)
            {
                npc.velocity *= .8f;
            }
            if (Sagittarius.MovementType[0] != 1)
            {
                npc.rotation = 0;
            }
        }
Пример #5
0
        public override void AI()
        {
            if (Main.expertMode)
            {
                damage = npc.damage / 4;
            }
            else
            {
                damage = npc.damage / 2;
            }
            npc.noGravity = true;
            npc.TargetClosest(true);
            Player   player    = Main.player[npc.target];
            AAPlayer modplayer = player.GetModPlayer <AAPlayer>();

            RingRoatation += .05f;
            npc.ai[1]++;
            if (internalAI[3] > 0)
            {
                internalAI[3]--;
            }

            if (Main.player[npc.target].dead && Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f)
            {
                npc.TargetClosest(true);
                if (Main.player[npc.target].dead)
                {
                    if (internalAI[0] != 1f)
                    {
                        if (Main.netMode != 1)
                        {
                            BaseUtility.Chat(Lang.BossChat("SagittariusFree1"), Color.PaleVioletRed);
                        }
                        internalAI[0] = 1f;
                    }
                }
                if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f)
                {
                    if (internalAI[0] != 1f)
                    {
                        if (Main.netMode != 1)
                        {
                            BaseUtility.Chat(Lang.BossChat("SagittariusFree2"), Color.PaleVioletRed);
                        }
                        internalAI[0] = 1f;
                    }
                }
            }
            if (internalAI[0] == 1f)
            {
                npc.TargetClosest(true);
                npc.velocity *= .7f;
                npc.alpha    += 5;
                if (npc.alpha >= 255)
                {
                    npc.active = false;
                }
                if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f)
                {
                    npc.TargetClosest(true);

                    internalAI[0] = 0f;
                }
            }
            else
            {
                npc.TargetClosest(true);
                if (npc.alpha > 0)
                {
                    npc.alpha -= 10;
                }
                if (npc.alpha <= 0)
                {
                    npc.alpha = 0;
                }
            }

            internalAI[1]++;

            if (internalAI[2] == 2)
            {
                npc.dontTakeDamage = true;
            }
            else
            {
                npc.dontTakeDamage = false;
            }

            if (internalAI[1] >= 300)
            {
                internalAI[1] = 0;
                internalAI[2] = internalAI[3] <= 0 ? Main.rand.Next(3) : Main.rand.Next(2);
                internalAI[4] = Main.rand.Next(2);
                if (internalAI[2] == 2)
                {
                    CombatText.NewText(npc.Hitbox, Color.PaleVioletRed, Lang.BossChat("SagittariusFree3"));
                }
                npc.ai        = new float[4];
                npc.netUpdate = true;
            }

            if (internalAI[2] == 1)
            {
                BaseAI.AIEater(npc, ref npc.ai, 0.05f, 4f, 0, false, true);
                npc.rotation = 0;
                BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjType("SagProj"), ref shootAI[0], 15, damage, 10f, true, new Vector2(20f, 15f));
            }
            else if (internalAI[2] == 2) //Shield Mode
            {
                ShieldScale += .02f;
                if (ShieldScale >= 1f)
                {
                    ShieldScale = 1f;
                }
                internalAI[3] = 1200;
                npc.life     += 2;
                CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), CombatText.HealLife, string.Concat(2), false, false);
                BaseAI.AISpaceOctopus(npc, ref npc.ai, Main.player[npc.target].Center, 0.07f, 5f, 250f, 70f, ShootLaser);
            }
            else
            {
                BaseAI.AIEye(npc, ref npc.ai, false, true, .3f, .3f, 4, 4, 0, 0);
                npc.rotation = 0;
            }

            if (internalAI[2] != 2f)
            {
                ShieldScale -= .02f;
                if (ShieldScale <= 0f)
                {
                    ShieldScale = 0f;
                }
            }
            bool foundLocation = false;

            if (internalAI[4] == 1)
            {
                npc.alpha += 5;

                int Xint = Main.rand.Next(-500, 500);
                int Yint = Main.rand.Next(-500, 500);

                if (npc.alpha >= 255)
                {
                    npc.alpha = 255;
                    if ((Xint < -100 || Xint > 100) && (Yint < -90 || Yint > 90))
                    {
                        foundLocation = true;
                    }
                }
                if (foundLocation)
                {
                    Vector2 tele = new Vector2(player.Center.X + Xint, player.Center.Y + Yint);
                    npc.Center    = tele;
                    internalAI[4] = 0;
                }
            }
            else
            {
                npc.alpha -= 3;
                if (npc.alpha <= 0)
                {
                    npc.alpha = 0;
                }
            }

            npc.noTileCollide = true;
        }