Example #1
0
        public override void AI()
        {
            BaseAI.AIEater(npc, ref npc.ai, .022f, 4, .6f, false, true);
            Player player       = Main.player[npc.target];
            bool   playerActive = player != null && player.active && !player.dead;

            BaseAI.LookAt(playerActive ? player.Center : (npc.Center + npc.velocity), npc, 0);
        }
Example #2
0
 public override float SpawnChance(NPCSpawnInfo spawnInfo)
 {
     BaseAI.AIEater(npc, ref npc.ai, 0.022f, 42, 0.7f, false, true);
     npc.rotation = 0f;
     if (Main.hardMode)
     {
         return(VariaWorld.cavityTiles > 75 ? 8f : 0f);
     }
     else
     {
         return(0.0f);
     }
 }
        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;
        }