public void drawStatus(int x, int y) { for (int a = 0; a < statusEffects.Count; a++) { Console.SetCursorPosition(x, y + a); ConsoleEx.TextColor(statusEffects[a].colorFore, statusEffects[a].colorBack); if (statusEffects[a].level > 1) { if (statusEffects[a].permanent) { Console.Write(statusEffects[a].name + " " + statusEffects[a].level); } else { Console.Write(statusEffects[a].name + " " + statusEffects[a].level + " (" + statusEffects[a].timeLeft + " turns left)"); } } else { if (statusEffects[a].permanent) { Console.Write(statusEffects[a].name); } else { Console.Write(statusEffects[a].name + " (" + statusEffects[a].timeLeft + " turns left)"); } } ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); } }
public static void drawAllClasses() { for (int x = 0; x < classList.Length; x++) { Console.SetCursorPosition(1, x + 1); if (Program.selectedSpecies == x) { ConsoleEx.TextColor(ConsoleForeground.Magenta, ConsoleBackground.Yellow); drawClass(classList[x]); } else { ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); drawClass(classList[x]); } } ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); }
public void draw(int x, int y) { if (isEmpty(x, y)) { map[x, y].draw(); } else { if (items[x, y] != null) { ConsoleEx.TextColor(ConsoleForeground.Cyan, ConsoleBackground.Black); Console.Write('@'); } else if (gold[x, y] > 0) { ConsoleEx.TextColor(ConsoleForeground.Yellow, ConsoleBackground.Black); Console.Write('G'); } } }
public void WriteRPGStats(int x, int y) { ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); Console.SetCursorPosition(x, y); Console.WriteLine("Health: " + stats.health + "/" + stats.maxHealth); Console.SetCursorPosition(x, y + 1); Console.WriteLine("Ether: " + stats.mana + "/" + stats.maxMana); Console.SetCursorPosition(x, y + 2); Console.WriteLine("Gold: " + stats.gold); Console.SetCursorPosition(x, y + 4); Console.WriteLine("Strength: " + stats.strength); Console.SetCursorPosition(x, y + 5); Console.WriteLine("Dexterity: " + stats.dexterity); Console.SetCursorPosition(x, y + 6); Console.WriteLine("Intelligence: " + stats.intelligence); Console.SetCursorPosition(x, y + 7); Console.WriteLine("Wisdom: " + stats.wisdom); Console.SetCursorPosition(x, y + 8); Console.WriteLine("Level: " + stats.level + " (%" + (((float)stats.xp / (float)stats.reqXp) * 100) + ")"); if (species != Species._faerie) { Console.SetCursorPosition(x, y + 10); int adjHunger = (Math.Min(Math.Max(hunger, -5000), 7000) + 5000) / 1000; ConsoleEx.TextColor(hungerColor(Math.Max(adjHunger - 1, 0)), ConsoleBackground.Black); Console.Write(calcHungerStatus() + " "); for (int a = 0; a < adjHunger; a++) { ConsoleEx.TextColor(hungerColor(a), ConsoleBackground.Black); Console.Write("|"); } ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); Console.Write("\n"); } Console.SetCursorPosition(x, y + 12); Console.Write("EV: " + stats.evasion); Console.SetCursorPosition(x, y + 13); Console.Write("DEF: " + stats.armor); }
public static void showMainMenu() { Boolean hasSelectedSpecies = false; Boolean hasSelectedClass = false; //Draw the species list while (!hasSelectedSpecies) { string bufferClear = ""; for (int x = 0; x < 69; x++) { bufferClear += " "; } ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 0, 70, Species.speciesList.Length + 3, false); Util.writeLn("Select a species", 2, 0); Species.drawAllSpecies(); Util.writeLn(bufferClear, 1, Species.speciesList.Length + 2); Util.writeLn(Species.speciesList[selectedSpecies].lore, 1, Species.speciesList.Length + 2); ConsoleKeyInfo keyInfo = Console.ReadKey(); if (keyInfo.Key == ConsoleKey.DownArrow) { selectedSpecies++; if (selectedSpecies > Species.speciesList.Length - 1) { selectedSpecies = 0; } } if (keyInfo.Key == ConsoleKey.UpArrow) { selectedSpecies--; if (selectedSpecies < 0) { selectedSpecies = Species.speciesList.Length - 1; } } if (keyInfo.Key == ConsoleKey.Enter) { currSpecies = Species.speciesList[selectedSpecies]; hasSelectedSpecies = true; } } Console.Clear(); selectedSpecies = 0; while (!hasSelectedClass) { ConsoleEx.TextColor(ConsoleForeground.DarkGray, ConsoleBackground.Black); ConsoleEx.DrawRectangle(BorderStyle.Text, 0, Class.classList.Length + 2, 70, Species.speciesList.Length + 3, false); Util.writeLn("Select a species", Class.classList.Length + 4, 0); Species.drawAllSpecies(Class.classList.Length + 2); Util.writeLn(currSpecies.lore, 1, Species.speciesList.Length + 2 + Class.classList.Length + 2); ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 0, 70, Class.classList.Length + 1, false); Util.writeLn("Select a class--Species: " + currSpecies.abbrv, 2, 0); Class.drawAllClasses(); ConsoleKeyInfo keyInfo = Console.ReadKey(); if (keyInfo.Key == ConsoleKey.DownArrow) { selectedSpecies++; if (selectedSpecies > Species.speciesList.Length - 1) { selectedSpecies = 0; } } if (keyInfo.Key == ConsoleKey.UpArrow) { selectedSpecies--; if (selectedSpecies < 0) { selectedSpecies = Species.speciesList.Length - 1; } } if (keyInfo.Key == ConsoleKey.Enter) { currClass = Class.classList[selectedSpecies]; hasSelectedClass = true; } } Console.Clear(); Console.WriteLine("What is your name?"); player = new Player(Console.ReadLine(), currSpecies, currClass); //Console.WriteLine("You are a " + player.identifier); Console.WriteLine(); player.WriteStats(); player.stats.calcStats(); Console.ReadLine(); world.genMap(); levelMap.Add(Program.area + ":" + Program.floor, world); startGame(); }
public static void renderGame() { if (!stuck) { Console.Clear(); ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 0, 26, 26, false); for (int y = -14; y < 13; y++) { for (int x = -14; x < 13; x++) { while (renderX + x < 0) { x++; } while (renderY + y < 0) { y++; } if (Math.Sqrt(Math.Pow((renderX + x) - renderX, 2) + Math.Pow((renderY + y) - renderY, 2)) < 12.6) { Console.SetCursorPosition(Math.Min(26, Math.Max(1, x + 13)), Math.Min(26, Math.Max(1, y + 13))); try { if (renderX + x == renderX && renderY + y == renderY) { ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); if (player.status.hasAttr("Invisible")) { ConsoleEx.TextColor(ConsoleForeground.DarkGray, ConsoleBackground.Black); } Console.Write("P"); ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); } else { if (Mob.getMobsAtPos(renderX + x, renderY + y).Count == 0) { world.draw(renderX + x, renderY + y); } else { ConsoleEx.TextColor(Mob.getMobsAtPos(renderX + x, renderY + y)[0].colorFore, Mob.getMobsAtPos(renderX + x, renderY + y)[0].colorBack); Console.Write(Mob.getMobsAtPos(renderX + x, renderY + y)[0].symbol); msgLog.Add(Mob.getMobsAtPos(renderX + x, renderY + y)[0].name + " has been spotted near you!"); } } } catch { //ConsoleEx.TextColor(ConsoleForeground.Red, ConsoleBackground.Black); //Console.Write('X'); } ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); } else { Console.SetCursorPosition(Math.Min(26, Math.Max(1, x + 13)), Math.Min(26, Math.Max(1, y + 13))); ConsoleEx.TextColor(ConsoleForeground.DarkGray, ConsoleBackground.Black); Console.Write(':'); } } } ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black); ConsoleEx.DrawRectangle(BorderStyle.Text, 27, 0, 26, 40, false); ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 27, 26, 13, false); Console.SetCursorPosition(2, 27); Console.WriteLine("Turn " + currTurn); Console.SetCursorPosition(2, 0); Console.Write(area + ":" + floor + " (" + renderX + " ~ " + renderY + ")"); player.WriteRPGStats(28, 1); if (player.status.statusEffects.Count > 0) { ConsoleEx.DrawRectangle(BorderStyle.Text, 54, 0, 35, player.status.statusEffects.Count + 1, false); player.status.drawStatus(55, 1); } if (!showAbilities) { for (int x = 0; x < player.inventory.Length; x++) { if (player.inventoryStacks[x] > 0) { string s = player.inventoryStacks[x] + " " + player.inventory[x].name; if (Program.selectedSlot == x) { s = "> " + s; } if (player.inventoryEquip[x] || player.inventory[x].equipped) { s = s + " (Equipped)"; } if (player.inventory[x].bound && player.inventory[x].discoveredBound) { s = s + " (Bound)"; } if (player.status.statusEffects.Count > 0) { Util.writeLn(s, 91, 1 + x); } else { Util.writeLn(s, 54, 1 + x); } } else { string s = "Empty Slot"; if (Program.selectedSlot == x) { s = "> " + s; } if (player.status.statusEffects.Count > 0) { Util.writeLn(s, 91, 1 + x); } else { Util.writeLn(s, 54, 1 + x); } player.inventory[x] = null; player.inventoryStacks[x] = 0; player.inventoryEquip[x] = false; } } } else { int iter = 0; foreach (Ability a in player.abilities) { string s = ""; if (iter == Program.selectedSlot) { s = "> "; } s += a.name; if (a.etherCost > 0) { s += "(costs " + a.etherCost + " ether"; if (a.healthCost > 0) { s += " and " + a.healthCost + " health)"; } else { s += ")"; } } if (a.healthCost > 0 && a.etherCost <= 0) { s += "(costs " + a.healthCost + " health)"; } if (player.status.statusEffects.Count > 0) { Util.writeLn(s, 91, 1 + iter); } else { Util.writeLn(s, 54, 1 + iter); } iter++; } } ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 41, 88, 6, false); for (int x = 0; x < 5; x++) { try { Util.writeLn(msgLog.ToArray()[msgLog.ToArray().Length - (1 + x)], 1, 42 + x); } catch { break; } } player.status.update(); } }
public void draw() { ConsoleEx.TextColor(colorFore, colorBack); Console.Write(icon); }
public void drawClary() { ConsoleEx.TextColor(colorFore, colorBack); Console.Write('x'); }