private void SlimeBoss(int x, int y)
        {
            BigSlime bigSlime = new BigSlime(new Vector2(x, y), 0)
            {
                Health              = (mineLevel == 1) ? 400 : ((mineLevel / 2) * 400),
                speed               = 6,
                ExperienceGained    = 40,
                DamageToFarmer      = (Config.difficulty > 5) ? (int)(mineLevel / 2 * difficulty) : ((mineLevel == 1) ? 12 : ((mineLevel / 2) * 12)),
                isGlowing           = true,
                glowingTransparency = 0.0f
            };

            bigSlime.jitteriness.Value = (Double)100.0;
            bigSlime.c.Value           = new NetColor(new Color(rng.Next(255), rng.Next(255), rng.Next(255)));

            Game1.mine.tryToAddMonster((Monster)bigSlime, x, y);
            _bossHpEvents.Add((Monster)bigSlime, new Action(BossLevel10Die));

            if (rng.Next(1, 10) > 5)
            {
                _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 2, 300));
                _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 4, 200));
                _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 8, 100));
                _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 16, 20));
            }
        }
Exemplo n.º 2
0
        Monster CreateRandomMonster(Vector2 location)
        {
            Monster monster = null;

            if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Bat))
            {
                monster = new Bat(new Vector2());
            }
            else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Ghost))
            {
                monster = new Ghost(new Vector2());
            }
            else if (CanHazMonster(Settings.Monsters.BigSlime))
            {
                monster = new BigSlime(new Vector2(), GetSlimeLevel());
            }
            else if (CanHazMonster(Settings.Monsters.Grub))
            {
                monster = new Grub(new Vector2(), true);
            }
            else if (CanHazMonster(Settings.Monsters.Fly))
            {
                monster = new Fly(new Vector2(), true);
            }
            else if (CanHazMonster(Settings.Monsters.Brute))
            {
                monster = new ShadowBrute(new Vector2());
            }
            else if (CanHazMonster(Settings.Monsters.Golem))
            {
                monster = new RockGolem(new Vector2(), deepWoods.GetCombatLevel());
            }
            else if (CanHazMonster(Settings.Monsters.RockCrab))
            {
                monster = new RockCrab(new Vector2(), GetRockCrabType());
            }
            else
            {
                foreach (var modMonster in DeepWoodsAPI.ToShuffledList(ModEntry.GetAPI().Monsters))
                {
                    if (modMonster.Item1(deepWoods, location))
                    {
                        monster = modMonster.Item2();
                        break;
                    }
                }
                if (monster == null)
                {
                    monster = new GreenSlime(new Vector2(), GetSlimeLevel());
                }
            }

            if (deepWoods.level.Value >= Settings.Level.MinLevelForBuffedMonsters && !this.random.CheckChance(Settings.Monsters.ChanceForUnbuffedMonster))
            {
                BuffMonster(monster);
            }

            return(monster);
        }
        private void CreateLevel10()
        {
            int  height = Game1.mine.Map.DisplayHeight;
            int  width  = Game1.mine.Map.DisplayWidth;
            bool flag   = false;

            for (int tileX = 1; tileX < width; ++tileX)
            {
                for (int tileY = 1; tileY < height; ++tileY)
                {
                    if (Game1.mine.isTileClearForMineObjects(new Vector2((float)tileX, (float)tileY)))
                    {
                        BigSlime bigSlime = new BigSlime(new Vector2((float)tileX, (float)tileY), 0);
                        bigSlime.Health              = 400;
                        bigSlime.speed               = 6;
                        bigSlime.ExperienceGained    = 40;
                        bigSlime.DamageToFarmer      = 12;
                        bigSlime.isGlowing           = true;
                        bigSlime.glowingTransparency = 0.0f;
                        bigSlime.jitteriness.Value   = (Double)100.0;
                        bigSlime.c.Value             = new NetColor(new Color(100, 0, 0));

                        Game1.mine.tryToAddMonster((Monster)bigSlime, tileX, tileY);
                        _bossHpEvents.Add((Monster)bigSlime, new Action(BossLevel10Die));
                        flag = true;

                        _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 2, 300));
                        _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 4, 200));
                        _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 8, 100));
                        _monstersToSpawn.Add(new BossSpawn((Monster) new GreenSlime(), 16, 20));
                    }

                    if (flag)
                    {
                        break;
                    }
                }

                if (flag)
                {
                    break;
                }
            }

            foreach (var pair in Game1.currentLocation.Objects.Pairs)
            {
                Vector2 tile             = pair.Key;
                StardewValley.Object obj = pair.Value;

                ////////this.Monitor.Log($"{obj.Name} at {tile}", LogLevel.Debug);

                if (obj.name == "Chest")
                {
                    Game1.currentLocation.removeObject(tile, false);
                    break;
                }
            }
        }
 private static void Postfix(BigSlime __instance, int mineArea)
 {
     if (__instance.heldObject?.Value is not null || ModEntry.GiantCropFertilizerID == -1)
     {
         return;
     }
     try
     {
         if (__instance.heldObject is not null &&
             mineArea >= 120 &&
             Game1.mine?.GetAdditionalDifficulty() is > 0 &&
             Game1.random.NextDouble() < 0.05)
         {
             __instance.heldObject.Value = new SObject(ModEntry.GiantCropFertilizerID, 1);
         }
     }
     catch (Exception ex)
     {
         ModEntry.ModMonitor.Log($"Failed in postfix for BigSlime's constructor.\n\n{ex}", LogLevel.Error);
     }
 }
 private static void Postfix(BigSlime __instance, int mineArea)
 {
     if (__instance.heldObject?.Value is not null || __instance.heldObject is null)
     {
         return;
     }
     try
     {
         if (mineArea >= 120 &&
             Game1.mine?.GetAdditionalDifficulty() is > 0 &&
             Game1.random.NextDouble() < 0.10)
         {
             if (ModEntry.DeluxeFruitTreeFertilizerID != -1 && Game1.random.NextDouble() < 0.5)
             {
                 __instance.heldObject.Value = new SObject(ModEntry.DeluxeFruitTreeFertilizerID, 1);
             }
             else if (ModEntry.DeluxeFishFoodID != -1)
             {
                 __instance.heldObject.Value = new SObject(ModEntry.DeluxeFishFoodID, 1);
             }
             return;
         }
         if (ModEntry.LuckyFertilizerID != -1 &&
             mineArea >= 120 &&
             Game1.mine?.GetAdditionalDifficulty() is <= 0 &&
             Game1.random.NextDouble() < 0.05)
         {
             __instance.heldObject.Value = new SObject(ModEntry.LuckyFertilizerID, 1);
             return;
         }
     }
     catch (Exception ex)
     {
         ModEntry.ModMonitor.Log($"Failed in postfix for BigSlime's constructor.\n\n{ex}", LogLevel.Error);
     }
 }
