Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * APCS Project 1: FracCalc
- * Name: Kyle Phan
- * Period: 6
- * Checkpoint: 1, 2
- * Date: 10/24/16
- *
- */
- import java.util.Scanner;
- public class Pokemon
- {
- /* whole = the whole string
- * wholeDos = the second whole string
- * whole2 = the whole int
- * whole3 = the second whole int
- */
- public static void main(String[] args)
- {
- Scanner encounter = new Scanner(System.in);
- System.out.println("A wild Spearow appeared!");
- System.out.println("Fight? (Y/N)");
- String fight = encounter.nextLine();
- if(fight.equals("N") || fight.equals("n"))
- {
- System.out.println("You got away safely.");
- }
- if(fight.equals("Y") || fight.equals("y"))
- {
- System.out.println(pokeBattle(fight));
- }
- }
- public static String pokeBattle(String input)
- {
- Scanner battle = new Scanner(System.in);
- int EXP = 0;
- int squirtleHP = 12;
- int charmanderHP = 12;
- int bulbasaurHP = 12;
- int spearowHP = 11;
- int tackle = 4;
- int bubble = 6;
- int ember = 6;
- int vinewhip = 6;
- String movechosen;
- int move;
- System.out.println("What pokemon do you want to send out?");
- System.out.println("1 - Bulbasaur");
- System.out.println("2 - Charmander");
- System.out.println("3 - Squirtle");
- int pokes = battle.nextInt();
- String pokechosen;
- switch (pokes)
- {
- case 1: pokechosen = "Bulbasaur";
- break;
- case 2: pokechosen = "Charmander";
- break;
- case 3: pokechosen = "Squirtle";
- break;
- default: pokechosen = "Invalid month";
- break;
- }
- while(spearowHP > 0 && bulbasaurHP > 0 && charmanderHP > 0 && squirtleHP > 0)
- {
- if(pokechosen.equals("Bulbasaur"))
- {
- System.out.println("Spearow: " + spearowHP + " HP");
- System.out.println("Bulbasaur: " + bulbasaurHP + " HP");
- System.out.println("---------------------------------");
- System.out.println("What Bulbasaur will you use?");
- System.out.println("1 - Vine Whip");
- System.out.println("2 - Tackle");
- move = battle.nextInt();
- switch (move)
- {
- case 1: System.out.println("Bulbasaur used Vine Whip!");
- System.out.println("[ 6 DAMAGE ]");
- spearowHP = spearowHP - vinewhip;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- bulbasaurHP = bulbasaurHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- case 2: System.out.println("Bulbasaur used Tackle!");
- System.out.println("[ 4 DAMAGE ]");
- spearowHP = spearowHP - tackle;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- bulbasaurHP = bulbasaurHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- default: movechosen = "Bulbasaur flailed!";
- if(spearowHP > 0)
- {
- System.out.println("Bulbasaur used flail!");
- System.out.println("Nothing happened...");
- System.out.println("");
- System.out.println("[ 0 DAMAGE ]");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- bulbasaurHP = bulbasaurHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- }
- }
- if(pokechosen.equals("Charmander"))
- {
- System.out.println("Spearow: " + spearowHP + " HP");
- System.out.println("Charmander: " + charmanderHP + " HP");
- System.out.println("---------------------------------");
- System.out.println("What move will Charmander use?");
- System.out.println("1 - Ember");
- System.out.println("2 - Tackle");
- move = battle.nextInt();
- switch (move)
- {
- case 1: System.out.println("Charmander used Ember!");
- System.out.println("[ 6 DAMAGE ]");
- spearowHP = spearowHP - ember;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- charmanderHP = charmanderHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- EXP++;
- return "You gained 3 XP!";
- }
- break;
- case 2: System.out.println("Charmander used Tackle!");
- System.out.println("[ 4 DAMAGE ]");
- spearowHP = spearowHP - tackle;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- charmanderHP = charmanderHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- EXP++;
- return "You gained 3 XP!";
- }
- break;
- default: movechosen = "Charmander flailed!";
- if(spearowHP > 0)
- {
- System.out.println("Charmander used flail!");
- System.out.println("Nothing happened...");
- System.out.println("[ 0 DAMAGE ]");
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- charmanderHP = charmanderHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- EXP++;
- return "You gained 3 XP";
- }
- break;
- }
- }
- if(pokechosen.equals("Squirtle"))
- {
- System.out.println("Spearow: " + spearowHP + " HP");
- System.out.println("Squirtle: " + squirtleHP + " HP");
- System.out.println("---------------------------------");
- System.out.println("What move will Squirtle use?");
- System.out.println("1 - Bubble");
- System.out.println("2 - Tackle");
- move = battle.nextInt();
- switch (move)
- {
- case 1: System.out.println("Squirtle used Bubble!");
- System.out.println("[ 6 DAMAGE ]");
- spearowHP = spearowHP - bubble;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- squirtleHP = squirtleHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- case 2: System.out.println("Squirtle used Tackle!");
- System.out.println("[ 4 DAMAGE ]");
- spearowHP = spearowHP - tackle;
- if(spearowHP > 0)
- {
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- squirtleHP = squirtleHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- default: movechosen = "Squirtle flailed!";
- if(spearowHP > 0)
- {
- System.out.println("Squirtle used flail!");
- System.out.println("Nothing happened...");
- System.out.println("[ 0 DAMAGE ]");
- System.out.println("");
- System.out.println("Spearow used wing attack!");
- System.out.println("[ 4 DAMAGE ]");
- System.out.println("");
- squirtleHP = squirtleHP - tackle;
- }
- if(spearowHP < 0)
- {
- System.out.println("");
- System.out.println("Spearow Fainted");
- return "You gained 3 XP!";
- }
- break;
- }
- }
- }
- if(squirtleHP == 0 || charmanderHP == 0 || bulbasaurHP == 0)
- {
- return "You blacked out and went to the nearest Pokemon Center...";
- }
- else if(spearowHP <= 0 && charmanderHP < 12 && charmanderHP > 0)
- {
- System.out.println("Charmander is evolving...!");
- System.out.println("Charmander evolved into Charmeleon!");
- return "Charr.. Charr..";
- }
- else
- {
- return "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement