示例#1
0
        public override void PreUpdate()
        {
            if (pages > 8)
            {
                pages = 8;
            }
            bool hasShroudedIIIRequirement = Lighting.GetSubLight(player.Top).X == 0f;
            bool hasShroudedIIRequirement  = Lighting.GetSubLight(player.Top).X > 0f &&
                                             Lighting.GetSubLight(player.Top).X < 0.05f;
            bool hasShroudedIRequirement = Lighting.GetSubLight(player.Top).X >= 0.05f &&
                                           Lighting.GetSubLight(player.Top).X < 0.1f;

            if (hasShroudedIIIRequirement && !hasShroudedIIRequirement && hasShroudedIIIRequirement)
            {
                player.AddBuff(ModContent.BuffType <Shrouded_3>(), 2, false);
            }
            if (hasShroudedIIRequirement && !hasShroudedIIIRequirement && !hasShroudedIRequirement)
            {
                player.AddBuff(ModContent.BuffType <Shrouded_2>(), 2, false);
            }
            if (!hasShroudedIIRequirement && !hasShroudedIIIRequirement && hasShroudedIRequirement)
            {
                player.AddBuff(ModContent.BuffType <Shrouded_1>(), 2, false);
            }
        }
示例#2
0
        private void DrawTilingBackground()
        {
            Texture2D tex       = GetTexture("Backgrounds/VitricSand");
            Rectangle blacklist = new Rectangle(StarlightWorld.VitricBiome.X, StarlightWorld.VitricBiome.Y + 6, StarlightWorld.VitricBiome.Width, StarlightWorld.VitricBiome.Height - 12);

            for (int x = 0; x <= Main.screenWidth + tex.Width; x += tex.Width)
            {
                for (int y = 0; y <= Main.screenHeight + tex.Height; y += tex.Height)
                {
                    Vector2 pos = new Vector2(x - Main.screenPosition.X % tex.Width, y - Main.screenPosition.Y % tex.Height);

                    for (int k = 0; k < tex.Width; k += 16)
                    {
                        for (int m = 0; m < tex.Height; m += 16)
                        {
                            Vector2 target = pos + new Vector2(k, m);
                            Vector3 vector = Lighting.GetSubLight(target + Main.screenPosition);
                            Color   color  = new Color(vector.X, vector.Y, vector.Z);//Lighting.GetColor((int)(pos.X + k + Main.screenPosition.X) / 16, (int)(pos.Y + m + Main.screenPosition.Y) / 16);
                            if (CheckBackground(target, Vector2.One * 16, blacklist))
                            {
                                Main.spriteBatch.Draw(tex, target, new Rectangle(k, m, 16, 16), color, 0, Vector2.Zero, 1, 0, 0);
                            }
                        }
                    }
                }
            }
        }
 public override void Apply(Entity entity, DrawData?drawData)
 {
     if (entity == null)
     {
         this.Shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
     }
     else
     {
         float num1 = 0.0f;
         if (drawData.HasValue)
         {
             num1 = drawData.Value.rotation;
         }
         Vector2 position      = entity.position;
         float   width         = (float)entity.width;
         float   height        = (float)entity.height;
         Vector2 vector2_1     = new Vector2(width, height) * 0.1f;
         Vector2 vector2_2     = position + vector2_1;
         float   x             = width * 0.8f;
         float   y             = height * 0.8f;
         Vector2 vector2_3     = new Vector2(x * 0.5f, 0.0f);
         Vector3 subLight1     = Lighting.GetSubLight(vector2_2 + vector2_3);
         Vector2 vector2_4     = new Vector2(0.0f, y * 0.5f);
         Vector3 subLight2     = Lighting.GetSubLight(vector2_2 + vector2_4);
         Vector2 vector2_5     = new Vector2(x, y * 0.5f);
         Vector3 subLight3     = Lighting.GetSubLight(vector2_2 + vector2_5);
         Vector2 vector2_6     = new Vector2(x * 0.5f, y);
         Vector3 subLight4     = Lighting.GetSubLight(vector2_2 + vector2_6);
         float   num2          = subLight1.X + subLight1.Y + subLight1.Z;
         float   num3          = subLight2.X + subLight2.Y + subLight2.Z;
         float   num4          = subLight3.X + subLight3.Y + subLight3.Z;
         float   num5          = subLight4.X + subLight4.Y + subLight4.Z;
         Vector2 spinningpoint = new Vector2(num4 - num3, num5 - num2);
         if ((double)spinningpoint.Length() > 1.0)
         {
             float num6 = 1f;
             spinningpoint /= num6;
         }
         if (entity.direction == -1)
         {
             spinningpoint.X *= -1f;
         }
         spinningpoint = spinningpoint.RotatedBy(-(double)num1, new Vector2());
         Vector3 vector3 = new Vector3(spinningpoint, (float)(1.0 - ((double)spinningpoint.X * (double)spinningpoint.X + (double)spinningpoint.Y * (double)spinningpoint.Y)));
         vector3.X *= 2f;
         vector3.Y -= 0.15f;
         vector3.Y *= 2f;
         vector3.Normalize();
         vector3.Z *= 0.6f;
         this.Shader.Parameters["uLightSource"].SetValue(vector3);
     }
     base.Apply(entity, drawData);
 }