Exemplo n.º 6
0
        private Monster GetMonster(int x, Vector2 loc)
        {
            Monster m;

            switch (x)
            {
            case 0:
                m = new DustSpirit(loc);
                break;

            case 1:
                m = new Grub(loc);
                break;

            case 2:
                m = new Skeleton(loc);
                break;

            case 3:
                m = new RockCrab(loc);
                break;

            case 4:
                m = new Ghost(loc);
                break;

            case 5:
                m = new GreenSlime(loc);
                break;

            case 6:
                m = new RockGolem(loc);
                break;

            case 7:
                m = new ShadowBrute(loc);
                break;

            case 8:
                int y = rand.Next(1, 6);

                //m = new Monster();

                if (y == 1)
                {
                    m = new RockCrab(loc, "Iridium Crab");
                }
                else if (y == 2)
                {
                    m = new Ghost(loc, "Carbon Ghost");
                }
                else if (y == 3)
                {
                    m = new LavaCrab(loc);
                }
                //else if (y == 4)
                //m = new Bat(loc, Math.Max(Game1.player.CombatLevel * 5, 50));
                else if (y == 4)
                {
                    m = new GreenSlime(loc, Math.Max(Game1.player.CombatLevel * 5, 50));
                }
                else if (y == 5)
                {
                    m = new BigSlime(loc, Math.Max(Game1.player.CombatLevel * 5, 50));
                }
                else
                {
                    m = new Mummy(loc);
                }

                break;

            default:
                m = new Monster();
                break;
            }

            return(m);
        }
        Monster CreateRandomMonster(Vector2 location)
        {
            Monster monster = null;

            if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Bat))
            {
                monster = new Bat(new Vector2());
            }
            else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Ghost))
            {
                monster = new Ghost(new Vector2());
            }
            else if (CanHazMonster(Settings.Monsters.BigSlime))
            {
                monster = new BigSlime(new Vector2(), GetSlimeLevel());
            }
            else if (CanHazMonster(Settings.Monsters.Grub))
            {
                monster = new Grub(new Vector2(), true);
            }
            else if (CanHazMonster(Settings.Monsters.Fly))
            {
                monster = new Fly(new Vector2(), true);
            }
            else if (CanHazMonster(Settings.Monsters.Brute))
            {
                monster = new ShadowBrute(new Vector2());
            }
            else if (CanHazMonster(Settings.Monsters.Golem))
            {
                monster = new RockGolem(new Vector2(), deepWoods.GetCombatLevel());
            }
            else if (CanHazMonster(Settings.Monsters.RockCrab))
            {
                monster = new RockCrab(new Vector2(), GetRockCrabType());
            }
            else if (CanHazMonster(Settings.Monsters.Bug))
            {
                monster = new Bug(new Vector2(), 121);
                monster.isHardModeMonster.Value = true;
            }
            else if (CanHazMonster(Settings.Monsters.ArmoredBug))
            {
                monster = new Bug(new Vector2(), 121);
                monster.isHardModeMonster.Value = true;
            }
            else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.PutridGhost))
            {
                monster = new Ghost(new Vector2(), "Putrid Ghost");
            }
            else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.DustSprite))
            {
                monster = new DustSpirit(new Vector2()); new Leaper();
            }
            else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Spider))
            {
                monster = new Leaper(new Vector2());
            }
            else
            {
                foreach (var modMonster in DeepWoodsAPI.ToShuffledList(ModEntry.GetAPI().Monsters))
                {
                    // Item1 is a mod provided function that returns true if the mod wants to spawn a custom monster at this location.
                    // Item2 is a mod provided function that returns the custom monster.
                    if (modMonster.Item1(deepWoods, location))
                    {
                        monster = modMonster.Item2();
                        break;
                    }
                }
            }

            // No other monster was selected and no mod provided a monster, default to green slime
            if (monster == null)
            {
                monster = new GreenSlime(new Vector2(), GetSlimeLevel());
            }

            if (!Settings.Monsters.DisableBuffedMonsters &&
                deepWoods.level.Value >= Settings.Level.MinLevelForBuffedMonsters &&
                !this.random.CheckChance(Settings.Monsters.ChanceForUnbuffedMonster))
            {
                BuffMonster(monster);
            }

            if (!Settings.Monsters.DisableDangerousMonsters &&
                deepWoods.level.Value >= Settings.Level.MinLevelForDangerousMonsters &&
                !this.random.CheckChance(Settings.Monsters.ChanceForNonDangerousMonster))
            {
                monster.isHardModeMonster.Value = true;
            }

            monster.faceDirection(this.random.GetRandomValue(0, 4));

            return(monster);
        }
