Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // weapon class
- package javaapplication4;
- public class Weapon {
- public static void main(String[] args) {
- String[] weapon = new String[10];
- weapon[0] = "";
- weapon[1] = "";
- weapon[2] = "";
- weapon[3] = "";
- weapon[4] = "";
- weapon[5] = "";
- weapon[6] = "";
- }
- }
- //Main Method
- package javaapplication4;
- import java.util.*;
- public class JavaApplication4 {
- public static String a = "a";
- public static String b = "b";
- public static String c = "c";
- public static void main(String[] args) {
- int Playerattack = 10;
- int Playerdefense = 10;
- int Playerlifepoints = 100;
- int Goblinattack = 6 - (Playerdefense / 5);
- int Goblindefense = 5;
- int Goblinlifepoints = 40;
- int Defendgoblin = Goblinattack - Playerdefense + 10;
- int Defenddamage = Playerattack / 5;
- int spec = 5;
- int coins = 0;
- Scanner Inputin = new Scanner(System.in);
- Weapon[] weapons = new Weapon[5];
- weapons[0] = new Weapon("Sword", 5);
- System.out.println("Hello warrior what is your name?");
- String name = Inputin.nextLine();
- System.out.println("Welcome, " + name);
- System.out.println("You currently have " + Playerattack + " " + "attack, " + Playerdefense + " " + "defense, and " + Playerlifepoints + " " + "lifepoints ");
- System.out.println("You currently have " + spec + " special points" + " avaliable, what would you like to spend them on?");
- System.out.println("Press a for +1 attack, b for +1 defense or c for +10 Lifepoints");
- for (int sp = spec; spec > 0; spec--) { // Adding stats
- String plusstats = Inputin.nextLine();
- if (plusstats.equals(a)) {
- Playerattack++;
- System.out.println("Your attack is now " + Playerattack);
- }
- if (plusstats.equals(b)) {
- Playerdefense++;
- System.out.println("Your defense is now " + Playerdefense);
- }
- if (plusstats.equals(c)) {
- Playerlifepoints = Playerlifepoints + 10;
- System.out.println("Your life points are now " + Playerlifepoints);
- }
- if (plusstats.equals("admin")) {
- Playerlifepoints = Playerlifepoints + 1000;
- Playerattack = Playerattack + 1000;
- Playerdefense = Playerdefense + 1000;
- System.out.println("Hello, Admin");
- }
- }
- System.out.println("You now have " + Playerattack + " " + "attack, " + Playerdefense + " " + "defense, and " + Playerlifepoints + " " + "lifepoints ");
- System.out.println("A Goblin aproaches, you are forced to fight");
- System.out.println("Goblin, attack " + Goblinattack + " defense " + Goblindefense + " lifepoints " + Goblinlifepoints + " Vs. " + name + ", attack " + Playerattack + " defense " + Playerdefense + " lifepoints " + Playerlifepoints);
- System.out.println("Press a to attack, b to defend.");
- for (int GoblinHp = Goblinlifepoints; Goblinlifepoints > 1;) {
- String attackgoblin = Inputin.nextLine();
- if (attackgoblin.equals(a)) {
- Goblinlifepoints = Goblinlifepoints - Playerattack;
- Playerlifepoints = Playerlifepoints - Goblinattack;
- System.out.println("You attack the Goblin and deal " + Playerattack + " damage");
- System.out.println("You are attacked by the goblin and are dealt " + Goblinattack + " damage");
- System.out.println("You now have " + Playerlifepoints + " health");
- System.out.println("The Goblin now has " + Goblinlifepoints + " health");
- }
- if (attackgoblin.equals(b)) {
- Goblinlifepoints = Goblinlifepoints - Defenddamage;
- Playerlifepoints = Playerlifepoints - Defendgoblin;
- System.out.println("You defend from the Goblin and deal " + Defenddamage + " damage");
- System.out.println("You are attacked by the goblin and are dealt " + Defendgoblin + " damage");
- System.out.println("You now have " + Playerlifepoints + " health");
- System.out.println("The Goblin now has " + Goblinlifepoints + " health");
- }
- }
- System.out.println("Congrats you have defeated the Goblin!");
- System.out.println("You now have " + Playerlifepoints + " health");
- coins = coins + 130;
- System.out.println("You found " + coins + " Gold coins!");
- String rdrop = pickRand.get(drops);
- System.out.println("You found Item" + rdrop);
- System.out.println("Would you like to equip it? a, Yes b, No");
- for (int eq = 1; eq > 0; eq--) {
- String equip = Inputin.nextLine();
- if (equip.equals(a)) {
- System.out.println("You equip the item; your Stats are now " + Playerattack + " attack " + Playerdefense + " defense and " + Playerlifepoints + " life points");
- }
- if (equip.equals(b)) {
- System.out.println("You Discard the Item");
- }
- }
- System.out.println("You have beaten the game..... for now.");
- }
- }
Add Comment
Please, Sign In to add comment