示例#4
0
        public override void Apply(Entity entity, DrawData?drawData)
        {
            if (entity == null)
            {
                Shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
            }
            else
            {
                var num1 = 0.0f;
                if (drawData.HasValue)
                {
                    num1 = drawData.Value.rotation;
                }
                var position      = entity.position;
                var width         = entity.width;
                var height        = (float)entity.height;
                var vector2       = position + new Vector2(width, height) * 0.1f;
                var x             = width * 0.8f;
                var y             = height * 0.8f;
                var subLight1     = Lighting.GetSubLight(vector2 + new Vector2(x * 0.5f, 0.0f));
                var subLight2     = Lighting.GetSubLight(vector2 + new Vector2(0.0f, y * 0.5f));
                var subLight3     = Lighting.GetSubLight(vector2 + new Vector2(x, y * 0.5f));
                var subLight4     = Lighting.GetSubLight(vector2 + new Vector2(x * 0.5f, y));
                var num2          = subLight1.X + subLight1.Y + subLight1.Z;
                var num3          = subLight2.X + subLight2.Y + subLight2.Z;
                var num4          = subLight3.X + subLight3.Y + subLight3.Z;
                var num5          = subLight4.X + subLight4.Y + subLight4.Z;
                var spinningpoint = new Vector2(num4 - num3, num5 - num2);
                if (spinningpoint.Length() > 1.0)
                {
                    var num6 = 1f;
                    spinningpoint /= num6;
                }

                if (entity.direction == -1)
                {
                    spinningpoint.X *= -1f;
                }
                spinningpoint = spinningpoint.RotatedBy(-(double)num1, new Vector2());
                var vector3 = new Vector3(spinningpoint,
                                          (float)(1.0 - (spinningpoint.X * (double)spinningpoint.X +
                                                         spinningpoint.Y * (double)spinningpoint.Y)));
                vector3.X *= 2f;
                vector3.Y -= 0.15f;
                vector3.Y *= 2f;
                vector3.Normalize();
                vector3.Z *= 0.6f;
                Shader.Parameters["uLightSource"].SetValue(vector3);
            }

            base.Apply(entity, drawData);
        }
示例#5
0
        public override void Apply(Entity entity, DrawData?drawData)
        {
            if (entity == null)
            {
                _shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
            }
            else
            {
                float num1 = 0.0f;
                if (drawData.HasValue)
                {
                    num1 = drawData.Value.rotation;
                }

                Vector2 vector2_1     = entity.position;
                float   x1            = (float)entity.width;
                float   y1            = (float)entity.height;
                Vector2 vector2_2     = vector2_1 + new Vector2(x1, y1) * 0.1f;
                float   x2            = x1 * 0.8f;
                float   y2            = y1 * 0.8f;
                Vector3 subLight1     = Lighting.GetSubLight(vector2_2 + new Vector2(x2 * 0.5f, 0.0f));
                Vector3 subLight2     = Lighting.GetSubLight(vector2_2 + new Vector2(0.0f, y2 * 0.5f));
                Vector3 subLight3     = Lighting.GetSubLight(vector2_2 + new Vector2(x2, y2 * 0.5f));
                Vector3 subLight4     = Lighting.GetSubLight(vector2_2 + new Vector2(x2 * 0.5f, y2));
                float   num2          = subLight1.X + subLight1.Y + subLight1.Z;
                float   num3          = subLight2.X + subLight2.Y + subLight2.Z;
                float   num4          = subLight3.X + subLight3.Y + subLight3.Z;
                float   num5          = subLight4.X + subLight4.Y + subLight4.Z;
                Vector2 spinningpoint = new Vector2(num4 - num3, num5 - num2);
                if ((double)spinningpoint.Length() > 1.0)
                {
                    float num6 = 1f;
                    spinningpoint /= num6;
                }

                if (entity.direction == -1)
                {
                    spinningpoint.X *= -1f;
                }

                spinningpoint = Utils.RotatedBy(spinningpoint, -(double)num1, new Vector2());
                Vector3 vector3 = new Vector3(spinningpoint, (float)(1.0 - ((double)spinningpoint.X * (double)spinningpoint.X + (double)spinningpoint.Y * (double)spinningpoint.Y)));
                vector3.X *= 2f;
                vector3.Y -= 0.15f;
                vector3.Y *= 2f;
                vector3.Normalize();
                vector3.Z *= 0.6f;
                _shader.Parameters["uLightSource"].SetValue(vector3);
            }
            base.Apply(entity, drawData);
        }
 public override void Apply(Entity entity, DrawData?drawData)
 {
     if (entity == null)
     {
         base.Shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
     }
     else
     {
         float rotation = 0f;
         if (drawData.HasValue)
         {
             rotation = drawData.Value.rotation;
         }
         Vector2 position = entity.position;
         float   width    = (float)entity.width;
         float   height   = (float)entity.height;
         Vector2 source   = position + new Vector2(width, height) * 0.1f;
         width  *= 0.8f;
         height *= 0.8f;
         Vector3 subLight  = Lighting.GetSubLight(source + new Vector2(width * 0.5f, 0f));
         Vector3 subLight2 = Lighting.GetSubLight(source + new Vector2(0f, height * 0.5f));
         Vector3 subLight3 = Lighting.GetSubLight(source + new Vector2(width, height * 0.5f));
         Vector3 subLight4 = Lighting.GetSubLight(source + new Vector2(width * 0.5f, height));
         float   vec4      = subLight.X + subLight.Y + subLight.Z;
         float   vec2      = subLight2.X + subLight2.Y + subLight2.Z;
         float   vec1      = subLight3.X + subLight3.Y + subLight3.Z;
         float   vec3      = subLight4.X + subLight4.Y + subLight4.Z;
         Vector2 vector    = new Vector2(vec1 - vec2, vec3 - vec4);
         float   length    = vector.Length();
         if (length > 1f)
         {
             length  = 1f;
             vector /= length;
         }
         if (entity.direction == -1)
         {
             vector.X *= -1f;
         }
         vector = vector.RotatedBy((double)(-(double)rotation), default(Vector2));
         Vector3 value = new Vector3(vector, 1f - (vector.X * vector.X + vector.Y * vector.Y));
         value.X *= 2f;
         value.Y -= 0.15f;
         value.Y *= 2f;
         value.Normalize();
         value.Z *= 0.6f;
         base.Shader.Parameters["uLightSource"].SetValue(value);
     }
     base.Apply(entity, drawData);
 }
