Пример #1
0
        public void Tick()
        {
            if (!Active)
            {
                return;
            }

            CharacterManager.instance.Prune();
            MapManager.instance.LockRenderBitmap();
            foreach (var religionParser in ReligionManager.instance.AllReligions)
            {
                religionParser.TryFillHolySites();
            }
            for (int n = 0; n < 100; n++)
            {
                for (int x = 0; x < characters.Count; x++)
                {
                    CharacterParser character = characters[x];
                    if (character.Liege != null)
                    {
                        continue;
                    }
                    if (character.PrimaryTitle == null)
                    {
                        continue;
                    }

                    if (character.PrimaryTitle.Government != null)
                    {
                        if (!character.PrimaryTitle.Government.cultureAllow.Contains(character.culture))
                        {
                            if (character.culture == "norse")
                            {
                            }
                            character.PrimaryTitle.Government.cultureAllow.Add(character.culture);
                            //Government.cultureDone.Add(character.culture + "_" + character.PrimaryTitle.Government.type);
                        }
                    }

                    character.UpdateCultural();
                    if (character.PrimaryTitle != null && character.PrimaryTitle.Liege == null)
                    {
                        if (!character.TickDisable)
                        {
                            character.Tick();
                        }
                    }
                    float chanceOfRevolt = 1.0f;

                    chanceOfRevolt *= Globals.BaseChanceOfRevolt;
                    int i = character.NumberofCountTitles;
                    if (i == 0)
                    {
                        i++;
                    }
                    chanceOfRevolt /= i;
                    int c = character.NumberofCountTitles;
                    if (c == 0)
                    {
                        continue;
                    }

                    if (c < 10)
                    {
                        continue;
                    }
                    if (c > 150)
                    {
                        chanceOfRevolt /= 100;
                    }

                    if (Rand.Next((int)chanceOfRevolt) == 0)
                    {
                        HandleRevolt(character);
                        character.TickDisable = true;
                    }
                    if (character.Titles.Count == 0 || character.bKill)
                    {
                        characters.Remove(character);
                        character.KillTitles();
                        x--;
                    }
                }
                Year++;
                if (Year == 5000)
                {
                    //      Form1.instance.Export();
                }
            }

            MapManager.instance.UnlockRenderBitmap();
        }