Exemplo n.º 8
0
        private void CreateLevel()
        {
            if (!Game1.inMine || Game1.currentLocation.Name.Contains("UndergroundMine"))
            {
                return;
            }

            int  height    = Game1.mine.Map.DisplayHeight;
            int  width     = Game1.mine.Map.DisplayWidth;
            bool triggered = false;

            for (int x = 1; x < width; x++)
            {
                for (int y = 1; y < height; y++)
                {
                    if (Game1.mine.isTileClearForMineObjects(new Vector2(x, y)))
                    {
                        BigSlime bg = new BigSlime(new Vector2(x, y), 0)
                        {
                            Health = 400, Speed = 6
                        };

                        bg.jitteriness.Value   = 100.0f;
                        bg.ExperienceGained    = 40;
                        bg.DamageToFarmer      = 12;
                        bg.c.Value             = new Color(0.0f, 50f, 0.0f);
                        bg.glowingColor        = new Color(byte.MaxValue, 0.0f, 0.0f);
                        bg.glowRate            = 20.0f;
                        bg.isGlowing           = true;
                        bg.glowingTransparency = 0.0f;
                        Game1.mine.tryToAddMonster(bg, x, y);

                        triggered = true;
                        _bossHpEvents.Add(bg, BossDied);
                        _monsterSpawner.Add(new Boss(new GreenSlime(), 2, 300));
                        _monsterSpawner.Add(new Boss(new GreenSlime(), 4, 200));
                        _monsterSpawner.Add(new Boss(new GreenSlime(), 6, 100));
                        _monsterSpawner.Add(new Boss(new GreenSlime(), 16, 20));
                    }
                    if (triggered)
                    {
                        break;
                    }
                }
                if (triggered)
                {
                    break;
                }
            }

            var objects = Game1.currentLocation.objects.Pairs;

            if (objects.Any())
            {
                var pair = objects.FirstOrDefault();
                Game1.mine.removeObject(pair.Key, false);
                Monitor.Log("HarderMines removed game chest.");
            }

            if (_bossInventoryState[0] != 1 || _bossInventory[0].Count <= 0)
            {
                return;
            }

            Chest chest = new Chest("interactive", new Vector2(9f, 9f), Game1.mine);

            foreach (Treasure t in _bossInventory[0])
            {
                switch (t.Id)
                {
                case -1:
                    continue;

                case 506:
                    chest.addItem(new Boots(506));
                    continue;

                default:
                    chest.addItem(new StardewValley.Object(Vector2.Zero, t.Id, t.Count));
                    continue;
                }
            }
            Game1.mine.objects.Add(new Vector2(9f, 9f), chest);
            Monitor.Log("Added chest.");
            _bossInventoryState[0] = 1;
        }