示例#7
0
 public override void Apply(Entity entity, DrawData?drawData)
 {
     if (entity == null)
     {
         base.Shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
     }
     else
     {
         float num = 0f;
         if (drawData.HasValue)
         {
             num = drawData.Value.rotation;
         }
         Vector2 position = entity.position;
         float   num2     = entity.width;
         float   num3     = entity.height;
         Vector2 value    = position + new Vector2(num2, num3) * 0.1f;
         num2 *= 0.8f;
         num3 *= 0.8f;
         Vector3 subLight  = Lighting.GetSubLight(value + new Vector2(num2 * 0.5f, 0f));
         Vector3 subLight2 = Lighting.GetSubLight(value + new Vector2(0f, num3 * 0.5f));
         Vector3 subLight3 = Lighting.GetSubLight(value + new Vector2(num2, num3 * 0.5f));
         Vector3 subLight4 = Lighting.GetSubLight(value + new Vector2(num2 * 0.5f, num3));
         float   num4      = subLight.X + subLight.Y + subLight.Z;
         float   num5      = subLight2.X + subLight2.Y + subLight2.Z;
         float   num6      = subLight3.X + subLight3.Y + subLight3.Z;
         float   num7      = subLight4.X + subLight4.Y + subLight4.Z;
         Vector2 vector    = new Vector2(num6 - num5, num7 - num4);
         float   num8      = vector.Length();
         if (num8 > 1f)
         {
             num8    = 1f;
             vector /= num8;
         }
         if (entity.direction == -1)
         {
             vector.X *= -1f;
         }
         vector = vector.RotatedBy(0f - num);
         Vector3 value2 = new Vector3(vector, 1f - (vector.X * vector.X + vector.Y * vector.Y));
         value2.X *= 2f;
         value2.Y -= 0.15f;
         value2.Y *= 2f;
         value2.Normalize();
         value2.Z *= 0.6f;
         base.Shader.Parameters["uLightSource"].SetValue(value2);
     }
     base.Apply(entity, drawData);
 }
 public override void Apply(Entity entity, DrawData?drawData)
 {
     if (entity == null)
     {
         this.Shader.get_Parameters().get_Item("uLightSource").SetValue(Vector3.get_Zero());
     }
     else
     {
         float num1 = 0.0f;
         if (drawData.HasValue)
         {
             num1 = drawData.Value.rotation;
         }
         Vector2 position  = entity.position;
         float   width     = (float)entity.width;
         float   height    = (float)entity.height;
         Vector2 vector2_1 = Vector2.op_Multiply(new Vector2(width, height), 0.1f);
         Vector2 vector2_2 = Vector2.op_Addition(position, vector2_1);
         float   num2      = width * 0.8f;
         float   num3      = height * 0.8f;
         Vector2 vector2_3 = new Vector2(num2 * 0.5f, 0.0f);
         Vector3 subLight1 = Lighting.GetSubLight(Vector2.op_Addition(vector2_2, vector2_3));
         Vector2 vector2_4 = new Vector2(0.0f, num3 * 0.5f);
         Vector3 subLight2 = Lighting.GetSubLight(Vector2.op_Addition(vector2_2, vector2_4));
         Vector2 vector2_5 = new Vector2(num2, num3 * 0.5f);
         Vector3 subLight3 = Lighting.GetSubLight(Vector2.op_Addition(vector2_2, vector2_5));
         Vector2 vector2_6 = new Vector2(num2 * 0.5f, num3);
         Vector3 subLight4 = Lighting.GetSubLight(Vector2.op_Addition(vector2_2, vector2_6));
         float   num4      = (float)(subLight1.X + subLight1.Y + subLight1.Z);
         float   num5      = (float)(subLight2.X + subLight2.Y + subLight2.Z);
         float   num6      = (float)(subLight3.X + subLight3.Y + subLight3.Z);
         float   num7      = (float)(subLight4.X + subLight4.Y + subLight4.Z);
         Vector2 spinningpoint;
         // ISSUE: explicit reference operation
         ((Vector2)@spinningpoint).\u002Ector(num6 - num5, num7 - num4);
         // ISSUE: explicit reference operation
         if ((double)((Vector2)@spinningpoint).Length() > 1.0)
         {
             float num8 = 1f;
             spinningpoint = Vector2.op_Division(spinningpoint, num8);
         }
         if (entity.direction == -1)
         {
             // ISSUE: explicit reference operation
             // ISSUE: variable of a reference type
             __Null& local = @spinningpoint.X;
             // ISSUE: cast to a reference type
             // ISSUE: explicit reference operation
             double num8 = (double) ^ (float&)local * -1.0;
示例#9
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            //SysDraw.Bitmap lightMap = new SysDraw.Bitmap(10, 10);
            //mod.Logger.Info("setting up variables");
            Texture2D lightMap = new Texture2D(spriteBatch.GraphicsDevice, 10, 10);

            Color[] lightData = new Color[100];
            Vector2 pos       = projectile.position;
            Vector3 col;

            //mod.Logger.Info("set up variables");
            for (int x = 0; x < 10; x++)
            {
                pos.X += 2;
                for (int y = 0; y < 10; y++)
                {
                    pos.Y += 2;
                    col    = Lighting.GetSubLight(pos);
                    lightData[(y * 10) + x] = new Color(((col.X + col.Y + col.Z) / 1.5f - 0.66f) * Min(projectile.timeLeft / 85f, 1), 0, 0);
                    //lightMap.SetPixel(x,y,SysDraw.Color.FromArgb(255,(int)((col.X+col.Y+col.Z)/3),0,0));
                }
                pos.Y -= 20;
            }
            //mod.Logger.Info("setting data");
            lightMap.SetData(lightData);
            //mod.Logger.Info("set data");
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Immediate, blendState, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
            DrawData data2 = new DrawData(mod.GetTexture("Items/Weapons/Explosives/Crystal_Grenade_Purple"), projectile.Center - Main.screenPosition, new Rectangle(0, 0, 14, 20), new Color(255, 255, 255, 255), projectile.rotation, new Vector2(7, 7), Vector2.One, SpriteEffects.None, 0);

            //Origins.perlinFade0.Shader.Parameters["uOffset"].SetValue(projectile.position);
            //Origins.perlinFade0.Shader.Parameters["uRotation"].SetValue(-projectile.rotation);
            Main.graphics.GraphicsDevice.Textures[1] = lightMap;
            Origins.perlinFade0.Shader.Parameters["uThreshold0"].SetValue(0f);
            Origins.perlinFade0.Shader.Parameters["uThreshold1"].SetValue(0.25f);
            Origins.perlinFade0.Apply(data2);
            DrawData data = new DrawData(mod.GetTexture("Items/Weapons/Explosives/Crystal_Grenade_Pink"), projectile.Center - Main.screenPosition, new Rectangle(0, 0, 14, 20), new Color(255, 255, 255, 255), projectile.rotation, new Vector2(7, 7), Vector2.One, SpriteEffects.None, 0);

            //Origins.perlinFade0.Shader.Parameters["uOffset"].SetValue(projectile.position);
            //Origins.perlinFade0.Shader.Parameters["uRotation"].SetValue(projectile.rotation);
            //Main.graphics.GraphicsDevice.Textures[1] = lightMap;
            Origins.perlinFade0.Shader.Parameters["uThreshold0"].SetValue(0.5f);
            Origins.perlinFade0.Shader.Parameters["uThreshold1"].SetValue(0.75f);
            Origins.perlinFade0.Apply(data);
            data.Draw(spriteBatch);
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.Transform);
        }
        private static void RefreshTargets(Vector2 position, float radius)
        {
            LockOnHelper._targets.Clear();
            var rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1200f));
            var center    = Main.player[Main.myPlayer].Center;
            var vector2   = Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);

            for (var index = 0; index < Main.npc.Length; ++index)
            {
                var n = Main.npc[index];
                if (LockOnHelper.ValidTarget(n) && (double)n.Distance(position) <= (double)radius &&
                    rectangle.Intersects(n.Hitbox) &&
                    ((double)Lighting.GetSubLight(n.Center).Length() / 3.0 >= 0.00999999977648258 &&
                     (LockOnHelper.UseMode != LockOnHelper.LockOnMode.ThreeDS ||
                      (double)Vector2.Dot(n.DirectionFrom(center), vector2) >= 0.649999976158142)))
                {
                    LockOnHelper._targets.Add(index);
                }
            }
        }
示例#11
0
        public override void PostAI()
        {
            Player player = Main.LocalPlayer;
            bool   facingTowardsSlendermanLeft  = npc.Center.X < player.Center.X && player.direction == -1;
            bool   facingTowardsSlendermanRight = npc.Center.X > player.Center.X && player.direction == 1;
            bool   noLight = Lighting.GetSubLight(npc.Top).X < 0.05f;

            if (noLight)
            {
                npc.alpha += 3;
            }
            else
            {
                npc.alpha -= 3;
            }
            if (!facingTowardsSlendermanLeft && !facingTowardsSlendermanRight)
            {
                npc.alpha += 3;
            }
            npc.alpha = Utils.Clamp(npc.alpha, TransparencyHelper.Visible, TransparencyHelper.Invisible);
        }
示例#12
0
        private static void RefreshTargets(Vector2 position, float radius)
        {
            LockOnHelper._targets.Clear();
            Rectangle rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1080f));
            Vector2   center    = Main.player[Main.myPlayer].Center;
            Vector2   vector2   = Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);

            for (int index = 0; index < Main.npc.Length; ++index)
            {
                NPC n = Main.npc[index];
                // ISSUE: explicit reference operation
                if (LockOnHelper.ValidTarget(n) && (double)n.Distance(position) <= (double)radius && ((Rectangle)@rectangle).Intersects(n.Hitbox))
                {
                    Vector3 subLight = Lighting.GetSubLight(n.Center);
                    // ISSUE: explicit reference operation
                    if ((double)((Vector3)@subLight).Length() / 3.0 >= 0.00999999977648258 && (LockOnHelper.UseMode != LockOnHelper.LockOnMode.ThreeDS || (double)Vector2.Dot(n.DirectionFrom(center), vector2) >= 0.649999976158142))
                    {
                        LockOnHelper._targets.Add(index);
                    }
                }
            }
        }
        public override void PostDrawTiles()
        {
            var player = Main.player[Main.myPlayer];

            var count = SpookyPlayer.Pages;

            if (!Main.playerInventory && player.CountBuffs() == 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 100f);
            }

            if (!Main.playerInventory && player.CountBuffs() <= 11 && player.CountBuffs() > 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 150f);
            }

            if (!Main.playerInventory && player.CountBuffs() > 11 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 210f);
            }

            if (Main.playerInventory && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 325f);
            }

            if (player.GetModPlayer <SpookyPlayer>().deathTextTimer == 1)
            {
                deathTextChoice = Main.rand.Next(0, 10);
            }

            var countCached = player.GetModPlayer <SpookyPlayer>().cachedPageCount;

            var lighterRed   = new Color(255, 50, 50);
            var lerpable     = SpookyTerrariaUtils.ColorSwitcher(Color.Red, lighterRed, 30f);
            var moreLerpable = Color.Lerp(Color.Red, Color.Green, player.GetModPlayer <SpookyPlayer>().cachedPageCount * 0.125f);
            // 205, 92, 92, a: 255

            var displayableString = SpookyTerrariaUtils.ChooseRandomDeathText(deathTextChoice);
            var subString         = "Returning to Main Menu...";
            var pagesFound        = $"Pages Found: {player.GetModPlayer<SpookyPlayer>().cachedPageCount} / 8";

            float x1 = Main.screenWidth / 2;
            float y1 = Main.screenHeight / 2;

            var b = y1 - 75f;

            var x = Main.rand.NextFloat(x1 - 5, x1 + 5);
            var y = Main.rand.NextFloat(y1 - 5, y1 + 5);

            var m = y1 - 100f;

            var j = y1 + 40f;

            var middle1 = Main.fontDeathText.MeasureString(displayableString) / 2;
            var middle2 = Main.fontDeathText.MeasureString(subString) / 2;
            var middle3 = Main.fontDeathText.MeasureString(pagesFound) / 2;

            if (player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(countCached, x1 - 88, b);
                // Main.hideUI = true;
                Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                // Text with shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x, y), Color.IndianRed * 0.6f, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Text without shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x1, y1), Color.IndianRed, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Pages Found
                Main.spriteBatch.DrawString(Main.fontDeathText, pagesFound, new Vector2(x1, m), moreLerpable, 0f, middle3, 0.4f, SpriteEffects.None, 0f);
                if (Main.worldName == SpookyTerrariaUtils.slenderWorldName)
                {
                    Main.spriteBatch.DrawString(Main.fontDeathText, subString, new Vector2(x1, j), lerpable, 0f, middle2, 0.5f, SpriteEffects.None, 0f);
                }

                Main.spriteBatch.End();
            }

            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer < 99 && player.GetModPlayer <SpookyPlayer>().pageDisplayTimer > 0)
            {
                // player.GetModPlayer<SpookyPlayer>().displayTimes++;
                SpookyTerrariaUtils.DrawPageInterface(choice);
            }

            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer == 99)
            {
                choice = Main.rand.Next(1, 9);
            }

            var lighting = Lighting.GetSubLight(Main.MouseWorld).X;

            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (lighting > 0.05f)
            {
                if (!Main.gameMenu)
                {
                    if (Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageLeft || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageRight || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageWall)
                    {
                        var pickUp = "Right click to pick up";
                        var g      = Main.fontMouseText.MeasureString(pickUp);
                        // Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseScreen + new Vector2(25, 25), Color.White, 0f, new Vector2(0, 0), Main.essScale * 5/*1f*/, SpriteEffects.None, 0f);
                        Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseWorld + new Vector2(15, -35) - Main.screenPosition, Color.White * lighting, 0f, new Vector2(g.X / 2, 5), 1f, SpriteEffects.None, 0f);
                    }
                }
            }

            Main.spriteBatch.End();
        }
        private void Main_DrawPlayers(On.Terraria.Main.orig_DrawPlayers orig, Main self)
        {
            orig(self);
            Mod mod    = this;
            var player = Main.player[Main.myPlayer];

            if (player.dead)
            {
                Main.hideUI = true;
                fadeScale   = 0f;
            }

            if (!Main.hasFocus)
            {
                timerToLightStatic  = 0;
                timerToMediumStatic = 0;
                timerToSevereStatic = 0;
            }

            for (var ll = 0; ll < Main.maxNPCs; ll++)
            {
                var npc      = Main.npc[ll];
                var distance = npc.Distance(Main.player[Main.myPlayer].Center);
                if (npc.active && distance <= 1000f)
                {
                    if (npc.type == ModContent.NPCType <Slenderman>())
                    {
                        var noLight = Lighting.GetSubLight(npc.Top).X < 0.05f;
                        if (Main.GameUpdateCount % 3 == 0)
                        {
                            staticFrame.Y += 650;
                        }

                        if (staticFrame.Y >= 1950)
                        {
                            staticFrame.Y = 0;
                        }

                        var facingTowardsSlendermanLeft  = npc.Center.X < player.Center.X && player.direction == -1;
                        var facingTowardsSlendermanRight = npc.Center.X > player.Center.X && player.direction == 1;
                        Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                        Main.spriteBatch.Draw(mod.GetTexture("Assets/Static"), new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), staticFrame, Color.White * fadeScale, 0f, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), 5f, SpriteEffects.None, 1f);
                        Main.spriteBatch.End();
                        if (facingTowardsSlendermanLeft || facingTowardsSlendermanRight && !noLight)
                        {
                            if (fadeScale > 0f && fadeScale < 0.4f)
                            {
                                timerToMediumStatic = 0;
                                timerToSevereStatic = 0;
                                timerToLightStatic++;
                                if (Main.hasFocus)
                                {
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere");
                                }

                                if (timerToLightStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight"));
                                }

                                if (timerToLightStatic >= 480)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight"));
                                    timerToLightStatic = 0;
                                }
                            }

                            if (fadeScale >= 0.4 && fadeScale < 0.8f)
                            {
                                timerToLightStatic  = 0;
                                timerToSevereStatic = 0;
                                timerToMediumStatic++;
                                if (Main.hasFocus)
                                {
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere");
                                }

                                if (timerToMediumStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium"));
                                }

                                if (timerToMediumStatic >= 480)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium"));
                                    timerToMediumStatic = 0;
                                }
                            }

                            if (fadeScale >= 0.8f)
                            {
                                timerToMediumStatic = 0;
                                timerToLightStatic  = 0;
                                timerToSevereStatic++;
                                if (Main.hasFocus)
                                {
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                                    AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                                }

                                if (timerToSevereStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere"));
                                }

                                if (timerToSevereStatic >= 132)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere"));
                                    timerToSevereStatic = 0;
                                }
                            }

                            // MAJOR TODO: MAKE STATIC
                            if (!Collision.SolidCollision(npc.position, npc.width, 20) && distance <= 1000 &&
                                Collision.CanHitLine(player.Top, player.width, 10, npc.Top, npc.width, 20))
                            {
                                if (!noLight)
                                {
                                    if (Main.GameUpdateCount % 3 == 0)
                                    {
                                        fadeScale += 0.005f;
                                    }
                                }
                                else
                                {
                                    if (Main.GameUpdateCount % 10 == 0)
                                    {
                                        fadeScale += 0.005f;
                                    }
                                }
                            }
                        }
                        else if (!facingTowardsSlendermanLeft && !facingTowardsSlendermanRight)
                        {
                            timerToLightStatic  = 0;
                            timerToMediumStatic = 0;
                            timerToSevereStatic = 0;
                            if (!noLight)
                            {
                                if (Main.GameUpdateCount % 3 == 0)
                                {
                                    fadeScale -= 0.005f;
                                }
                            }
                            else
                            {
                                if (Main.GameUpdateCount % 10 == 0)
                                {
                                    fadeScale -= 0.005f;
                                }
                            }
                        }
                        else if (distance > 1000f)
                        {
                            if (Main.GameUpdateCount % 3 == 0)
                            {
                                fadeScale -= 0.005f;
                            }
                        }

                        if (fadeScale > 1f)
                        {
                            fadeScale = 1f;
                        }

                        if (fadeScale < 0f)
                        {
                            fadeScale = 0f;
                        }

                        if (fadeScale >= 1f)
                        {
                            player.KillMe(
                                PlayerDeathReason.ByCustomReason(
                                    $"{player.name} stared at death for too long."), player.statLife + 50, 0);
                        }

                        if (fadeScale == 0f)
                        {
                            if (Main.hasFocus)
                            {
                                AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                                AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                                AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere");
                            }
                        }
                    }

                    if (npc.type == ModContent.NPCType <Slenderman>() && !npc.active)
                    {
                        AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                        AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                        timerToLightStatic  = 0;
                        timerToMediumStatic = 0;
                        timerToSevereStatic = 0;
                        fadeScale          -= 0.005f;
                    }
                }

                // Main.NewText($"L: {timerToLightStatic} | M: {timerToMediumStatic} | S: {timerToSevereStatic}");
            }
        }
