public void CreateProvinceDetails(CultureParser culture) { if (culture.Governments.Count == 0) { AddBarony("tribal", culture); return; } foreach (var government in culture.Governments) { switch (government.type) { case "tribal": case "nomadic": AddBarony("tribal", culture); break; case "republic": AddBarony("town", culture); break; case "theocracy": AddBarony("temple", culture); break; case "feudal": AddBarony("castle", culture); break; } } }
public CultureParser AddCulture(String name) { if (name != "norse") { String oname = name; name = StarNames.SafeName(name); LanguageManager.instance.Add(name, oname); } ScriptScope scope = new ScriptScope(); scope.Name = name; Name = name; Scope.Add(scope); CultureParser r = new CultureParser(scope); CultureManager.instance.AllCultures.Add(r); Cultures.Add(r); CultureManager.instance.CultureMap[name] = r; r.Name = Name; r.Init(); Scope.SetChild(r.Scope); return(r); }
public Government BranchGovernment(Government gov, CultureParser culture) { var newGov = gov.Mutate(10); { if (newGov.type == "nomadic") { newGov.type = "tribal"; newGov.SetType(newGov.type); } } do { newGov.name = culture.dna.GetMaleName(); } while (LanguageManager.instance.Get(StarNames.SafeName(newGov.name) + "_government") != null); string s = newGov.name; newGov.name = StarNames.SafeName(newGov.name) + "_government"; LanguageManager.instance.Add(newGov.name, s); culture.Governments.Add(newGov); if (!newGov.cultureAllow.Contains(culture.Name)) newGov.cultureAllow.Add(culture.Name); return newGov; }
public CultureParser AddCulture(String name) { if (name != "norse") { String oname = name; name = StarNames.SafeName(name); LanguageManager.instance.Add(name, oname); } ScriptScope scope = new ScriptScope(); scope.Name = name; Name = name; Scope.Add(scope); CultureParser r = new CultureParser(scope); CultureManager.instance.AllCultures.Add(r); Cultures.Add(r); CultureManager.instance.CultureMap[name] = r; r.Name = Name; r.Init(); Scope.SetChild(r.Scope); return r; }
public Government BranchGovernment(Government gov, CultureParser culture) { var newGov = gov.Mutate(10); { if (newGov.type == "nomadic") { newGov.type = "tribal"; newGov.SetType(newGov.type); } } do { newGov.name = culture.dna.GetMaleName(); } while (LanguageManager.instance.Get(StarNames.SafeName(newGov.name) + "_government") != null); string s = newGov.name; newGov.name = StarNames.SafeName(newGov.name) + "_government"; LanguageManager.instance.Add(newGov.name, s); culture.Governments.Add(newGov); if (!newGov.cultureAllow.Contains(culture.Name)) { newGov.cultureAllow.Add(culture.Name); } return(newGov); }
public TitleParser CreateBaronyScriptScope(ProvinceParser capital, CultureParser culture) { var place = culture.dna.GetPlaceName(); var text = place; place = StarNames.SafeName(text); if (TitleManager.instance.TieredTitles.ContainsKey("b_" + place)) { return(CreateBaronyScriptScope(capital, culture)); } var rand = Rand.Get(); Color col = Color.FromArgb(255, rand.Next(200) + 55, rand.Next(200) + 55, rand.Next(200) + 55); ScriptScope scope = new ScriptScope(); scope.Parent = capital.Title.Scope; scope.Name = "b_" + place; LanguageManager.instance.Add("b_" + place, text); // scope.Kids.Add(new ScriptCommand() { Name = "rebel", Value = false }); TitleParser title = new TitleParser(scope); TieredTitles[title.Name] = title; capital.Title.Scope.Add(title.Scope); // if (culture.dna.horde) // title.Scope.Do("historical_nomad = yes"); // AddTitle(title); return(title); }
public Dynasty GetDynasty(CultureParser culture) { ScriptScope scope = new ScriptScope(); scope.Name = ID.ToString(); ID++; do { Name = culture.dna.GetDynastyName(); } while (Name == null || Name.Trim().Length == 0); var nameScope = new ScriptCommand("name", Name, scope); scope.Add(nameScope); scope.Add(new ScriptCommand("culture", culture.Name, scope)); script.Root.Add(scope); var d = new Dynasty() { ID = ID - 1, Scope = scope, NameScope = nameScope }; d.Color = Color.FromArgb(255, Rand.Next(200) + 55, Rand.Next(200) + 55, Rand.Next(200) + 55); DynastyMap[ID - 1] = d; culture.Dynasties.Add(d); return(d); }
public void CreateProvinceDetails(CultureParser culture) { { AddBarony("tribal", culture); } AddAdditionalBaronies(culture); }
private void AddAdditionalBaronies(CultureParser culture) { for (int x = 0; x < 7; x++) { AddBarony("tribal", culture, false); } }
public void AddCulture(CultureParser r) { if (r.Group != null) { r.Group.Scope.Remove(r.Scope); } Scope.Add(r.Scope); Cultures.Add(r); }
public void RenameForCulture(CultureParser culture) { var name = culture.dna.GetPlaceName(); Rename(name); if (Rank == 1 && Owns.Count > 0) { Owns[0].Rename(name); } }
public void AddBarony(string type, CultureParser culture, bool enabled = true) { TitleParser title = TitleManager.instance.CreateBaronyScriptScope(this, culture); baronies.Add(new Barony() { province = this, title = title.Name, titleParser = title, type = type, enabled = enabled }); this.Title.AddSub(title); }
private void AddBarony(string type, CultureParser culture) { TitleParser title = TitleManager.instance.CreateBaronyScriptScope(this, culture); baronies.Add(new Barony() { province = this, title = title.Name, titleParser = title, type = type }); this.Title.AddSub(title); SimulationManager.instance.AddCharacterForTitle(title); }
public void LoadVanilla() { SaveCultures = false; var files = ModManager.instance.GetFileKeys("common\\cultures"); foreach (var file in files) { Script s = ScriptLoader.instance.LoadKey(file); foreach (var rootChild in s.Root.Children) { CultureGroupParser p = new CultureGroupParser(rootChild as ScriptScope); AllCultureGroups.Add(p); CultureGroupMap[p.Name] = p; foreach (var scopeChild in p.Scope.Children) { if (scopeChild is ScriptScope) { var sc = scopeChild as ScriptScope; if (sc.Name == "graphical_cultures") { continue; } CultureParser r = new CultureParser(sc, p); AllCultures.Add(r); CultureMap[r.Name] = r; p.Cultures.Add(r); r.Group = p; r.LanguageName = LanguageManager.instance.Get(r.Name); CulturalDna dna = new CulturalDna(); foreach (var scope in r.Scope.Scopes) { if (scope.Name == "male_names" || scope.Name == "female_names") { String[] male_names = scope.Data.Split(new[] { ' ', '_', '\t' }); foreach (var maleName in male_names) { var mName = maleName.Trim(); if (mName.Length > 0) { dna.Cannibalize(mName); } } } } r.dna = dna; } } } } }
public void AddCulture(CultureParser r) { r.group = this; if (r.Group != null) { r.Group.Scope.Remove(r.Scope); } Scope.Add(r.Scope); Cultures.Add(r); Cultures = Cultures.Distinct().ToList(); }
public CultureParser BranchCulture(string Culture) { var rel = CultureMap[Culture]; var group = rel.Group; var cultureName = rel.dna.GetPlaceName(); while (GroupMap.ContainsKey(StarNames.SafeName(cultureName))) { cultureName = rel.dna.GetPlaceName(); } CultureParser rel2 = null; if (allowMultiCultureGroups) { rel2 = group.AddCulture(cultureName); rel2.Init(); rel2.dna = rel.dna.MutateSmall(4); } else { // need to make a new group for the culture var newGroupName = rel.dna.GetPlaceName(); while (GroupMap.ContainsKey(StarNames.SafeName(newGroupName))) { newGroupName = rel.dna.GetPlaceName(); } LanguageManager.instance.Add(StarNames.SafeName(newGroupName), newGroupName); var newCultureGroup = AddCultureGroup(StarNames.SafeName(newGroupName), group); newCultureGroup.Name = StarNames.SafeName(newGroupName); rel2 = newCultureGroup.AddCulture(cultureName); newCultureGroup.AddCulture(rel2); rel2.Init(); rel2.dna = rel.dna.Mutate(16, rel); rel2.dna.DoRandom(); CultureGroupMap[newCultureGroup.Name] = newCultureGroup; } rel2.DoDetailsForCulture(); return(rel2); }
public Dynasty GetDynasty(CultureParser culture) { ScriptScope scope = new ScriptScope(); scope.Name = ID.ToString(); ID++; scope.Add(new ScriptCommand("name", culture.dna.GetDynastyName(), scope)); scope.Add(new ScriptCommand("culture", culture.Name, scope)); script.Root.Add(scope); var d = new Dynasty() {ID = ID - 1, Scope = scope}; DynastyMap[ID - 1] = d; culture.Dynasties.Add(d); return d; }
public void RenameForCulture(CultureParser culture) { LanguageManager.instance.Remove(Name); String namem = null; do { var name = culture.dna.GetPlaceName(); namem = name; } while (MapManager.instance.ProvinceMap.ContainsKey(StarNames.SafeName(namem))); Rename(namem); }
public void Init() { Scope.Clear(); chosenGfx = CultureParser.GetRandomCultureGraphics(); Scope.Do(@" graphical_cultures = { " + chosenGfx + @" } "); r = Rand.Next(255); g = Rand.Next(255); b = Rand.Next(255); Scope.UnsavedData["color"] = Color.FromArgb(255, r, g, b); }
public CultureParser BranchCulture(string Culture) { var rel = this.CultureMap[Culture]; var group = rel.Group; var naa = rel.dna.GetPlaceName(); while (GroupMap.ContainsKey(StarNames.SafeName(naa))) { naa = rel.dna.GetPlaceName(); } CultureParser rel2 = null; if (!allowMultiCultureGroups) { var na = rel.dna.GetPlaceName(); while (GroupMap.ContainsKey(StarNames.SafeName(na))) { na = rel.dna.GetPlaceName(); } LanguageManager.instance.Add(StarNames.SafeName(na), na); var group2 = AddCultureGroup(StarNames.SafeName(na), group); group2.Name = StarNames.SafeName(na); rel2 = group2.AddCulture(naa); group2.AddCulture(rel2); rel2.Init(); rel2.dna = rel.dna.Mutate(16, rel); rel2.dna.DoRandom(); CultureGroupMap[group2.Name] = group2; } else { rel2 = group.AddCulture(naa); rel2.Init(); rel2.dna = rel.dna.MutateSmall(4); } rel2.DoDetailsForCulture(); return(rel2); }
public Dynasty GetDynasty(CultureParser culture) { ScriptScope scope = new ScriptScope(); scope.Name = ID.ToString(); ID++; scope.Add(new ScriptCommand("name", culture.dna.GetDynastyName(), scope)); scope.Add(new ScriptCommand("culture", culture.Name, scope)); script.Root.Add(scope); var d = new Dynasty() { ID = ID - 1, Scope = scope }; DynastyMap[ID - 1] = d; culture.Dynasties.Add(d); return(d); }
public void RenameForCulture(CultureParser culture) { LanguageManager.instance.Remove(Name); var name = culture.dna.GetPlaceName(); if (MapManager.instance.ProvinceMap.ContainsKey("c_" + StarNames.SafeName(name))) { RenameForCulture(culture); return; } if (Title != null) { Title.Rename(name); } Rename(name); }
public void AddBarony2(CultureParser culture) { if (Rand.Next(4) == 0) { if (Rand.Next(2) != 0) { AddBarony("temple", culture); } else { AddBarony("city", culture); } } else { AddBarony("castle", culture); } }
public CulturalDna Mutate(int numChanges, CultureParser rel) { this.culture = rel; var c = new CulturalDna(); c.empTitle = empTitle; c.kingTitle = kingTitle; c.dukeTitle = dukeTitle; c.countTitle = countTitle; c.baronTitle = baronTitle; c.mayorTitle = mayorTitle; c.tribal = tribal; c.wordsForLand.AddRange(wordsForLand); //c.cons.AddRange(cons); // c.vowels.AddRange(vowels); c.CommonStartNames.AddRange(CommonStartNames); c.CommonMiddleNames.AddRange(CommonMiddleNames); c.CommonEndNames.AddRange(CommonEndNames); c.WordFormats.AddRange(CommonWordFormats); c.portraitPool.AddRange(portraitPool); c.placeFormat = placeFormat; c.firstLetters.AddRange(firstLetters); c.wordLengthBias = wordLengthBias; c.from_dynasty_prefix = from_dynasty_prefix; c.count_titles_hidden = count_titles_hidden; c.baron_titles_hidden = baron_titles_hidden; c.allow_looting = allow_looting; c.female_patronym = female_patronym; c.male_patronym = male_patronym; c.founder_named_dynasties = founder_named_dynasties; c.dynasty_title_names = dynasty_title_names; c.horde = horde; c.culture = culture; c.seafarer = seafarer; for (int n = 0; n < numChanges; n++) { c.DoRandomChange(rel); } return(c); }
public Government CreateNewGovernment(CultureParser culture) { Government g = new Government(); g.type = "tribal"; Government r = g.Mutate(8); r.name = culture.dna.GetMaleName(); string s = r.name; r.name = StarNames.SafeName(r.name) + "_government"; LanguageManager.instance.Add(r.name, s); culture.Governments.Add(r); r.SetType(r.type); if (!r.cultureAllow.Contains(culture.Name)) { r.cultureAllow.Add(culture.Name); // governments.Add(r); } return(r); }
public CultureParser AddCulture(String name) { string langName = ""; if (name != "norse") { String oname = name; name = StarNames.SafeName(name); LanguageManager.instance.Add(name, oname); langName = oname; } ScriptScope scope = new ScriptScope(); scope.Name = name; Scope.Add(scope); CultureParser r = new CultureParser(scope, this); CultureManager.instance.AllCultures.Add(r); r.LanguageName = langName; Cultures.Add(r); CultureManager.instance.CultureMap[name] = r; r.Name = name; r.Init(); r.group = this; var col = Col(); r.r = col.R; r.g = col.G; r.b = col.B; Scope.SetChild(r.Scope); return(r); }
public void AddBarony2(CultureParser culture) { AddBarony("tribal", culture); }
public void Mutate(ReligionParser rel, CultureParser culture, int nChanges) { this.dna = culture.dna; this.ai_convert_other_group = rel.ai_convert_other_group; this.max_consorts = rel.max_consorts; this.max_wives = rel.max_wives; this.religious_clothing_head = rel.religious_clothing_head; this.religious_clothing_priest = rel.religious_clothing_priest; this.allow_looting = rel.allow_looting; this.allow_rivermovement = rel.allow_rivermovement; this.allow_viking_invasion = rel.allow_viking_invasion; this.autocephaly = rel.autocephaly; this.bs_marriage = rel.bs_marriage; this.can_call_crusade = rel.can_call_crusade; this.can_excommunicate = rel.can_excommunicate; this.can_grant_claim = rel.can_grant_claim; this.can_grant_divorce = rel.can_grant_divorce; this.can_have_antipopes = rel.can_have_antipopes; this.can_hold_temples = rel.can_hold_temples; this.can_retire_to_monastery = rel.can_retire_to_monastery; this.divine_blood = rel.divine_blood; this.female_temple_holders = rel.female_temple_holders; this.hasLeader = rel.hasLeader; this.has_heir_designation = rel.has_heir_designation; this.investiture = rel.investiture; this.matrilineal_marriages = rel.matrilineal_marriages; this.pacifist = rel.pacifist; this.pc_marriage = rel.pc_marriage; this.peace_prestige_loss = rel.peace_prestige_loss; this.polytheism = rel.polytheism; this.priests_can_inherit = rel.priests_can_inherit; this.psc_marriage = rel.psc_marriage; high_god_name = rel.high_god_name; devil = rel.devil; priest = rel.priest; gods.AddRange(rel.gods); int r = Rand.Next(255); int g = Rand.Next(255); int b = Rand.Next(255); r = rel.r; g = rel.g; b = rel.b; switch (Rand.Next(3)) { case 0: r += Rand.Next(-45, 45); g += Rand.Next(-25, 25); b += Rand.Next(-15, 15); break; case 1: g += Rand.Next(-45, 45); r += Rand.Next(-25, 25); b += Rand.Next(-15, 15); break; case 2: b += Rand.Next(-45, 45); g += Rand.Next(-25, 25); r += Rand.Next(-15, 15); break; } if (r > 255) { r = 255; } if (g > 255) { g = 255; } if (b > 255) { b = 255; } if (r < 0) { r = 0; } if (g < 0) { g = 0; } if (b < 0) { b = 0; } for (int n = 0; n < nChanges; n++) { MakeChange(); } DoReligionScope(high_god_name, devil, priest, scripture_name, crusade_name, culture.dna, r, g, b); }
public void CreateFromCulture(CultureParser c) { dna = c; }
public void AddTemple(CultureParser culture) { AddBarony("temple", culture); }
public Government CreateNewGovernment(CultureParser culture) { Government g = new Government(); g.type = "tribal"; Government r = g.Mutate(8); r.name = culture.dna.GetMaleName(); string s = r.name; r.name = StarNames.SafeName(r.name) + "_government"; LanguageManager.instance.Add(r.name, s); culture.Governments.Add(r); r.SetType(r.type); if (!r.cultureAllow.Contains(culture.Name)) r.cultureAllow.Add(culture.Name); // governments.Add(r); return r; }
private void DoRandomChange() { switch (Rand.Next(4)) { case 0: // replace 1/3 of the Start words and replace with random dna culture.... { int count = CommonStartNames.Count / 2; WordFormats.Clear(); ReplaceStartNames(count); { wordsForLand.Clear(); int c = wordsForLand.Count / 2; int create = 3; for (int n = 0; n < create; n++) { String a = ""; a = ConstructWord(2 * wordLengthBias, 4 * wordLengthBias); if (!wordsForLand.Contains(a)) { wordsForLand.Add(a); continue; } } } } break; case 1: { int count = CommonEndNames.Count / 2; ReplaceEndNames(count); WordFormats.Clear(); { wordsForLand.Clear(); int c = wordsForLand.Count / 2; int create = 3; for (int n = 0; n < create; n++) { String a = ""; a = ConstructWord(2 * wordLengthBias, 4 * wordLengthBias); if (!wordsForLand.Contains(a)) { wordsForLand.Add(a); continue; } } } } break; case 2: // replace 1/3 of the words for land { WordFormats.Clear(); if (portraitPool.Count == 0) { return; } int x = Rand.Next(portraitPool.Count); var por = portraitPool[x]; portraitPool.RemoveAt(x); portraitPool.Add(culture.GetRelatedCultureGfx(por)); if (Rand.Next(6) == 0) { if (portraitPool.Count == 1) { portraitPool.Add(culture.GetRelatedCultureGfx(por)); } else if (portraitPool.Count == 2) { portraitPool.RemoveAt(Rand.Next(2)); } } if (Rand.Next(6) == 0) { portraitPool.RemoveAt(0); portraitPool.Add(CultureParser.GetRandomCultureGraphics()); } } break; case 3: // for(int n=0;n<3;n++) { // switch (Rand.Next(6)) { // case 0: empTitle = ConstructWord(2, 5); empTitle = LanguageManager.instance.AddSafe(empTitle); // break; // case 1: kingTitle = ConstructWord(2, 5); kingTitle = LanguageManager.instance.AddSafe(kingTitle); // break; // case 2: dukeTitle = ConstructWord(2, 5); dukeTitle = LanguageManager.instance.AddSafe(dukeTitle); // break; // case 3: countTitle = ConstructWord(2, 5); countTitle = LanguageManager.instance.AddSafe(countTitle); // break; // case 4: baronTitle = ConstructWord(2, 5); baronTitle = LanguageManager.instance.AddSafe(baronTitle); // break; // case 5: mayorTitle = ConstructWord(2, 5); mayorTitle = LanguageManager.instance.AddSafe(mayorTitle); // break; } } break; } if (culture != null) { culture.DoDetailsForCulture(); } }
private string GetRelatedCultureGfx(CultureGroupParser group) { return(CultureParser.GetRandomCultureGraphics(group)); }
public CharacterParser FindPreviousOwner(CharacterParser prevOwner, List <CharacterParser> prevOwners, int year) { List <CharacterParser> choices = new List <CharacterParser>(); List <CharacterParser> choicesDyn = new List <CharacterParser>(); if (prevOwner == null) { return(null); } CultureParser cul = prevOwner.Culture; for (int index = 0; index < Characters.Count; index++) { var characterParser = Characters[index]; if (characterParser.isFemale) { continue; } if (prevOwners.Contains(characterParser)) { continue; } if (year <= characterParser.YearOfBirth) { continue; } if (year >= characterParser.YearOfDeath) { continue; } if (characterParser.Culture != cul) { continue; } if (characterParser.Father == null) { continue; } if (prevOwner != null) { if (prevOwner == characterParser) { continue; } } if (prevOwner.Dynasty != characterParser.Dynasty) { choices.Add(characterParser); } else { choicesDyn.Add(characterParser); } } if (Rand.Next(6) != 0 && choicesDyn.Count > 0) { return(choicesDyn[Rand.Next(choicesDyn.Count)]); } if (choices.Count > 0) { return(choices[Rand.Next(choices.Count)]); } return(null); }
public TitleParser CreateBaronyScriptScope(ProvinceParser capital, CultureParser culture) { var place = culture.dna.GetPlaceName(); var text = place; place = StarNames.SafeName(text); if (TitleManager.instance.TieredTitles.ContainsKey("b_" + place)) { return CreateBaronyScriptScope(capital, culture); } var rand = Rand.Get(); Color col = Color.FromArgb(255, rand.Next(200) + 55, rand.Next(200) + 55, rand.Next(200) + 55); ScriptScope scope = new ScriptScope(); scope.Parent = capital.Title.Scope; scope.Name = "b_" + place; LanguageManager.instance.Add("b_" + place, text); // scope.Kids.Add(new ScriptCommand() { Name = "rebel", Value = false }); TitleParser title = new TitleParser(scope); TieredTitles[title.Name] = title; capital.Title.Scope.Add(title.Scope); // if (culture.dna.horde) // title.Scope.Do("historical_nomad = yes"); // AddTitle(title); return title; }
public void Mutate(ReligionParser rel, CultureParser culture, int nChanges) { this.dna = culture.dna; this.ai_convert_other_group = rel.ai_convert_other_group; this.max_consorts = rel.max_consorts; this.max_wives = rel.max_wives; this.religious_clothing_head = rel.religious_clothing_head; this.religious_clothing_priest = rel.religious_clothing_priest; this.allow_looting = rel.allow_looting; this.allow_rivermovement = rel.allow_rivermovement; this.allow_viking_invasion = rel.allow_viking_invasion; this.autocephaly = rel.autocephaly; this.bs_marriage = rel.bs_marriage; this.can_call_crusade = rel.can_call_crusade; this.can_excommunicate = rel.can_excommunicate; this.can_grant_claim = rel.can_grant_claim; this.can_grant_divorce = rel.can_grant_divorce; this.can_have_antipopes = rel.can_have_antipopes; this.can_hold_temples = rel.can_hold_temples; this.can_retire_to_monastery = rel.can_retire_to_monastery; this.divine_blood = rel.divine_blood; this.female_temple_holders = rel.female_temple_holders; this.hasLeader = rel.hasLeader; this.has_heir_designation = rel.has_heir_designation; this.investiture = rel.investiture; this.matrilineal_marriages = rel.matrilineal_marriages; this.pacifist = rel.pacifist; this.pc_marriage = rel.pc_marriage; this.peace_prestige_loss = rel.peace_prestige_loss; this.polytheism = rel.polytheism; this.priests_can_inherit = rel.priests_can_inherit; this.psc_marriage = rel.psc_marriage; high_god_name = rel.high_god_name; devil = rel.devil; priest = rel.priest; gods.AddRange(rel.gods); int r = Rand.Next(255); int g = Rand.Next(255); int b = Rand.Next(255); r = rel.r; g = rel.g; b = rel.b; switch (Rand.Next(3)) { case 0: r += Rand.Next(-45, 45); g += Rand.Next(-25, 25); b += Rand.Next(-15, 15); break; case 1: g += Rand.Next(-45, 45); r += Rand.Next(-25, 25); b += Rand.Next(-15, 15); break; case 2: b += Rand.Next(-45, 45); g += Rand.Next(-25, 25); r += Rand.Next(-15, 15); break; } if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; for(int n=0;n<nChanges;n++) MakeChange(); DoReligionScope(high_god_name, devil, priest, scripture_name, crusade_name, culture.dna, r, g, b); }