Exemplo n.º 9
0
 private void BigSlime(BigSlime instance)
 {
     instance.flip = instance.FacingDirection == (int)CharacterDirection.Right;
 }
Exemplo n.º 10
0
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 public void Return( BigSlime _slime )
 {
     ++idx;
     bigSlimes[idx] = _slime;
 }
Exemplo n.º 11
0
 public void SpawnFastSlimeFrom(BigSlime _bigSlime, int _amount)
 {
     Vector2 spawnPos = new Vector2(_bigSlime.transform.position.x,
                                    _bigSlime.transform.position.y);
     for (int i = 0; i < _amount; i++ ) {
         FastSlime slime = SpawnFastSlimeAt(spawnPos);
         aliveFastSlimeCount += 1;
         slime.SetSpawner(this);
         slime.GetIntoField();
     }
 }
Exemplo n.º 12
0
 public void DestroyEnemy(BigSlime _slime)
 {
     _slime.enabled = false;
     aliveBigSlimeCount -= 1;
     if (aliveBigSlimeCount < 0) aliveBigSlimeCount = 0;
     bigSlimePool.Return(_slime);
 }
Exemplo n.º 13
0
 private void GameLoop_OneSecondUpdateTicked(object sender, StardewModdingAPI.Events.OneSecondUpdateTickedEventArgs e)
 {
     if (!IsModEnabled())
     {
         return;
     }
     if (slimeFarmer)
     {
         if (!Config.SlimeEnabled || Game1.random.NextDouble() < 0.1)
         {
             slimeFarmer = false;
         }
     }
     else if (Config.SlimeEnabled)
     {
         slimeFarmer = Game1.random.NextDouble() < 0.01;
         if (slimeFarmer)
         {
             if (slime == null)
             {
                 slime = new BigSlime(Game1.player.Position, 121);
             }
         }
     }
     if (backwardsFarmer)
     {
         if (!Config.BackwardsEnabled || Game1.random.NextDouble() < 0.1)
         {
             backwardsFarmer = false;
         }
     }
     else if (Config.BackwardsEnabled)
     {
         backwardsFarmer = Game1.random.NextDouble() < 0.008;
     }
     if (gianting)
     {
         if (Config.GiantEnabled || Game1.random.NextDouble() < 0.1)
         {
             gianting = false;
         }
     }
     else if (Config.GiantEnabled)
     {
         gianting = Game1.random.NextDouble() < 0.01;
     }
     if (asciifying)
     {
         if (!Config.AsciiEnabled || Game1.random.NextDouble() < 0.1)
         {
             asciifying = false;
         }
     }
     else if (pixelating)
     {
         if (!Config.PixelateEnabled || Game1.random.NextDouble() < 0.1)
         {
             pixelating = false;
         }
     }
     else
     {
         if (Config.PixelateEnabled)
         {
             pixelating = Game1.random.NextDouble() < 0.01;
         }
         if (!pixelating && Config.AsciiEnabled)
         {
             asciifying = Game1.random.NextDouble() < 0.008;
         }
         else
         {
             asciifying = false;
         }
     }
     if (!Config.BeesEnabled || beeDataList.Count > 30)
     {
         beeDataList.Clear();
     }
     else if (Game1.random.NextDouble() < (beeDataList.Count + 1) / 30f)
     {
         beeDataList.Add(new BeeData()
         {
             pos = new Vector2(Game1.random.Next(Game1.viewport.Width), Game1.random.Next(Game1.viewport.Height))
         });
     }
 }
Exemplo n.º 14
0
 // void draw(SpriteBatch b)
 private static void BigSlime_DrawPostfix(BigSlime __instance, SpriteBatch b)
 {
     ModFestiveSlimes._bigSlimeManager.DrawHat(SDateTime.Today, b, __instance);
 }