示例#15
0
        private static void RefreshTargets(Vector2 position, float radius)
        {
            _targets.Clear();
            Rectangle rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1200f));

            _ = Main.player[Main.myPlayer].Center;
            Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);
            for (int i = 0; i < Main.npc.Length; i++)
            {
                NPC nPC = Main.npc[i];
                if (ValidTarget(nPC) && !(nPC.Distance(position) > radius) && rectangle.Intersects(nPC.Hitbox) && !(Lighting.GetSubLight(nPC.Center).Length() / 3f < 0.03f))
                {
                    _targets.Add(i);
                }
            }
        }
示例#16
0
        private static void RefreshTargets(Vector2 position, float radius)
        {
            LockOnHelper._targets.Clear();
            Rectangle rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1200f));
            Vector2   center    = Main.player[Main.myPlayer].Center;

            Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);
            for (int index = 0; index < Main.npc.Length; ++index)
            {
                NPC n = Main.npc[index];
                if (LockOnHelper.ValidTarget(n) && (double)n.Distance(position) <= (double)radius && rectangle.Intersects(n.Hitbox) && (double)Lighting.GetSubLight(n.Center).Length() / 3.0 >= 0.0299999993294477)
                {
                    LockOnHelper._targets.Add(index);
                }
            }
        }
示例#17
0
        // Token: 0x06000E3B RID: 3643 RVA: 0x003E836C File Offset: 0x003E656C
        private static void RefreshTargets(Vector2 position, float radius)
        {
            LockOnHelper._targets.Clear();
            Rectangle rectangle = Utils.CenteredRectangle(Main.player[Main.myPlayer].Center, new Vector2(1920f, 1200f));
            Vector2   center    = Main.player[Main.myPlayer].Center;
            Vector2   value     = Main.player[Main.myPlayer].DirectionTo(Main.MouseWorld);

            for (int i = 0; i < Main.npc.Length; i++)
            {
                NPC nPC = Main.npc[i];
                if (LockOnHelper.ValidTarget(nPC) && nPC.Distance(position) <= radius && rectangle.Intersects(nPC.Hitbox) && Lighting.GetSubLight(nPC.Center).Length() / 3f >= 0.01f && (LockOnHelper.UseMode != LockOnHelper.LockOnMode.ThreeDS || Vector2.Dot(nPC.DirectionFrom(center), value) >= 0.65f))
                {
                    LockOnHelper._targets.Add(i);
                }
            }
        }
