Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 53.58 KB | None | 0 0
  1. public class Armor extends Item {
  2.  private int health;
  3.  
  4.  public Armor(){
  5.   setName("Rags");
  6.   setHealth(180);
  7.  }
  8.  
  9.  public void compare(Armor old){
  10.   System.out.println("[----------- NEW ARMOR -----------]\n");
  11.   System.out.println("  "+old.getModifier()+" "+ old.getName()+" ["+old.getGrade()+"]\n\t-> "+getModifier()+" "+getName()+" ["+getGrade()+"]");
  12.   System.out.println("\t\t"+old.getHealth()+" -> "+getHealth()+" [HP]");
  13.   System.out.println("\t\t"+old.getVitBuff()+" -> "+getVitBuff()+" [VIT]");
  14.   System.out.println("\t\t"+old.getStrBuff()+" -> "+getStrBuff()+" [STR]");
  15.   System.out.println("\t\t"+old.getDexBuff()+" -> "+getDexBuff()+" [DEX]");
  16.   System.out.println("\t\t"+old.getIntBuff()+" -> "+getIntBuff()+" [INT]");
  17.   System.out.println("\t\t"+old.getLckBuff()+" -> "+getLckBuff()+" [LCK]\n");
  18.  }
  19.  
  20.  public void scaleHealth(double scale){
  21.   this.health *= scale;
  22.  }
  23.  
  24.  public int getHealth(){
  25.   return this.health;
  26.  }
  27.  
  28.  public void setHealth(int health){
  29.   this.health = health;
  30.  }
  31.  
  32.  }
  33.  
  34.  
  35.  
  36.  
  37. import java.util.Scanner;
  38. import java.util.ArrayList;
  39.  
  40. public class Blacksmith {
  41.  
  42.  private Scanner scan;
  43.  private ItemGenerator ig;
  44.  private Player player;
  45.  private boolean[] items;
  46.  private ArrayList<Integer> counters;
  47.  private String input;
  48.  
  49.  public Blacksmith(Scanner scan, Player player, ItemGenerator ig){
  50.   this.player = player;
  51.   this.scan = scan;
  52.   this.ig = ig;
  53.   items = new boolean[3];
  54.   counters = new ArrayList<Integer>(3);
  55.   counters.add(3);
  56.   counters.add(3);
  57.   counters.add(3);
  58.   refreshItems();
  59.  }
  60.  
  61.  public void offerLoop(int i){
  62.   Item item = ig.rollItem();
  63.   int buyPrice = 1200 * item.getValue() /1000;
  64.   ig.printWait();
  65.   counters.set(i,0);
  66.   for(;;){
  67.    if(item.getClass() == Weapon.class){
  68.     ((Weapon)item).compare(player.getWeapon());
  69.    }else{
  70.     ((Armor)item).compare(player.getArmor());
  71.    }
  72.    System.out.println("\n > [GOLD] : "+player.getGold()+"\n");
  73.    printBreaker();
  74.    System.out.println("[E] - Buy ("+buyPrice+" GOLD)");
  75.    System.out.println("[S] - Refuse Offer");
  76.    printBreaker();
  77.    System.out.print(" > ");
  78.    input = scan.nextLine();
  79.    System.out.println("\n");
  80.    if(input.equals("e")){
  81.     if(player.getGold()-buyPrice >= 0){
  82.      player.useGold(buyPrice);
  83.      player.giveItem(item);
  84.      break;
  85.     }else{
  86.      System.out.println("You do not have enough GOLD!\n");
  87.      break;
  88.     }
  89.    }else if(input.equals("s")){
  90.     System.out.println("The Blacksmith salvages the item.\n");
  91.     break;
  92.    }else{
  93.     System.out.println("Invalid Input. Try Again.\n");
  94.    }
  95.   }
  96.  }
  97.  
  98.  public void menuLoop(){
  99.   for(;;){
  100.    System.out.println("[-------------- BLACKSMITH --------------]\n");
  101.    System.out.println("> \"Would you be interested in buying an item?\"\n");
  102.    System.out.println(" > [GOLD] : "+player.getGold()+"\n");
  103.    printBreaker();
  104.    refreshItems();
  105.    System.out.println(" [1] - "+getOption(0) + " ( "+counters.get(0)+" / 3 )");
  106.    System.out.println(" [2] - "+getOption(1) + " ( "+counters.get(1)+" / 3 )");
  107.    System.out.println(" [3] - "+getOption(2) + " ( "+counters.get(2)+" / 3 )");
  108.    System.out.println(" [Q] - Exit Blacksmith");
  109.    printBreaker();
  110.    System.out.print(" > ");
  111.    input = scan.nextLine();
  112.    System.out.println();
  113.    if(input.equals("1")){
  114.     if(items[0]) offerLoop(0);
  115.     else System.out.println("That item is not available right now!\n");
  116.    }else if(input.equals("2")){
  117.     if(items[1]) offerLoop(1);
  118.     else System.out.println("That item is not available right now!\n");
  119.    }else if(input.equals("3")){
  120.     if(items[2]) offerLoop(2);
  121.     else System.out.println("That item is not available right now!\n");
  122.    }else if(input.equals("q")){
  123.     break;
  124.    }else{
  125.     System.out.println("Invalid Input. Try Again.\n");
  126.    }
  127.   }
  128.  }
  129.  
  130.  public void refreshItems(){
  131.   for(int i = 0 ; i < items.length ; i++ ){
  132.    if(counters.get(i) == 3){
  133.     items[i] = true;
  134.    }else
  135.     items[i] = false;
  136.   }
  137.  }
  138.  
  139.  public void addCounter(){
  140.   int highestCounter = 0;
  141.   if(!items[0]) highestCounter = counters.get(0);
  142.   if(!items[1]){
  143.    highestCounter = Math.max(highestCounter, counters.get(1));
  144.   }
  145.   if(!items[2]){
  146.    highestCounter = Math.max(highestCounter, counters.get(2));
  147.   }
  148.   int index = counters.indexOf(highestCounter);
  149.   if(index != -1) counters.set(index,counters.get(index)+1);
  150.  }
  151.  
  152.  public String getOption(int i){
  153.   if(items[i]) return "[ROLL ITEM]";
  154.   else return "[NONE]";
  155.  }
  156.  
  157.  public void printBreaker(){
  158.   System.out.println("[---------------------------------------]");
  159.  }
  160.  
  161. }
  162.  
  163.  
  164.  
  165.  
  166. public class Enemy extends Entity {
  167.  
  168.  private String modifier, attackStyle;
  169.  private int value;
  170.  
  171.  public Enemy(){
  172.   setComboMeter(1);
  173.  }
  174.  
  175.  public void nerf(String difficulty){
  176.   int healthScale = 900;
  177.   int dmgScale = 850;
  178.   int valueScale = 800;
  179.   if(difficulty.equals("Pussy")){
  180.    healthScale = 750;
  181.    dmgScale = 700;
  182.    valueScale = 600;
  183.   }else if(difficulty.equals("Gatekeeper")){
  184.    healthScale = 1400;
  185.    dmgScale = 1400;
  186.    valueScale = 1000;
  187.   }
  188.   getWeapon().setDmg(getWeapon().getDmg() * dmgScale / 1000);
  189.     getArmor().setHealth(getArmor().getHealth() * healthScale / 1000);
  190.   setCurHealth(getMaxHealth());
  191.  
  192.   value = value * valueScale / 1000 ;
  193.  }
  194.  
  195.  public int getAttack(){
  196.   int totalDmg = 0;
  197.   if(getName().equals("Gargoyle")){
  198.  
  199.    if(getComboMeter() == 1){
  200.    
  201.     // .5 [DMG] +5 [STR]
  202.     attackStyle = "Bash";
  203.     totalDmg = 500 * getWeapon().getDmg() / 1000 + 5 * getStrLvl();
  204.    
  205.    }else if(getComboMeter() == 2){
  206.    
  207.     // .7 [DMG] +2 [INT] +3 [DEX] (+.4 Dmg Dealt Heal)
  208.     attackStyle = "Stone Gaze";
  209.     totalDmg = 700 * getWeapon().getDmg() / 1000 + 2 * getIntLvl() + 3 * getDexLvl();
  210.     heal(400 * totalDmg / 1000);
  211.    
  212.    }else if(getComboMeter() == 3){
  213.    
  214.     // .9 [DMG] +7 [STR]
  215.     attackStyle = "Clobber";
  216.     totalDmg = 900 * getWeapon().getDmg() / 1000 + 7 * getStrLvl();
  217.    
  218.    }
  219.    
  220.   }else if(getName().equals("Skeleton")){
  221.  
  222.    if(getComboMeter() == 1){
  223.    
  224.     // .5 [DMG] +5 [DEX]
  225.     attackStyle = "Jab";
  226.     totalDmg = 500 * getWeapon().getDmg() / 1000 + 5 * getDexLvl();
  227.    
  228.    }else if(getComboMeter() == 2){
  229.    
  230.     // .7 [DMG] +3 [STR] +2 [LCK]
  231.     attackStyle = "Head Toss";
  232.     totalDmg = 700 * getWeapon().getDmg() / 1000 + 3 * getStrLvl() + 2 * getLckLvl();
  233.    
  234.    }else if(getComboMeter() == 3){
  235.    
  236.     // .9 [DMG] +4 [DEX] +3 [INT]
  237.     attackStyle = "Spook";
  238.     totalDmg = 900 * getWeapon().getDmg() / 1000 + 4 * getDexLvl() + 3 * getIntLvl();
  239.    
  240.    }
  241.    
  242.   }else if(getName().equals("Rat")){
  243.  
  244.    if(getComboMeter() == 1){
  245.    
  246.     attackStyle = "Lunge";
  247.     //.3 [DMG] +3 STR
  248.     totalDmg = 300 * getWeapon().getDmg() / 1000 + 3 * getStrLvl();
  249.    
  250.    }else if(getComboMeter() == 2){
  251.    
  252.     attackStyle = "Bite";
  253.     //.5 [DMG] +4 [STR] +2 [DEX]
  254.     totalDmg = 500 * getWeapon().getDmg() / 1000 + 4 * getStrLvl() + 2 * getDexLvl();
  255.    
  256.    }else if(getComboMeter() == 3){
  257.    
  258.     attackStyle = "Deep Bite";
  259.     //.7 [DMG] +5 [STR]
  260.     totalDmg = 700 * getWeapon().getDmg() / 1000 + 5 * getStrLvl();
  261.    }
  262.    
  263.   }else if(getName().equals("Hawk")){
  264.  
  265.    if(getComboMeter() == 1){
  266.    
  267.     attackStyle = "Scratch";
  268.     //.2 [DMG] +4 [DEX] (+1.4 Dmg Dealt Heal)
  269.     totalDmg = 200 * getWeapon().getDmg() / 1000 + 4 * getDexLvl();
  270.     heal(1400 * totalDmg / 1000);
  271.    
  272.    }else if(getComboMeter() == 2){
  273.    
  274.     attackStyle = "Wing Blast";
  275.     //.2 [DMG] +5 [DEX] +5 [INT]
  276.     totalDmg = 200 * getWeapon().getDmg() / 1000 + 5 * getDexLvl() + 5 * getIntLvl();
  277.    
  278.    }else if(getComboMeter() == 3){
  279.    
  280.     attackStyle = "Aerial Assault";
  281.     //.8 [DMG] +6 [DEX] +.15 Miss [HP]
  282.     totalDmg = 800 * getWeapon().getDmg() / 1000 + 6 * getDexLvl() + 150 * (getMaxHealth() - getCurHealth()) / 1000;
  283.    
  284.    }
  285.    
  286.   }else if(getName().equals("Dragon")){
  287.  
  288.    if(getComboMeter() == 1){
  289.    
  290.     attackStyle = "Charge Up";
  291.     //.1 [DMG] +2 [VIT] (+.3 Miss [HP] Heal)
  292.     totalDmg = 100 * getWeapon().getDmg() / 1000 + 2 * getVitLvl();
  293.     heal(300 * (getMaxHealth() - getCurHealth()) / 1000);
  294.    
  295.    }else if(getComboMeter() == 2){
  296.    
  297.     attackStyle = "Exhaust";
  298.     //.4 [DMG] +2 [VIT] +2 [STR]
  299.     totalDmg = 400 * getWeapon().getDmg() / 1000 + 2 * getVitLvl() + 2 * getStrLvl();
  300.    
  301.    }else if(getComboMeter() == 3){
  302.    
  303.     attackStyle = "Fire Breath";
  304.     //[DMG] +4 [VIT] +6 [INT]
  305.     totalDmg = getWeapon().getDmg() + 4 * getVitLvl() + 6 * getIntLvl();
  306.    
  307.    }
  308.    
  309.   }
  310.   return totalDmg;
  311.  }
  312.  
  313.  public String getAttackStyle(){
  314.   return this.attackStyle;
  315.  }
  316.  
  317.  public int getValue(){
  318.   return this.value;
  319.  }
  320.  
  321.  public void setValue(int value){
  322.   this.value = value;
  323.  }
  324.  
  325.  public int getLevel(){
  326.   return getBaseVit() + getBaseStr() + getBaseDex() + getBaseInt() + getBaseLck();
  327.  }
  328.  
  329.  public void printStats(){
  330.   System.out.println("[-------------  ENEMY STATS -------------]\n");
  331.   System.out.println("Name:\t\t"+getModifier().toUpperCase()+" "+getName().toUpperCase());
  332.   System.out.println("\n[HP] :\t"+getCurHealth()+" / "+getMaxHealth());
  333.   System.out.println("[DMG] :\t"+getWeapon().getDmg());
  334.   System.out.println("[VIT] :\t"+getVitLvl());
  335.   System.out.println("[STR] :\t"+getStrLvl());
  336.   System.out.println("[DEX] :\t"+getDexLvl());
  337.   System.out.println("[INT] :\t"+getIntLvl());
  338.   System.out.println("[LCK] :\t"+getLckLvl() + "\n");
  339.  }
  340.  
  341.  public String getModifier(){
  342.   return this.modifier;
  343.  }
  344.  
  345.  public void setModifier(String modifier){
  346.   this.modifier = modifier;
  347.  }
  348.  
  349. }
  350.  
  351.  
  352.  
  353.  
  354. import java.util.Random;
  355.  
  356. public class EnemyGenerator {
  357.  
  358.  private Random rand;
  359.  private Player player;
  360.  
  361.  public EnemyGenerator(Random rand, Player player){
  362.   this.rand = rand;
  363.   this.player = player;
  364.  }
  365.  
  366.  public Enemy rollEnemy(){
  367.   Enemy enemy = new Enemy();
  368.   Weapon weapon = new Weapon();
  369.   Armor armor = new Armor();
  370.   int dmgRoll = rand.nextInt(300) + 601;
  371.   int healthRoll = rand.nextInt(300) + 601;
  372.   int typeRoll = rand.nextInt(1000);
  373.   int modifierRoll = rand.nextInt(1000);
  374.   int vitRoll = rand.nextInt(600)+701;
  375.   int strRoll = rand.nextInt(600)+701;
  376.   int dexRoll = rand.nextInt(600)+701;
  377.   int intRoll = rand.nextInt(600)+701;
  378.   int lckRoll = rand.nextInt(600)+701;
  379.   int playerScale = player.getLevel() / 5 + 1;
  380.  
  381.   weapon.setDmg( dmgRoll * player.getWeapon().getDmg() / 1000 );
  382.   armor.setHealth( healthRoll * player.getArmor().getHealth() / 1000 );
  383.  
  384.   if(typeRoll < 350){
  385.  
  386.    enemy.setName("Rat");
  387.    weapon.setDmg(weapon.getDmg() - 15);
  388.    enemy.setVitLvl(700 * ( playerScale * vitRoll / 1000 ) / 1000);
  389.    enemy.setStrLvl(800 * ( playerScale * strRoll / 1000 ) / 1000);
  390.    enemy.setDexLvl(800 * ( playerScale * dexRoll / 1000 ) / 1000);
  391.    enemy.setIntLvl(800 * ( playerScale * intRoll / 1000 ) / 1000);
  392.    enemy.setLckLvl(800 * ( playerScale * lckRoll / 1000 ) / 1000);
  393.    enemy.setValue(60);
  394.  
  395.   }else if(typeRoll < 600){
  396.  
  397.    enemy.setName("Hawk");
  398.    enemy.setVitLvl(900 * ( playerScale * vitRoll / 1000 ) / 1000);
  399.    enemy.setStrLvl(800 * ( playerScale * strRoll / 1000 ) / 1000);
  400.    enemy.setDexLvl(1200 * ( playerScale * dexRoll / 1000 ) / 1000);
  401.    enemy.setIntLvl(900 * ( playerScale * intRoll / 1000 ) / 1000);
  402.    enemy.setLckLvl(800 * ( playerScale * lckRoll / 1000 ) / 1000);
  403.    enemy.setValue(90);
  404.  
  405.   }else if(typeRoll < 750){
  406.  
  407.    enemy.setName("Gargoyle");
  408.    weapon.setDmg(weapon.getDmg() + 5);
  409.    armor.setHealth(armor.getHealth() + 1100 * armor.getHealth() / 1000);
  410.    enemy.setVitLvl(1200 * ( playerScale * vitRoll / 1000 ) / 1000);
  411.    enemy.setStrLvl(1200 * ( playerScale * strRoll / 1000 ) / 1000);
  412.    enemy.setDexLvl(600 * ( playerScale * dexRoll / 1000 ) / 1000);
  413.    enemy.setIntLvl(900 * ( playerScale * intRoll / 1000 ) / 1000);
  414.    enemy.setLckLvl(500 * ( playerScale * lckRoll / 1000) / 1000);
  415.    enemy.setValue(100);
  416.  
  417.   }else if(typeRoll < 900){
  418.  
  419.    enemy.setName("Skeleton");
  420.    enemy.setVitLvl(1000 * ( playerScale * vitRoll / 1000 ) / 1000);
  421.    enemy.setStrLvl(1200 * ( playerScale * strRoll / 1000 ) / 1000);
  422.    enemy.setDexLvl(600 * ( playerScale * dexRoll / 1000 ) / 1000);
  423.    enemy.setIntLvl(800 * ( playerScale * intRoll / 1000 ) / 1000);
  424.    enemy.setLckLvl(900 * ( playerScale * lckRoll / 1000 ) / 1000);
  425.    enemy.setValue(90);
  426.  
  427.   }else{
  428.  
  429.    enemy.setName("Dragon");
  430.    armor.setHealth(armor.getHealth() + 1400 * armor.getHealth() / 1000);
  431.    enemy.setVitLvl(1600 * ( playerScale * vitRoll / 1000 ) / 1000);
  432.    enemy.setStrLvl(1400 * ( playerScale * strRoll / 1000 ) / 1000);
  433.    enemy.setDexLvl(1400 * ( playerScale * dexRoll / 1000) / 1000);
  434.    enemy.setIntLvl(1800 * ( playerScale * intRoll / 1000 ) / 1000);
  435.    enemy.setLckLvl(1200 * ( playerScale * lckRoll / 1000 ) / 1000);
  436.    enemy.setValue(200);
  437.    
  438.   }
  439.  
  440.   if(modifierRoll < 600){
  441.    
  442.    enemy.setModifier("Normal");
  443.    
  444.   }else if(modifierRoll < 700){
  445.    
  446.    enemy.setModifier("Swift");
  447.    enemy.setDexLvl(4+ 1500 * enemy.getBaseDex() / 1000 );
  448.    enemy.setLckLvl(8 + 1500 * enemy.getBaseLck() / 1000 );
  449.    enemy.setValue(enemy.getValue()*1200/1000);
  450.    
  451.   }else if(modifierRoll < 825){
  452.  
  453.    enemy.setModifier("Giant");
  454.    enemy.setVitLvl(2 + 1500 * enemy.getBaseVit() / 1000 );
  455.    enemy.setStrLvl(2 + 1500 * enemy.getBaseStr() / 1000 );
  456.    armor.setHealth(1200 * armor.getHealth() / 1000 );
  457.    enemy.setValue(enemy.getValue()*1600/1000);
  458.  
  459.   }else if(modifierRoll < 950){
  460.  
  461.    enemy.setModifier("Magical");
  462.    enemy.setIntLvl(2 + 1500 * enemy.getBaseInt() / 1000 );
  463.    enemy.setValue(enemy.getValue()*1200/1000);
  464.    
  465.   }else{
  466.  
  467.    enemy.setModifier("Legendary");
  468.    enemy.setVitLvl(4 + 1600 * enemy.getBaseVit() / 1000 );
  469.    enemy.setStrLvl(4 + 1600 * enemy.getBaseStr() / 1000 );
  470.    enemy.setDexLvl(4 + 1600 * enemy.getBaseDex() / 1000 );
  471.    enemy.setIntLvl(4 + 1600 * enemy.getBaseInt() / 1000 );
  472.    enemy.setLckLvl(4 + 1600 * enemy.getBaseLck() / 1000 );
  473.    weapon.setDmg(1100 * weapon.getDmg() / 1000 );
  474.    enemy.setValue(enemy.getValue()*1800/1000);
  475.    
  476.   }
  477.   enemy.setWeapon(weapon);
  478.   enemy.setArmor(armor);
  479.   enemy.setBaseHealth(15 * enemy.getVitLvl());
  480.   enemy.setValue((enemy.getValue() + 1200 * enemy.getLevel() / 1000) * (rand.nextInt(300) + 851) / 1000);
  481.   return enemy;
  482.  
  483.  }
  484.  
  485. }
  486.  
  487.  
  488.  
  489.  
  490.  
  491. public class Entity {
  492.  
  493.  private int curHealth, baseHealth;
  494.  private int vitLvl, strLvl, dexLvl, intLvl, lckLvl;
  495.  private int comboMeter;
  496.  private String name;
  497.  private Weapon weapon;
  498.  private Armor armor;
  499.  
  500.  public Entity(){
  501.   setWeapon(new Weapon());
  502.   setArmor(new Armor());
  503.  }
  504.  
  505.  public void incrementComboMeter(){
  506.   if(comboMeter == 3)
  507.    comboMeter = 1;
  508.   else comboMeter++;
  509.  }
  510.  
  511.  public int getComboMeter(){
  512.   return this.comboMeter;
  513.  }
  514.  
  515.  public void setComboMeter(int comboMeter){
  516.   this.comboMeter = Math.max(1,comboMeter);
  517.  }
  518.  
  519.  public void heal(int heal){
  520.   setCurHealth(curHealth + heal);
  521.  }
  522.  
  523.  public boolean isAlive(){
  524.   return curHealth>0;
  525.  }
  526.  
  527.  public void takeDmg(int dmg){
  528.   setCurHealth(curHealth - dmg);
  529.  }
  530.  
  531.  public void giveItem(Item item){
  532.   if(item.getClass() == Weapon.class){
  533.    setWeapon((Weapon)item);
  534.   }else{
  535.    curHealth -= getArmor().getHealth();
  536.    setArmor((Armor)item);
  537.   }
  538.  }
  539.  
  540.  public void printName(){
  541.  
  542.   if(this.getClass() == Enemy.class){
  543.    System.out.println(((Enemy)this).getModifier().toUpperCase() + " " + this.getName().toUpperCase()+" ");
  544.    
  545.   }else{
  546.    String combo = "[";System.out.print(this.getName().toUpperCase() + "     ");
  547.  
  548.    for(int i = 1 ; i <= 3 ; i ++){
  549.     if(i <= comboMeter ){
  550.      combo += " "+i+" ";
  551.      if(i != 3) combo += "|";
  552.     }else{
  553.      combo += "    ";
  554.     }
  555.    }
  556.    combo += "]";
  557.    System.out.println(combo);
  558.   }
  559.  }
  560.  
  561.  public void printHealthbar(){
  562.   String healthbar = "<[";
  563.   int healthIncrement = 50;
  564.   int barSize = Math.min(19,getMaxHealth() / healthIncrement) + 1;
  565.   if(barSize >= 19){
  566.    healthIncrement = getMaxHealth() / barSize - 1;
  567.   }
  568.   for(int i = 0 ; i < barSize ; i++){
  569.    if(i * healthIncrement <= curHealth){
  570.     healthbar += "•";
  571.    }else{
  572.     healthbar += "  ";
  573.    }
  574.   }
  575.   healthbar += "]>";
  576.   System.out.println(" HP: "+healthbar+"\t[ "+getCurHealth()+" / "+getMaxHealth()+ " ]" );
  577.  }
  578.  
  579.  public int getCurHealth(){
  580.   return Math.max(0,curHealth);
  581.  }
  582.  
  583.  public void setCurHealth(int curHealth){
  584.   this.curHealth = Math.min(curHealth,getMaxHealth());
  585.  }
  586.  
  587.  public int getBaseHealth(){
  588.   return this.baseHealth;
  589.  }
  590.  
  591.  public void setBaseHealth(int baseHealth){
  592.   this.baseHealth = baseHealth;
  593.   curHealth = Math.min(getMaxHealth(),curHealth+baseHealth);
  594.  }
  595.  
  596.  public int getMaxHealth(){
  597.   baseHealth = 15 * getVitLvl();
  598.   return baseHealth + armor.getHealth();
  599.  }
  600.  
  601.  public int getVitLvl(){
  602.   return vitLvl + weapon.getVitBuff() + armor.getVitBuff();
  603.  }
  604.  
  605.  public int getBaseVit(){
  606.   return this.vitLvl;
  607.  }
  608.  
  609.  public void levelVit(){
  610.   this.vitLvl++;
  611.   baseHealth = vitLvl*15;
  612.   setCurHealth(curHealth+30);
  613.  }
  614.  
  615.  public void setVitLvl(int vitLvl){
  616.   this.vitLvl = vitLvl;
  617.   setBaseHealth(vitLvl*15);
  618.  }
  619.  
  620.  public int getStrLvl(){
  621.   return strLvl + weapon.getStrBuff() + armor.getStrBuff();
  622.  }
  623.  
  624.  public int getBaseStr(){
  625.   return this.strLvl;
  626.  }
  627.  
  628.  public void levelStr(){
  629.   this.strLvl++;
  630.  }
  631.  
  632.  public void setStrLvl(int strLvl){
  633.   this.strLvl = strLvl;
  634.  }
  635.  
  636.  public int getDexLvl(){
  637.   return dexLvl + weapon.getDexBuff() + armor.getDexBuff();
  638.  }
  639.  
  640.  public int getBaseDex(){
  641.   return this.dexLvl;
  642.  }
  643.  
  644.  public void levelDex(){
  645.   this.dexLvl++;
  646.  }
  647.  
  648.  public void setDexLvl(int dexLvl){
  649.   this.dexLvl = dexLvl;
  650.  }
  651.  
  652.  public int getIntLvl(){
  653.   return intLvl + weapon.getIntBuff() + armor.getIntBuff();
  654.  }
  655.  
  656.  public int getBaseInt(){
  657.   return this.intLvl;
  658.  }
  659.  
  660.  public void levelInt(){
  661.   this.intLvl++;
  662.  }
  663.  
  664.  public void setIntLvl(int intLvl){
  665.   this.intLvl = intLvl;
  666.  }
  667.  
  668.  public int getLckLvl(){
  669.   return lckLvl + weapon.getLckBuff() + armor.getLckBuff();
  670.  }
  671.  
  672.  public int getBaseLck(){
  673.   return this.lckLvl;
  674.  }
  675.  
  676.  public void levelLck(){
  677.   this.lckLvl++;
  678.  }
  679.  
  680.  public void setLckLvl(int lckLvl){
  681.   this.lckLvl = lckLvl;
  682.  }
  683.  
  684.  public String getName(){
  685.   return this.name;
  686.  }
  687.  
  688.  public void setName(String name){
  689.   this.name = name;
  690.  }
  691.  
  692.  public Weapon getWeapon(){
  693.   return this.weapon;
  694.  }
  695.  
  696.  public void setWeapon(Weapon weapon){
  697.   this.weapon = weapon;
  698.  
  699.   curHealth = getMaxHealth();
  700.  }
  701.  
  702.  public Armor getArmor(){
  703.   return this.armor;
  704.  }
  705.  
  706.  public void setArmor(Armor armor){
  707.   this.armor = armor;
  708.  
  709.   curHealth = getMaxHealth();
  710.  }
  711.  
  712. }
  713.  
  714.  
  715.  
  716.  
  717. import java.util.Random;
  718. import java.util.Scanner;
  719.  
  720. public class FightArena {
  721.  
  722.  private Scanner scan;
  723.  private Random rand;
  724.  private Enemy enemy;
  725.  private Player player;
  726.  private EnemyGenerator eg;
  727.  private ItemGenerator ig;
  728.  private int dmg, accuracy, atkRoll, dmgRoll,dropRoll,dropChance,reward;
  729.  private String input;
  730.  
  731.  public FightArena(Scanner scan, Random rand, Player player, EnemyGenerator eg, ItemGenerator ig){
  732.   this.scan = scan;
  733.   this.rand = rand;
  734.   this.player = player;
  735.   this.eg = eg;
  736.   this.ig = ig;
  737.  }
  738.  
  739.  public void printBreaker(){
  740.   System.out.println("[---------------------------------------]");
  741.  }
  742.  
  743.  public void fight(){
  744.   int heals = 5;
  745.   dropChance = 400 + 10 * player.getLckLvl();
  746.   if( player.getDifficulty().equals("Gatekeeper") ) {
  747.    dropChance += 200;
  748.    heals += 2;
  749.   }else if( player.getDifficulty().equals("Pussy") ) {
  750.    dropChance += 300;
  751.    heals += 5;
  752.   }
  753.   player.setComboMeter(1);
  754.   enemy = eg.rollEnemy();
  755.   enemy.nerf(player.getDifficulty());
  756.   enemy.printStats();
  757.   reward = enemy.getValue();
  758.   printBreaker();
  759.   System.out.print(" > Press anything to continue...");
  760.   scan.nextLine();
  761.   System.out.println("\n[---------------- FIGHT ----------------]\n\n");
  762.   System.out.println(" > You encountered a "+enemy.getModifier()+" "+enemy.getName()+"!\n");
  763.   enemy.printName();
  764.   enemy.printHealthbar();
  765.   System.out.println("\n\n > You prepare for battle.\n");
  766.   player.printName();
  767.   player.printHealthbar();
  768.   System.out.println("\n");
  769.   while(enemy.isAlive() && player.isAlive()){
  770.    printBreaker();
  771.    System.out.println(" [A] - "+player.getAttackStyle()+"\n\t=> "+player.getAttackDesc());
  772.    System.out.println(" [H] - Heal ( "+heals+" )\n\t=> 56 +18 [VIT]");
  773.    printBreaker();
  774.    System.out.print(" > ");
  775.    input = scan.nextLine();
  776.    System.out.println("\n");
  777.    System.out.println("[---------------- FIGHT ----------------]\n\n");
  778.    if(input.equals("h")){
  779.     if(heals == 0){
  780.      System.out.println(" > You've Ran Out Of Heals!\n");
  781.      enemy.printName();
  782.      enemy.printHealthbar();
  783.      System.out.println("\n\n > You've Ran Out Of Heals!\n");
  784.      player.printName();
  785.      player.printHealthbar();
  786.      System.out.println("\n");
  787.     }else{
  788.      heals--;
  789.      player.heal(56 + 18 * player.getVitLvl());
  790.      player.setComboMeter(1);
  791.      System.out.println(" > You Healed +"+(56 + 18 * player.getVitLvl())+" HP.\n");
  792.      atkRoll = rand.nextInt(1000);
  793.      accuracy = 800 - 2 * player.getLckLvl() + 8 * enemy.getLckLvl();
  794.      if(atkRoll < accuracy){
  795.       dmgRoll = rand.nextInt(240)+881;
  796.       dmg = enemy.getAttack() * dmgRoll / 1000;
  797.       player.takeDmg(dmg);
  798.       enemy.printName();
  799.       enemy.printHealthbar();
  800.       System.out.println();
  801.       System.out.println(" > Enemy used "+enemy.getAttackStyle()+" dealing "+dmg+" DMG.");
  802.       enemy.incrementComboMeter();
  803.      }else{
  804.       dmg = 0;
  805.       enemy.printName();
  806.       enemy.printHealthbar();
  807.       System.out.println();
  808.       System.out.println(" > The Enemy missed you.");
  809.       if(enemy.getComboMeter() == 3)
  810.        enemy.setComboMeter(2);
  811.      }
  812.      System.out.println();
  813.      player.printName();
  814.      player.printHealthbar();
  815.      System.out.println("\n");
  816.     }
  817.    }else if(input.equals("a")){
  818.     atkRoll = rand.nextInt(1000);
  819.     accuracy = 800 + 10 * player.getLckLvl() - 2 * enemy.getLckLvl();
  820.     if(atkRoll < accuracy){
  821.      dmgRoll = rand.nextInt(240)+881;
  822.      dmg = player.getAttack() * dmgRoll / 1000;
  823.      enemy.takeDmg(dmg);
  824.      System.out.println(" > You use "+player.getAttackStyle()+" dealing "+dmg+" DMG.");
  825.      player.incrementComboMeter();
  826.     }else{
  827.      dmg = 0;
  828.      if(player.getComboMeter()==3)
  829.       player.setComboMeter(2);
  830.      System.out.println(" > You missed the Enemy.");
  831.     }
  832.     System.out.println();
  833.     enemy.printName();
  834.     enemy.printHealthbar();
  835.     System.out.println("\n");
  836.     if(enemy.isAlive()){
  837.      atkRoll = rand.nextInt(1000);
  838.      accuracy = 800 - 2 * player.getLckLvl() + 8 * enemy.getLckLvl();
  839.      if(atkRoll < accuracy){
  840.       dmgRoll = rand.nextInt(240)+881;
  841.       dmg = enemy.getAttack() * dmgRoll / 1000;
  842.       player.takeDmg(dmg);
  843.       System.out.println(" > Enemy used "+enemy.getAttackStyle()+" dealing "+dmg+" DMG.");
  844.       enemy.incrementComboMeter();
  845.      }else{
  846.       dmg = 0;
  847.       System.out.println(" > The Enemy missed you.");
  848.       if(enemy.getComboMeter() == 3)
  849.        enemy.setComboMeter(2);
  850.      }
  851.      System.out.println();
  852.      player.printName();
  853.      player.printHealthbar();
  854.      System.out.println("\n");
  855.     }else{
  856.      System.out.println(" > The "+enemy.getName()+" falls to the ground.");
  857.      System.out.println();
  858.      player.printName();
  859.      player.printHealthbar();
  860.      System.out.println("\n");
  861.      printBreaker();
  862.      System.out.print(" > Press anything to continue...");
  863.      scan.nextLine();
  864.      System.out.println("\n");
  865.      player.giveGold(reward);
  866.      player.giveRestCharge();
  867.      int expReward =  enemy.getMaxHealth() / 6;
  868.      player.giveExp(expReward);
  869.      System.out.println("[-------------- REWARDS --------------]\n");
  870.      System.out.println("\tYou gained [+"+ reward + " GOLD]\t[+"+expReward+" EXP]\n");
  871.      System.out.print("\t\t[EXP] : " + player.getCurExp() + " / " + player.getTargetExp());
  872.      if(player.getCurExp() == player.getTargetExp()){
  873.       System.out.print("     LEVEL UP!");
  874.      }
  875.      System.out.println("\n");
  876.      printBreaker();
  877.      System.out.print(" > Press anything to continue...");
  878.      scan.nextLine();
  879.      System.out.println("\n");
  880.      dropRoll = rand.nextInt(1000);
  881.      if(dropRoll < dropChance){
  882.       dropItem();
  883.      }
  884.     }
  885.    }else{
  886.     System.out.println("Invalid Input. Try Again.\n");
  887.    }
  888.   }
  889.  }
  890.  
  891.  public void dropItem(){
  892.   Item item = ig.rollItem();
  893.   ig.printWait();
  894.   for(;;){
  895.    if(item.getClass() == Weapon.class){
  896.     ((Weapon)item).compare(player.getWeapon());
  897.    }else{
  898.     ((Armor)item).compare(player.getArmor());
  899.    }
  900.    System.out.println();
  901.    printBreaker();
  902.    System.out.println("[E] - Equip");
  903.    System.out.println("[S] - Sell (+"+item.getValue()+" GOLD)");
  904.    printBreaker();
  905.    System.out.print(" > ");
  906.    input = scan.nextLine();
  907.    System.out.println("\n");
  908.    if(input.equals("e")){
  909.     player.giveItem(item);
  910.     break;
  911.    }else if(input.equals("s")){
  912.     player.giveGold(item.getValue());
  913.     break;
  914.    }else{
  915.     System.out.println("Invalid Input. Try Again.\n");
  916.    }
  917.   }
  918.  }
  919.  
  920.  
  921. }
  922.  
  923.  
  924.  
  925.  
  926. import java.util.Scanner;
  927. import java.util.Random;
  928.  
  929. public class Game {
  930.  
  931.  private Scanner scan;
  932.  private Player player;
  933.  private ItemGenerator ig;
  934.  private EnemyGenerator eg;
  935.  private FightArena fa;
  936.  private Lobby lobby;
  937.  private Blacksmith blacksmith;
  938.  
  939.  public Game(Scanner scan, Random rand){
  940.   this.scan = scan;
  941.   player = new Player();
  942.   ig = new ItemGenerator(rand,player);
  943.   eg = new EnemyGenerator(rand,player);
  944.   fa = new FightArena(scan,rand,player,eg,ig);
  945.   blacksmith = new Blacksmith(scan,player,ig);
  946.   lobby = new Lobby(scan,player,fa,blacksmith);
  947.  }
  948.  
  949.  public void test(){
  950.   boolean confirm = false;
  951.   while(!confirm){
  952.    lobby.chooseName();
  953.    lobby.chooseSex();
  954.    lobby.chooseClass();
  955.    lobby.chooseDifficulty();
  956.    System.out.println();
  957.    for(;;){
  958.     player.printStats();
  959.     lobby.printBreaker();
  960.     System.out.println("\n > Do you wish to continue with these settings?\n");
  961.     lobby.printBreaker();
  962.     System.out.println(" [Y] - Yes");
  963.     System.out.println(" [N] - No");
  964.     lobby.printBreaker();
  965.     System.out.print(" > ");
  966.     String input = scan.nextLine();
  967.     System.out.println("\n");
  968.     if(input.equals("y")){
  969.      confirm = true;
  970.      break;
  971.     }else if(input.equals("n")){
  972.      confirm = false;
  973.      break;
  974.     }else{
  975.      System.out.println("Invalid Input. Try Again.\n");
  976.     }
  977.    }
  978.   }
  979.   fa.dropItem();
  980.   lobby.mainLoop();
  981.  }
  982.  
  983.  
  984.  
  985.  
  986.  
  987. }
  988.  
  989.  
  990.  
  991.  
  992.  
  993. public class Item {
  994.  
  995.  private String modifier, name, grade;
  996.  private int vitBuff, strBuff, dexBuff, intBuff, lckBuff, value;
  997.  
  998.  public Item(){
  999.   modifier = "";
  1000.   name = "None";
  1001.   grade = "";
  1002.  }
  1003.  
  1004.  public void scaleBuffs(double scale){
  1005.   setVitBuff( (int) ( getVitBuff() * scale ) );
  1006.   setStrBuff( (int) ( getStrBuff() * scale ) );
  1007.   setDexBuff( (int) ( getDexBuff() * scale ) );
  1008.   setIntBuff( (int) ( getIntBuff() * scale ) );
  1009.   setLckBuff( (int) ( getLckBuff() * scale ) );
  1010.  }
  1011.  
  1012.  public int getValue(){
  1013.   return value;
  1014.  }
  1015.  
  1016.  public void setValue(int value){
  1017.   this.value = value;
  1018.  }
  1019.  
  1020.  public String getModifier(){
  1021.   return this.modifier;
  1022.  }
  1023.  
  1024.  public void setModifier(String modifier){
  1025.   this.modifier = modifier;
  1026.  }
  1027.  
  1028.  public String getName(){
  1029.   return this.name;
  1030.  }
  1031.  
  1032.  public void setName(String name){
  1033.   this.name = name;
  1034.  }
  1035.  
  1036.  public String getGrade(){
  1037.   return this.grade;
  1038.  }
  1039.  
  1040.  public void setGrade(String grade){
  1041.   this.grade = grade;
  1042.  }
  1043.  
  1044.  public int getVitBuff(){
  1045.   return this.vitBuff;
  1046.  }
  1047.  
  1048.  public void setVitBuff(int vitBuff){
  1049.   this.vitBuff = vitBuff;
  1050.  }
  1051.  
  1052.  public int getStrBuff(){
  1053.   return this.strBuff;
  1054.  }
  1055.  
  1056.  public void setStrBuff(int strBuff){
  1057.   this.strBuff = strBuff;
  1058.  }
  1059.  
  1060.  public int getDexBuff(){
  1061.   return this.dexBuff;
  1062.  }
  1063.  
  1064.  public void setDexBuff(int dexBuff){
  1065.   this.dexBuff = dexBuff;
  1066.  }
  1067.  
  1068.  public int getIntBuff(){
  1069.   return this.intBuff;
  1070.  }
  1071.  
  1072.  public void setIntBuff(int intBuff){
  1073.   this.intBuff = intBuff;
  1074.  }
  1075.  
  1076.  public int getLckBuff(){
  1077.   return this.lckBuff;
  1078.  }
  1079.  
  1080.  public void setLckBuff(int lckBuff){
  1081.   this.lckBuff = lckBuff;
  1082.  }
  1083.  
  1084. }
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091. import java.util.Random;
  1092.  
  1093. public class ItemGenerator {
  1094.  
  1095.  private Random rand;
  1096.  private Player player;
  1097.  
  1098.  public ItemGenerator(Random rand, Player player){
  1099.   this.rand = rand;
  1100.   this.player = player;
  1101.  }
  1102.  
  1103.  public void printWait(){
  1104.   System.out.println("[------------- NEW ITEM -------------]\n");
  1105.   try{Thread.sleep(600);}catch(Exception e){}
  1106.   System.out.println("\t  €+++++++++++++++++€");
  1107.   try{Thread.sleep(50);}catch(Exception e){}
  1108.   System.out.println("\t  €+++++++++++++++++€");
  1109.   try{Thread.sleep(100);}catch(Exception e){}
  1110.   System.out.println("\t  €€+++++++++++++++€€");
  1111.   try{Thread.sleep(100);}catch(Exception e){}
  1112.   System.out.println("\t  +€€+++++++++++++€€+");
  1113.   try{Thread.sleep(100);}catch(Exception e){}
  1114.   System.out.println("\t  ++€€+++++++++++€€++");
  1115.   try{Thread.sleep(100);}catch(Exception e){}
  1116.   System.out.println("\t  ++++€€+++++++€€++++");
  1117.   try{Thread.sleep(100);}catch(Exception e){}
  1118.   System.out.println("\t  ++++++€€+++€€++++++");
  1119.   try{Thread.sleep(200);}catch(Exception e){}
  1120.   System.out.println("\t  +++++++€€+€€+++++++");
  1121.   try{Thread.sleep(200);}catch(Exception e){}
  1122.   System.out.println("\t  +++++++€€+€€+++++++");
  1123.   try{Thread.sleep(200);}catch(Exception e){}
  1124.   System.out.println("\t  ++++++++€€€++++++++");
  1125.   try{Thread.sleep(400);}catch(Exception e){}
  1126.   System.out.println("\t  ++++++++€€€++++++++");
  1127.   try{Thread.sleep(400);}catch(Exception e){}
  1128.   System.out.println("\t  +++++++++€+++++++++\n");
  1129.   try{Thread.sleep(600);}catch(Exception e){}
  1130.  }
  1131.  
  1132.  public Item rollItem(){
  1133.   int typeRoll = rand.nextInt(1000);
  1134.   int modifierRoll = rand.nextInt(1000);
  1135.   int nameRoll = rand.nextInt(1000);
  1136.   int gradeRoll = rand.nextInt(1000);
  1137.   int dmgRoll = rand.nextInt(200)+801;
  1138.   Item item;
  1139.  
  1140.   if(typeRoll < 500){
  1141.    item = new Weapon();
  1142.    
  1143.    
  1144.    if(modifierRoll < 400){
  1145.     item.setModifier("Normal");
  1146.    }else if(modifierRoll < 545){
  1147.     item.setModifier("Imbued");
  1148.     item.setIntBuff( ( 400 * player.getIntLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
  1149.    }else if(modifierRoll < 690){
  1150.     item.setModifier("Heavy");
  1151.     item.setVitBuff( ( 300 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
  1152.    }else if(modifierRoll < 835){
  1153.     item.setModifier("Lucky");
  1154.     item.setLckBuff( ( 400 * player.getLckLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 8 / 1000 );
  1155.    }else if(modifierRoll < 980){
  1156.     item.setModifier("Reinforced");
  1157.     item.setStrBuff( ( 400 * player.getStrLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
  1158.     item.setDexBuff( ( 400 * player.getDexLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
  1159.    }else{
  1160.     item.setModifier("Legendary");
  1161.     item.setVitBuff( ( 400 * player.getVitLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
  1162.     item.setStrBuff( ( 800 * player.getStrLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
  1163.     item.setDexBuff( ( 800 * player.getDexLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
  1164.     item.setIntBuff( ( 800 * player.getIntLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
  1165.     item.setLckBuff( ( 800 * player.getLckLvl() / 1000 ) * ( rand.nextInt(250) + 751 ) / 1000 );
  1166.    }
  1167.    
  1168.    if(nameRoll < 200){
  1169.     item.setName("Revolver");
  1170.     item.setDexBuff(item.getDexBuff()+5);
  1171.     item.setLckBuff(item.getLckBuff()+2);
  1172.     ((Weapon)item).setDmg( (4 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000 ) + (2 * (player.getLckLvl() + item.getLckBuff() ) * dmgRoll / 1000) );
  1173.    }else if(nameRoll < 400){
  1174.     item.setName("Broadsword");
  1175.     item.setStrBuff(item.getStrBuff()+4);
  1176.     item.setDexBuff(item.getDexBuff()+1);
  1177.     ((Weapon)item).setDmg( (5 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000 ) + (1 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
  1178.    }else if(nameRoll < 600){
  1179.     item.setName("Staff");
  1180.     item.setDexBuff(item.getDexBuff()+1);
  1181.     item.setIntBuff(item.getIntBuff()+4);
  1182.     ((Weapon)item).setDmg( (5 * (player.getIntLvl() + item.getIntBuff() ) * dmgRoll / 1000 ) + (1 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
  1183.    }else if(nameRoll < 800){
  1184.     item.setName("Bow");
  1185.     item.setDexBuff(item.getDexBuff()+4);
  1186.     item.setStrBuff(item.getStrBuff()+1);
  1187.     ((Weapon)item).setDmg( (4 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000 ) + (1 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
  1188.    }else{
  1189.     item.setName("Warhammer");
  1190.     item.setVitBuff(item.getVitBuff()+2);
  1191.     item.setStrBuff(item.getStrBuff()+3);
  1192.     ((Weapon)item).setDmg( (4 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + (3 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
  1193.    }
  1194.    
  1195.    if(gradeRoll < 100){
  1196.     item.setGrade("D");
  1197.     ((Weapon)item).scaleDmg(0.8);
  1198.     item.setValue(100);
  1199.    }else if(gradeRoll < 300){
  1200.    item.setGrade("C");
  1201.    item.scaleBuffs(1.5);
  1202.    item.setValue(200);
  1203.    }else if(gradeRoll < 700){
  1204.     item.setGrade("B");
  1205.     ((Weapon)item).scaleDmg(1.4);
  1206.     item.scaleBuffs(2.5);
  1207.     item.setValue(300);
  1208.    }else if(gradeRoll < 950){
  1209.     item.setGrade("A");
  1210.     ((Weapon)item).scaleDmg(1.8);
  1211.     item.scaleBuffs(3.5);
  1212.     item.setValue(400);
  1213.    }else if(gradeRoll < 985){
  1214.     item.setGrade("S");
  1215.     ((Weapon)item).scaleDmg(2.5);
  1216.     item.scaleBuffs(5.0);
  1217.     item.setValue(500);
  1218.    }
  1219.    
  1220.    
  1221.   }else{
  1222.    item = new Armor();
  1223.    
  1224.    if(modifierRoll < 400){
  1225.     item.setModifier("Normal");
  1226.    }else if(modifierRoll < 575){
  1227.     item.setModifier("Imbued");
  1228.     item.setIntBuff( ( 300 * player.getIntLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
  1229.    }else if(modifierRoll < 750){
  1230.     item.setModifier("Heavy");
  1231.     item.setVitBuff( ( 300 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
  1232.    }else if(modifierRoll < 925){
  1233.     item.setModifier("Lucky");
  1234.     item.setLckBuff( ( 300 * player.getLckLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 6 / 1000 );
  1235.    }else{
  1236.     item.setModifier("Chipped");
  1237.     item.setVitBuff( ( 100 * player.getVitLvl() / 1000 ) * ( ( rand.nextInt(250) + 751 ) / 1000 ) + ( rand.nextInt(250) + 751 ) * 4 / 1000 );
  1238.    }
  1239.    
  1240.    if(nameRoll < 200){
  1241.     item.setName("Chainmail");
  1242.     item.setVitBuff(item.getVitBuff() + 2);
  1243.     ((Armor)item).setHealth( (13 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
  1244.    }else if(nameRoll < 400){
  1245.     item.setName("Platebody");
  1246.     item.setVitBuff(item.getVitBuff() + 4);
  1247.     ((Armor)item).setHealth( (15 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getStrLvl() + item.getStrBuff() ) * dmgRoll / 1000) );
  1248.    }else if(nameRoll < 600){
  1249.     item.setName("Robes");
  1250.     item.setVitBuff(item.getVitBuff() + 2);
  1251.     ((Armor)item).setHealth( (12 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getIntLvl() + item.getIntBuff() ) * dmgRoll / 1000) );
  1252.    }else if(nameRoll < 800){
  1253.     item.setName("Bracers");
  1254.     item.setVitBuff(item.getVitBuff() + 3);
  1255.     ((Armor)item).setHealth( (13 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 3 * (player.getDexLvl() + item.getDexBuff() ) * dmgRoll / 1000) );
  1256.    }else{
  1257.     item.setName("Formal Wear");
  1258.     item.setVitBuff(item.getVitBuff() + 1);
  1259.     ((Armor)item).setHealth( (9 * (player.getVitLvl() + item.getVitBuff() ) * dmgRoll / 1000 ) + ( 7 * (player.getLckLvl() + item.getLckBuff() ) * dmgRoll / 1000) );
  1260.    }
  1261.    
  1262.    if(gradeRoll < 100){
  1263.     item.setGrade("D");
  1264.     ((Armor)item).scaleHealth(0.8);
  1265.     item.setValue(100);
  1266.    }else if(gradeRoll < 300){
  1267.    item.setGrade("C");
  1268.    ((Armor)item).scaleBuffs(1.5);
  1269.    item.setValue(200);
  1270.    }else if(gradeRoll < 700){
  1271.     item.setGrade("B");
  1272.     ((Armor)item).scaleHealth(1.1);
  1273.     item.scaleBuffs(2.5);
  1274.     item.setValue(300);
  1275.    }else if(gradeRoll < 950){
  1276.     item.setGrade("A");
  1277.     ((Armor)item).scaleHealth(1.2);
  1278.     item.scaleBuffs(3.5);
  1279.     item.setValue(400);
  1280.    }else{
  1281.     item.setGrade("S");
  1282.     ((Armor)item).scaleHealth(1.4);
  1283.     item.scaleBuffs(5.0);
  1284.     item.setValue(500);
  1285.    }
  1286.    
  1287.   }
  1288.    item.setValue(item.getValue() + 20 * ( item.getVitBuff() + item.getStrBuff() + item.getDexBuff() + item.getIntBuff() + item.getLckBuff() ) );
  1289.   if(item.getClass() == Weapon.class){
  1290.    item.setValue(item.getValue() + 1100 * ((Weapon)item).getDmg() / 1000 );
  1291.   }else{
  1292.    item.setValue(item.getValue() + 400 * ((Armor)item).getHealth() / 1000 );
  1293.   }
  1294.  
  1295.   return item;
  1296.  
  1297.  }
  1298.  
  1299. }
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307. import java.util.Scanner;
  1308. import java.util.Random;
  1309.  
  1310. public class Launcher {
  1311.  
  1312.  public static void main(String[] args)
  1313.  {
  1314.  
  1315.   Scanner scan = new Scanner(System.in);
  1316.   Random rand = new Random();
  1317.   Game game = new Game(scan,rand);
  1318.   game.test();
  1319.  }
  1320.  
  1321. }
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327. import java.util.Scanner;
  1328.  
  1329. public class Lobby {
  1330.  
  1331.  private Blacksmith blacksmith;
  1332.  private FightArena fa;
  1333.  private Scanner scan;
  1334.  private Player player;
  1335.  private String input;
  1336.  
  1337.  public Lobby(Scanner scan, Player player, FightArena fa, Blacksmith blacksmith){
  1338.   this.blacksmith = blacksmith;
  1339.   this.scan = scan;
  1340.   this.player = player;
  1341.   this.fa = fa;
  1342.  }
  1343.  
  1344.  public void printBreaker(){
  1345.   System.out.println("[---------------------------------------]");
  1346.  }
  1347.  
  1348.  public void mainLoop(){
  1349.   for(;;){
  1350.    if(player.canLevel()){
  1351.     levelLoop();
  1352.    }else{
  1353.     System.out.println("[---------------- LOBBY ----------------]\n");
  1354.     System.out.println(" > Welcome to the lobby. There is a training arena here.\n");
  1355.     System.out.println(" > [HP] : "+player.getCurHealth()+" / "+player.getMaxHealth()+"\n");
  1356.     System.out.println(" > [GOLD] : "+player.getGold()+"\n");
  1357.     printBreaker();
  1358.     System.out.println(" [F] - Enter Training Arena");
  1359.     System.out.println(" [S] - Check Stats");
  1360.     System.out.println(" [H] - Rest ( "+player.getRestCharges()+" / 3 )");
  1361.     System.out.println(" [B] - Services");
  1362.     System.out.println(" [Q] - Exit Lobby");
  1363.     printBreaker();
  1364.     System.out.print(" > ");
  1365.     input = scan.nextLine();
  1366.     System.out.println("\n");
  1367.     if(input.equals("f")){
  1368.      fa.fight();
  1369.      blacksmith.addCounter();
  1370.      blacksmith.refreshItems();
  1371.      if(!player.isAlive())
  1372.       break;
  1373.     }else if(input.equals("s")){
  1374.      player.printStats();
  1375.     }else if(input.equals("h")){
  1376.      if(player.getRestCharges()>0 && player.getCurHealth() != player.getMaxHealth()){
  1377.       player.heal(56 + 18 * player.getVitLvl());
  1378.       player.useRestCharge();
  1379.       System.out.println(" > You rest for awhile, healing "+(56 + 18*player.getVitLvl())+" HP.\n");
  1380.       System.out.println(" > [HP] : "+player.getCurHealth()+" / "+player.getMaxHealth()+"\n");
  1381.      }else{
  1382.       System.out.println(" > You may not rest at this time.\n\n");
  1383.      }
  1384.     }else if(input.equals("b")){
  1385.      servicesLoop();
  1386.     }else if(input.equals("q")){
  1387.      break;
  1388.     }else{
  1389.      System.out.println("Invalid Input. Try Again.\n");
  1390.     }
  1391.    }
  1392.   }
  1393.  }
  1394.  
  1395.  public void servicesLoop(){
  1396.   int reqExp = player.getTargetExp() - player.getCurExp();
  1397.   int levelCost = 2500 * reqExp / 1000;
  1398.   int respecCost = 50 * player.getLevel();
  1399.   for(;;){
  1400.    System.out.println("[-------------- SERVICES --------------]\n");
  1401.    System.out.println(" > \"What can I do for you today?\"\n");
  1402.    System.out.println(" > [GOLD] : "+player.getGold()+"\n");
  1403.    printBreaker();
  1404.    System.out.println(" [R] - Reassign ( "+respecCost+" GOLD )");
  1405.    System.out.println(" [B] - Level Up ( "+levelCost+" GOLD )");
  1406.    System.out.println(" [K] - Blacksmith");
  1407.    System.out.println(" [Q] - Exit Services");
  1408.    printBreaker();
  1409.    System.out.print(" > ");
  1410.    input = scan.nextLine();
  1411.    System.out.println();
  1412.    if(input.equals("r")){
  1413.     if(player.getGold() >= respecCost){
  1414.      player.useGold(respecCost);
  1415.      respec();
  1416.     }else System.out.println("Not Enough GOLD\n!");
  1417.    }else if(input.equals("b")){
  1418.     if(player.getGold() >= levelCost){
  1419.      player.giveExp(reqExp);
  1420.      player.useGold(levelCost);
  1421.      levelLoop();
  1422.     }else System.out.println("Not Enough GOLD\n!");
  1423.    }else if(input.equals("k")){
  1424.     blacksmith.menuLoop();
  1425.    }else if(input.equals("q")){
  1426.     break;
  1427.    }else{
  1428.     System.out.println("Invalid Input. Try Again.\n");
  1429.    }
  1430.   }
  1431.  }
  1432.  
  1433.  public void chooseName(){
  1434.   System.out.println("[---------------- NAME ----------------]\n");
  1435.   System.out.println(" > What Is Your Name?\n");
  1436.   printBreaker();
  1437.   System.out.print(" > ");
  1438.   input = scan.nextLine();
  1439.   System.out.println("\n");
  1440.   player.setName(input);
  1441.  }
  1442.  
  1443.  public void chooseSex(){
  1444.   for(;;){
  1445.    System.out.println("[---------------- SEX ----------------]\n");
  1446.    System.out.println(" > What Is Your Sex?\n");
  1447.    printBreaker();
  1448.    System.out.println(" [M] - Male");
  1449.    System.out.println(" [F] - Female");
  1450.    printBreaker();
  1451.    System.out.print(" > ");
  1452.    input = scan.nextLine();
  1453.    System.out.println("\n");
  1454.    if(input.equals("m")){
  1455.     player.setSex("M");
  1456.     break;
  1457.    }else if(input.equals("f")){
  1458.     player.setSex("F");
  1459.     break;
  1460.    }else{
  1461.     System.out.println("Invalid Input. Try Again.\n");
  1462.    }
  1463.   }
  1464.  }
  1465.  
  1466.  public void levelLoop(){
  1467.   for(;;){
  1468.    System.out.println("[-------------- LEVEL UP --------------]\n");
  1469.    System.out.println(" > Congratulations! You Just Advanced A Level.\n");
  1470.    System.out.println(" > Select A Skill To Increase.\n");
  1471.    printBreaker();
  1472.    System.out.println(" [1] - [VIT]\t: " +player.getBaseVit()+" -> "+ (player.getBaseVit()+1));
  1473.    System.out.println(" [2] - [STR]\t: " +player.getBaseStr()+" -> "+ (player.getBaseStr()+1));
  1474.    System.out.println(" [3] - [DEX]\t: " +player.getBaseDex()+" -> "+ (player.getBaseDex()+1));
  1475.    System.out.println(" [4] - [INT]\t: " +player.getBaseInt()+" -> "+ (player.getBaseInt()+1));
  1476.    System.out.println(" [5] - [LCK]\t: " +player.getBaseLck()+" -> "+ (player.getBaseLck()+1));
  1477.    printBreaker();
  1478.    System.out.print(" > ");
  1479.    input = scan.nextLine();
  1480.    System.out.println("\n");
  1481.    if(input.equals("1")){
  1482.     player.levelVit();
  1483.     break;
  1484.    }else if(input.equals("2")){
  1485.     player.levelStr();
  1486.     break;
  1487.    }else if(input.equals("3")){
  1488.     player.levelDex();
  1489.     break;
  1490.    }else if(input.equals("4")){
  1491.     player.levelInt();
  1492.     break;
  1493.    }else if(input.equals("5")){
  1494.     player.levelLck();
  1495.     break;
  1496.    }else{
  1497.     System.out.println("Invalid Input. Try Again.");
  1498.    }
  1499.   }
  1500.  }
  1501.  
  1502.  public void respec(){
  1503.   boolean confirm = false;
  1504.   int levels = player.getLevel();
  1505.   int assignment;
  1506.   while(!confirm){
  1507.    chooseClass();
  1508.    int remaining = levels;
  1509.    System.out.println("[-------------- RE SPEC --------------]\n");
  1510.    System.out.println(" > Skill Points Remaining: "+remaining+"\n");
  1511.    for(;;){
  1512.     try{
  1513.      printBreaker();
  1514.      System.out.print(" > Set [VIT] : ");
  1515.      input = scan.nextLine();
  1516.      System.out.println();
  1517.      assignment = Integer.parseInt(input);
  1518.      if(remaining - assignment >= 0){
  1519.       remaining -= assignment;
  1520.       player.setVitLvl(assignment);
  1521.       break;
  1522.      }else System.out.println("Not enough Skill Points.\n");
  1523.     }catch(Exception e){
  1524.      System.out.println("Invalid Input. Try Again.");
  1525.     }
  1526.    }
  1527.    System.out.println(" > Skill Points Remaining: "+remaining+"\n");
  1528.    for(;;){
  1529.     try{
  1530.      printBreaker();
  1531.      System.out.print(" > Set [STR] : ");
  1532.      input = scan.nextLine();
  1533.      System.out.println();
  1534.      assignment = Integer.parseInt(input);
  1535.      if(remaining - assignment >= 0){
  1536.       remaining -= assignment;
  1537.       player.setStrLvl(assignment);
  1538.       break;
  1539.      }else System.out.println("Not enough Skill Points.\n");
  1540.     }catch(Exception e){
  1541.      System.out.println("Invalid Input. Try Again.");
  1542.     }
  1543.    }
  1544.    System.out.println(" > Skill Points Remaining: "+remaining+"\n");
  1545.    for(;;){
  1546.     try{
  1547.      printBreaker();
  1548.      System.out.print(" > Set [DEX] : ");
  1549.      input = scan.nextLine();
  1550.      System.out.println();
  1551.      assignment = Integer.parseInt(input);
  1552.      if(remaining - assignment >= 0){
  1553.       remaining -= assignment;
  1554.       player.setDexLvl(assignment);
  1555.       break;
  1556.      }else System.out.println("Not enough Skill Points.\n");
  1557.     }catch(Exception e){
  1558.      System.out.println("Invalid Input. Try Again.");
  1559.     }
  1560.    }
  1561.    System.out.println(" > Skill Points Remaining: "+remaining+"\n");
  1562.    for(;;){
  1563.     try{
  1564.      printBreaker();
  1565.      System.out.print(" > Set [INT] : ");
  1566.      input = scan.nextLine();
  1567.      System.out.println();
  1568.      assignment = Integer.parseInt(input);
  1569.      if(remaining - assignment >= 0){
  1570.       remaining -= assignment;
  1571.       player.setIntLvl(assignment);
  1572.       break;
  1573.      }else System.out.println("Not enough Skill Points.\n");
  1574.     }catch(Exception e){
  1575.      System.out.println("Invalid Input. Try Again.");
  1576.     }
  1577.    }
  1578.    System.out.println(" > Skill Points Remaining: "+remaining+"\n");
  1579.    for(;;){
  1580.     try{
  1581.      printBreaker();
  1582.      System.out.print(" > Set [LCK] : ");
  1583.      input = scan.nextLine();
  1584.      System.out.println();
  1585.      assignment = Integer.parseInt(input);
  1586.      if(remaining - assignment >= 0){
  1587.       remaining -= assignment;
  1588.       player.setLckLvl(assignment);
  1589.       break;
  1590.      }else System.out.println("Not enough Skill Points.\n");
  1591.     }catch(Exception e){
  1592.      System.out.println("Invalid Input. Try Again.");
  1593.     }
  1594.    }
  1595.    System.out.println();
  1596.    for(;;){
  1597.     player.setLevel(player.getBaseVit() + player.getBaseStr() + player.getBaseDex() + player.getBaseInt() + player.getBaseLck());
  1598.     player.printStats();
  1599.     printBreaker();
  1600.     System.out.println("\n > Do you wish to continue with these settings?\n");
  1601.     printBreaker();
  1602.     System.out.println(" [Y] - Yes");
  1603.     System.out.println(" [N] - No");
  1604.     printBreaker();
  1605.     System.out.print(" > ");
  1606.     String input = scan.nextLine();
  1607.     System.out.println("\n");
  1608.     if(input.equals("y")){
  1609.      confirm = true;
  1610.      break;
  1611.     }else if(input.equals("n")){
  1612.      confirm = false;
  1613.      break;
  1614.     }else{
  1615.      System.out.println("Invalid Input. Try Again.\n");
  1616.     }
  1617.    }
  1618.   }
  1619.  }
  1620.  
  1621.  public void chooseClass(){
  1622.   for(;;){
  1623.    System.out.println("[---------------- CLASS ----------------]\n");
  1624.    System.out.println(" > What Is Your Class?\n");
  1625.    printBreaker();
  1626.    System.out.println(" [1] - Gunslinger");
  1627.    System.out.println(" [2] - Barbarian");
  1628.    printBreaker();
  1629.    System.out.print(" > ");
  1630.    input = scan.nextLine();
  1631.    System.out.println("\n");
  1632.    if(input.equals("1")){
  1633.     player.setType("Gunslinger");
  1634.     break;
  1635.    }else if(input.equals("2")){
  1636.     player.setType("Barbarian");
  1637.     break;
  1638.    }else{
  1639.     System.out.println("Invalid Input. Try Again.\n");
  1640.    }
  1641.   }
  1642.  }
  1643.  
  1644.  public void chooseDifficulty(){
  1645.   for(;;){
  1646.    System.out.println("[------------- DIFFICULTY -------------]\n");
  1647.    System.out.println(" > Set Your Difficulty.\n");
  1648.    printBreaker();
  1649.    System.out.println(" [1] - Pussy Mode");
  1650.    System.out.println(" [2] - Regular Mode");
  1651.    System.out.println(" [3] - Gatekeeper Mode");
  1652.    printBreaker();
  1653.    System.out.print(" > ");
  1654.    input = scan.nextLine();
  1655.    System.out.println("\n");
  1656.    if(input.equals("1")){
  1657.     player.setDifficulty("Pussy");
  1658.     break;
  1659.    }else if(input.equals("2")){
  1660.     player.setDifficulty("Regular");
  1661.     break;
  1662.    }else if(input.equals("3")){
  1663.     player.setDifficulty("Gatekeeper");
  1664.     break;
  1665.    }else{
  1666.     System.out.println("Invalid Input. Try Again.\n");
  1667.    }
  1668.   }
  1669.  }
  1670.  
  1671.  
  1672.  
  1673. }
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681. public class Player extends Entity {
  1682.  
  1683.  private String type, sex;
  1684.  private int gold, restCharges;
  1685.  private String attackStyle, attackDesc, difficulty;
  1686.  private int curExp, targetExp, level;
  1687.  
  1688.  public Player(){
  1689.   gold = 0;
  1690.   setComboMeter(1);
  1691.   attackStyle = "";
  1692.   difficulty = "Normal";
  1693.   restCharges = 3;
  1694.   targetExp = 50;
  1695.  }
  1696.  
  1697.  public int getAttack(){
  1698.   int totalDmg = 0;
  1699.   if(type.equals("Barbarian")){
  1700.    if(getComboMeter() == 1){
  1701.     // 0.3 [DMG] +4 [STR] (+2 Dmg Dealt Heal)
  1702.     totalDmg = 300 * getWeapon().getDmg() / 1000 + 4 * getStrLvl();
  1703.     heal(2000 * totalDmg / 1000);
  1704.    }else if(getComboMeter() == 2){
  1705.     // 0.5 [DMG] +6 [STR] +3 [DEX]
  1706.     totalDmg = 500 * getWeapon().getDmg() / 1000 + 6 * getStrLvl() + 3 * getDexLvl();
  1707.    }else if(getComboMeter() == 3){
  1708.     // [DMG] +5 [STR] +.5 Missing [HP]
  1709.     totalDmg =  getWeapon().getDmg() + 5 * getStrLvl() + 500 * ( getMaxHealth() - getCurHealth() ) / 1000;
  1710.    }
  1711.   }else if(type.equals("Gunslinger")){
  1712.    if(getComboMeter() == 1){
  1713.     // .6 [DMG] +4 [DEX]
  1714.     totalDmg = 600 * getWeapon().getDmg() / 1000 + 4 * getDexLvl();
  1715.    }else if(getComboMeter() == 2){
  1716.     // [DMG] +0.2 Current [HP]
  1717.     totalDmg = getWeapon().getDmg() + 200 * getCurHealth() / 1000;
  1718.    }else if(getComboMeter() == 3){
  1719.     // .6 [DMG] +8 [LCK] (+.8 Dmg Dealt Heal)
  1720.     totalDmg = 600 * getWeapon().getDmg() / 1000 + 8 * getLckLvl();
  1721.     heal(800 * totalDmg / 1000);
  1722.    }
  1723.   }
  1724.   return totalDmg;
  1725.  }
  1726.  
  1727.  public String getAttackStyle(){
  1728.   if(type.equals("Barbarian")){
  1729.    if(getComboMeter() == 1){
  1730.     attackStyle = "Whirlwind";
  1731.     attackDesc = ".3 [DMG] +4 [STR] (+2 Dmg Dealt Heal)";
  1732.    }else if(getComboMeter() == 2){
  1733.     attackStyle = "Frenzy";
  1734.     attackDesc = ".5 [DMG] +6 [STR] +3 [DEX]";
  1735.    }else if(getComboMeter() == 3){
  1736.     attackStyle = "Final Blow";
  1737.     attackDesc = "[DMG] +5 [STR] +.5 Miss [HP]";
  1738.    }
  1739.   }else if(type.equals("Gunslinger")){
  1740.    if(getComboMeter() == 1){
  1741.     attackStyle = "Love Tap";
  1742.     attackDesc = ".6 [DMG] +4 [DEX]";
  1743.    }else if(getComboMeter() == 2){
  1744.     attackStyle = "Showdown";
  1745.     attackDesc = "[DMG] +.1 Current [HP]";
  1746.    }else if(getComboMeter() == 3){
  1747.     attackStyle = "Lucky Shot";
  1748.     attackDesc = ".6 [DMG] +8 [LCK] (+.8 Dmg Dealt Heal)";
  1749.    }
  1750.   }
  1751.   return this.attackStyle;
  1752.  }
  1753.  
  1754.  public String getAttackDesc(){
  1755.   return this.attackDesc;
  1756.  }
  1757.  
  1758.  public int getRestCharges(){
  1759.   return restCharges;
  1760.  }
  1761.  
  1762.  public void useRestCharge(){
  1763.   restCharges--;
  1764.  }
  1765.  
  1766.  public void giveRestCharge(){
  1767.   restCharges = Math.min(3,restCharges+1);
  1768.  }
  1769.  
  1770.  public String getDifficulty(){
  1771.   return this.difficulty;
  1772.  }
  1773.  
  1774.  public void setDifficulty(String difficulty){
  1775.   this.difficulty = difficulty;
  1776.  }
  1777.  
  1778.  public void giveGold(int gold){
  1779.   this.gold += gold;
  1780.  }
  1781.  
  1782.  public void giveExp(int exp){
  1783.   curExp += exp;
  1784.  }
  1785.  
  1786.  public boolean canLevel(){
  1787.   boolean levelUp = false;
  1788.   if(curExp >= targetExp){
  1789.    curExp = 0;
  1790.    targetExp = 1300 * targetExp / 1000;
  1791.    level++;
  1792.    setCurHealth(getMaxHealth());
  1793.    levelUp = true;
  1794.   }
  1795.   return levelUp;
  1796.  }
  1797.  
  1798.  public void printStats(){
  1799.   System.out.println("[---------------- STATS ----------------]\n");
  1800.   System.out.println("Name:\t\t"+getName()+" ("+sex+") {"+type+"}");
  1801.   System.out.println("Weapon:\t"+getWeapon().getModifier()+" "+getWeapon().getName()+" ["+getWeapon().getGrade()+"]");
  1802.   System.out.println("Armor:\t\t"+getArmor().getModifier()+" "+getArmor().getName() + " ["+getArmor().getGrade() + "]\n");
  1803.   System.out.println("[HP] :\t"+getCurHealth()+" / "+getMaxHealth());
  1804.   System.out.println("[DMG] :\t"+getWeapon().getDmg());
  1805.   System.out.println("[VIT] :\t"+getVitLvl()+"\t("+getBaseVit()+")");
  1806.   System.out.println("[STR] :\t"+getStrLvl()+"\t("+getBaseStr()+")");
  1807.   System.out.println("[DEX] :\t"+getDexLvl()+"\t("+getBaseDex()+")\t\tLVL:\t"+getLevel());
  1808.   System.out.println("[INT] :\t"+getIntLvl()+"\t("+getBaseInt()+")\t\tEXP:\t"+curExp+" / "+targetExp);
  1809.   System.out.println("[LCK] :\t"+getLckLvl()+"\t("+getBaseLck()+")\t\tGOLD:\t"+gold+"\n");
  1810.  
  1811.  }
  1812.  
  1813.  public int getCurExp(){
  1814.   return Math.min(curExp, targetExp);
  1815.  }
  1816.  
  1817.  public void setCurExp(int curExp){
  1818.   this.curExp = curExp;
  1819.  }
  1820.  
  1821.  public int getTargetExp(){
  1822.   return this.targetExp;
  1823.  }
  1824.  
  1825.  public void setTargetExp(int targetExp){
  1826.   this.targetExp = targetExp;
  1827.  }
  1828.  
  1829.  public int getLevel(){
  1830.   return this.level;
  1831.  }
  1832.  
  1833.  public void setLevel(int level){
  1834.   this.level = level;
  1835.  }
  1836.  
  1837.  public String getType(){
  1838.   return this.type;
  1839.  }
  1840.  
  1841.  public void setType(String type){
  1842.   this.type = type;
  1843.   if(type.equals("Gunslinger")){
  1844.    setVitLvl(8);
  1845.    setStrLvl(5);
  1846.    setDexLvl(13);
  1847.    setIntLvl(5);
  1848.    setLckLvl(14);
  1849.   }else if(type.equals("Barbarian")){
  1850.    setVitLvl(8);
  1851.    setStrLvl(12);
  1852.    setDexLvl(8);
  1853.    setIntLvl(5);
  1854.    setLckLvl(12);
  1855.   }
  1856.   setBaseHealth(getVitLvl()*15);
  1857.   level = getBaseVit() + getBaseStr() + getBaseDex() + getBaseInt() + getBaseLck();
  1858.  }
  1859.  
  1860.  public String getSex(){
  1861.   return this.sex;
  1862.  }
  1863.  
  1864.  public void setSex(String sex){
  1865.   this.sex = sex;
  1866.  }
  1867.  
  1868.  public int getGold(){
  1869.   return this.gold;
  1870.  }
  1871.  
  1872.  public void useGold(int gold){
  1873.   this.gold -= gold;
  1874.  }
  1875.  
  1876. }
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883. public class Weapon extends Item {
  1884.  
  1885.  private int dmg;
  1886.  
  1887.  public Weapon(){
  1888.   setName("Dagger");
  1889.   setDmg(30);
  1890.  }
  1891.  
  1892.  public void compare(Weapon old){
  1893.   System.out.println("[----------- NEW WEAPON -----------]\n");
  1894.   System.out.println("  "+old.getModifier()+" "+ old.getName()+" ["+old.getGrade()+"]\n\t-> "+getModifier()+" "+getName()+" ["+getGrade()+"]");
  1895.   System.out.println("\t\t"+old.getDmg()+" -> "+getDmg()+" [DMG]");
  1896.   System.out.println("\t\t"+old.getVitBuff()+" -> "+getVitBuff()+" [VIT]");
  1897.   System.out.println("\t\t"+old.getStrBuff()+" -> "+getStrBuff()+" [STR]");
  1898.   System.out.println("\t\t"+old.getDexBuff()+" -> "+getDexBuff()+" [DEX]");
  1899.   System.out.println("\t\t"+old.getIntBuff()+" -> "+getIntBuff()+" [INT]");
  1900.   System.out.println("\t\t"+old.getLckBuff()+" -> "+getLckBuff()+" [LCK]");
  1901.  }
  1902.  
  1903.  public void scaleDmg(double scale){
  1904.   dmg *= scale;
  1905.  }
  1906.  
  1907.  public int getDmg(){
  1908.   return this.dmg;
  1909.  }
  1910.  
  1911.  public void setDmg(int dmg){
  1912.   this.dmg = dmg;
  1913.  }
  1914.  
  1915. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement