public CharacterParser CreateNewCharacter(Dynasty dynasty, bool bFemale, int dateOfBirth, string religion, String culture) { if (!bInit) { Init(); } var chr = new CharacterParser(); Characters.Add(chr); AliveCharacters.Add(chr); chr.YearOfBirth = dateOfBirth; if (dynasty == null) { dynasty = DynastyManager.instance.GetDynasty(CultureManager.instance.CultureMap[culture]); } chr.Dynasty = dynasty; chr.religion = religion; chr.isFemale = bFemale; chr.culture = culture; chr.YearOfDeath = SimulationManager.instance.Year + 1000; AddedSinceLastPrune.Add(chr); CharacterMap[chr.ID] = chr; chr.SetupExistingDynasty(); chr.UpdateCultural(); return(chr); }
public CharacterParser CreateNewCharacter(String culture, String religion, bool bFemale) { if (!bInit) { Init(); } // var scope = new ScriptScope(); // scope.Name = CharacterParser.IDMax.ToString(); // scope.SetChild(CharactersScript.Root); var chr = new CharacterParser(); // chr.SetProperty("dynasty", Rand.Next(1235)+1); // chr.SetProperty("culture", new ScriptReference("norse")); // chr.SetProperty("religion", new ScriptReference("pagan")); // chr.DeleteProperty("name"); Characters.Add(chr); chr.YearOfBirth = 769 - Rand.Next(60); chr.Dynasty = DynastyManager.instance.GetDynasty(CultureManager.instance.CultureMap[culture]); chr.religion = religion; chr.isFemale = bFemale; chr.culture = culture; chr.YearOfDeath = 769 + Rand.Next(30); this.CharactersScript.Root.SetChild(chr.Scope); AddedSinceLastPrune.Add(chr); CharacterMap[chr.ID] = chr; chr.SetupExistingDynasty(); chr.UpdateCultural(); return(chr); }
public CharacterParser CreateNewHistoricCharacter(Dynasty dynasty, bool bFemale, string religion, String culture, int dateOfBirth, int dateOfDeath = -1, bool adult = true) { if (!bInit) { Init(); } // var scope = new ScriptScope(); // scope.Name = CharacterParser.IDMax.ToString(); // scope.SetChild(CharactersScript.Root); var chr = new CharacterParser(); // chr.SetProperty("dynasty", Rand.Next(1235)+1); // chr.SetProperty("culture", new ScriptReference("norse")); // chr.SetProperty("religion", new ScriptReference("pagan")); // chr.DeleteProperty("name"); Characters.Add(chr); chr.YearOfBirth = dateOfBirth; chr.isFemale = bFemale; chr.culture = culture; chr.religion = religion; if (dateOfDeath != -1) { chr.YearOfDeath = dateOfDeath; } else { chr.YearOfDeath = dateOfBirth + Rand.Next(40); if (Rand.Next(4) == 0) { chr.YearOfDeath = dateOfBirth + Rand.Next(80); } if (adult) { chr.YearOfDeath = dateOfBirth + 16 + Rand.Next(80 - 16); } } this.CharactersScript.Root.SetChild(chr.Scope); AddedSinceLastPrune.Add(chr); CharacterMap[chr.ID] = chr; chr.Dynasty = dynasty; chr.SetupExistingDynasty(); chr.UpdateCultural(); // CharacterManager.instance.SetAllDates(chr.YearOfBirth, chr.YearOfDeath, chr.Scope); return(chr); }
public CharacterParser CreateNewHistoricCharacter(Dynasty dynasty, bool bFemale, string religion, String culture, int dateOfBirth, int dateOfDeath = -1, bool adult = true) { if (!bInit) { Init(); } var chr = new CharacterParser(); Characters.Add(chr); AliveCharacters.Add(chr); chr.YearOfBirth = dateOfBirth; chr.isFemale = bFemale; chr.culture = culture; chr.religion = religion; if (dateOfDeath != -1) { chr.YearOfDeath = dateOfDeath; } else { chr.YearOfDeath = dateOfBirth + 150 + Rand.Next(40); if (Rand.Next(4) == 0) { chr.YearOfDeath = dateOfBirth + 150 + Rand.Next(80); } if (adult) { chr.YearOfDeath = dateOfBirth + 150 + 16 + Rand.Next(80 - 16); } } this.CharactersScript.Root.SetChild(chr.Scope); AddedSinceLastPrune.Add(chr); CharacterMap[chr.ID] = chr; chr.Dynasty = dynasty; chr.SetupExistingDynasty(); chr.UpdateCultural(); return(chr); }
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(); }