Ejemplo n.º 1
0
        public override void AI()
        {
            npc.velocity *= 0;

            if (npc.ai[3]++ < 120)
            {
                npc.scale += npc.ai[2] * 0.01f;
                if (npc.scale > 1f)
                {
                    npc.ai[2] = -1;
                    npc.scale = 1f;
                }
                if (npc.scale < 0.7)
                {
                    npc.ai[2] = 1;
                    npc.scale = 0.7f;
                }
                return;
            }
            else
            {
                if (npc.scale < 1)
                {
                    npc.ai[2]  = 1;
                    npc.scale += .1f;
                }
            }

            if (!title)
            {
                CSkies.ShowTitle(npc, 6);
                title = true;
            }
            music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/FurySoul");
            if (++npc.ai[0] >= 12 && Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (++npc.ai[1] >= 15)
                {
                    int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <FurySoul>(), 0, 10);
                    Main.npc[n].Center   = npc.Center;
                    Main.npc[n].velocity = npc.velocity;
                    int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShockwaveBoom"), 0, 1, Main.myPlayer, 0, 12);
                    Main.projectile[p].Center = npc.Center;
                    npc.active = false;
                }
                npc.ai[0]     = 0;
                npc.netUpdate = true;
            }
        }
Ejemplo n.º 2
0
        public override void AI()
        {
            if (!title)
            {
                CSkies.ShowTitle(npc, 4);
                title = true;
            }

            if (++npc.ai[0] >= 5 && Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (++npc.ai[1] >= 19)
                {
                    int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShockwaveBoom"), 0, 1, Main.myPlayer, 0, 12);
                    Main.projectile[p].Center = npc.Center;
                    int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Void"), 0, 30);
                    Main.npc[n].Center   = npc.Center;
                    Main.npc[n].velocity = npc.velocity;
                    npc.active           = false;
                }
                npc.ai[0]     = 0;
                npc.netUpdate = true;
            }
            npc.velocity *= .98f;
        }
Ejemplo n.º 3
0
        public override void AI()
        {
            if (!title)
            {
                CSkies.ShowTitle(npc, 3);
                title = true;
            }

            Lighting.AddLight(npc.Center, 0, 0f, .15f);
            npc.TargetClosest();
            if (!Main.dayTime)
            {
                if (npc.alpha <= 0)
                {
                    npc.alpha = 0;
                }
                else
                {
                    npc.alpha -= 5;
                }
            }
            else
            {
                if (npc.alpha >= 255)
                {
                    npc.active = false;
                }
                else
                {
                    npc.alpha += 5;
                }
            }

            if (internalAI[3] == 0 && npc.ai[3] < 1000)
            {
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    for (int m = 0; m < StarCount; m++)
                    {
                        int projectileID = Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("BlackHole"), npc.damage / 4, 4, Main.myPlayer, m);
                        Main.projectile[projectileID].Center    = npc.Center;
                        Main.projectile[projectileID].velocity  = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()));
                        Main.projectile[projectileID].velocity *= 8f;
                    }
                    internalAI[3] = 1;
                    npc.netUpdate = true;
                }
            }
            if (internalAI[1] < 120)
            {
                internalAI[1] += 2;
            }
            else
            {
                internalAI[1] = 120;
                npc.netUpdate = true;
            }

            BaseAI.AISkull(npc, ref npc.ai, true, 11, 350, .05f, .07f);

            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (internalAI[2]++ > 200)
                {
                    FireLaser(npc);
                    internalAI[2] = 0;
                    npc.netUpdate = true;
                }
                if (npc.ai[3] == 1200f)
                {
                    npc.netUpdate = true;
                }
                else if (npc.ai[3] < 1200)
                {
                    npc.ai[3]++;
                    npc.netUpdate = true;
                    if (npc.ai[2]++ == (Main.expertMode ? 400 : 500))
                    {
                        internalAI[0] += 1;
                        npc.netUpdate  = true;
                    }
                }
                if (!CUtils.AnyProjectiles(ModContent.ProjectileType <BlackHole>()))
                {
                    npc.ai[2]     = 0;
                    internalAI[0] = 0;
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                    internalAI[3] = 0;
                    npc.netUpdate = true;
                }
            }

            if (npc.ai[3] >= 1200f)
            {
                if (npc.ai[3] > (Main.expertMode ? 1500 : 1400))
                {
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                else
                {
                    npc.ai[3]++;
                }

                npc.ai[2]     = 0;
                npc.velocity *= .98f;
                if (VortexScale < 1f)
                {
                    VortexScale += .01f;
                }
                VortexRotation += .3f;

                for (int u = 0; u < Main.maxPlayers; u++)
                {
                    Player target = Main.player[u];

                    if (target.active && Vector2.Distance(npc.Center, target.Center) < 260 * VortexScale)
                    {
                        float   num3   = 6f;
                        Vector2 vector = new Vector2(target.position.X + target.width / 4, target.position.Y + target.height / 4);
                        float   num4   = npc.Center.X - vector.X;
                        float   num5   = npc.Center.Y - vector.Y;
                        float   num6   = (float)Math.Sqrt(num4 * num4 + num5 * num5);
                        num6  = num3 / num6;
                        num4 *= num6;
                        num5 *= num6;
                        int num7 = 4;
                        target.velocity.X = (target.velocity.X * (num7 - 1) + num4) / num7;
                        target.velocity.Y = (target.velocity.Y * (num7 - 1) + num5) / num7;
                    }
                }
            }
            else
            {
                if (VortexScale > 0f)
                {
                    VortexScale -= .05f;
                }
                VortexRotation += .05f;
            }

            npc.rotation = 0;

            for (int m = npc.oldPos.Length - 1; m > 0; m--)
            {
                npc.oldPos[m] = npc.oldPos[m - 1];
            }
            npc.oldPos[0] = npc.position;
        }
