internal void Sold(GameConfig config) { this.Traits = new Traits(); this.birthday = new DateTime(); this.birthstamp = new DateTime(); this.BestEquip = "Sharp Rock"; this.Equips = new Dictionary <string, string>(); this.Inventory = new Dictionary <string, int>(); this.Inventory["Gold"] = 0; this.Spells = new Dictionary <string, string>(); this.ExpBar = new ProgressBar("ExpBar", "$remaining XP needed for next level", config.LevelUpTime(1), 0); this.EncumBar = new ProgressBar("EncumBar", "$position/$max cubits", GetStat("STR") + 10, 0); this.Traits.Name = config.GenerateName(); this.Traits.Race = config.RandomRace(); this.Traits.Class = config.RandomClass(); this.Traits.Level = 1; this.date = this.birthday; this.stamp = this.birthstamp; foreach (var equip in this.Equips.Keys) { this.Equips[equip] = ""; } this.Equips["Weapon"] = this.BestEquip; this.Equips["Hauberk"] = "-3 Burlap"; }
private static string NamedMonster(int level, GameState gameState, GameConfig config) { var lev = 0; var result = ""; for (var i = 0; i < 5; ++i) { var m = Pick(config.Monsters, gameState); if (result == "" || (Math.Abs(level - StrToInt(Split(m, 1))) < Math.Abs(level - lev))) { result = Split(m, 0); lev = StrToInt(Split(m, 1)); } } return(config.GenerateName() + " the " + result); }
private static object ImpressiveGuy(GameState gameState, GameConfig config) { return(Pick(config.ImpressiveTitles, gameState) + (gameState.Random(2) == 1 ? " of the " + Pick(config.Races, gameState) : " of " + config.GenerateName())); }
private static (string description, int level) MonsterTask(int level, GameState gameState, GameConfig config) { var definite = false; int i; for (i = level; i >= 1; --i) { if (Odds(2, 5, gameState)) { level += RandSign(gameState); } } if (level < 1) { level = 1; } // level = level of puissance of opponent(s) we'll return string monster = ""; int lev; if (Odds(1, 25, gameState)) { // Use an NPC every once in a while monster = " " + Split(Pick(config.Races, gameState), 0); if (Odds(1, 2, gameState)) { monster = "passing" + monster + " " + Split(Pick(config.Klasses, gameState), 0); } else { monster = PickLow(config.Titles, gameState) + " " + config.GenerateName() + " the" + monster; definite = true; } lev = level; monster = monster + "|" + IntToStr(level) + "|*"; } else if (gameState.QuestMonster != "" && Odds(1, 4, gameState)) { // Use the quest monster monster = config.Monsters[gameState.QuestMonsterIndex]; lev = StrToInt(Split(monster, 1)); } else { // Pick the monster out of so many random ones closest to the level we want monster = Pick(config.Monsters, gameState); lev = StrToInt(Split(monster, 1)); for (var ii = 0; ii < 5; ++ii) { var m1 = Pick(config.Monsters, gameState); if (Math.Abs(level - StrToInt(Split(m1, 1))) < Math.Abs(level - lev)) { monster = m1; lev = StrToInt(Split(monster, 1)); } } } var result = Split(monster, 0); gameState.Task = "kill|" + monster; var qty = 1; if (level - lev > 10) { // lev is too low. multiply... // qty = MathF.Floor((level + gameState.Random(Math.Max(lev,1))) / Math.Max(lev,1)); qty = (level + gameState.Random(Math.Max(lev, 1))) / Math.Max(lev, 1); if (qty < 1) { qty = 1; } // level = Math.Floor(level / qty); level = level / qty; } if ((level - lev) <= -10) { result = "imaginary " + result; } else if ((level - lev) < -5) { i = 10 + (level - lev); i = 5 - gameState.Random(i + 1); result = Sick(i, Young((lev - level) - i, result)); } else if (((level - lev) < 0) && (gameState.Random(2) == 1)) { result = Sick(level - lev, result); } else if (((level - lev) < 0)) { result = Young(level - lev, result); } else if ((level - lev) >= 10) { result = "messianic " + result; } else if ((level - lev) > 5) { i = 10 - (level - lev); i = 5 - gameState.Random(i + 1); result = Big(i, Special((level - lev) - i, result)); } else if (((level - lev) > 0) && (gameState.Random(2) == 1)) { result = Big(level - lev, result); } else if (((level - lev) > 0)) { result = Special(level - lev, result); } lev = level; level = lev * qty; if (!definite) { result = Indefinite(result, qty); } return(result, level); }