Beispiel #1
0
        private static void NPCLeaving(NPCBase npc)
        {
            if (Random.NextFloat() > .49f)
            {
                float cost = ColonistManager.PenalizeFood(npc.Colony, 0.05f);

                PandaChat.Send(npc.Colony, _localizationHelper, "TakenFood", ChatColor.red);
            }
            else
            {
                var numberOfItems = Random.Next(1, 10);

                for (var i = 0; i < numberOfItems; i++)
                {
                    var randItem = Random.Next(npc.Colony.Stockpile.ItemCount);
                    var item     = npc.Colony.Stockpile.GetByIndex(randItem);

                    if (item.Type != ColonyBuiltIn.ItemTypes.AIR.Id && item.Amount != 0)
                    {
                        var leaveTax = Pipliz.Math.RoundToInt(item.Amount * .10);
                        npc.Colony.Stockpile.TryRemove(item.Type, leaveTax);

                        PandaChat.Send(npc.Colony, _localizationHelper, "LeavingTakingItems", ChatColor.red, leaveTax.ToString(), ItemId.GetItemId(item.Type).Name);
                    }
                }

                PandaChat.Send(npc.Colony, _localizationHelper, "LeavingNumberOfItems", ChatColor.red, numberOfItems.ToString());
            }

            npc.health = 0;
            npc.OnDeath();
        }
        private static void CantSpawnBoss(ColonyState cs)
        {
            cs.FaiedBossSpawns++;

            if (cs.FaiedBossSpawns > 10)
            {
                PandaChat.SendThrottle(cs, _localizationHelper, "NoBanner", ChatColor.red, ColonistManager.PenalizeFood(cs.ColonyRef, 0.15f) * 100 + "%");
            }

            cs.ColonyRef.OnZombieSpawn(false);
        }