Advertisement
Guest User

simple calculator

a guest
Nov 12th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.43 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Collections;
  3.  
  4. public class GearOptimizer{
  5.    
  6.     /***** BEGIN SETTINGS *****/
  7.     private static boolean mwExotic = false;
  8.    
  9.     private static boolean mwHelmet = true;
  10.     private static boolean mwGlove = true;
  11.     private static boolean mwChest = true;
  12.     private static boolean mwBoot = true;
  13.    
  14.     private static Gear gearMinimum = new Gear("min", 0, 0, 30, 60, 30, 40);
  15.     private static int minStatPoints = 24;
  16.     private static int minWasted = 20;
  17.     /***** END SETTINGS *****/
  18.    
  19.     public static void main(String []args) {
  20.  
  21.         /***** BEGIN EXOTICS *****/
  22.         Gear nezarac = new Gear("Nezarac", 10, 7, 7, 6, 6, 10);
  23.         if(mwExotic) nezarac.masterwork();
  24.         Gear tempest = new Gear("Tempest", 13, 6, 7, 6, 12, 6);
  25.         if(mwExotic) tempest.masterwork();
  26.         Gear contraverse = new Gear("Contraverse", 6, 6, 12, 12, 6, 6);
  27.         if(mwExotic) contraverse.masterwork();
  28.         Gear ophidian = new Gear("Ophidian", 11, 6, 7, 6, 6, 12);
  29.         if(mwExotic) ophidian.masterwork();
  30.         /***** END EXOTICS *****/
  31.        
  32.         //setup the list of gear
  33.         ArrayList<Gear> helmets = mwHelmet ? masterworkedSlot(getHelmets()) : getHelmets();
  34.         ArrayList<Gear> gloves = mwGlove ? masterworkedSlot(getGloves()) : getGloves();
  35.         ArrayList<Gear> chests = mwChest ? masterworkedSlot(getChests()) : getChests();
  36.         ArrayList<Gear> boots = mwBoot ? masterworkedSlot(getBoots()) : getBoots();
  37.        
  38.         ArrayList<Set> set = new ArrayList<>();
  39.         System.out.println("Tempest");
  40.         for(Gear glove : gloves) {
  41.             for(Gear chest : chests) {
  42.                 for(Gear boot : boots) {
  43.                     Set tempestSet = new Set(tempest, glove, chest, boot);
  44.                     if(qualifiedSet(tempestSet)) {
  45.                         set.add(tempestSet);
  46.                     }
  47.                 }
  48.             }
  49.         }
  50.         Collections.sort(set);
  51.         for(Set setItem : set) {
  52.             System.out.println(setItem.toString());
  53.         }
  54.         set.clear();
  55.        
  56.         System.out.println("Tempest Revised");
  57.         for(Gear glove : gloves) {
  58.             for(Gear chest : chests) {
  59.                 for(Gear boot : boots) {
  60.                     Set tempestSet = new Set(tempest, glove, chest, boot);
  61.                     if(qualifiedSet(tempestSet) && chest.getName().equals("C5") && boot.getName().equals("B7")) {
  62.                         set.add(tempestSet);
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.         Collections.sort(set);
  68.         for(Set setItem : set) {
  69.             System.out.println(setItem.toString());
  70.         }
  71.         set.clear();
  72.        
  73.         System.out.println("Contraverse");
  74.         for(Gear helmet : helmets) {
  75.             for(Gear chest : chests) {
  76.                 for(Gear boot : boots) {
  77.                     Set contraverseSet = new Set(helmet, contraverse, chest, boot);
  78.                     if(qualifiedSet(contraverseSet)) {
  79.                         set.add(contraverseSet);
  80.                     }
  81.                 }
  82.             }
  83.         }
  84.         Collections.sort(set);
  85.         for(Set setItem : set) {
  86.             System.out.println(setItem.toString());
  87.         }
  88.         set.clear();
  89.        
  90.         System.out.println("Ophidian Revised");
  91.         for(Gear helmet : helmets) {
  92.             for(Gear chest : chests) {
  93.                 for(Gear boot : boots) {
  94.                     Set ophidianSet = new Set(helmet, ophidian, chest, boot);
  95.                     if(qualifiedSet(ophidianSet) && helmet.getName().equals("H3") && chest.getName().equals("C5") && boot.getName().equals("B7")) {
  96.                         set.add(ophidianSet);
  97.                     }
  98.                 }
  99.             }
  100.         }
  101.         Collections.sort(set);
  102.         for(Set setItem : set) {
  103.             System.out.println(setItem.toString());
  104.         }
  105.         set.clear();
  106.     }
  107.    
  108.     public static boolean qualifiedSet(Set setItem) {
  109.         return (setItem.getMobility() >= gearMinimum.getMobility() &&
  110.                 setItem.getResilience() >= gearMinimum.getResilience() &&
  111.                 setItem.getRecovery() >= gearMinimum.getRecovery() &&
  112.                 setItem.getDiscipline() >= gearMinimum.getDiscipline() &&
  113.                 setItem.getIntellect() >= gearMinimum.getIntellect() &&
  114.                 setItem.getStrength() >= gearMinimum.getStrength() &&
  115.                 setItem.getTotal() >= minStatPoints &&
  116.                 setItem.getWasted() <= minWasted);
  117.     }
  118.    
  119.     public static ArrayList<Gear> masterworkedSlot(ArrayList<Gear> gearList) {
  120.         for(Gear gear : gearList) {
  121.             gear.masterwork();
  122.         }
  123.        
  124.         return gearList;
  125.     }
  126.    
  127.     public static ArrayList<Gear> getHelmets() {
  128.         ArrayList<Gear> helmets = new ArrayList<>();
  129.        
  130.         helmets.add(new Gear("H1", 2, 8, 18, 12, 7, 10));
  131.         helmets.add(new Gear("H2", 2, 2, 22, 7, 13, 7));
  132.         helmets.add(new Gear("H3", 9, 12, 6, 12, 7, 8));
  133.         helmets.add(new Gear("H4", 14, 2, 14, 2, 12, 17));
  134.         helmets.add(new Gear("H5", 6, 6, 15, 13, 6, 12));
  135.        
  136.         return helmets;
  137.     }
  138.    
  139.     public static ArrayList<Gear> getGloves() {
  140.         ArrayList<Gear> gloves = new ArrayList<>();
  141.        
  142.         gloves.add(new Gear("G1", 7, 8, 15, 11, 8, 9));
  143.         gloves.add(new Gear("G2", 11, 2, 15, 6, 16, 10));
  144.         gloves.add(new Gear("G3", 2, 22, 6, 2, 10, 18));
  145.         gloves.add(new Gear("G4", 17, 7, 2, 2, 13, 13));
  146.         gloves.add(new Gear("G5", 13, 2, 16, 7, 13, 7));
  147.         gloves.add(new Gear("G6", 14, 2, 10, 18, 6, 2));
  148.         gloves.add(new Gear("G7", 10, 6, 12, 9, 13, 6));
  149.         gloves.add(new Gear("G8", 20, 2, 6, 8, 16, 2));
  150.        
  151.         return gloves;
  152.     }
  153.    
  154.     public static ArrayList<Gear> getChests() {
  155.         ArrayList<Gear> chests = new ArrayList<>();
  156.        
  157.         chests.add(new Gear("C1", 7, 6, 15, 9, 12, 11));
  158.         chests.add(new Gear("C2", 8, 8, 10, 13, 14, 2));
  159.         chests.add(new Gear("C3", 10, 8, 7, 8, 6, 12));
  160.         chests.add(new Gear("C4", 2, 2, 22, 6, 12, 8));
  161.         chests.add(new Gear("C5", 10, 8, 7, 6, 7, 16));
  162.         chests.add(new Gear("C6", 7, 7, 13, 15, 8, 6));
  163.         chests.add(new Gear("C7", 2, 12, 13, 10, 16, 2));
  164.         chests.add(new Gear("C8", 7, 6, 11, 13, 10, 2));
  165.        
  166.         return chests;
  167.     }
  168.    
  169.     public static ArrayList<Gear> getBoots() {
  170.         ArrayList<Gear> boots = new ArrayList<>();
  171.        
  172.         boots.add(new Gear("B1", 6, 8, 13, 19, 2, 8));
  173.         boots.add(new Gear("B2", 7, 7, 14, 21, 8, 2));
  174.         boots.add(new Gear("B3", 6, 2, 22, 11, 7, 8));
  175.         boots.add(new Gear("B4", 9, 2, 19, 7, 17, 2));
  176.         boots.add(new Gear("B5", 12, 8, 6, 2, 12, 13));
  177.         boots.add(new Gear("B6", 13, 7, 6, 17, 7, 2));
  178.         boots.add(new Gear("B7", 6, 18, 7, 22, 2, 2));
  179.         boots.add(new Gear("B8", 6, 2, 21, 16, 8, 6));
  180.         boots.add(new Gear("B9", 14, 7, 9, 14, 2, 12));
  181.         boots.add(new Gear("B10", 8, 13, 7, 18, 9, 2));
  182.         boots.add(new Gear("B11", 8, 13, 7, 13, 13, 2));
  183.         boots.add(new Gear("B12", 17, 2, 7, 8, 6, 12));
  184.         boots.add(new Gear("B13", 2, 10, 19, 8, 8, 10));
  185.         boots.add(new Gear("B14", 6, 16, 6, 17, 9, 2));
  186.         boots.add(new Gear("B15", 7, 12, 8, 24, 2, 2));
  187.        
  188.         return boots;
  189.     }
  190. }
  191.  
  192. class Set implements Comparable {
  193.     private Gear helmet;
  194.     private Gear glove;
  195.     private Gear chest;
  196.     private Gear boot;
  197.     private Gear classItem;
  198.    
  199.     public Set(Gear h, Gear g, Gear c, Gear b) {
  200.         helmet = h;
  201.         glove = g;
  202.         chest = c;
  203.         boot = b;
  204.         classItem = new Gear("bond", 2, 2, 2, 2, 2, 2);
  205.     }
  206.    
  207.     public Gear getHelmet() {
  208.         return helmet;
  209.     }
  210.    
  211.     public Gear getGlove() {
  212.         return glove;
  213.     }
  214.    
  215.     public Gear getChest() {
  216.         return chest;
  217.     }
  218.    
  219.     public Gear getBoot() {
  220.         return boot;
  221.     }
  222.    
  223.     public int getMobility() {
  224.         return helmet.getMobility() + glove.getMobility() + chest.getMobility() + boot.getMobility() + classItem.getMobility() + 5; //traction
  225.     }
  226.    
  227.     public int getResilience() {
  228.         return helmet.getResilience() + glove.getResilience() + chest.getResilience() + boot.getResilience() + classItem.getResilience();
  229.     }
  230.    
  231.     public int getRecovery() {
  232.         return helmet.getRecovery() + glove.getRecovery() + chest.getRecovery() + boot.getRecovery() + classItem.getRecovery();
  233.     }
  234.    
  235.     public int getDiscipline() {
  236.         return helmet.getDiscipline() + glove.getDiscipline() + chest.getDiscipline() + boot.getDiscipline() + classItem.getDiscipline();
  237.     }
  238.    
  239.     public int getIntellect() {
  240.         return helmet.getIntellect() + glove.getIntellect() + chest.getIntellect() + boot.getIntellect() + classItem.getIntellect();
  241.     }
  242.    
  243.     public int getStrength() {
  244.         return helmet.getStrength() + glove.getStrength() + chest.getStrength() + boot.getStrength() + classItem.getStrength();
  245.     }
  246.    
  247.     public int getTotal() {
  248.         return getMobility()/10 + getResilience()/10 + getRecovery()/10 +
  249.                getDiscipline()/10 + getIntellect()/10 + getStrength()/10;
  250.     }
  251.    
  252.     public int getWasted() {
  253.         return getMobility()%10 + getResilience()%10 + getRecovery()%10 +
  254.                getDiscipline()%10 + getIntellect()%10 + getStrength()%10;
  255.     }
  256.    
  257.     @Override
  258.     public int compareTo(Object set) {
  259.         return ((Set)set).getTotal() - getTotal();
  260.     }
  261.    
  262.     public String getName() {
  263.         return helmet.getName() + ":" + glove.getName() + ":" + chest.getName() + ":" + boot.getName();
  264.     }
  265.    
  266.     public String getStats() {
  267.         return "(" + getMobility() + ", " + getResilience() + ", " + getRecovery() + ", " + getDiscipline() + ", " + getIntellect() + ", " + getStrength() + ")";
  268.        
  269.     }
  270.    
  271.     public String toString() {
  272.         return getName() + " [" + getTotal() + "] " + getStats() + " [" + getWasted() + "]";
  273.     }
  274. }
  275.  
  276.  
  277. class Gear {
  278.     private String name;
  279.    
  280.     private int mobility;
  281.     private int resilience;
  282.     private int recovery;
  283.    
  284.     private int discipline;
  285.     private int intellect;
  286.     private int strength;
  287.    
  288.     public Gear() {
  289.         name = "";
  290.         mobility = 0;
  291.         resilience = 0;
  292.         recovery = 0;
  293.         discipline = 0;
  294.         intellect = 0;
  295.         strength = 0;
  296.     }
  297.    
  298.     public Gear(String nm, int mob, int res, int rec, int dis, int intl, int str) {
  299.         name = nm;
  300.         mobility = mob;
  301.         resilience = res;
  302.         recovery = rec;
  303.         discipline = dis;
  304.         intellect = intl;
  305.         strength = str;
  306.     }
  307.    
  308.     public String getName() {
  309.         return name;
  310.     }
  311.    
  312.     public int getMobility() {
  313.         return mobility;
  314.     }
  315.    
  316.     public int getResilience() {
  317.         return resilience;
  318.     }
  319.    
  320.     public int getRecovery() {
  321.         return recovery;
  322.     }
  323.    
  324.     public int getDiscipline() {
  325.         return discipline;
  326.     }
  327.    
  328.     public int getIntellect() {
  329.         return intellect;
  330.     }
  331.    
  332.     public int getStrength() {
  333.         return strength;
  334.     }
  335.    
  336.     public void masterwork() {
  337.         mobility += 2;
  338.         resilience += 2;
  339.         recovery += 2;
  340.         discipline += 2;
  341.         intellect += 2;
  342.         strength += 2;
  343.     }
  344. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement