package herotingy; import java.util.Scanner; import java.util.Random; import java.util.HashMap; import java.io.IOException; class Hero { String name; String ability1; String ability2; String ability3; String ult; String weapon; int damage; int health; //Constructor for Object. Hero(String n,String wn,String q,String w,String e,String r,int d,int hp){ name = n; ability1 = q; ability2 = w; ability3 = e; ult = r; weapon = wn; damage = d; health = hp; }//end hero maker }//end Hero //Why did I make this again? Eeh, its fine. class Arena{ String name; String theme; String size; String art; //Constructor for Object. Arena(String na,String th,String sz,String rt){ name = na; theme = th; size = sz; art = rt; }//end Arena Maker }//end Arena /** * Main is where the action is! * @author Matt Lehman */ public class FightingSim { /** * Yup, its main. * @param args, Main. * @throws IOException * @throws InterruptedException for Sleep.threads */ public static void main(String[] args) throws IOException, InterruptedException{ Scanner scan = new Scanner(System.in); Random randNum = new Random(); Hero[] roster = new Hero[8]; HashMap grid = new HashMap(); //Constructor at work roster[0] = new Hero("Doomfist","Doomfist's Gauntlet","Windup Punch","Ground Punch","Throw Rock","Doom Punch",75,250); roster[1] = new Hero("Waterson Malone","Watermelon Launcher","Detonate Melon","Seed Spit","Pocket Salt","Fruit Stand",50,300); roster[2] = new Hero("Grimoire Silvertongue","Spell Book","Magic Missile","FireBall","Lightning Bolt","Explosion Magic",100,200); roster[3] = new Hero("Tsorig","Fume Ultra Greatsword","Shield Bash","Kick","Weapon Art","Gesture BM",40,500); roster[4] = new Hero("Doggo Gabe","Paws","Bork","Sneeze","Sniff","Remix",45,400); roster[5] = new Hero("Test Subject#5643","Portal Gun","Weighted Storage Cube","Shoot Portal","Pick up Sentry Turret","Infinite Fall Loop",100,200); roster[6] = new Hero("Spoodermin","Web Shooter","Web Throw","Tarzan Kick","Gr8 RzpNsib1S","Web Bukakke",50,300); roster[7] = new Hero("Lleroy Jenkins","Two-Handed Sword","Charge","Smite","Hammer of Justice","Battle Cry",75,250); //Grid so I can grab Heroes by name later on. grid.put(roster[0].name, roster[0]); grid.put(roster[1].name, roster[1]); grid.put(roster[2].name, roster[2]); grid.put(roster[3].name, roster[3]); grid.put(roster[4].name, roster[4]); grid.put(roster[5].name, roster[5]); grid.put(roster[6].name, roster[6]); grid.put(roster[7].name, roster[7]); //WALL OF TEXT-ART Arena garden = new Arena("Garden","Nature","Medium", " %%%; * *\n" + " | %%%; %%%~%%%; . . *\n" + " # |__/__%%%____/_/~%;% .\n" + " ___%%;______%%;% . * *\n" + "\" \" /~ %-// \\ \\__%#%%_-%%;`\n" + " | ~%-/_%` \\ \\_/%%#%%` .\n" + "# | %%%#% \\__/%%#%%;%`,\n" + " \"| ;%%%;` * .\n" + " | * (\n" + "| #| * . .\n" + " || . . . .\n" + " | . ` ' ` *\n" + "# | .'''. ' .'''. *\n" + " \"| * . .. ' ' .. .\n" + "' | * ' '.'.' ' .\n" + " | .'''.'.'''.\n" + " \" | .----------. ' .''.'.''. '\n" + " | |__________| . . : . .\n" + " |_{}_{}/|__________|\\{}_{}_{} _'___':'___'_ {}_{}_{}_{}_{}_{}_{}_{}\n" + "' #| || ||/____________\\|| || ||(_____________)|| || || || || || || ||\n" + "lc'\\\"\"\"\"\"\"|| ||\"\"\"\"\"\"\"\"\"\"\"\"( )\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n" + "\"\"\"\"\" | | _) (_ .^-^. ~\"\"~\n" + " ~\"\"~ (_______)~~\"\"\"~~ '._.'\n" + " ~~\"\"~~ ~\"\"~ .' '.\n" + " '.,.'\n" + " `'`'"); Arena dungeon = new Arena("Catacomes","dungeon","Small", "|.'', ,''.|\n" + "|.'.'', ,''.'.|\n" + "|.'.'.'', ,''.'.'.|\n" + "|.'.'.'.'', ,''.'.'.'.|\n" + "|.'.'.'.'.| |.'.'.'.'.|\n" + "|.'.'.'.'.|===; ;===|.'.'.'.'.|\n" + "|.'.'.'.'.|:::|', ,'|:::|.'.'.'.'.|\n" + "|.'.'.'.'.|---|'.|, _______ ,|.'|---|.'.'.'.'.|\n" + "|.'.'.'.'.|:::|'.|'|???????|'|.'|:::|.'.'.'.'.|\n" + "|,',',',',|---|',|'|???????|'|,'|---|,',',',',|\n" + "|.'.'.'.'.|:::|'.|'|???????|'|.'|:::|.'.'.'.'.|\n" + "|.'.'.'.'.|---|',' /%%%\\ ','|---|.'.'.'.'.|\n" + "|.'.'.'.'.|===:' /%%%%%\\ ':===|.'.'.'.'.|\n" + "|.'.'.'.'.|%%%%%%%%%%%%%%%%%%%%%%%%%|.'.'.'.'.|\n" + "|.'.'.'.',' /%%%%%%%%%\\ ','.'.'.'.|\n" + "|.'.'.',' /%%%%%%%%%%%\\ ','.'.'.|\n" + "|.'.',' /%%%%%%%%%%%%%\\ ','.'.|\n" + "|.',' /%%%%%%%%%%%%%%%\\ ','.|\n" + "|;____________/%%%%%Spicer%%%%%%\\____________;|"); Arena ally = new Arena("Streets","Urban","Medium", " ________ _______\n" + " /\\ \\ \\ \\/_______/ ______/\\ \\ /\\ \\/ /\\ \\/ /\\ \\_____________\n" + " /\\ \\ \\ \\/______ / /\\ /:\\\\ \\ ::\\ /::\\ /::\\ /____ ____ __\n" + " /\\ \\ \\ \\/_______/ /:\\\\ /:\\:\\\\______\\::/ \\::/ \\::/// / / //\n" + " /\\ \\ \\ \\/_______/ _/____\\/:\\:\\:/_____ / / /\\ \\/ /\\ \\///___/ /___//___\n" + "_____/___ \\ \\/_______/ /\\::::::\\\\:\\:/_____ / \\ /::\\ /::\\ /____ ____ ____\n" + " \\ \\/_______/ /:\\\\::::::\\\\:/_____ / \\\\::/ \\::/// / / / / /\n" + " \\/_______/ /:\\:\\\\______\\/______/_____\\\\/ /\\ \\///___/ /___/ /_____\n" + "\\ \\______/ /:\\:\\:/_____:/\\ \\ ___ / /::\\ /____ ____ _/\\::::\n" + "\\\\__________\\____/ /:\\:\\:/_____:/:\\\\ \\__ /_______/____/_/___/_ / \\:::\n" + "//__________/___/ _/____:/_____:/:\\:\\\\______\\ / /\\ /\\::\n" + "///\\ \\/ /\\ .----.\\___:/:\\:\\:/_____ // \\ / \\/ \\:\n" + "///\\\\ \\ /::\\\\ \\_\\ \\\\_:/:\\:\\:/_____ //:\\ \\ /\\ /\\ /\\\n" + "//:/\\\\ \\//\\::\\\\ \\ \\ \\\\/:\\:\\:/_____ //:::\\ \\ / \\/ \\/+/\n" + "/:/:/\\\\_________/:\\/:::\\`----' \\\\:\\:/_____ //o:/\\:\\ \\_____________/\\ /\\ / /\n" + ":/:/://________//\\::/\\::\\_______\\\\:/_____ ///\\_\\ \\:\\/____________/ \\/ \\/+/\\\n" + "/:/:///_/_/_/_/:\\/::\\ \\:/__ __ /:/_____ ///\\//\\\\/:/ _____ ____/\\ /\\ / / \\\n" + ":/:///_/_/_/_//\\::/\\:\\///_/ /_//:/______/_/ :~\\/::/ /____/ /___/ \\/ \\/+/\\ /\n" + "/:///_/_/_/_/:\\/::\\ \\:/__ __ /:/____/\\ / \\\\:\\/:/ _____ ____/\\ /\\ / / \\/\n" + ":///_/_/_/_//\\::/\\:\\///_/ /_//:/____/\\:\\____\\\\::/ /____/ /___/ \\/ \\/+/\\ /\\\n" + "///_/_/_/_/:\\/::\\ \\:/__ __ /:/____/\\:\\/____/\\\\/____________/\\ /\\ / / \\/ \\\n" + "//_/_/_/_//\\::/\\:\\///_/ /_//::::::/\\:\\/____/ /----/----/--/ \\/ \\/+/\\ /\\ /\n" + "/_/_/_/_/:\\/::\\ \\:/__ __ /\\:::::/\\:\\/____/ \\/____/____/__/\\ /\\ / / \\/ \\/_\n" + "_/_/_/_//\\::/\\:\\///_/ /_//\\:\\::::\\:\\/____/ \\_____________/ \\/ \\/+/\\ /\\ /\n" + "/_/_/_/:\\/::\\ \\:/__ __ /\\:\\:\\::::\\/____/ \\ _ _ _ _ _ /\\ /\\ / / \\/ \\/___\n" + "_/_/_//\\::/\\:\\///_/ /_//\\:\\:\\:\\ \\_________/ \\/ \\/+/\\ /\\ / /\n" + "/_/_/:\\/::\\ \\:/__ __ /\\:\\:\\:\\:\\______________\\ /\\ /\\ / / \\/ \\/___/_\n" + "_/_//\\::/\\:\\///_/ /_//::\\:\\:\\:\\/______________/ / \\/ \\/+/\\ /\\ / /\n" + "/_/:\\/::\\ \\:/__ __ /::::\\:\\:\\/______________/\\ /\\ /\\ / / \\/ \\/___/___\n" + "_//\\::/\\:\\///_/ /_//:\\::::\\:\\/______________/ \\ / \\/ \\/+/\\ /\\ / / /\n" + "/:\\/::\\ \\:/__ __ /:\\:\\::::\\/______________/ \\ /\\ /\\ / / \\/ \\/___/___/\n" + "/\\::/\\:\\///_/ /_//:\\:\\:\\ \\ \\/\\\\\\/+/\\ /\\ / / /+/\n" + "\\/::\\ \\:/__ __ /:\\:\\:\\:\\_________________________\\ ///\\\\\\/ \\/ \\/___/___/ /_\n" + "::/\\:\\///_/ /_//:\\:\\:\\:\\/_________________________////::\\\\\\ /\\ / / /+/\n" + "::\\ \\:/__ __ /:\\:\\:\\:\\/_________________________/:\\/____\\\\\\/ \\/___/___/ /___\n" + "/\\:\\///_/ /_//:\\:\\:\\:\\/_________________________/:::\\ /\\/\\ / / /+/ /\n" + "\\ \\:/__ __ /:\\:\\:\\:\\/_________________________/:::::\\ /// \\/___/___/ /___/_\n" + ":\\///_/ /_//:\\:\\:\\:\\/_________________________/:\\:::::\\///\\ / / __________\n" + "\\:/__ __ /:\\:\\:\\:\\/_________________________/:::\\:::::\\/ \\/___/__/\\\n" + "///_/ /_//:\\:\\:\\:\\/_________________________/:\\:::\\:::::\\ / / /::\\\n" + "/__ __ /\\::\\:\\:\\/_________________________/_____::\\:::::\\/___/__/:/\\:\\\n" + "/_/ /_//::\\::\\:\\/_____________________/\\/_/_/_/_/\\ \\ /::\\ \\:\\\n" + "_ __ /:\\::\\:8\\/_____________________/\\/\\ /\\_\\\\/\\ \\ 8 /:/\\:\\ \\:\\\n" + "/ /_//\\ \\|______________________//\\\\/\\::\\/__\\\\/\\ \\|______/::\\ \\:\\ \\:\\\n" + " __ / \\ \\ /:\\/:\\/\\_______\\/\\ /:/\\:\\ \\:\\/::\\\n" + "/_// 8 -8 -- -- -- -- //\\::/\\\\/_/_/_/_/_/ -- --/::\\ \\:\\ \\::/\\:\\\n" + "_ / |\\ \\ |________________/:\\/::\\///__/ /__//_______/:/\\:\\ \\:\\/::\\ \\:\\\n" + "__________\\ \\ //\\::/\\:/___ ___ / /::\\ \\:\\ \\::/\\:\\ \\:\\\n" + "::::::::::\\\\ \\ \\ /:\\/::\\///__/ /__// /:/\\:\\ \\:\\/::\\ \\:\\ \\:"); //Nicely packaged Walls of text Arena[] maps = new Arena[3]; maps[0] = garden; maps[1] = ally; maps[2] = dungeon; //List of Heroes to look at when code is running System.out.println(roster[0].name+"\n"+ roster[1].name+"\n"+ roster[2].name+"\n"+ roster[3].name+"\n"+ roster[4].name+"\n"+ roster[5].name+"\n"+ roster[6].name+"\n"+ roster[7].name); //Spacer System.out.println("--------------------------------"); //Refer to Method Comment HeroViewer(grid, roster); //Input 2 Heroes to do battle, now with a Typo checker! int checker1 = 0; int checker2 = 0; System.out.println("Please Enter 2 Heroes to do battle!"); while(checker1 == 0){ System.out.println("Enter Hero 1:"); String heName1 = scan.nextLine(); Hero contestant1 = grid.get(heName1); //The Typo Checker for(int i=0;i 0 && deeg.health > 0){ int juanHit = hit.nextInt(juan.damage); int deegHit = hit.nextInt(deeg.damage); //Hero 1 Hit and Health Check Thread.sleep(1000); deeg.health -= juanHit; if(deeg.health < 0){ deeg.health = 0; //System.out.println(deeg.name + " Was knocked out!"); //[Debug line] } else{ System.out.println(juan.name + " used their " + juanAttack[hit.nextInt(4)] + " for " + juanHit + " Damage!"); } //Hero 2 Hit and Health Check Thread.sleep(1000); juan.health -= deegHit; if(juan.health < 0){ juan.health = 0; //System.out.println(juan.name + " Was knocked out!"); //[Debug line] } else{ System.out.println(deeg.name + " used their " + deegAttack[hit.nextInt(4)] + " for " + deegHit + " Damage!"); } }//end while() //Finishing Move!!! if(deeg.health == 0 && juan.health != 0){ System.out.println(juan.name + " uses their Ultamite ability " + juan.ult + " to finish " + deeg.name + "!"); System.out.println(juan.name + " Wins!"); } else if(juan.health == 0 && deeg.health != 0){ System.out.println(deeg.name + " uses their Ultamite: " + deeg.ult + " to finish " + juan.name + "!"); System.out.println(deeg.name + " Wins!"); } else{ System.out.println("Its a Draw!!!"); }//end if }//end Fight }//end FightingSim