public static Color ResolveColor(Color c) { switch (c) { case Color.RandomFire: return(R.Choose(Color.Red, Color.DarkRed, Color.Yellow)); case Color.RandomIce: return(R.Choose(Color.White, Color.Cyan, Color.Blue, Color.DarkBlue)); case Color.RandomLightning: return(R.Choose(Color.White, Color.Yellow, Color.Yellow, Color.DarkYellow)); case Color.RandomBreached: if (R.OneIn(4)) { return(Color.DarkGreen); } return(Color.Green); case Color.RandomExplosion: if (R.OneIn(4)) { return(Color.Red); } return(Color.DarkRed); case Color.RandomGlowingFungus: if (R.OneIn(35)) { return(Color.DarkCyan); } return(Color.Cyan); case Color.RandomTorch: if (R.OneIn(8)) { if (R.CoinFlip()) { return(Color.White); } else { return(Color.Red); } } return(Color.Yellow); case Color.RandomDoom: if (R.OneIn(6)) { return(R.Choose(Color.DarkRed, Color.DarkGray)); } return(Color.DarkMagenta); //return R.Choose(Color.DarkGray,Color.DarkGray,Color.DarkRed,Color.DarkMagenta); case Color.RandomConfusion: if (R.OneIn(16)) { return(R.Choose(Color.Red, Color.Green, Color.Blue, Color.Cyan, Color.Yellow, Color.White)); } return(Color.Magenta); case Color.RandomDark: return(R.Choose(Color.DarkBlue, Color.DarkCyan, Color.DarkGray, Color.DarkGreen, Color.DarkMagenta, Color.DarkRed, Color.DarkYellow)); case Color.RandomBright: return(R.Choose(Color.Red, Color.Green, Color.Blue, Color.Cyan, Color.Yellow, Color.Magenta, Color.White, Color.Gray)); case Color.RandomRGB: return(R.Choose(Color.Red, Color.Green, Color.Blue)); case Color.RandomDRGB: return(R.Choose(Color.DarkRed, Color.DarkGreen, Color.DarkBlue)); case Color.RandomRGBW: return(R.Choose(Color.Red, Color.Green, Color.Blue, Color.White)); case Color.RandomCMY: return(R.Choose(Color.Cyan, Color.Magenta, Color.Yellow)); case Color.RandomDCMY: return(R.Choose(Color.DarkCyan, Color.DarkMagenta, Color.DarkYellow)); case Color.RandomCMYW: return(R.Choose(Color.Cyan, Color.Magenta, Color.Yellow, Color.White)); case Color.RandomRainbow: return(R.Choose(Color.Red, Color.Green, Color.Blue, Color.Cyan, Color.Yellow, Color.Magenta, Color.DarkBlue, Color.DarkCyan, Color.DarkGreen, Color.DarkMagenta, Color.DarkRed, Color.DarkYellow)); case Color.RandomAny: return(R.Choose(Color.Red, Color.Green, Color.Blue, Color.Cyan, Color.Yellow, Color.Magenta, Color.DarkBlue, Color.DarkCyan, Color.DarkGreen, Color.DarkMagenta, Color.DarkRed, Color.DarkYellow, Color.White, Color.Gray, Color.DarkGray)); case Color.OutOfSight: if (Global.Option(OptionType.DARK_GRAY_UNSEEN)) { if (Screen.GLMode) { return(Color.DarkerGray); } else { return(Color.DarkGray); } } else { return(Color.DarkBlue); } case Color.TerrainDarkGray: if (Screen.GLMode || !Global.Option(OptionType.DARK_GRAY_UNSEEN)) { return(Color.DarkGray); } else { return(Color.Gray); } case Color.HealthBar: if (Screen.GLMode) { return(Color.DarkerRed); } else { return(Color.DarkRed); } case Color.StatusEffectBar: if (Screen.GLMode) { return(Color.DarkerMagenta); } else { return(Color.DarkMagenta); } case Color.EnvironmentDescription: if (Screen.GLMode) { return(Color.ForestGreen); } else { return(Color.Green); } case Color.DarkEnvironmentDescription: if (Screen.GLMode) { return(Color.DarkForestGreen); } else { return(Color.DarkGreen); } default: return(c); } }
public async Task Print(bool special_message) { Game.Console.CursorVisible = false; //if(str.Last() != ""){ foreach (string s in str) { if (s != "You regenerate. " && s != "You rest... " && s != "") { player.Interrupt(); } } bool repeated_message = false; foreach (string s in str) { if (s != "") { int last = position - 1; if (last == -1) { last = 19; } string prev = log[last]; string count = "1"; int pos = prev.LastIndexOf(" (x"); if (pos != -1) { count = prev.Substring(pos + 3); count = count.Substring(0, count.Length - 1); prev = prev.Substring(0, pos + 1); } bool too_long_if_repeated = false; if (prev.Length + 3 + (int.Parse(count) + 1).ToString().Length > max_length) { too_long_if_repeated = true; } if (prev == s && str.Count == 1 && !too_long_if_repeated) { //trying this - only add the (x2) part if it's a single-line message, for ease of reading log[last] = prev + "(x" + (int.Parse(count) + 1).ToString() + ")"; repeated_message = true; } else { log[position] = s; ++position; if (position == 20) { position = 0; } repeated_message = false; } } } /* for(int i=0;i<3;++i){ * //Game.Console.SetCursorPosition(Global.MAP_OFFSET_COLS,i); * //Game.Console.Write("".PadRight(Global.COLS)); * Screen.WriteMapString(i-3,0,"".PadToMapSize()); * }*/ if (Global.Option(OptionType.HIDE_OLD_MESSAGES)) { for (int i = 0; i < 3; ++i) { if (i <= str.Count - 1) { //Game.Console.SetCursorPosition(Global.MAP_OFFSET_COLS,i); //Game.Console.Write(str[i]); Screen.WriteMapString(i - 3, 0, str[i].PadToMapSize()); } else { Screen.WriteMapString(i - 3, 0, "".PadToMapSize()); } } } else { int lines = str.Count; if (str.Last() == "") { --lines; } for (int i = 0; i < 3; ++i) { //Game.Console.SetCursorPosition(Global.MAP_OFFSET_COLS,i); /* if(i >= 3-lines && str[(i+lines)-3] != ""){ * Game.Console.Write(str[(i+lines)-3]); * } * else{ * Screen.ForegroundColor = ConsoleColor.DarkGray; * Game.Console.Write(PreviousMessage(3-(i+lines))); * Screen.ForegroundColor = ConsoleColor.Gray; * }*/ bool old_message = true; if (3 - i <= lines) { old_message = false; } if (old_message) { //Screen.ForegroundColor = ConsoleColor.DarkGray; //Game.Console.Write(PreviousMessage(3-i)); Screen.WriteMapString(i - 3, 0, PreviousMessage(3 - i).PadToMapSize(), Color.DarkGray); Screen.ForegroundColor = ConsoleColor.Gray; } else { if (repeated_message) { int pos = PreviousMessage(3 - i).LastIndexOf(" (x"); if (pos != -1) { //Game.Console.Write(PreviousMessage(3-i).Substring(0,pos)); //Screen.ForegroundColor = ConsoleColor.DarkGray; //Game.Console.Write(PreviousMessage(3-i).Substring(pos)); Screen.WriteMapString(i - 3, 0, PreviousMessage(3 - i).Substring(0, pos)); Screen.WriteMapString(i - 3, pos, PreviousMessage(3 - i).Substring(pos).PadToMapSize(), Color.DarkGray); Screen.ForegroundColor = ConsoleColor.Gray; } else { //Game.Console.Write(PreviousMessage(3-i)); Screen.WriteMapString(i - 3, 0, PreviousMessage(3 - i).PadToMapSize()); } } else { //Game.Console.Write(PreviousMessage(3-i)); Screen.WriteMapString(i - 3, 0, PreviousMessage(3 - i).PadToMapSize()); } } } } if (overflow != "" || special_message == true) { int cursor_col = str.Last().Length + Global.MAP_OFFSET_COLS; int cursor_row = Game.Console.CursorTop; if (cursor_row > 2) { cursor_row = 2; //hack - attempts a quick fix for the [more] appearing at the player's row } if (Screen.MapChar(0, 0).c == "-") { //hack M.RedrawWithStrings(); } else { M.Draw(); } //Game.Console.SetCursorPosition(cursor_col,cursor_row); //Screen.ForegroundColor = ConsoleColor.Yellow; //Game.Console.Write("[more]"); Screen.WriteString(cursor_row, cursor_col, "[more]", Color.Yellow); Screen.ForegroundColor = ConsoleColor.Gray; Game.Console.CursorVisible = true; await Game.Console.ReadKey(true); } str.Clear(); str.Add(overflow); overflow = ""; /* } * else{ * for(int i=0;i<3;++i){ * Game.Console.SetCursorPosition(Global.MAP_OFFSET_COLS,i); * Game.Console.Write("".PadRight(Global.COLS)); * } * }*/ }