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); }
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)); }