示例#18
0
 public override void Apply(Entity entity, DrawData?drawData)
 {
     if (entity == null)
     {
         this.Shader.get_Parameters().get_Item("uLightSource").SetValue(Vector3.get_Zero());
     }
     else
     {
         float num1 = 0.0f;
         if (drawData.HasValue)
         {
             num1 = drawData.Value.rotation;
         }
         Vector2 position  = entity.position;
         float   width     = (float)entity.width;
         float   height    = (float)entity.height;
         Vector2 vector2   = Vector2.op_Addition(position, Vector2.op_Multiply(new Vector2(width, height), 0.1f));
         float   num2      = width * 0.8f;
         float   num3      = height * 0.8f;
         Vector3 subLight1 = Lighting.GetSubLight(Vector2.op_Addition(vector2, new Vector2(num2 * 0.5f, 0.0f)));
         Vector3 subLight2 = Lighting.GetSubLight(Vector2.op_Addition(vector2, new Vector2(0.0f, num3 * 0.5f)));
         Vector3 subLight3 = Lighting.GetSubLight(Vector2.op_Addition(vector2, new Vector2(num2, num3 * 0.5f)));
         Vector3 subLight4 = Lighting.GetSubLight(Vector2.op_Addition(vector2, new Vector2(num2 * 0.5f, num3)));
         float   num4      = (float)(subLight1.X + subLight1.Y + subLight1.Z);
         float   num5      = (float)(subLight2.X + subLight2.Y + subLight2.Z);
         float   num6      = (float)(subLight3.X + subLight3.Y + subLight3.Z);
         float   num7      = (float)(subLight4.X + subLight4.Y + subLight4.Z);
         Vector2 spinningpoint;
         // ISSUE: explicit reference operation
         ((Vector2)@spinningpoint).\u002Ector(num6 - num5, num7 - num4);
         // ISSUE: explicit reference operation
         if ((double)((Vector2)@spinningpoint).Length() > 1.0)
         {
             float num8 = 1f;
             spinningpoint = Vector2.op_Division(spinningpoint, num8);
         }
         if (entity.direction == -1)
         {
             // ISSUE: explicit reference operation
             // ISSUE: variable of a reference type
             Vector2& local = @spinningpoint;
             // ISSUE: explicit reference operation
             double num8 = (^ local).X * -1.0;
             // ISSUE: explicit reference operation
             (^ local).X = (__Null)num8;
         }
         spinningpoint = spinningpoint.RotatedBy(-(double)num1, (Vector2)null);
         Vector3 vector3;
         // ISSUE: explicit reference operation
         ((Vector3)@vector3).\u002Ector(spinningpoint, (float)(1.0 - (spinningpoint.X * spinningpoint.X + spinningpoint.Y * spinningpoint.Y)));
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector3& local1 = @vector3;
         // ISSUE: explicit reference operation
         double num9 = (^ local1).X * 2.0;
         // ISSUE: explicit reference operation
         (^ local1).X = (__Null)num9;
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector3& local2 = @vector3;
         // ISSUE: explicit reference operation
         double num10 = (^ local2).Y - 0.150000005960464;
         // ISSUE: explicit reference operation
         (^ local2).Y = (__Null)num10;
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector3& local3 = @vector3;
         // ISSUE: explicit reference operation
         double num11 = (^ local3).Y * 2.0;
         // ISSUE: explicit reference operation
         (^ local3).Y = (__Null)num11;
         // ISSUE: explicit reference operation
         ((Vector3)@vector3).Normalize();
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector3& local4 = @vector3;
         // ISSUE: explicit reference operation
         double num12 = (^ local4).Z * 0.600000023841858;
         // ISSUE: explicit reference operation
         (^ local4).Z = (__Null)num12;
         this.Shader.get_Parameters().get_Item("uLightSource").SetValue(vector3);
     }
     base.Apply(entity, drawData);
 }
