Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Armor extends Item {
- private int health;
- public Armor(){
- setName("Rags");
- setHealth(180);
- }
- public void compare(Armor old){
- System.out.println("[----------- NEW ARMOR -----------]\n");
- System.out.println(" "+old.getModifier()+" "+ old.getName()+" ["+old.getGrade()+"]\n\t-> "+getModifier()+" "+getName()+" ["+getGrade()+"]");
- System.out.println("\t\t"+old.getHealth()+" -> "+getHealth()+" [HP]");
- System.out.println("\t\t"+old.getVitBuff()+" -> "+getVitBuff()+" [VIT]");
- System.out.println("\t\t"+old.getStrBuff()+" -> "+getStrBuff()+" [STR]");
- System.out.println("\t\t"+old.getDexBuff()+" -> "+getDexBuff()+" [DEX]");
- System.out.println("\t\t"+old.getIntBuff()+" -> "+getIntBuff()+" [INT]");
- System.out.println("\t\t"+old.getLckBuff()+" -> "+getLckBuff()+" [LCK]\n");
- }
- public void scaleHealth(double scale){
- this.health *= scale;
- }
- public int getHealth(){
- return this.health;
- }
- public void setHealth(int health){
- this.health = health;
- }
- }
- import java.util.Scanner;
- import java.util.ArrayList;
- public class Blacksmith {
- private Scanner scan;
- private ItemGenerator ig;
- private Player player;
- private boolean[] items;
- private ArrayList<Integer> counters;
- private String input;
- public Blacksmith(Scanner scan, Player player, ItemGenerator ig){
- this.player = player;
- this.scan = scan;
- this.ig = ig;
- items = new boolean[3];
- counters = new ArrayList<Integer>(3);
- counters.add(3);
- counters.add(3);
- counters.add(3);
- refreshItems();
- }
- public void offerLoop(int i){
- Item item = ig.rollItem();
- int buyPrice = 1200 * item.getValue() /1000;
- ig.printWait();
- counters.set(i,0);
- for(;;){
- if(item.getClass() == Weapon.class){
- ((Weapon)item).compare(player.getWeapon());
- }else{
- ((Armor)item).compare(player.getArmor());
- }
- System.out.println("\n > [GOLD] : "+player.getGold()+"\n");
- printBreaker();
- System.out.println("[E] - Buy ("+buyPrice+" GOLD)");
- System.out.println("[S] - Refuse Offer");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("e")){
- if(player.getGold()-buyPrice >= 0){
- player.useGold(buyPrice);
- player.giveItem(item);
- break;
- }else{
- System.out.println("You do not have enough GOLD!\n");
- break;
- }
- }else if(input.equals("s")){
- System.out.println("The Blacksmith salvages the item.\n");
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void menuLoop(){
- for(;;){
- System.out.println("[-------------- BLACKSMITH --------------]\n");
- System.out.println("> \"Would you be interested in buying an item?\"\n");
- System.out.println(" > [GOLD] : "+player.getGold()+"\n");
- printBreaker();
- refreshItems();
- System.out.println(" [1] - "+getOption(0) + " ( "+counters.get(0)+" / 3 )");
- System.out.println(" [2] - "+getOption(1) + " ( "+counters.get(1)+" / 3 )");
- System.out.println(" [3] - "+getOption(2) + " ( "+counters.get(2)+" / 3 )");
- System.out.println(" [Q] - Exit Blacksmith");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println();
- if(input.equals("1")){
- if(items[0]) offerLoop(0);
- else System.out.println("That item is not available right now!\n");
- }else if(input.equals("2")){
- if(items[1]) offerLoop(1);
- else System.out.println("That item is not available right now!\n");
- }else if(input.equals("3")){
- if(items[2]) offerLoop(2);
- else System.out.println("That item is not available right now!\n");
- }else if(input.equals("q")){
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void refreshItems(){
- for(int i = 0 ; i < items.length ; i++ ){
- if(counters.get(i) == 3){
- items[i] = true;
- }else
- items[i] = false;
- }
- }
- public void addCounter(){
- int highestCounter = 0;
- if(!items[0]) highestCounter = counters.get(0);
- if(!items[1]){
- highestCounter = Math.max(highestCounter, counters.get(1));
- }
- if(!items[2]){
- highestCounter = Math.max(highestCounter, counters.get(2));
- }
- int index = counters.indexOf(highestCounter);
- if(index != -1) counters.set(index,counters.get(index)+1);
- }
- public String getOption(int i){
- if(items[i]) return "[ROLL ITEM]";
- else return "[NONE]";
- }
- public void printBreaker(){
- System.out.println("[---------------------------------------]");
- }
- }
- public class Enemy extends Entity {
- private String modifier, attackStyle;
- private int value;
- public Enemy(){
- setComboMeter(1);
- }
- public void nerf(String difficulty){
- int healthScale = 900;
- int dmgScale = 850;
- int valueScale = 800;
- if(difficulty.equals("Pussy")){
- healthScale = 750;
- dmgScale = 700;
- valueScale = 600;
- }else if(difficulty.equals("Gatekeeper")){
- healthScale = 1400;
- dmgScale = 1400;
- valueScale = 1000;
- }
- getWeapon().setDmg(getWeapon().getDmg() * dmgScale / 1000);
- getArmor().setHealth(getArmor().getHealth() * healthScale / 1000);
- setCurHealth(getMaxHealth());
- value = value * valueScale / 1000 ;
- }
- public int getAttack(){
- int totalDmg = 0;
- if(getName().equals("Gargoyle")){
- if(getComboMeter() == 1){
- // .5 [DMG] +5 [STR]
- attackStyle = "Bash";
- totalDmg = 500 * getWeapon().getDmg() / 1000 + 5 * getStrLvl();
- }else if(getComboMeter() == 2){
- // .7 [DMG] +2 [INT] +3 [DEX] (+.4 Dmg Dealt Heal)
- attackStyle = "Stone Gaze";
- totalDmg = 700 * getWeapon().getDmg() / 1000 + 2 * getIntLvl() + 3 * getDexLvl();
- heal(400 * totalDmg / 1000);
- }else if(getComboMeter() == 3){
- // .9 [DMG] +7 [STR]
- attackStyle = "Clobber";
- totalDmg = 900 * getWeapon().getDmg() / 1000 + 7 * getStrLvl();
- }
- }else if(getName().equals("Skeleton")){
- if(getComboMeter() == 1){
- // .5 [DMG] +5 [DEX]
- attackStyle = "Jab";
- totalDmg = 500 * getWeapon().getDmg() / 1000 + 5 * getDexLvl();
- }else if(getComboMeter() == 2){
- // .7 [DMG] +3 [STR] +2 [LCK]
- attackStyle = "Head Toss";
- totalDmg = 700 * getWeapon().getDmg() / 1000 + 3 * getStrLvl() + 2 * getLckLvl();
- }else if(getComboMeter() == 3){
- // .9 [DMG] +4 [DEX] +3 [INT]
- attackStyle = "Spook";
- totalDmg = 900 * getWeapon().getDmg() / 1000 + 4 * getDexLvl() + 3 * getIntLvl();
- }
- }else if(getName().equals("Rat")){
- if(getComboMeter() == 1){
- attackStyle = "Lunge";
- //.3 [DMG] +3 STR
- totalDmg = 300 * getWeapon().getDmg() / 1000 + 3 * getStrLvl();
- }else if(getComboMeter() == 2){
- attackStyle = "Bite";
- //.5 [DMG] +4 [STR] +2 [DEX]
- totalDmg = 500 * getWeapon().getDmg() / 1000 + 4 * getStrLvl() + 2 * getDexLvl();
- }else if(getComboMeter() == 3){
- attackStyle = "Deep Bite";
- //.7 [DMG] +5 [STR]
- totalDmg = 700 * getWeapon().getDmg() / 1000 + 5 * getStrLvl();
- }
- }else if(getName().equals("Hawk")){
- if(getComboMeter() == 1){
- attackStyle = "Scratch";
- //.2 [DMG] +4 [DEX] (+1.4 Dmg Dealt Heal)
- totalDmg = 200 * getWeapon().getDmg() / 1000 + 4 * getDexLvl();
- heal(1400 * totalDmg / 1000);
- }else if(getComboMeter() == 2){
- attackStyle = "Wing Blast";
- //.2 [DMG] +5 [DEX] +5 [INT]
- totalDmg = 200 * getWeapon().getDmg() / 1000 + 5 * getDexLvl() + 5 * getIntLvl();
- }else if(getComboMeter() == 3){
- attackStyle = "Aerial Assault";
- //.8 [DMG] +6 [DEX] +.15 Miss [HP]
- totalDmg = 800 * getWeapon().getDmg() / 1000 + 6 * getDexLvl() + 150 * (getMaxHealth() - getCurHealth()) / 1000;
- }
- }else if(getName().equals("Dragon")){
- if(getComboMeter() == 1){
- attackStyle = "Charge Up";
- //.1 [DMG] +2 [VIT] (+.3 Miss [HP] Heal)
- totalDmg = 100 * getWeapon().getDmg() / 1000 + 2 * getVitLvl();
- heal(300 * (getMaxHealth() - getCurHealth()) / 1000);
- }else if(getComboMeter() == 2){
- attackStyle = "Exhaust";
- //.4 [DMG] +2 [VIT] +2 [STR]
- totalDmg = 400 * getWeapon().getDmg() / 1000 + 2 * getVitLvl() + 2 * getStrLvl();
- }else if(getComboMeter() == 3){
- attackStyle = "Fire Breath";
- //[DMG] +4 [VIT] +6 [INT]
- totalDmg = getWeapon().getDmg() + 4 * getVitLvl() + 6 * getIntLvl();
- }
- }
- return totalDmg;
- }
- public String getAttackStyle(){
- return this.attackStyle;
- }
- public int getValue(){
- return this.value;
- }
- public void setValue(int value){
- this.value = value;
- }
- public int getLevel(){
- return getBaseVit() + getBaseStr() + getBaseDex() + getBaseInt() + getBaseLck();
- }
- public void printStats(){
- System.out.println("[------------- ENEMY STATS -------------]\n");
- System.out.println("Name:\t\t"+getModifier().toUpperCase()+" "+getName().toUpperCase());
- System.out.println("\n[HP] :\t"+getCurHealth()+" / "+getMaxHealth());
- System.out.println("[DMG] :\t"+getWeapon().getDmg());
- System.out.println("[VIT] :\t"+getVitLvl());
- System.out.println("[STR] :\t"+getStrLvl());
- System.out.println("[DEX] :\t"+getDexLvl());
- System.out.println("[INT] :\t"+getIntLvl());
- System.out.println("[LCK] :\t"+getLckLvl() + "\n");
- }
- public String getModifier(){
- return this.modifier;
- }
- public void setModifier(String modifier){
- this.modifier = modifier;
- }
- }
- import java.util.Random;
- public class EnemyGenerator {
- private Random rand;
- private Player player;
- public EnemyGenerator(Random rand, Player player){
- this.rand = rand;
- this.player = player;
- }
- public Enemy rollEnemy(){
- Enemy enemy = new Enemy();
- Weapon weapon = new Weapon();
- Armor armor = new Armor();
- int dmgRoll = rand.nextInt(300) + 601;
- int healthRoll = rand.nextInt(300) + 601;
- int typeRoll = rand.nextInt(1000);
- int modifierRoll = rand.nextInt(1000);
- int vitRoll = rand.nextInt(600)+701;
- int strRoll = rand.nextInt(600)+701;
- int dexRoll = rand.nextInt(600)+701;
- int intRoll = rand.nextInt(600)+701;
- int lckRoll = rand.nextInt(600)+701;
- int playerScale = player.getLevel() / 5 + 1;
- weapon.setDmg( dmgRoll * player.getWeapon().getDmg() / 1000 );
- armor.setHealth( healthRoll * player.getArmor().getHealth() / 1000 );
- if(typeRoll < 350){
- enemy.setName("Rat");
- weapon.setDmg(weapon.getDmg() - 15);
- enemy.setVitLvl(700 * ( playerScale * vitRoll / 1000 ) / 1000);
- enemy.setStrLvl(800 * ( playerScale * strRoll / 1000 ) / 1000);
- enemy.setDexLvl(800 * ( playerScale * dexRoll / 1000 ) / 1000);
- enemy.setIntLvl(800 * ( playerScale * intRoll / 1000 ) / 1000);
- enemy.setLckLvl(800 * ( playerScale * lckRoll / 1000 ) / 1000);
- enemy.setValue(60);
- }else if(typeRoll < 600){
- enemy.setName("Hawk");
- enemy.setVitLvl(900 * ( playerScale * vitRoll / 1000 ) / 1000);
- enemy.setStrLvl(800 * ( playerScale * strRoll / 1000 ) / 1000);
- enemy.setDexLvl(1200 * ( playerScale * dexRoll / 1000 ) / 1000);
- enemy.setIntLvl(900 * ( playerScale * intRoll / 1000 ) / 1000);
- enemy.setLckLvl(800 * ( playerScale * lckRoll / 1000 ) / 1000);
- enemy.setValue(90);
- }else if(typeRoll < 750){
- enemy.setName("Gargoyle");
- weapon.setDmg(weapon.getDmg() + 5);
- armor.setHealth(armor.getHealth() + 1100 * armor.getHealth() / 1000);
- enemy.setVitLvl(1200 * ( playerScale * vitRoll / 1000 ) / 1000);
- enemy.setStrLvl(1200 * ( playerScale * strRoll / 1000 ) / 1000);
- enemy.setDexLvl(600 * ( playerScale * dexRoll / 1000 ) / 1000);
- enemy.setIntLvl(900 * ( playerScale * intRoll / 1000 ) / 1000);
- enemy.setLckLvl(500 * ( playerScale * lckRoll / 1000) / 1000);
- enemy.setValue(100);
- }else if(typeRoll < 900){
- enemy.setName("Skeleton");
- enemy.setVitLvl(1000 * ( playerScale * vitRoll / 1000 ) / 1000);
- enemy.setStrLvl(1200 * ( playerScale * strRoll / 1000 ) / 1000);
- enemy.setDexLvl(600 * ( playerScale * dexRoll / 1000 ) / 1000);
- enemy.setIntLvl(800 * ( playerScale * intRoll / 1000 ) / 1000);
- enemy.setLckLvl(900 * ( playerScale * lckRoll / 1000 ) / 1000);
- enemy.setValue(90);
- }else{
- enemy.setName("Dragon");
- armor.setHealth(armor.getHealth() + 1400 * armor.getHealth() / 1000);
- enemy.setVitLvl(1600 * ( playerScale * vitRoll / 1000 ) / 1000);
- enemy.setStrLvl(1400 * ( playerScale * strRoll / 1000 ) / 1000);
- enemy.setDexLvl(1400 * ( playerScale * dexRoll / 1000) / 1000);
- enemy.setIntLvl(1800 * ( playerScale * intRoll / 1000 ) / 1000);
- enemy.setLckLvl(1200 * ( playerScale * lckRoll / 1000 ) / 1000);
- enemy.setValue(200);
- }
- if(modifierRoll < 600){
- enemy.setModifier("Normal");
- }else if(modifierRoll < 700){
- enemy.setModifier("Swift");
- enemy.setDexLvl(4+ 1500 * enemy.getBaseDex() / 1000 );
- enemy.setLckLvl(8 + 1500 * enemy.getBaseLck() / 1000 );
- enemy.setValue(enemy.getValue()*1200/1000);
- }else if(modifierRoll < 825){
- enemy.setModifier("Giant");
- enemy.setVitLvl(2 + 1500 * enemy.getBaseVit() / 1000 );
- enemy.setStrLvl(2 + 1500 * enemy.getBaseStr() / 1000 );
- armor.setHealth(1200 * armor.getHealth() / 1000 );
- enemy.setValue(enemy.getValue()*1600/1000);
- }else if(modifierRoll < 950){
- enemy.setModifier("Magical");
- enemy.setIntLvl(2 + 1500 * enemy.getBaseInt() / 1000 );
- enemy.setValue(enemy.getValue()*1200/1000);
- }else{
- enemy.setModifier("Legendary");
- enemy.setVitLvl(4 + 1600 * enemy.getBaseVit() / 1000 );
- enemy.setStrLvl(4 + 1600 * enemy.getBaseStr() / 1000 );
- enemy.setDexLvl(4 + 1600 * enemy.getBaseDex() / 1000 );
- enemy.setIntLvl(4 + 1600 * enemy.getBaseInt() / 1000 );
- enemy.setLckLvl(4 + 1600 * enemy.getBaseLck() / 1000 );
- weapon.setDmg(1100 * weapon.getDmg() / 1000 );
- enemy.setValue(enemy.getValue()*1800/1000);
- }
- enemy.setWeapon(weapon);
- enemy.setArmor(armor);
- enemy.setBaseHealth(15 * enemy.getVitLvl());
- enemy.setValue((enemy.getValue() + 1200 * enemy.getLevel() / 1000) * (rand.nextInt(300) + 851) / 1000);
- return enemy;
- }
- }
- public class Entity {
- private int curHealth, baseHealth;
- private int vitLvl, strLvl, dexLvl, intLvl, lckLvl;
- private int comboMeter;
- private String name;
- private Weapon weapon;
- private Armor armor;
- public Entity(){
- setWeapon(new Weapon());
- setArmor(new Armor());
- }
- public void incrementComboMeter(){
- if(comboMeter == 3)
- comboMeter = 1;
- else comboMeter++;
- }
- public int getComboMeter(){
- return this.comboMeter;
- }
- public void setComboMeter(int comboMeter){
- this.comboMeter = Math.max(1,comboMeter);
- }
- public void heal(int heal){
- setCurHealth(curHealth + heal);
- }
- public boolean isAlive(){
- return curHealth>0;
- }
- public void takeDmg(int dmg){
- setCurHealth(curHealth - dmg);
- }
- public void giveItem(Item item){
- if(item.getClass() == Weapon.class){
- setWeapon((Weapon)item);
- }else{
- curHealth -= getArmor().getHealth();
- setArmor((Armor)item);
- }
- }
- public void printName(){
- if(this.getClass() == Enemy.class){
- System.out.println(((Enemy)this).getModifier().toUpperCase() + " " + this.getName().toUpperCase()+" ");
- }else{
- String combo = "[";System.out.print(this.getName().toUpperCase() + " ");
- for(int i = 1 ; i <= 3 ; i ++){
- if(i <= comboMeter ){
- combo += " "+i+" ";
- if(i != 3) combo += "|";
- }else{
- combo += " ";
- }
- }
- combo += "]";
- System.out.println(combo);
- }
- }
- public void printHealthbar(){
- String healthbar = "<[";
- int healthIncrement = 50;
- int barSize = Math.min(19,getMaxHealth() / healthIncrement) + 1;
- if(barSize >= 19){
- healthIncrement = getMaxHealth() / barSize - 1;
- }
- for(int i = 0 ; i < barSize ; i++){
- if(i * healthIncrement <= curHealth){
- healthbar += "•";
- }else{
- healthbar += " ";
- }
- }
- healthbar += "]>";
- System.out.println(" HP: "+healthbar+"\t[ "+getCurHealth()+" / "+getMaxHealth()+ " ]" );
- }
- public int getCurHealth(){
- return Math.max(0,curHealth);
- }
- public void setCurHealth(int curHealth){
- this.curHealth = Math.min(curHealth,getMaxHealth());
- }
- public int getBaseHealth(){
- return this.baseHealth;
- }
- public void setBaseHealth(int baseHealth){
- this.baseHealth = baseHealth;
- curHealth = Math.min(getMaxHealth(),curHealth+baseHealth);
- }
- public int getMaxHealth(){
- baseHealth = 15 * getVitLvl();
- return baseHealth + armor.getHealth();
- }
- public int getVitLvl(){
- return vitLvl + weapon.getVitBuff() + armor.getVitBuff();
- }
- public int getBaseVit(){
- return this.vitLvl;
- }
- public void levelVit(){
- this.vitLvl++;
- baseHealth = vitLvl*15;
- setCurHealth(curHealth+30);
- }
- public void setVitLvl(int vitLvl){
- this.vitLvl = vitLvl;
- setBaseHealth(vitLvl*15);
- }
- public int getStrLvl(){
- return strLvl + weapon.getStrBuff() + armor.getStrBuff();
- }
- public int getBaseStr(){
- return this.strLvl;
- }
- public void levelStr(){
- this.strLvl++;
- }
- public void setStrLvl(int strLvl){
- this.strLvl = strLvl;
- }
- public int getDexLvl(){
- return dexLvl + weapon.getDexBuff() + armor.getDexBuff();
- }
- public int getBaseDex(){
- return this.dexLvl;
- }
- public void levelDex(){
- this.dexLvl++;
- }
- public void setDexLvl(int dexLvl){
- this.dexLvl = dexLvl;
- }
- public int getIntLvl(){
- return intLvl + weapon.getIntBuff() + armor.getIntBuff();
- }
- public int getBaseInt(){
- return this.intLvl;
- }
- public void levelInt(){
- this.intLvl++;
- }
- public void setIntLvl(int intLvl){
- this.intLvl = intLvl;
- }
- public int getLckLvl(){
- return lckLvl + weapon.getLckBuff() + armor.getLckBuff();
- }
- public int getBaseLck(){
- return this.lckLvl;
- }
- public void levelLck(){
- this.lckLvl++;
- }
- public void setLckLvl(int lckLvl){
- this.lckLvl = lckLvl;
- }
- public String getName(){
- return this.name;
- }
- public void setName(String name){
- this.name = name;
- }
- public Weapon getWeapon(){
- return this.weapon;
- }
- public void setWeapon(Weapon weapon){
- this.weapon = weapon;
- curHealth = getMaxHealth();
- }
- public Armor getArmor(){
- return this.armor;
- }
- public void setArmor(Armor armor){
- this.armor = armor;
- curHealth = getMaxHealth();
- }
- }
- import java.util.Random;
- import java.util.Scanner;
- public class FightArena {
- private Scanner scan;
- private Random rand;
- private Enemy enemy;
- private Player player;
- private EnemyGenerator eg;
- private ItemGenerator ig;
- private int dmg, accuracy, atkRoll, dmgRoll,dropRoll,dropChance,reward;
- private String input;
- public FightArena(Scanner scan, Random rand, Player player, EnemyGenerator eg, ItemGenerator ig){
- this.scan = scan;
- this.rand = rand;
- this.player = player;
- this.eg = eg;
- this.ig = ig;
- }
- public void printBreaker(){
- System.out.println("[---------------------------------------]");
- }
- public void fight(){
- int heals = 5;
- dropChance = 400 + 10 * player.getLckLvl();
- if( player.getDifficulty().equals("Gatekeeper") ) {
- dropChance += 200;
- heals += 2;
- }else if( player.getDifficulty().equals("Pussy") ) {
- dropChance += 300;
- heals += 5;
- }
- player.setComboMeter(1);
- enemy = eg.rollEnemy();
- enemy.nerf(player.getDifficulty());
- enemy.printStats();
- reward = enemy.getValue();
- printBreaker();
- System.out.print(" > Press anything to continue...");
- scan.nextLine();
- System.out.println("\n[---------------- FIGHT ----------------]\n\n");
- System.out.println(" > You encountered a "+enemy.getModifier()+" "+enemy.getName()+"!\n");
- enemy.printName();
- enemy.printHealthbar();
- System.out.println("\n\n > You prepare for battle.\n");
- player.printName();
- player.printHealthbar();
- System.out.println("\n");
- while(enemy.isAlive() && player.isAlive()){
- printBreaker();
- System.out.println(" [A] - "+player.getAttackStyle()+"\n\t=> "+player.getAttackDesc());
- System.out.println(" [H] - Heal ( "+heals+" )\n\t=> 56 +18 [VIT]");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- System.out.println("[---------------- FIGHT ----------------]\n\n");
- if(input.equals("h")){
- if(heals == 0){
- System.out.println(" > You've Ran Out Of Heals!\n");
- enemy.printName();
- enemy.printHealthbar();
- System.out.println("\n\n > You've Ran Out Of Heals!\n");
- player.printName();
- player.printHealthbar();
- System.out.println("\n");
- }else{
- heals--;
- player.heal(56 + 18 * player.getVitLvl());
- player.setComboMeter(1);
- System.out.println(" > You Healed +"+(56 + 18 * player.getVitLvl())+" HP.\n");
- atkRoll = rand.nextInt(1000);
- accuracy = 800 - 2 * player.getLckLvl() + 8 * enemy.getLckLvl();
- if(atkRoll < accuracy){
- dmgRoll = rand.nextInt(240)+881;
- dmg = enemy.getAttack() * dmgRoll / 1000;
- player.takeDmg(dmg);
- enemy.printName();
- enemy.printHealthbar();
- System.out.println();
- System.out.println(" > Enemy used "+enemy.getAttackStyle()+" dealing "+dmg+" DMG.");
- enemy.incrementComboMeter();
- }else{
- dmg = 0;
- enemy.printName();
- enemy.printHealthbar();
- System.out.println();
- System.out.println(" > The Enemy missed you.");
- if(enemy.getComboMeter() == 3)
- enemy.setComboMeter(2);
- }
- System.out.println();
- player.printName();
- player.printHealthbar();
- System.out.println("\n");
- }
- }else if(input.equals("a")){
- atkRoll = rand.nextInt(1000);
- accuracy = 800 + 10 * player.getLckLvl() - 2 * enemy.getLckLvl();
- if(atkRoll < accuracy){
- dmgRoll = rand.nextInt(240)+881;
- dmg = player.getAttack() * dmgRoll / 1000;
- enemy.takeDmg(dmg);
- System.out.println(" > You use "+player.getAttackStyle()+" dealing "+dmg+" DMG.");
- player.incrementComboMeter();
- }else{
- dmg = 0;
- if(player.getComboMeter()==3)
- player.setComboMeter(2);
- System.out.println(" > You missed the Enemy.");
- }
- System.out.println();
- enemy.printName();
- enemy.printHealthbar();
- System.out.println("\n");
- if(enemy.isAlive()){
- atkRoll = rand.nextInt(1000);
- accuracy = 800 - 2 * player.getLckLvl() + 8 * enemy.getLckLvl();
- if(atkRoll < accuracy){
- dmgRoll = rand.nextInt(240)+881;
- dmg = enemy.getAttack() * dmgRoll / 1000;
- player.takeDmg(dmg);
- System.out.println(" > Enemy used "+enemy.getAttackStyle()+" dealing "+dmg+" DMG.");
- enemy.incrementComboMeter();
- }else{
- dmg = 0;
- System.out.println(" > The Enemy missed you.");
- if(enemy.getComboMeter() == 3)
- enemy.setComboMeter(2);
- }
- System.out.println();
- player.printName();
- player.printHealthbar();
- System.out.println("\n");
- }else{
- System.out.println(" > The "+enemy.getName()+" falls to the ground.");
- System.out.println();
- player.printName();
- player.printHealthbar();
- System.out.println("\n");
- printBreaker();
- System.out.print(" > Press anything to continue...");
- scan.nextLine();
- System.out.println("\n");
- player.giveGold(reward);
- player.giveRestCharge();
- int expReward = enemy.getMaxHealth() / 6;
- player.giveExp(expReward);
- System.out.println("[-------------- REWARDS --------------]\n");
- System.out.println("\tYou gained [+"+ reward + " GOLD]\t[+"+expReward+" EXP]\n");
- System.out.print("\t\t[EXP] : " + player.getCurExp() + " / " + player.getTargetExp());
- if(player.getCurExp() == player.getTargetExp()){
- System.out.print(" LEVEL UP!");
- }
- System.out.println("\n");
- printBreaker();
- System.out.print(" > Press anything to continue...");
- scan.nextLine();
- System.out.println("\n");
- dropRoll = rand.nextInt(1000);
- if(dropRoll < dropChance){
- dropItem();
- }
- }
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void dropItem(){
- Item item = ig.rollItem();
- ig.printWait();
- for(;;){
- if(item.getClass() == Weapon.class){
- ((Weapon)item).compare(player.getWeapon());
- }else{
- ((Armor)item).compare(player.getArmor());
- }
- System.out.println();
- printBreaker();
- System.out.println("[E] - Equip");
- System.out.println("[S] - Sell (+"+item.getValue()+" GOLD)");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("e")){
- player.giveItem(item);
- break;
- }else if(input.equals("s")){
- player.giveGold(item.getValue());
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- }
- import java.util.Scanner;
- import java.util.Random;
- public class Game {
- private Scanner scan;
- private Player player;
- private ItemGenerator ig;
- private EnemyGenerator eg;
- private FightArena fa;
- private Lobby lobby;
- private Blacksmith blacksmith;
- public Game(Scanner scan, Random rand){
- this.scan = scan;
- player = new Player();
- ig = new ItemGenerator(rand,player);
- eg = new EnemyGenerator(rand,player);
- fa = new FightArena(scan,rand,player,eg,ig);
- blacksmith = new Blacksmith(scan,player,ig);
- lobby = new Lobby(scan,player,fa,blacksmith);
- }
- public void test(){
- boolean confirm = false;
- while(!confirm){
- lobby.chooseName();
- lobby.chooseSex();
- lobby.chooseClass();
- lobby.chooseDifficulty();
- System.out.println();
- for(;;){
- player.printStats();
- lobby.printBreaker();
- System.out.println("\n > Do you wish to continue with these settings?\n");
- lobby.printBreaker();
- System.out.println(" [Y] - Yes");
- System.out.println(" [N] - No");
- lobby.printBreaker();
- System.out.print(" > ");
- String input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("y")){
- confirm = true;
- break;
- }else if(input.equals("n")){
- confirm = false;
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- fa.dropItem();
- lobby.mainLoop();
- }
- }
- public class Item {
- private String modifier, name, grade;
- private int vitBuff, strBuff, dexBuff, intBuff, lckBuff, value;
- public Item(){
- modifier = "";
- name = "None";
- grade = "";
- }
- public void scaleBuffs(double scale){
- setVitBuff( (int) ( getVitBuff() * scale ) );
- setStrBuff( (int) ( getStrBuff() * scale ) );
- setDexBuff( (int) ( getDexBuff() * scale ) );
- setIntBuff( (int) ( getIntBuff() * scale ) );
- setLckBuff( (int) ( getLckBuff() * scale ) );
- }
- public int getValue(){
- return value;
- }
- public void setValue(int value){
- this.value = value;
- }
- public String getModifier(){
- return this.modifier;
- }
- public void setModifier(String modifier){
- this.modifier = modifier;
- }
- public String getName(){
- return this.name;
- }
- public void setName(String name){
- this.name = name;
- }
- public String getGrade(){
- return this.grade;
- }
- public void setGrade(String grade){
- this.grade = grade;
- }
- public int getVitBuff(){
- return this.vitBuff;
- }
- public void setVitBuff(int vitBuff){
- this.vitBuff = vitBuff;
- }
- public int getStrBuff(){
- return this.strBuff;
- }
- public void setStrBuff(int strBuff){
- this.strBuff = strBuff;
- }
- public int getDexBuff(){
- return this.dexBuff;
- }
- public void setDexBuff(int dexBuff){
- this.dexBuff = dexBuff;
- }
- public int getIntBuff(){
- return this.intBuff;
- }
- public void setIntBuff(int intBuff){
- this.intBuff = intBuff;
- }
- public int getLckBuff(){
- return this.lckBuff;
- }
- public void setLckBuff(int lckBuff){
- this.lckBuff = lckBuff;
- }
- }
- import java.util.Random;
- public class ItemGenerator {
- private Random rand;
- private Player player;
- public ItemGenerator(Random rand, Player player){
- this.rand = rand;
- this.player = player;
- }
- public void printWait(){
- System.out.println("[------------- NEW ITEM -------------]\n");
- try{Thread.sleep(600);}catch(Exception e){}
- System.out.println("\t €+++++++++++++++++€");
- try{Thread.sleep(50);}catch(Exception e){}
- System.out.println("\t €+++++++++++++++++€");
- try{Thread.sleep(100);}catch(Exception e){}
- System.out.println("\t €€+++++++++++++++€€");
- try{Thread.sleep(100);}catch(Exception e){}
- System.out.println("\t +€€+++++++++++++€€+");
- try{Thread.sleep(100);}catch(Exception e){}
- System.out.println("\t ++€€+++++++++++€€++");
- try{Thread.sleep(100);}catch(Exception e){}
- System.out.println("\t ++++€€+++++++€€++++");
- try{Thread.sleep(100);}catch(Exception e){}
- System.out.println("\t ++++++€€+++€€++++++");
- try{Thread.sleep(200);}catch(Exception e){}
- System.out.println("\t +++++++€€+€€+++++++");
- try{Thread.sleep(200);}catch(Exception e){}
- System.out.println("\t +++++++€€+€€+++++++");
- try{Thread.sleep(200);}catch(Exception e){}
- System.out.println("\t ++++++++€€€++++++++");
- try{Thread.sleep(400);}catch(Exception e){}
- System.out.println("\t ++++++++€€€++++++++");
- try{Thread.sleep(400);}catch(Exception e){}
- System.out.println("\t +++++++++€+++++++++\n");
- try{Thread.sleep(600);}catch(Exception e){}
- }
- public Item rollItem(){
- int typeRoll = rand.nextInt(1000);
- int modifierRoll = rand.nextInt(1000);
- int nameRoll = rand.nextInt(1000);
- int gradeRoll = rand.nextInt(1000);
- int dmgRoll = rand.nextInt(200)+801;
- Item item;
- if(typeRoll < 500){
- item = new Weapon();
- if(modifierRoll < 400){
- item.setModifier("Normal");
- }else if(modifierRoll < 545){
- item.setModifier("Imbued");
- item.setIntBuff( ( 400 * player.getIntLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
- }else if(modifierRoll < 690){
- item.setModifier("Heavy");
- item.setVitBuff( ( 300 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
- }else if(modifierRoll < 835){
- item.setModifier("Lucky");
- item.setLckBuff( ( 400 * player.getLckLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 8 / 1000 );
- }else if(modifierRoll < 980){
- item.setModifier("Reinforced");
- item.setStrBuff( ( 400 * player.getStrLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
- item.setDexBuff( ( 400 * player.getDexLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
- }else{
- item.setModifier("Legendary");
- item.setVitBuff( ( 400 * player.getVitLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
- item.setStrBuff( ( 800 * player.getStrLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
- item.setDexBuff( ( 800 * player.getDexLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
- item.setIntBuff( ( 800 * player.getIntLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
- item.setLckBuff( ( 800 * player.getLckLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
- }
- if(nameRoll < 200){
- item.setName("Revolver");
- item.setDexBuff(item.getDexBuff()+5);
- item.setLckBuff(item.getLckBuff()+2);
- ((Weapon)item).setDmg( (4 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000 ) + (2 * (player.getLckLvl() + item.getLckBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 400){
- item.setName("Broadsword");
- item.setStrBuff(item.getStrBuff()+4);
- item.setDexBuff(item.getDexBuff()+1);
- ((Weapon)item).setDmg( (5 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000 ) + (1 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 600){
- item.setName("Staff");
- item.setDexBuff(item.getDexBuff()+1);
- item.setIntBuff(item.getIntBuff()+4);
- ((Weapon)item).setDmg( (5 * (player.getIntLvl() + item.getIntBuff() ) * dmgRoll / 1000 ) + (1 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 800){
- item.setName("Bow");
- item.setDexBuff(item.getDexBuff()+4);
- item.setStrBuff(item.getStrBuff()+1);
- ((Weapon)item).setDmg( (4 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000 ) + (1 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
- }else{
- item.setName("Warhammer");
- item.setVitBuff(item.getVitBuff()+2);
- item.setStrBuff(item.getStrBuff()+3);
- ((Weapon)item).setDmg( (4 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + (3 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
- }
- if(gradeRoll < 100){
- item.setGrade("D");
- ((Weapon)item).scaleDmg(0.8);
- item.setValue(100);
- }else if(gradeRoll < 300){
- item.setGrade("C");
- item.scaleBuffs(1.5);
- item.setValue(200);
- }else if(gradeRoll < 700){
- item.setGrade("B");
- ((Weapon)item).scaleDmg(1.4);
- item.scaleBuffs(2.5);
- item.setValue(300);
- }else if(gradeRoll < 950){
- item.setGrade("A");
- ((Weapon)item).scaleDmg(1.8);
- item.scaleBuffs(3.5);
- item.setValue(400);
- }else if(gradeRoll < 985){
- item.setGrade("S");
- ((Weapon)item).scaleDmg(2.5);
- item.scaleBuffs(5.0);
- item.setValue(500);
- }
- }else{
- item = new Armor();
- if(modifierRoll < 400){
- item.setModifier("Normal");
- }else if(modifierRoll < 575){
- item.setModifier("Imbued");
- item.setIntBuff( ( 300 * player.getIntLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
- }else if(modifierRoll < 750){
- item.setModifier("Heavy");
- item.setVitBuff( ( 300 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
- }else if(modifierRoll < 925){
- item.setModifier("Lucky");
- item.setLckBuff( ( 300 * player.getLckLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
- }else{
- item.setModifier("Chipped");
- item.setVitBuff( ( 100 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
- }
- if(nameRoll < 200){
- item.setName("Chainmail");
- item.setVitBuff(item.getVitBuff() + 2);
- ((Armor)item).setHealth( (13 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 400){
- item.setName("Platebody");
- item.setVitBuff(item.getVitBuff() + 4);
- ((Armor)item).setHealth( (15 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 600){
- item.setName("Robes");
- item.setVitBuff(item.getVitBuff() + 2);
- ((Armor)item).setHealth( (12 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getIntLvl() + item.getIntBuff() ) * dmgRoll / 1000) );
- }else if(nameRoll < 800){
- item.setName("Bracers");
- item.setVitBuff(item.getVitBuff() + 3);
- ((Armor)item).setHealth( (13 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
- }else{
- item.setName("Formal Wear");
- item.setVitBuff(item.getVitBuff() + 1);
- ((Armor)item).setHealth( (9 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 7 * (player.getLckLvl() + item.getLckBuff() ) * dmgRoll / 1000) );
- }
- if(gradeRoll < 100){
- item.setGrade("D");
- ((Armor)item).scaleHealth(0.8);
- item.setValue(100);
- }else if(gradeRoll < 300){
- item.setGrade("C");
- ((Armor)item).scaleBuffs(1.5);
- item.setValue(200);
- }else if(gradeRoll < 700){
- item.setGrade("B");
- ((Armor)item).scaleHealth(1.1);
- item.scaleBuffs(2.5);
- item.setValue(300);
- }else if(gradeRoll < 950){
- item.setGrade("A");
- ((Armor)item).scaleHealth(1.2);
- item.scaleBuffs(3.5);
- item.setValue(400);
- }else{
- item.setGrade("S");
- ((Armor)item).scaleHealth(1.4);
- item.scaleBuffs(5.0);
- item.setValue(500);
- }
- }
- item.setValue(item.getValue() + 20 * ( item.getVitBuff() + item.getStrBuff() + item.getDexBuff() + item.getIntBuff() + item.getLckBuff() ) );
- if(item.getClass() == Weapon.class){
- item.setValue(item.getValue() + 1100 * ((Weapon)item).getDmg() / 1000 );
- }else{
- item.setValue(item.getValue() + 400 * ((Armor)item).getHealth() / 1000 );
- }
- return item;
- }
- }
- import java.util.Scanner;
- import java.util.Random;
- public class Launcher {
- public static void main(String[] args)
- {
- Scanner scan = new Scanner(System.in);
- Random rand = new Random();
- Game game = new Game(scan,rand);
- game.test();
- }
- }
- import java.util.Scanner;
- public class Lobby {
- private Blacksmith blacksmith;
- private FightArena fa;
- private Scanner scan;
- private Player player;
- private String input;
- public Lobby(Scanner scan, Player player, FightArena fa, Blacksmith blacksmith){
- this.blacksmith = blacksmith;
- this.scan = scan;
- this.player = player;
- this.fa = fa;
- }
- public void printBreaker(){
- System.out.println("[---------------------------------------]");
- }
- public void mainLoop(){
- for(;;){
- if(player.canLevel()){
- levelLoop();
- }else{
- System.out.println("[---------------- LOBBY ----------------]\n");
- System.out.println(" > Welcome to the lobby. There is a training arena here.\n");
- System.out.println(" > [HP] : "+player.getCurHealth()+" / "+player.getMaxHealth()+"\n");
- System.out.println(" > [GOLD] : "+player.getGold()+"\n");
- printBreaker();
- System.out.println(" [F] - Enter Training Arena");
- System.out.println(" [S] - Check Stats");
- System.out.println(" [H] - Rest ( "+player.getRestCharges()+" / 3 )");
- System.out.println(" [B] - Services");
- System.out.println(" [Q] - Exit Lobby");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("f")){
- fa.fight();
- blacksmith.addCounter();
- blacksmith.refreshItems();
- if(!player.isAlive())
- break;
- }else if(input.equals("s")){
- player.printStats();
- }else if(input.equals("h")){
- if(player.getRestCharges()>0 && player.getCurHealth() != player.getMaxHealth()){
- player.heal(56 + 18 * player.getVitLvl());
- player.useRestCharge();
- System.out.println(" > You rest for awhile, healing "+(56 + 18*player.getVitLvl())+" HP.\n");
- System.out.println(" > [HP] : "+player.getCurHealth()+" / "+player.getMaxHealth()+"\n");
- }else{
- System.out.println(" > You may not rest at this time.\n\n");
- }
- }else if(input.equals("b")){
- servicesLoop();
- }else if(input.equals("q")){
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- }
- public void servicesLoop(){
- int reqExp = player.getTargetExp() - player.getCurExp();
- int levelCost = 2500 * reqExp / 1000;
- int respecCost = 50 * player.getLevel();
- for(;;){
- System.out.println("[-------------- SERVICES --------------]\n");
- System.out.println(" > \"What can I do for you today?\"\n");
- System.out.println(" > [GOLD] : "+player.getGold()+"\n");
- printBreaker();
- System.out.println(" [R] - Reassign ( "+respecCost+" GOLD )");
- System.out.println(" [B] - Level Up ( "+levelCost+" GOLD )");
- System.out.println(" [K] - Blacksmith");
- System.out.println(" [Q] - Exit Services");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println();
- if(input.equals("r")){
- if(player.getGold() >= respecCost){
- player.useGold(respecCost);
- respec();
- }else System.out.println("Not Enough GOLD\n!");
- }else if(input.equals("b")){
- if(player.getGold() >= levelCost){
- player.giveExp(reqExp);
- player.useGold(levelCost);
- levelLoop();
- }else System.out.println("Not Enough GOLD\n!");
- }else if(input.equals("k")){
- blacksmith.menuLoop();
- }else if(input.equals("q")){
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void chooseName(){
- System.out.println("[---------------- NAME ----------------]\n");
- System.out.println(" > What Is Your Name?\n");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- player.setName(input);
- }
- public void chooseSex(){
- for(;;){
- System.out.println("[---------------- SEX ----------------]\n");
- System.out.println(" > What Is Your Sex?\n");
- printBreaker();
- System.out.println(" [M] - Male");
- System.out.println(" [F] - Female");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("m")){
- player.setSex("M");
- break;
- }else if(input.equals("f")){
- player.setSex("F");
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void levelLoop(){
- for(;;){
- System.out.println("[-------------- LEVEL UP --------------]\n");
- System.out.println(" > Congratulations! You Just Advanced A Level.\n");
- System.out.println(" > Select A Skill To Increase.\n");
- printBreaker();
- System.out.println(" [1] - [VIT]\t: " +player.getBaseVit()+" -> "+ (player.getBaseVit()+1));
- System.out.println(" [2] - [STR]\t: " +player.getBaseStr()+" -> "+ (player.getBaseStr()+1));
- System.out.println(" [3] - [DEX]\t: " +player.getBaseDex()+" -> "+ (player.getBaseDex()+1));
- System.out.println(" [4] - [INT]\t: " +player.getBaseInt()+" -> "+ (player.getBaseInt()+1));
- System.out.println(" [5] - [LCK]\t: " +player.getBaseLck()+" -> "+ (player.getBaseLck()+1));
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("1")){
- player.levelVit();
- break;
- }else if(input.equals("2")){
- player.levelStr();
- break;
- }else if(input.equals("3")){
- player.levelDex();
- break;
- }else if(input.equals("4")){
- player.levelInt();
- break;
- }else if(input.equals("5")){
- player.levelLck();
- break;
- }else{
- System.out.println("Invalid Input. Try Again.");
- }
- }
- }
- public void respec(){
- boolean confirm = false;
- int levels = player.getLevel();
- int assignment;
- while(!confirm){
- chooseClass();
- int remaining = levels;
- System.out.println("[-------------- RE SPEC --------------]\n");
- System.out.println(" > Skill Points Remaining: "+remaining+"\n");
- for(;;){
- try{
- printBreaker();
- System.out.print(" > Set [VIT] : ");
- input = scan.nextLine();
- System.out.println();
- assignment = Integer.parseInt(input);
- if(remaining - assignment >= 0){
- remaining -= assignment;
- player.setVitLvl(assignment);
- break;
- }else System.out.println("Not enough Skill Points.\n");
- }catch(Exception e){
- System.out.println("Invalid Input. Try Again.");
- }
- }
- System.out.println(" > Skill Points Remaining: "+remaining+"\n");
- for(;;){
- try{
- printBreaker();
- System.out.print(" > Set [STR] : ");
- input = scan.nextLine();
- System.out.println();
- assignment = Integer.parseInt(input);
- if(remaining - assignment >= 0){
- remaining -= assignment;
- player.setStrLvl(assignment);
- break;
- }else System.out.println("Not enough Skill Points.\n");
- }catch(Exception e){
- System.out.println("Invalid Input. Try Again.");
- }
- }
- System.out.println(" > Skill Points Remaining: "+remaining+"\n");
- for(;;){
- try{
- printBreaker();
- System.out.print(" > Set [DEX] : ");
- input = scan.nextLine();
- System.out.println();
- assignment = Integer.parseInt(input);
- if(remaining - assignment >= 0){
- remaining -= assignment;
- player.setDexLvl(assignment);
- break;
- }else System.out.println("Not enough Skill Points.\n");
- }catch(Exception e){
- System.out.println("Invalid Input. Try Again.");
- }
- }
- System.out.println(" > Skill Points Remaining: "+remaining+"\n");
- for(;;){
- try{
- printBreaker();
- System.out.print(" > Set [INT] : ");
- input = scan.nextLine();
- System.out.println();
- assignment = Integer.parseInt(input);
- if(remaining - assignment >= 0){
- remaining -= assignment;
- player.setIntLvl(assignment);
- break;
- }else System.out.println("Not enough Skill Points.\n");
- }catch(Exception e){
- System.out.println("Invalid Input. Try Again.");
- }
- }
- System.out.println(" > Skill Points Remaining: "+remaining+"\n");
- for(;;){
- try{
- printBreaker();
- System.out.print(" > Set [LCK] : ");
- input = scan.nextLine();
- System.out.println();
- assignment = Integer.parseInt(input);
- if(remaining - assignment >= 0){
- remaining -= assignment;
- player.setLckLvl(assignment);
- break;
- }else System.out.println("Not enough Skill Points.\n");
- }catch(Exception e){
- System.out.println("Invalid Input. Try Again.");
- }
- }
- System.out.println();
- for(;;){
- player.setLevel(player.getBaseVit() + player.getBaseStr() + player.getBaseDex() + player.getBaseInt() + player.getBaseLck());
- player.printStats();
- printBreaker();
- System.out.println("\n > Do you wish to continue with these settings?\n");
- printBreaker();
- System.out.println(" [Y] - Yes");
- System.out.println(" [N] - No");
- printBreaker();
- System.out.print(" > ");
- String input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("y")){
- confirm = true;
- break;
- }else if(input.equals("n")){
- confirm = false;
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- }
- public void chooseClass(){
- for(;;){
- System.out.println("[---------------- CLASS ----------------]\n");
- System.out.println(" > What Is Your Class?\n");
- printBreaker();
- System.out.println(" [1] - Gunslinger");
- System.out.println(" [2] - Barbarian");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("1")){
- player.setType("Gunslinger");
- break;
- }else if(input.equals("2")){
- player.setType("Barbarian");
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- public void chooseDifficulty(){
- for(;;){
- System.out.println("[------------- DIFFICULTY -------------]\n");
- System.out.println(" > Set Your Difficulty.\n");
- printBreaker();
- System.out.println(" [1] - Pussy Mode");
- System.out.println(" [2] - Regular Mode");
- System.out.println(" [3] - Gatekeeper Mode");
- printBreaker();
- System.out.print(" > ");
- input = scan.nextLine();
- System.out.println("\n");
- if(input.equals("1")){
- player.setDifficulty("Pussy");
- break;
- }else if(input.equals("2")){
- player.setDifficulty("Regular");
- break;
- }else if(input.equals("3")){
- player.setDifficulty("Gatekeeper");
- break;
- }else{
- System.out.println("Invalid Input. Try Again.\n");
- }
- }
- }
- }
- public class Player extends Entity {
- private String type, sex;
- private int gold, restCharges;
- private String attackStyle, attackDesc, difficulty;
- private int curExp, targetExp, level;
- public Player(){
- gold = 0;
- setComboMeter(1);
- attackStyle = "";
- difficulty = "Normal";
- restCharges = 3;
- targetExp = 50;
- }
- public int getAttack(){
- int totalDmg = 0;
- if(type.equals("Barbarian")){
- if(getComboMeter() == 1){
- // 0.3 [DMG] +4 [STR] (+2 Dmg Dealt Heal)
- totalDmg = 300 * getWeapon().getDmg() / 1000 + 4 * getStrLvl();
- heal(2000 * totalDmg / 1000);
- }else if(getComboMeter() == 2){
- // 0.5 [DMG] +6 [STR] +3 [DEX]
- totalDmg = 500 * getWeapon().getDmg() / 1000 + 6 * getStrLvl() + 3 * getDexLvl();
- }else if(getComboMeter() == 3){
- // [DMG] +5 [STR] +.5 Missing [HP]
- totalDmg = getWeapon().getDmg() + 5 * getStrLvl() + 500 * ( getMaxHealth() - getCurHealth() ) / 1000;
- }
- }else if(type.equals("Gunslinger")){
- if(getComboMeter() == 1){
- // .6 [DMG] +4 [DEX]
- totalDmg = 600 * getWeapon().getDmg() / 1000 + 4 * getDexLvl();
- }else if(getComboMeter() == 2){
- // [DMG] +0.2 Current [HP]
- totalDmg = getWeapon().getDmg() + 200 * getCurHealth() / 1000;
- }else if(getComboMeter() == 3){
- // .6 [DMG] +8 [LCK] (+.8 Dmg Dealt Heal)
- totalDmg = 600 * getWeapon().getDmg() / 1000 + 8 * getLckLvl();
- heal(800 * totalDmg / 1000);
- }
- }
- return totalDmg;
- }
- public String getAttackStyle(){
- if(type.equals("Barbarian")){
- if(getComboMeter() == 1){
- attackStyle = "Whirlwind";
- attackDesc = ".3 [DMG] +4 [STR] (+2 Dmg Dealt Heal)";
- }else if(getComboMeter() == 2){
- attackStyle = "Frenzy";
- attackDesc = ".5 [DMG] +6 [STR] +3 [DEX]";
- }else if(getComboMeter() == 3){
- attackStyle = "Final Blow";
- attackDesc = "[DMG] +5 [STR] +.5 Miss [HP]";
- }
- }else if(type.equals("Gunslinger")){
- if(getComboMeter() == 1){
- attackStyle = "Love Tap";
- attackDesc = ".6 [DMG] +4 [DEX]";
- }else if(getComboMeter() == 2){
- attackStyle = "Showdown";
- attackDesc = "[DMG] +.1 Current [HP]";
- }else if(getComboMeter() == 3){
- attackStyle = "Lucky Shot";
- attackDesc = ".6 [DMG] +8 [LCK] (+.8 Dmg Dealt Heal)";
- }
- }
- return this.attackStyle;
- }
- public String getAttackDesc(){
- return this.attackDesc;
- }
- public int getRestCharges(){
- return restCharges;
- }
- public void useRestCharge(){
- restCharges--;
- }
- public void giveRestCharge(){
- restCharges = Math.min(3,restCharges+1);
- }
- public String getDifficulty(){
- return this.difficulty;
- }
- public void setDifficulty(String difficulty){
- this.difficulty = difficulty;
- }
- public void giveGold(int gold){
- this.gold += gold;
- }
- public void giveExp(int exp){
- curExp += exp;
- }
- public boolean canLevel(){
- boolean levelUp = false;
- if(curExp >= targetExp){
- curExp = 0;
- targetExp = 1300 * targetExp / 1000;
- level++;
- setCurHealth(getMaxHealth());
- levelUp = true;
- }
- return levelUp;
- }
- public void printStats(){
- System.out.println("[---------------- STATS ----------------]\n");
- System.out.println("Name:\t\t"+getName()+" ("+sex+") {"+type+"}");
- System.out.println("Weapon:\t"+getWeapon().getModifier()+" "+getWeapon().getName()+" ["+getWeapon().getGrade()+"]");
- System.out.println("Armor:\t\t"+getArmor().getModifier()+" "+getArmor().getName() + " ["+getArmor().getGrade() + "]\n");
- System.out.println("[HP] :\t"+getCurHealth()+" / "+getMaxHealth());
- System.out.println("[DMG] :\t"+getWeapon().getDmg());
- System.out.println("[VIT] :\t"+getVitLvl()+"\t("+getBaseVit()+")");
- System.out.println("[STR] :\t"+getStrLvl()+"\t("+getBaseStr()+")");
- System.out.println("[DEX] :\t"+getDexLvl()+"\t("+getBaseDex()+")\t\tLVL:\t"+getLevel());
- System.out.println("[INT] :\t"+getIntLvl()+"\t("+getBaseInt()+")\t\tEXP:\t"+curExp+" / "+targetExp);
- System.out.println("[LCK] :\t"+getLckLvl()+"\t("+getBaseLck()+")\t\tGOLD:\t"+gold+"\n");
- }
- public int getCurExp(){
- return Math.min(curExp, targetExp);
- }
- public void setCurExp(int curExp){
- this.curExp = curExp;
- }
- public int getTargetExp(){
- return this.targetExp;
- }
- public void setTargetExp(int targetExp){
- this.targetExp = targetExp;
- }
- public int getLevel(){
- return this.level;
- }
- public void setLevel(int level){
- this.level = level;
- }
- public String getType(){
- return this.type;
- }
- public void setType(String type){
- this.type = type;
- if(type.equals("Gunslinger")){
- setVitLvl(8);
- setStrLvl(5);
- setDexLvl(13);
- setIntLvl(5);
- setLckLvl(14);
- }else if(type.equals("Barbarian")){
- setVitLvl(8);
- setStrLvl(12);
- setDexLvl(8);
- setIntLvl(5);
- setLckLvl(12);
- }
- setBaseHealth(getVitLvl()*15);
- level = getBaseVit() + getBaseStr() + getBaseDex() + getBaseInt() + getBaseLck();
- }
- public String getSex(){
- return this.sex;
- }
- public void setSex(String sex){
- this.sex = sex;
- }
- public int getGold(){
- return this.gold;
- }
- public void useGold(int gold){
- this.gold -= gold;
- }
- }
- public class Weapon extends Item {
- private int dmg;
- public Weapon(){
- setName("Dagger");
- setDmg(30);
- }
- public void compare(Weapon old){
- System.out.println("[----------- NEW WEAPON -----------]\n");
- System.out.println(" "+old.getModifier()+" "+ old.getName()+" ["+old.getGrade()+"]\n\t-> "+getModifier()+" "+getName()+" ["+getGrade()+"]");
- System.out.println("\t\t"+old.getDmg()+" -> "+getDmg()+" [DMG]");
- System.out.println("\t\t"+old.getVitBuff()+" -> "+getVitBuff()+" [VIT]");
- System.out.println("\t\t"+old.getStrBuff()+" -> "+getStrBuff()+" [STR]");
- System.out.println("\t\t"+old.getDexBuff()+" -> "+getDexBuff()+" [DEX]");
- System.out.println("\t\t"+old.getIntBuff()+" -> "+getIntBuff()+" [INT]");
- System.out.println("\t\t"+old.getLckBuff()+" -> "+getLckBuff()+" [LCK]");
- }
- public void scaleDmg(double scale){
- dmg *= scale;
- }
- public int getDmg(){
- return this.dmg;
- }
- public void setDmg(int dmg){
- this.dmg = dmg;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement