public override void Load(TagCompound tag)
        {
            VitricBiome.X      = (int)tag.Get <Vector2>("VitricBiomePos").X;
            VitricBiome.Y      = (int)tag.Get <Vector2>("VitricBiomePos").Y;
            VitricBiome.Width  = (int)tag.Get <Vector2>("VitricBiomeSize").X;
            VitricBiome.Height = (int)tag.Get <Vector2>("VitricBiomeSize").Y;

            SquidNPCProgress      = tag.GetInt("SquidNPCProgress");
            SquidBossArena.X      = (int)tag.Get <Vector2>("SquidBossArenaPos").X;
            SquidBossArena.Y      = (int)tag.Get <Vector2>("SquidBossArenaPos").Y;
            SquidBossArena.Width  = (int)tag.Get <Vector2>("SquidBossArenaSize").X;
            SquidBossArena.Height = (int)tag.Get <Vector2>("SquidBossArenaSize").Y;
            permafrostCenter      = tag.GetInt("PermafrostCenter");

            flags = (WorldFlags)tag.GetInt(nameof(flags));

            TagCompound tag1 = tag.GetCompound(nameof(TownUpgrades));
            Dictionary <string, bool> targetDict = new Dictionary <string, bool>();

            foreach (KeyValuePair <string, object> pair in tag1)
            {
                targetDict.Add(pair.Key, tag1.GetBool(pair.Key));
            }

            TownUpgrades = targetDict;

            PureTiles = (List <Vector2>)tag.GetList <Vector2>(nameof(PureTiles));

            RiftLocation = tag.Get <Vector2>(nameof(RiftLocation));

            Chungus  = tag.GetFloat("Chungus");
            Chungus += 0.01f;

            knownRecipies = (List <string>)tag.GetList <string>("Recipies");

            for (int k = 0; k <= PureTiles.Count - 1; k++)
            {
                for (int i = (int)PureTiles[k].X - 16; i <= (int)PureTiles[k].X + 16; i++)
                {
                    for (int j = (int)PureTiles[k].Y - 16; j <= (int)PureTiles[k].Y + 16; j++)
                    {
                        PurifyTransformation.RevertTile(i, j);
                    }
                }
            }

            PureTiles.Clear();

            foreach (Key key in KeyInventory)
            {
                Content.GUI.KeyInventory.keys.Add(new Content.GUI.KeyIcon(key, false));
            }

            //setup overlays
            cathedralOverlay = new Cutaway(GetTexture("StarlightRiver/Assets/Bosses/SquidBoss/CathedralOver"), SquidBossArena.TopLeft() * 16);
        }
Esempio n. 2
0
        public override void AI()
        {
            if (projectile.timeLeft <= 800 && projectile.ai[1] == 0 && StarlightRiver.Instance.AbilityKeys.Get <Pure>().JustPressed) //recall logic
            {
                projectile.ai[1]        = 1;
                projectile.timeLeft     = 150;
                projectile.extraUpdates = 2;
                projectile.netUpdate    = true;
            }

            //if (projectile.timeLeft == 900) //activate shader on start
            //Filters.Scene.Activate("PurityFilter", projectile.position).GetShader().UseDirection(new Vector2(0.1f, 0.1f));

            else if (projectile.timeLeft >= 800) //grow
            {
                projectile.ai[0] += 3;
            }

            else if (projectile.timeLeft < 150) //shrink
            {
                projectile.ai[0] -= 2;
            }

            //Filters.Scene["PurityFilter"].GetShader().UseProgress((projectile.ai[0] / 255) * 0.125f).UseIntensity((projectile.ai[0] / 255) * 0.006f);

            Dust.NewDust(projectile.Center - Vector2.One * 32, 32, 32, DustType <Dusts.Purify>()); //dusts around crown

            for (int x = -40; x < 40; x++)                                                         //tile transformation
            {
                for (int y = -40; y < 40; y++)
                {
                    Vector2 check = projectile.position / 16 + new Vector2(x, y);

                    if (Vector2.Distance(check * 16, projectile.Center) <= projectile.ai[0] - 2)
                    {
                        PurifyTransformation.TransformTile((int)check.X, (int)check.Y);
                    }
                    else
                    {
                        PurifyTransformation.RevertTile((int)check.X, (int)check.Y);
                    }

                    //just in case
                    if (projectile.timeLeft == 1)
                    {
                        PurifyTransformation.RevertTile((int)check.X, (int)check.Y);
                    }
                }
            }

            if (projectile.timeLeft == 1)
            {
                for (int k = 0; k <= 50; k++)
                {
                    Dust.NewDustPerfect(projectile.Center - Vector2.One * 8, DustType <Dusts.Purify2>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(2.4f), 0, default, 1.2f);
Esempio n. 3
0
        public override void Load(TagCompound tag)
        {
            VitricBiome.X      = (int)tag.Get <Vector2>("VitricBiomePos").X;
            VitricBiome.Y      = (int)tag.Get <Vector2>("VitricBiomePos").Y;
            VitricBiome.Width  = (int)tag.Get <Vector2>("VitricBiomeSize").X;
            VitricBiome.Height = (int)tag.Get <Vector2>("VitricBiomeSize").Y;

            SquidNPCProgress      = tag.GetInt("SquidNPCProgress");
            SquidBossArena.X      = (int)tag.Get <Vector2>("SquidBossArenaPos").X;
            SquidBossArena.Y      = (int)tag.Get <Vector2>("SquidBossArenaPos").Y;
            SquidBossArena.Width  = (int)tag.Get <Vector2>("SquidBossArenaSize").X;
            SquidBossArena.Height = (int)tag.Get <Vector2>("SquidBossArenaSize").Y;
            permafrostCenter      = tag.GetInt("PermafrostCenter");

            flags = (WorldFlags)tag.GetInt(nameof(flags));

            TagCompound tag1 = tag.GetCompound(nameof(TownUpgrades));
            Dictionary <string, bool> targetDict = new Dictionary <string, bool>();

            foreach (KeyValuePair <string, object> pair in tag1)
            {
                targetDict.Add(pair.Key, tag1.GetBool(pair.Key));
            }

            TownUpgrades = targetDict;

            PureTiles = (List <Vector2>)tag.GetList <Vector2>(nameof(PureTiles));

            RiftLocation = tag.Get <Vector2>(nameof(RiftLocation));

            Chungus = tag.GetFloat("Chungus");

            Chungus += Main.rand.NextFloat(-0.005f, 0.01f);
            Chungus  = MathHelper.Clamp(Chungus, 0, 1);

            knownRecipies = (List <string>)tag.GetList <string>("Recipies");

            for (int k = 0; k <= PureTiles.Count - 1; k++)
            {
                for (int i = (int)PureTiles[k].X - 16; i <= (int)PureTiles[k].X + 16; i++)
                {
                    for (int j = (int)PureTiles[k].Y - 16; j <= (int)PureTiles[k].Y + 16; j++)
                    {
                        PurifyTransformation.RevertTile(i, j);
                    }
                }
            }

            PureTiles.Clear();

            foreach (Key key in KeyInventory)
            {
                Content.GUI.KeyInventory.keys.Add(new Content.GUI.KeyIcon(key, false));
            }

            //setup overlays
            if (Main.netMode == NetmodeID.SinglePlayer)
            {
                CreateCutaways();
            }

            Physics.VerletChain.toDraw.Clear();

            DummyTile.dummies.Clear();
        }