//Pokegen.java package pokegen; import java.util.Random; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import pokegen.*; import java.io.*; public class Pokegen { private static BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in )); public static void main(String args[]) { Random generator = new Random(); System.out.print("minimum level?"); String min = null; try { min = stdin.readLine(); } catch (IOException ioe) { System.out.println("IO error trying to read input!"); System.exit(1); } System.out.println(""); System.out.print("Maximum level?"); String max = null; try { max = stdin.readLine(); } catch (IOException ioe) { System.out.println("IO error trying to read input!"); System.exit(1); } pokegen.pokedex PD = new pokegen.pokedex(); PD.initpokedex(); int i = generator.nextInt(PD.Pokedex.length-1); i=i+1; pokegen.Pokemon ChosenOne = PD.Pokedex[i]; ChosenOne.Genstats(Integer.parseInt(min),Integer.parseInt(max)); System.out.println("Your pokemon: " + ChosenOne.name + "(" + ChosenOne.num + ") level " + ChosenOne.lvl); System.out.println("Hit Points: " + ChosenOne.hp); System.out.println("Attack: " + ChosenOne.att); System.out.println("Special Attack: " + ChosenOne.spatt); System.out.println("Defense: " + ChosenOne.def); System.out.println("Special Defense: " + ChosenOne.spdef); System.out.println("Speed: " + ChosenOne.spd); System.out.println("IV: " + ChosenOne.iv); } } // pokedex.java: package pokegen; import java.util.Random; public class pokedex { static protected Pokemon Pokedex[] = new Pokemon[28]; public static void initpokedex() { Pokedex[0] = new Pokemon("missingno",0,0,0,0,0,0,0); Pokedex[1] = new Pokemon("Bulbasaur",1,45,49,49,45,65,65); Pokedex[2] = new Pokemon("Ivysaur",2,60,62,63,60,80,80); Pokedex[3] = new Pokemon("Venusaur",3,80,82,83,80,100,100); Pokedex[4] = new Pokemon("Charmander",4,39,52,43,65,60,50); Pokedex[5] = new Pokemon("Charmeleon",5,58,64,58,80,80,65); Pokedex[6] = new Pokemon("Charizard",6,78,84,78,100,109,85); Pokedex[7] = new Pokemon("Squirtle",7,44,48,65,43,50,64); Pokedex[8] = new Pokemon("Wartortle",8,59,63,80,58,65,80); Pokedex[9] = new Pokemon("Blastoise",9,79,83,100,78,85,105); Pokedex[10] = new Pokemon("Caterpie",10,45,30,35,45,20,20); Pokedex[11] = new Pokemon("Metapod",11,50,20,55,30,25,25); Pokedex[12] = new Pokemon("Butterfree",12,60,45,50,70,80,80); Pokedex[13] = new Pokemon("Weedle",13,40,35,30,50,20,20); Pokedex[14] = new Pokemon("Kakuna",14,45,25,50,35,25,25); Pokedex[15] = new Pokemon("Beedrill",15,65,80,40,75,45,80); Pokedex[16] = new Pokemon("Pidgey",16,40,45,40,56,35,35); Pokedex[17] = new Pokemon("Pidgeotto",17,63,60,55,71,50,50); Pokedex[18] = new Pokemon("Pidgeot",18,83,80,75,91,70,70); Pokedex[19] = new Pokemon("Rattata",18,30,56,35,72,25,35); Pokedex[20] = new Pokemon("Raticate",20,55,81,60,97,50,70); Pokedex[21] = new Pokemon("Spearow",21,40,60,30,70,31,31); Pokedex[22] = new Pokemon("Fearow",22,65,90,65,100,61,61); Pokedex[23] = new Pokemon("Ekans",23,35,60,44,55,40,54); Pokedex[24] = new Pokemon("Arbok",24,60,85,69,80,65,79); Pokedex[25] = new Pokemon("Pikachu",25,35,55,30,90,50,40); Pokedex[26] = new Pokemon("Raichu",26,60,90,55,100,90,80); Pokedex[27] = new Pokemon("Sandshrew",27,50,75,85,40,20,30); } } class Pokemon { public String name; public int num; public float hp; public float att; public float def; public float spd; public float spatt; public float spdef; public float iv; public int lvl; public Pokemon (String title, int number, int bhp, int batt, int bdef, int bspd, int bspatt, int bspdef) { name = title; num = number; hp = bhp; att = batt; def = bdef; spd = bspd; spatt = bspatt; spdef = bspdef; iv = 0; lvl = 0; } public void Genstats (int minlvl, int maxlvl){ Random generator = new Random(); iv = generator.nextInt(20); lvl = generator.nextInt(maxlvl-minlvl); lvl = lvl+minlvl; hp = ((iv + 2*hp)*(lvl/100))+10+lvl; att = (iv + 2*att)*(lvl/100); def = (iv + 2*def)*(lvl/100); spd = (iv + 2*spd)*(lvl/100); spatt = (iv + 2*spd)*(lvl/100); spdef = (iv + 2*spdef)*(lvl/100); } }