示例#19
0
        public override void PostDrawTiles()
        {
            Player player = Main.player[Main.myPlayer];

            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            Main.spriteBatch.Draw(mod.GetTexture("Assets/WhiteSquare"), player.position, null, Color.White * 0.25f, 0f, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), new Vector2(player.Hitbox.Width, player.Hitbox.Height), SpriteEffects.None, 1f);
            Main.spriteBatch.End();
            if (player.dead)
            {
                Main.hideUI = true;
                fadeScale   = 0f;
            }
            if (!Main.hasFocus)
            {
                timerToLightStatic  = 0;
                timerToMediumStatic = 0;
                timerToSevereStatic = 0;
            }
            for (int ll = 0; ll < Main.maxNPCs; ll++)
            {
                NPC   npc      = Main.npc[ll];
                float distance = npc.Distance(Main.player[Main.myPlayer].Center);
                if (npc.active && distance <= 1000f)
                {
                    if (npc.type == ModContent.NPCType <Slenderman>())
                    {
                        if (Main.GameUpdateCount % 3 == 0)
                        {
                            staticFrame.Y += 650;
                        }
                        if (staticFrame.Y >= 1950)
                        {
                            staticFrame.Y = 0;
                        }
                        bool facingTowardsSlendermanLeft  = npc.Center.X < player.Center.X && player.direction == -1;
                        bool facingTowardsSlendermanRight = npc.Center.X > player.Center.X && player.direction == 1;
                        Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); // sourceRectangle: new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y
                        Main.spriteBatch.Draw(mod.GetTexture("Assets/Static"), new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), sourceRectangle: staticFrame, Color.White * fadeScale, 0f, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), 5f, SpriteEffects.None, 1f);
                        Main.spriteBatch.End();
                        if (facingTowardsSlendermanLeft || facingTowardsSlendermanRight)
                        {
                            if (fadeScale > 0f && fadeScale < 0.4f)
                            {
                                timerToMediumStatic = 0;
                                timerToSevereStatic = 0;
                                timerToLightStatic++;
                                if (Main.hasFocus)
                                {
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticSevere");
                                }
                                if (timerToLightStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight"));
                                }
                                if (timerToLightStatic >= 480)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight"));
                                    timerToLightStatic = 0;
                                }
                            }
                            if (fadeScale >= 0.4 && fadeScale < 0.8f)
                            {
                                timerToLightStatic  = 0;
                                timerToSevereStatic = 0;
                                timerToMediumStatic++;
                                if (Main.hasFocus)
                                {
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticSevere");
                                }
                                if (timerToMediumStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium"));
                                }
                                if (timerToMediumStatic >= 480)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium"));
                                    timerToMediumStatic = 0;
                                }
                            }
                            if (fadeScale >= 0.8f)
                            {
                                timerToMediumStatic = 0;
                                timerToLightStatic  = 0;
                                timerToSevereStatic++;
                                if (Main.hasFocus)
                                {
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                                }
                                if (timerToSevereStatic == 2)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere"));
                                }
                                if (timerToSevereStatic >= 132)
                                {
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere"));
                                    timerToSevereStatic = 0;
                                }
                            }
                            // Main.NewText($"L: {timerToLightStatic} | M: {timerToMediumStatic} | S: {timerToSevereStatic}");
                            // MAJOR TODO: MAKE STATIC
                            if (!Collision.SolidCollision(npc.position, npc.width, 20))
                            {
                                if (Main.GameUpdateCount % 3 == 0)
                                {
                                    fadeScale += 0.005f;
                                }
                            }
                        }
                        else if (!facingTowardsSlendermanLeft && !facingTowardsSlendermanRight)
                        {
                            timerToLightStatic  = 0;
                            timerToMediumStatic = 0;
                            timerToSevereStatic = 0;
                            if (Main.GameUpdateCount % 3 == 0)
                            {
                                fadeScale -= 0.005f;
                            }
                        }
                        else if (distance > 1000f)
                        {
                            if (Main.GameUpdateCount % 3 == 0)
                            {
                                fadeScale -= 0.005f;
                            }
                        }
                        if (fadeScale > 1f)
                        {
                            fadeScale = 1f;
                        }
                        if (fadeScale < 0f)
                        {
                            fadeScale = 0f;
                        }
                        if (fadeScale >= 1f)
                        {
                            // player.KillMe(Terraria.DataStructures.PlayerDeathReason.ByCustomReason($"{player.name} stared at death for too long."), player.statLife + 50, 0, false);
                        }
                    }
                    if (npc.type == ModContent.NPCType <Slenderman>() && !npc.active)
                    {
                        timerToLightStatic  = 0;
                        timerToMediumStatic = 0;
                        timerToSevereStatic = 0;
                        fadeScale          -= 0.005f;
                    }
                }
                if (npc.type == ModContent.NPCType <Stalker>() && !npc.active)
                {
                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticMedium");
                    SoundEngine.StopAmbientSound("Sounds/Custom/Slender/StaticLight");
                }
            }

            if (player.GetModPlayer <SpookyPlayer>().deathTextTimer == 1)
            {
                deathTextChoice = Main.rand.Next(0, 10);
            }
            int countCached = player.GetModPlayer <SpookyPlayer>().cachedPageCount;

            Color lighterRed   = new Color(255, 50, 50);
            Color lerpable     = SpookyTerrariaUtils.ColorSwitcher(Color.Red, lighterRed, 30f);
            Color moreLerpable = Color.Lerp(Color.Red, Color.Green, player.GetModPlayer <SpookyPlayer>().cachedPageCount * 0.125f);
            // 205, 92, 92, a: 255

            string displayableString = SpookyTerrariaUtils.ChooseRandomDeathText(deathTextChoice);
            string subString         = "Returning to Main Menu...";
            string pagesFound        = $"Pages Found: {player.GetModPlayer<SpookyPlayer>().cachedPageCount} / 8";

            float x1 = Main.screenWidth / 2;
            float y1 = Main.screenHeight / 2;

            float b = y1 - 75f;

            float x = Main.rand.NextFloat(x1 - 5, x1 + 5);
            float y = Main.rand.NextFloat(y1 - 5, y1 + 5);

            float m = y1 - 100f;

            float j = y1 + 40f;

            Vector2 middle1 = Main.fontDeathText.MeasureString(displayableString) / 2;
            Vector2 middle2 = Main.fontDeathText.MeasureString(subString) / 2;
            Vector2 middle3 = Main.fontDeathText.MeasureString(pagesFound) / 2;

            if (player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(countCached, x1 - 88, b);
                // Main.hideUI = true;
                Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                // Text with shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x, y), Color.IndianRed * 0.6f, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Text without shake
                Main.spriteBatch.DrawString(Main.fontDeathText, displayableString, new Vector2(x1, y1), Color.IndianRed, 0f, middle1, 1f, SpriteEffects.None, 0f);
                // Pages Found
                Main.spriteBatch.DrawString(Main.fontDeathText, pagesFound, new Vector2(x1, m), moreLerpable, 0f, middle3, 0.4f, SpriteEffects.None, 0f);
                if (Main.worldName == SpookyTerrariaUtils.slenderWorldName)
                {
                    Main.spriteBatch.DrawString(Main.fontDeathText, subString, new Vector2(x1, j), lerpable, 0f, middle2, 0.5f, SpriteEffects.None, 0f);
                }
                Main.spriteBatch.End();
            }
            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer < 99 && player.GetModPlayer <SpookyPlayer>().pageDisplayTimer > 0)
            {
                // player.GetModPlayer<SpookyPlayer>().displayTimes++;
                SpookyTerrariaUtils.DrawPageInterface(choice);
            }
            if (player.GetModPlayer <SpookyPlayer>().pageDisplayTimer == 99)
            {
                choice = Main.rand.Next(1, 9);
            }
            float lighting = Lighting.GetSubLight(Main.MouseWorld).X;

            Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (lighting > 0.05f)
            {
                if (!Main.gameMenu)
                {
                    if (Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageLeft || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageRight || Main.LocalPlayer.GetModPlayer <SpookyPlayer>().hoveringPageWall)
                    {
                        string  pickUp = $"Right click to pick up";
                        Vector2 g      = Main.fontMouseText.MeasureString(pickUp);
                        // Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseScreen + new Vector2(25, 25), Color.White, 0f, new Vector2(0, 0), Main.essScale * 5/*1f*/, SpriteEffects.None, 0f);
                        Main.spriteBatch.DrawString(Main.fontMouseText, pickUp, Main.MouseWorld + new Vector2(15, -35) - Main.screenPosition, Color.White * lighting, 0f, new Vector2(g.X / 2, 5), 1f, SpriteEffects.None, 0f);
                    }
                }
            }
            Main.spriteBatch.End();
            if (Main.hasFocus && Main.worldName == SpookyTerrariaUtils.slenderWorldName)
            {
                SoundEngine.StopAmbientSound(SoundEngine.wavesSoundDir);
                oceanWavesTimer = 0;
            }
            if (!Main.hasFocus)
            {
                SoundEngine.StopAllAmbientSounds();
                SoundEngine.StopAmbientSound(SoundEngine.wavesSoundDir);
                player.GetModPlayer <SpookyPlayer>().hootTimer   = 0;
                player.GetModPlayer <SpookyPlayer>().breezeTimer = 0;

                jungleAmbTimer   = 0;
                dayAmbienceTimer = 0;

                oceanWavesTimer = 0;
                cricketsTimer   = 0;
                blizzTimer      = 0;
                caveRumbleTimer = 0;
            }

            // TODO: FINISH DRAWN RANDOMIZATION
            int count = SpookyPlayer.pages;

            if (!Main.playerInventory && player.CountBuffs() == 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 100f);
            }
            if (!Main.playerInventory && player.CountBuffs() <= 11 && player.CountBuffs() > 0 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 150f);
            }
            if (!Main.playerInventory && player.CountBuffs() > 11 && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 210f);
            }
            if (Main.playerInventory && !Main.hideUI && !player.dead)
            {
                SpookyTerrariaUtils.DrawPageUI(count, 35f, 325f);
            }
        }
        public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            swooshes.ForEach(n => n.Draw(spriteBatch));
            body.DrawBody(spriteBatch);

            npc.frame.Width  = 194;
            npc.frame.Height = 160;
            var effects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0;

            spriteBatch.Draw(GetTexture(Texture), npc.Center - Main.screenPosition, npc.frame, new Color(Lighting.GetSubLight(npc.Center)), npc.rotation, npc.frame.Size() / 2, npc.scale, effects, 0);

            //glow for last stand phase
            if (Phase == (int)AIStates.LastStand)
            {
                spriteBatch.Draw(GetTexture(Texture + "Shape"), npc.Center - Main.screenPosition, new Rectangle(npc.frame.X, 0, npc.frame.Width, npc.frame.Height), glowColor, npc.rotation, npc.frame.Size() / 2, npc.scale, effects, 0);
            }
            return(false);
        }