public GameContent(Race number, string name, SocialStatus status, PlayerClass player, int[] stats, int[] resists, int[] baseRes, int[,] wp) { Buffer = new ScreenBuffer(); WorldLevels = new List<Level>(); time = new Time(); turnCounter = 0; PC = new Character(69, 10, number, status, name, player, stats, resists, baseRes, wp); for (int i = 3; i > 0; i--) { WorldLevels.Add(new Level("Start" + i)); } for (int i = 0; i < WorldLevels.Count - 1; i++) { Level.ConnectLevels(WorldLevels[i], WorldLevels[i + 1]); } //CurrentMap = new Map("Data\\dungeon3.txt"); //CurrentMap = new Map(map, 1, 5); CurrentLevel = WorldLevels[0]; CurrentMap = CurrentLevel.Map; Entities = WorldLevels[0].EntityList; List<Point> startingPosList = Map.GenerateListOfStartingLocations(CurrentMap.map); Point startingPos = Map.SelectRandomEmptyLocation(startingPosList); //CurrentMap.addObjectAt(69, 10, PC); CurrentMap.addObjectAt(startingPos.X + 1, startingPos.Y + 5, PC); //startingPos = Map.SelectRandomEmptyLocation(startingPosList); ////CurrentMap.addObjectAt(27, 34, Enemy); //CurrentMap.addObjectAt(startingPos.X + 1, startingPos.Y + 5, Enemy); }
private void new_game_menu() { int charisma_bonus = 0; bool exit; string name = ""; StringName birthplace; Race r = new Race(); SocialStatus s = new SocialStatus(); PlayerClass p = new PlayerClass(); Character pc = new Character(); ConsoleKeyInfo key; Console.SetCursorPosition(Console.WindowWidth / 2 - Text.Length(Lang[StringName.CREATE_CHARACTER_MENU_TITLE]) / 2, 5); Console.Write(Lang[StringName.CREATE_CHARACTER_MENU_TITLE]); //roll for birthpalce int roll = Dice.Roll("d100"); if (roll >= 1 && roll <= 16) { birthplace = StringName.BIRTHPLACE_01; } else if (roll >= 17 && roll <= 25) { birthplace = StringName.BIRTHPLACE_02; } else if (roll >= 26 && roll <= 30) { birthplace = StringName.BIRTHPLACE_03; } else if (roll >= 31 && roll <= 34) { birthplace = StringName.BIRTHPLACE_04; } else if (roll >= 35 && roll <= 38) { birthplace = StringName.BIRTHPLACE_05; } else if (roll >= 39 && roll <= 42) { birthplace = StringName.BIRTHPLACE_06; } else if (roll >= 43 && roll <= 45) { birthplace = StringName.BIRTHPLACE_07; } else if (roll >= 46 && roll <= 48) { birthplace = StringName.BIRTHPLACE_08; } else if (roll >= 49 && roll <= 51) { birthplace = StringName.BIRTHPLACE_09; } else if (roll >= 52 && roll <= 54) { birthplace = StringName.BIRTHPLACE_10; } else if (roll >= 55 && roll <= 56) { birthplace = StringName.BIRTHPLACE_11; } else if (roll >= 57 && roll <= 58) { birthplace = StringName.BIRTHPLACE_12; } else if (roll > 59 && roll <= 60) { birthplace = StringName.BIRTHPLACE_13; } else if (roll >= 61 && roll <= 80) { birthplace = StringName.BIRTHPLACE_14; } else if (roll >= 81 && roll <= 99) { birthplace = StringName.BIRTHPLACE_15; } else { birthplace = StringName.BIRTHPLACE_16; } s.PoB = birthplace; //select gender Console.SetCursorPosition(17, 10); Console.Write(Lang[StringName.CREATE_CHARACTER_SELECT_GENDER]); Console.SetCursorPosition(19, 13); Text.Write("[|c[15]m|c[14]]\t"+Lang[StringName.MALE_TEXT]); Console.SetCursorPosition(19, 15); Text.Write("[|c[15]f|c[14]]\t" + Lang[StringName.FEMALE_TEXT]); while (true) { key = Console.ReadKey(true); if (key.Key == ConsoleKey.M || key.Key == ConsoleKey.F) { break; } } switch (key.Key) { case ConsoleKey.M: { r.GenderType = Gender.MALE; r.genderName = StringName.MALE_TEXT; break; } case ConsoleKey.F: { r.GenderType = Gender.FEMALE; r.genderName = StringName.FEMALE_TEXT; break; } } clearScreen(0, 10, 0, 0); //select race Console.SetCursorPosition(17, 10); Console.Write(Lang[StringName.CREATE_CHARACTER_SELECT_RACE]); Console.SetCursorPosition(19, 13); Text.Write("[|c[15]a|c[14]]\t"+Lang[StringName.HUMAN_TEXT]); Console.SetCursorPosition(19, 14); Text.Write("[|c[15]b|c[14]]\t" + Lang[StringName.HALF_ELF_TEXT]); Console.SetCursorPosition(19, 15); Text.Write("[|c[15]c|c[14]]\t" + Lang[StringName.ELF_TEXT]); Console.SetCursorPosition(19, 16); Text.Write("[|c[15]d|c[14]]\t" + Lang[StringName.HALF_GIANT_TEXT]); Console.SetCursorPosition(19, 17); Text.Write("[|c[15]e|c[14]]\t" + Lang[StringName.HALF_ORC_TEXT]); Console.SetCursorPosition(19, 18); Text.Write("[|c[15]f|c[14]]\t" + Lang[StringName.DWARF_TEXT]); Console.SetCursorPosition(19, 19); Text.Write("[|c[15]g|c[14]]\t" + Lang[StringName.GNOME_TEXT]); Console.SetCursorPosition(19, 20); Text.Write("[|c[15]h|c[14]]\t" + Lang[StringName.HALFLING_TEXT]); Console.SetCursorPosition(19, 21); Text.Write("[|c[15]i|c[14]]\t" + Lang[StringName.REPTILION_TEXT]); exit = false; while (!exit) { key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.A: { r.RaceType = Races.HUMAN; r.Name = StringName.HUMAN_TEXT; exit = true; break; } case ConsoleKey.B: { r.RaceType = Races.HALF_ELF; r.Name = StringName.HALF_ELF_TEXT; exit = true; break; } case ConsoleKey.C: { r.RaceType = Races.ELF; r.Name = StringName.ELF_TEXT; exit = true; break; } case ConsoleKey.D: { r.RaceType = Races.HALF_GIANT; r.Name = StringName.HALF_GIANT_TEXT; exit = true; break; } case ConsoleKey.E: { r.RaceType = Races.HALF_ORC; r.Name = StringName.HALF_ORC_TEXT; exit = true; break; } case ConsoleKey.F: { r.RaceType = Races.DWARF; r.Name = StringName.DWARF_TEXT; exit = true; break; } case ConsoleKey.G: { r.RaceType = Races.GNOME; r.Name = StringName.GNOME_TEXT; exit = true; break; } case ConsoleKey.H: { r.RaceType = Races.HALFLING; r.Name = StringName.HALFLING_TEXT; exit = true; break; } case ConsoleKey.I: { r.RaceType = Races.REPTILION; r.Name = StringName.REPTILION_TEXT; exit = true; break; } } } //roll height roll = Dice.Roll("d100"); if (roll >= 1 && roll <= 20) { r.Height = Race.HeightTable[(int)r.RaceType][0] + roll; } else if (roll >= 21 && roll <= 80) { r.Height = Race.HeightTable[(int)r.RaceType][1] + roll % 10; } else if (roll >= 81 && roll <= 99) { r.Height = Race.HeightTable[(int)r.RaceType][2] + (roll - 80); } else { int bonus = 0; int extraroll; do { extraroll = Dice.Roll("d10"); bonus += extraroll; } while (extraroll == 10); r.Height = Race.HeightTable[(int)r.RaceType][3] + bonus; } //roll weight roll = Dice.Roll("d100"); if (roll >= 1 && roll <= 20) { r.Weight = Race.WeightTable[(int)r.RaceType][0] + roll; } else if (roll >= 21 && roll <= 80) { r.Weight = Race.WeightTable[(int)r.RaceType][1] + roll % 10; } else if (roll >= 81 && roll <= 99) { r.Weight = Race.WeightTable[(int)r.RaceType][2] + (roll - 80); } else { int bonus = 0; int extraroll; do { extraroll = Dice.Roll("d10"); bonus += extraroll; } while (extraroll == 10); r.Weight = Race.WeightTable[(int)r.RaceType][3] + bonus; } //adjust height and weight depending on gender if (r.RaceType == Races.HALF_GIANT) { if (r.GenderType == Gender.FEMALE) { r.Height += 10; r.Weight += 10; } } else { if (r.GenderType == Gender.FEMALE) { r.Height -= 10; r.Weight -= 10; } } //starting social status roll = Dice.Roll("d100"); if (roll >= 1 && roll <= 5) { s.SocialClass = SocialClasses.POVERTY; s.nameSocialClass = StringName.POVERTY_TEXT; s.socialStatus = SocialStatuses.LOWER_POVERTY; s.nameSocialStatus = StringName.LOWER_POVERTY_TEXT; charisma_bonus = -15; s.Gold = Dice.Roll("d10"); s.Title = ""; } else if (roll >= 6 && roll <= 10) { s.SocialClass = SocialClasses.POVERTY; s.nameSocialClass = StringName.POVERTY_TEXT; s.socialStatus = SocialStatuses.MIDDLE_POVERTY; s.nameSocialStatus = StringName.MIDDLE_POVERTY_TEXT; charisma_bonus = -10; s.Gold = Dice.Roll("2d10"); s.Title = ""; } else if (roll >= 11 && roll <= 15) { s.SocialClass = SocialClasses.POVERTY; s.nameSocialClass = StringName.POVERTY_TEXT; s.socialStatus = SocialStatuses.UPPER_POVERTY; s.nameSocialStatus = StringName.UPPER_POVERTY_TEXT; charisma_bonus = -5; s.Gold = Dice.Roll("5d10"); s.Title = ""; } else if (roll >= 16 && roll <= 35) { s.SocialClass = SocialClasses.MIDDLE_CLASS; s.nameSocialClass = StringName.MIDDLE_CLASS_TEXT; s.socialStatus = SocialStatuses.LOWER_MIDDLE_CLASS; s.nameSocialStatus = StringName.LOWER_MIDDLE_CLASS_TEXT; s.Gold = Dice.Roll("d50"); s.Title = "el "; } else if (roll >= 36 && roll <= 55) { s.SocialClass = SocialClasses.MIDDLE_CLASS; s.nameSocialClass = StringName.MIDDLE_CLASS_TEXT; s.socialStatus = SocialStatuses.MIDDLE_MIDDLE_CLASS; s.nameSocialStatus = StringName.MIDDLE_MIDDLE_CLASS_TEXT; s.Gold = Dice.Roll("d100"); s.Title = "el "; } else if (roll >= 56 && roll <= 75) { s.SocialClass = SocialClasses.MIDDLE_CLASS; s.nameSocialClass = StringName.MIDDLE_CLASS_TEXT; s.socialStatus = SocialStatuses.UPPER_MIDDLE_CLASS; s.nameSocialStatus = StringName.UPPER_MIDDLE_CLASS_TEXT; s.Gold = Dice.Roll("2d100"); s.Title = "el "; } else if (roll >= 76 && roll <= 85) { s.SocialClass = SocialClasses.NOBILITY; s.nameSocialClass = StringName.NOBILITY_TEXT; s.socialStatus = SocialStatuses.LOWER_NOBILITY; s.nameSocialStatus = StringName.LOWER_NOBILITY_TEXT; s.Gold = Dice.Roll("d100"); s.Title = "tan "; } else if (roll >= 86 && roll <= 90) { s.SocialClass = SocialClasses.NOBILITY; s.nameSocialClass = StringName.NOBILITY_TEXT; s.socialStatus = SocialStatuses.MIDDLE_NOBILITY; s.nameSocialStatus = StringName.MIDDLE_NOBILITY_TEXT; s.Gold = Dice.Roll("2d100"); s.Title = "tan "; } else if (roll >= 91 && roll <= 95) { s.SocialClass = SocialClasses.NOBILITY; s.nameSocialClass = StringName.NOBILITY_TEXT; s.socialStatus = SocialStatuses.UPPER_NOBILITY; s.nameSocialStatus = StringName.UPPER_NOBILITY_TEXT; s.Gold = Dice.Roll("5d100"); s.Title = "tan "; } else { s.SocialClass = SocialClasses.NOBILITY; s.nameSocialClass = StringName.NOBILITY_TEXT; s.socialStatus = SocialStatuses.ELITE_NOBILITY; s.nameSocialStatus = StringName.ELITE_NOBILITY_TEXT; s.Gold = Dice.Roll("10d100"); if (r.GenderType == Gender.MALE) { s.Title = Lang[StringName.PRINCE_TEXT]; } else { s.Title = Lang[StringName.PRINCESS_TEXT]; } } //select class clearScreen(0, 10, 0, 0); Console.SetCursorPosition(17, 10); Console.Write(Lang[StringName.CREATE_CHARACTER_SELECT_CLASS]); List<Classess> availableClasses = new List<Classess>(); List<Classess> finalClasses = new List<Classess>(); for (Classess j = Classess.WARRIOR; j < Classess.MAX_SIZE; j++) { if (Race.ClassTable[(int)r.RaceType][(int)j] > 0) { availableClasses.Add(j); } } foreach (Classess c in availableClasses) { if ((c == Classess.KNIGHT || c == Classess.PALADIN || c == Classess.BLACK_KNIGHT) && s.SocialClass != SocialClasses.NOBILITY) { continue; } finalClasses.Add(c); } int count = finalClasses.Count; int top = 13; int left = 19; int asciiOffset = 96; for (int i = 0; i < count; i++) { if ((i > 0) && ((i + 9) % 9 == 0)) { //move to next column and reset row top = 13 - i; left += 20; } Console.SetCursorPosition(left, top + i); Text.Write("|c[14][|c[15]" + (char)(97 + i) + "|c[14]] "+Lang[PlayerClass.ClassEnumToStringName(finalClasses[i])]); } exit = false; while (!exit) { key = Console.ReadKey(true); if (key.KeyChar >= 97 && key.KeyChar <= asciiOffset + count) { p.playerClass = finalClasses[(int)key.KeyChar - 97]; p.className = PlayerClass.ClassEnumToStringName(p.playerClass); exit = true; } } clearScreen(0, 10, 0, 0); //roll for stats Console.SetCursorPosition(17, 10); Console.Write(Lang[StringName.CREATE_CHARACTER_STATS_TEXT]); int originPos = 19; int baseEnd = 29; int rollEnd = 60; int classEnd = 72; int totalEnd = 95; int empty; int numberPos; int[] stats = new int[(int)PrimaryStats.MAX_SIZE]; int[] rolls = new int[(int)PrimaryStats.MAX_SIZE]; int[] classBonus = new int[(int)PrimaryStats.MAX_SIZE]; int[] finals = new int[(int)PrimaryStats.MAX_SIZE]; for (PrimaryStats i = PrimaryStats.VITALITY; i < PrimaryStats.MAX_SIZE; i++) { if (r.GenderType == Gender.MALE) { stats[(int)i] = Race.MaleStatsTable[(int)r.RaceType][(int)i]; } else { stats[(int)i] = Race.FemaleStatsTable[(int)r.RaceType][(int)i]; } } for (int i = 1; i < (int)PrimaryStats.MAX_SIZE; i++) { if ((i == (int)PrimaryStats.MAGIC_SKILLS) && r.RaceType == Races.HUMAN) { rolls[i] = Dice.Roll("d100"); } else if (i == (int)PrimaryStats.NOTICE) { if (p.playerClass == Classess.PRIEST || p.playerClass == Classess.DRUID || p.playerClass == Classess.ASTROLOGER || p.playerClass == Classess.HALF_GOD) { rolls[i] = Dice.Roll("d10"); } else { rolls[i] = Dice.Roll("d5"); } } else { rolls[i] = Dice.Roll("d50"); } } //for (int i = 0; i < (int)PrimaryStats.MAX_SIZE; i++) //{ classBonus = PlayerClass.ParseClassBonuses(p.playerClass); //} for (int i = 0; i < (int)PrimaryStats.MAX_SIZE; i++) { finals[i] = stats[i] + rolls[i] + classBonus[i]; } Console.SetCursorPosition(originPos, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_STAT_NAMES_TEXT]); Console.SetCursorPosition(40, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_BASE_STATS_TEXT]); Console.SetCursorPosition(57, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_ROLL_TEXT]); Console.SetCursorPosition(65, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_CLASS_BONUS_TEXT]); Console.SetCursorPosition(90, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_TOTAL_STATS_TEXT]); //Display stats names Console.SetCursorPosition(19, 16); Text.Write("|c[10]" + Lang[StringName.STAT_VITALITY_TEXT]); Console.SetCursorPosition(19, 18); Text.Write("|c[10]" + Lang[StringName.STAT_STRENGTH_TEXT]); Console.SetCursorPosition(19, 20); Text.Write("|c[10]" + Lang[StringName.STAT_DEXTERITY_TEXT]); Console.SetCursorPosition(19, 22); Text.Write("|c[10]" + Lang[StringName.STAT_SPEED_TEXT]); Console.SetCursorPosition(19, 24); Text.Write("|c[10]" + Lang[StringName.STAT_INTELLIGENCE_TEXT]); Console.SetCursorPosition(19, 26); Text.Write("|c[10]" + Lang[StringName.STAT_WISDOM_TEXT]); Console.SetCursorPosition(19, 28); Text.Write("|c[10]" + Lang[StringName.STAT_MAGIC_SKILLS_TEXT]); Console.SetCursorPosition(19, 30); Text.Write("|c[10]" + Lang[StringName.STAT_CHARISMA_TEXT]); Console.SetCursorPosition(19, 32); Text.Write("|c[10]" + Lang[StringName.STAT_APPEARANCE_TEXT]); Console.SetCursorPosition(19, 34); Text.Write("|c[10]" + Lang[StringName.STAT_FAITH_TEXT]); Console.SetCursorPosition(19, 36); Text.Write("|c[10]" + Lang[StringName.STAT_NOTICE_TEXT]); for (int i = 0; i < (int)PrimaryStats.MAX_SIZE; i++) { //display base stats empty = baseEnd - Lang[(StringName)130 + i].Length - stats[i].ToString().Length; numberPos = originPos + Lang[(StringName)130 + i].Length + empty; Console.SetCursorPosition(numberPos, 16 + i*2); Text.Write("|c[10]" + stats[i]); //display rolls empty = rollEnd - baseEnd - rolls[i].ToString().Length; numberPos = baseEnd + empty; Console.SetCursorPosition(numberPos, 16 + i * 2); if (i == 0) { Console.Write(""); } else { Text.Write("|c[11]" + rolls[i]); } //display class bonuses empty = classEnd - rollEnd - classBonus[i].ToString().Length; numberPos = rollEnd + empty; Console.SetCursorPosition(numberPos, 16 + i * 2); if (classBonus[i] == 0) { Console.Write(""); } else { Text.Write("|c[6]" + classBonus[i]); } //display final score empty = totalEnd - classEnd - finals[i].ToString().Length; numberPos = classEnd + empty; Console.SetCursorPosition(numberPos, 16 + i * 2); Text.Write("|c[13]" + finals[i]); } //add charisma bonus for social status finals[(int)PrimaryStats.CHARISMA] += charisma_bonus; Console.SetCursorPosition(69, 42); Text.Write(Lang[StringName.CREATE_CHARACTER_CONTINUE_TEXT]); while (true) { key = Console.ReadKey(true); if (key.Key == ConsoleKey.Spacebar) { break; } } //roll for resists clearScreen(0, 10, 0, 0); Console.SetCursorPosition(17, 10); Text.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_TEXT]); Console.SetCursorPosition(10, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_BASE_MENTAL_TEXT]); Console.SetCursorPosition(74, 14); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_BASE_PHYSICAL_TEXT]); //mental Console.SetCursorPosition(13, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_RACE_BONUS_TEXT]); Console.SetCursorPosition(28, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_CLASS_BONUS_TEXT]); Console.SetCursorPosition(48, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_TOTAL_VALUE_TEXT]); //physical Console.SetCursorPosition(77, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_RACE_BONUS_TEXT]); Console.SetCursorPosition(92, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_CLASS_BONUS_TEXT]); Console.SetCursorPosition(110, 16); Console.Write(Lang[StringName.CREATE_CHARACTER_RESISTS_TOTAL_VALUE_TEXT]); int baseMental = finals[(int)PrimaryStats.INTELLIGENCE] / 10 + finals[(int)PrimaryStats.WISDOM] / 10 + finals[(int)PrimaryStats.VITALITY] / 20 + Dice.Roll("d10"); int basePhysical = finals[(int)PrimaryStats.VITALITY] / 10 + finals[(int)PrimaryStats.STRENGTH] / 10 + Dice.Roll("d10"); int[] raceBonuses = Race.ResistsTable[(int)r.RaceType]; int[] classBonuses = PlayerClass.ParseClassResistsBonuses(p.playerClass); int[] totalRes = new int[(int)Resists.MAX_SIZE]; int[] baseRes = new int[2]; baseRes[0] = baseMental; baseRes[1] = basePhysical; for (int i = 0; i < (int)Resists.MAX_SIZE; i++) { if (i == (int)Resists.RESIST_1) { totalRes[i] = baseMental + finals[(int)PrimaryStats.INTELLIGENCE] / 10 + raceBonuses[i] + classBonuses[i]; } else if (i == (int)Resists.RESIST_2) { totalRes[i] = baseMental + finals[(int)PrimaryStats.WISDOM] / 10 + raceBonuses[i] + classBonuses[i]; } else if (i == (int)Resists.RESIST_3) { totalRes[i] = baseMental + finals[(int)PrimaryStats.FAITH] / 10 + raceBonuses[i] + classBonuses[i]; } else if (i >= (int)Resists.RESIST_4 && i <= (int)Resists.RESIST_5) { totalRes[i] = baseMental + raceBonuses[i] + classBonuses[i]; } else { totalRes[i] = basePhysical + raceBonuses[i] + classBonuses[i]; } } int baseX = 0; int baseY = 18; originPos = 7; baseEnd = 12; classEnd = 23; totalEnd = 29; //base resists Console.SetCursorPosition(50, 14); Text.Write("|c[10]" + baseMental); Console.SetCursorPosition(112, 14); Text.Write("|c[10]" + basePhysical); //first 5 resists Console.SetCursorPosition(2, 18); Console.Write(Lang[StringName.RESIST01_TEXT]); Console.SetCursorPosition(2, 20); Console.Write(Lang[StringName.RESIST02_TEXT]); Console.SetCursorPosition(2, 22); Console.Write(Lang[StringName.RESIST03_TEXT]); Console.SetCursorPosition(2, 24); Console.Write(Lang[StringName.RESIST04_TEXT]); Console.SetCursorPosition(2, 26); Console.Write(Lang[StringName.RESIST05_TEXT]); //second five Console.SetCursorPosition(64, 18); Console.Write(Lang[StringName.RESIST06_TEXT]); Console.SetCursorPosition(64, 20); Console.Write(Lang[StringName.RESIST07_TEXT]); Console.SetCursorPosition(64, 22); Console.Write(Lang[StringName.RESIST08_TEXT]); Console.SetCursorPosition(64, 24); Console.Write(Lang[StringName.RESIST09_TEXT]); Console.SetCursorPosition(64, 26); Console.Write(Lang[StringName.RESIST10_TEXT]); Console.SetCursorPosition(69, 42); Text.Write(Lang[StringName.CREATE_CHARACTER_CONTINUE_TEXT]); for (int i = 0; i < (int)Resists.MAX_SIZE; i++) { if ((i > 0) && (i % 5 == 0)) { //reset row and move to next column baseX = 69-originPos; baseY = 18 - i*2; //display race bonuses empty = baseEnd - Lang[(StringName)159 + i].Length - raceBonuses[i].ToString().Length; numberPos = originPos + Lang[(StringName)159 + i].Length + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); if (raceBonuses[i] == 0) { Text.Write(""); } else { Text.Write("|c[10]" + raceBonuses[i]); } //dispaly class bonuses empty = classEnd - classBonuses[i].ToString().Length; numberPos = baseEnd + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); if (classBonuses[i] == 0) { Text.Write(""); } else { Text.Write("|c[11]" + classBonuses[i]); } //display total values empty = totalEnd - totalRes[i].ToString().Length; numberPos = classEnd + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); Text.Write("|c[13]" + totalRes[i]); } else { //display race bonuses empty = baseEnd - Lang[(StringName)159 + i].Length - raceBonuses[i].ToString().Length; numberPos = originPos + Lang[(StringName)159 + i].Length + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); if (raceBonuses[i] == 0) { Text.Write(""); } else { Text.Write("|c[10]" + raceBonuses[i]); } //dispaly class bonuses empty = classEnd - classBonuses[i].ToString().Length; numberPos = baseEnd + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); if (classBonuses[i] == 0) { Text.Write(""); } else { Text.Write("|c[11]" + classBonuses[i]); } //display total values empty = totalEnd - totalRes[i].ToString().Length; numberPos = classEnd + empty; Console.SetCursorPosition(baseX + numberPos, baseY + i * 2); Text.Write("|c[13]" + totalRes[i]); } } while (true) { key = Console.ReadKey(true); if (key.Key == ConsoleKey.Spacebar) { break; } } //select weapon proficiencies int freeWp = PlayerClass.ClassProficiencyTable[p.playerClass][0]; int baseWPValue = PlayerClass.ClassProficiencyTable[p.playerClass][1]; List<WeaponClass> wpList = new List<WeaponClass>(); wpList = select_weapon_proficiencies(p.playerClass, freeWp); int[,] wptotal = new int[wpList.Count, 2]; clearScreen(0, 10, 0, 0); //display proficiency data Console.SetCursorPosition(13, 13); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_YOUR_SELECTED_PROF_TEXT]); Console.SetCursorPosition(15, 16); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_PROFICIENCY_TEXT]); Console.SetCursorPosition(35, 16); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_BASE_TEXT]); Console.SetCursorPosition(52, 16); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_RESISTS_RACE_BONUS_TEXT]); Console.SetCursorPosition(70, 16); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_ROLL_TEXT]); Console.SetCursorPosition(80, 16); Text.Write("|c[14]"+Lang[StringName.CREATE_CHARACTER_TOTAL_STATS_TEXT]); //get racial bonuses Dictionary<WeaponClass, int> rb = Race.RaceProficiencyBonusTable[r.RaceType]; left = 17; top = 18; for (int i = 0; i < wpList.Count; i++) { Console.SetCursorPosition(left, top + i * 2); Text.Write("|c[10]" + Lang[(StringName)Enum.Parse(typeof(StringName), "WEAPONCLASS_" + (WeaponClass)wpList[i])]); Console.SetCursorPosition(40, top + i * 2); Text.Write(baseWPValue.ToString()); Console.SetCursorPosition(58, top + i * 2); int raceB = 0; if (rb.ContainsKey((WeaponClass)wpList[i])) { raceB = rb[(WeaponClass)wpList[i]]; } if (raceB != 0) { Text.Write("|c[6]" + raceB.ToString()); } Console.SetCursorPosition(71, top + i * 2); roll = Dice.Roll("d50"); Text.Write("|c[11]" + roll.ToString()); Console.SetCursorPosition(82, top + i * 2); wptotal[i, 0] = (int)wpList[i]; wptotal[i, 1] = baseWPValue + raceB + roll; Text.Write("|c[13]" + wptotal[i, 1].ToString()); } Console.SetCursorPosition(69, 42); Text.Write(Lang[StringName.CREATE_CHARACTER_CONTINUE_TEXT]); while (true) { key = Console.ReadKey(true); if (key.Key == ConsoleKey.Spacebar) { break; } } //select name clearScreen(0, 10, 0, 0); Console.SetCursorPosition(17, 23); Text.Write(Lang[StringName.CREATE_CHARACTER_GIVE_NAME_TEXT]); Console.CursorVisible = true; bool stopReading = false; while (!stopReading) { ConsoleKeyInfo c = Console.ReadKey(true); if (char.IsLetterOrDigit(c.KeyChar)) { Console.Write(c.KeyChar); name += c.KeyChar; } //backspace key if (c.KeyChar == 8) { if (name.Length == 0) { continue; } Console.Write("\b \b"); name = name.Remove(name.Length - 1); } //enter key if (c.KeyChar == 13) { stopReading = true; } } Console.CursorVisible = false; clearScreen(); newGame(r, name, s, p, finals, totalRes, baseRes, wptotal); }
public void newGame(Race dude, string name, SocialStatus status, PlayerClass player, int[] stats, int[] resists, int[] baseRes, int[,] wp) { GC = new GameContent(dude, name, status, player, stats, resists, baseRes, wp); }
public Character(int posX, int posY, Race r, SocialStatus s, string name, PlayerClass p, int[] pStats, int[] pResists, int[] pBaseRes, int[,] wp, char visual = '@') { _posX = posX; _posY = posY; _oldX = posX; _oldY = posY; _visibilityRange = 5; _visual = visual; _color = ConsoleColor.Green; _type = ObjectType.O_PC; _seen = true; gender = r.GenderType; genderName = r.genderName; race = r.RaceType; raceName = r.Name; Height = r.Height; Weight = r.Weight; Title = s.Title; Name = name; PlaceOfBirth = s.PoB; SocialClass = s.SocialClass; nameSocialClass = s.nameSocialClass; playerSocialStatus = s.socialStatus; nameSocialStatus = s.nameSocialStatus; playerClass = p.playerClass; className = p.className; _backpack = new Backpack(); _inventory = new Inventory(); _weaponProficiencies = new List<WeaponProficiency>(); _primaryStats = new Dictionary<PrimaryStats, Stat>(); _resists = new Dictionary<Resists, Stat>(); _BaseResists = new Dictionary<ResistGroup, Stat>(); _protection = new int[(int)DamageType.MAX_SIZE]; _states = new bool[(int)PlayerStates.MAX_SIZE]; changeState(PlayerStates.NORMAL); for (PrimaryStats i = PrimaryStats.VITALITY; i < PrimaryStats.MAX_SIZE; i++) { _primaryStats.Add(i, new Stat(pStats[(int)i])); } for (Resists i = Resists.RESIST_1; i < Resists.MAX_SIZE; i++) { _resists.Add(i, new Stat(pResists[(int)i])); } _BaseResists.Add(ResistGroup.MENTAL, new Stat(pBaseRes[0])); _BaseResists.Add(ResistGroup.PHYSICAL, new Stat(pBaseRes[1])); _Stamina = new Stat(_primaryStats[PrimaryStats.VITALITY].currentValue / 10 + _primaryStats[PrimaryStats.STRENGTH].currentValue / 10); _MagicPotential = new Stat(0); _freeProficiences = PlayerClass.ClassProficiencyTable[playerClass][0]; Gold = s.Gold; Level = 0; Exp = 0; _timeOfDamage = -1; CalculateRegenerationRate(); _defence = new Stat(Race.MaleStatsTable[(int)race][11]); int count = wp.GetLength(0); _freeProficiences = PlayerClass.ClassProficiencyTable[playerClass][0] - count; for (int i = 0; i < count; i++) { _weaponProficiencies.Add(new WeaponProficiency((WeaponClass)wp[i, 0], wp[i, 1], (StringName)Enum.Parse(typeof(StringName), "WEAPONCLASS_" + (WeaponClass)wp[i, 0]))); } CalculateBaseDefence(); CalculateBaseProtection(); CalculateEncumbrance(); CalculateStamina(); if (PlayerClass.GetCastesOfClass(playerClass) == Castes.PRIESTS || PlayerClass.GetCastesOfClass(playerClass) == Castes.SORCERERS) { CalculateMagicPotential(); } }