Ejemplo n.º 4
0
        public override void AI()
        {
            npc.rotation += .06f;
            npc.velocity *= 0;
            npc.ai[0]++;
            if (Main.netMode != NetmodeID.Server && !Filters.Scene["WhiteFlash"].IsActive())
            {
                Filters.Scene.Activate("WhiteFlash", npc.Center).GetShader().UseOpacity(npc.ai[0] * 5);
            }
            Filters.Scene["WhiteFlash"].GetShader().UseOpacity(npc.ai[0] * 5);

            if (npc.ai[0] == 120 && Main.netMode != NetmodeID.Server)
            {
                int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShockwaveBoom"), 0, 1, Main.myPlayer, 0, 12);
                Main.projectile[p].Center = npc.Center;
            }
            if (npc.ai[0] > 60)
            {
                if (!title)
                {
                    CSkies.ShowTitle(npc, 7);
                    title = true;
                }

                if (npc.ai[0] > 120)
                {
                    if (npc.alpha > 0)
                    {
                        npc.alpha -= 10;
                    }
                    else
                    {
                        npc.alpha = 0;
                    }
                }

                if (npc.alpha > 0)
                {
                    Fadeout    += 5;
                    ShineAlpha -= 5;
                    if (ShineAlpha <= 30)
                    {
                        ShineAlpha = 30;
                    }
                }
                else
                {
                    Fadeout    -= 5;
                    ShineAlpha += 3;
                    if (ShineAlpha >= 255)
                    {
                        ShineAlpha = 255;
                    }
                }
            }

            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (npc.ai[0] > 300 && Main.netMode != NetmodeID.Server && Filters.Scene["WhiteFlash"].IsActive())
                {
                    Filters.Scene["WhiteFlash"].Deactivate();
                }
                if (npc.ai[0] > 360)
                {
                    int n = NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, ModContent.NPCType <Novacore>(), 0, 10);
                    Main.npc[n].Center   = npc.Center;
                    Main.npc[n].velocity = npc.velocity;
                    Main.npc[n].frame.Y  = npc.frame.Y;
                    npc.active           = false;
                    npc.netUpdate        = true;
                }
            }
        }
Ejemplo n.º 5
0
        public override void AI()
        {
            if (!title)
            {
                CSkies.ShowTitle(npc, 1);
                title = true;
            }

            npc.TargetClosest();
            if (!Main.dayTime)
            {
                if (npc.alpha <= 0)
                {
                    npc.alpha = 0;
                }
                else
                {
                    Dust.NewDust(npc.position, npc.width, npc.height, 17, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, DustID.Electric, Color.White, 1f);
                    npc.alpha -= 3;
                }
            }
            else
            {
                if (npc.alpha >= 255)
                {
                    npc.active = false;
                }
                else
                {
                    Dust.NewDust(npc.position, npc.width, npc.height, 17, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, DustID.Electric, Color.White, 1f);
                    npc.alpha += 3;
                }
            }

            if (internalAI[3] == 0)
            {
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    for (int m = 0; m < StarCount; m++)
                    {
                        int projectileID = Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("Star"), npc.damage, 4, Main.myPlayer);
                        Main.projectile[projectileID].Center    = npc.Center;
                        Main.projectile[projectileID].velocity  = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()));
                        Main.projectile[projectileID].velocity *= 8f;
                        Main.projectile[projectileID].ai[0]     = m;
                    }
                    internalAI[3] = 1;
                    npc.netUpdate = true;
                }
            }
            if (internalAI[1] < 120)
            {
                internalAI[1] += 2;
            }
            else
            {
                internalAI[1] = 120;
                npc.netUpdate = true;
            }

            BaseAI.AISpaceOctopus(npc, ref npc.ai, .2f, 6, 270, 70, null);

            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (internalAI[2]++ > 100)
                {
                    FireLaser(npc);
                    internalAI[2] = 0;
                    npc.netUpdate = true;
                }
                if (npc.ai[2]++ == (Main.expertMode ? 501 : 701))
                {
                    internalAI[0] += 1;
                    npc.netUpdate  = true;
                }
                if (!CUtils.AnyProjectiles(ModContent.ProjectileType <Star>()))
                {
                    npc.ai[2]     = 0;
                    internalAI[0] = 0;
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                    internalAI[3] = 0;
                    npc.netUpdate = true;
                }
            }
            npc.rotation = 0;

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