Advertisement
Exception_Prototype

Untitled

May 26th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.10 KB | None | 0 0
  1. package com.prototype.testmodule.qg;
  2.  
  3. import java.util.Random;
  4.  
  5. public class QGTest2 {
  6.  
  7.     private static class Stabilizer {
  8.  
  9.         private int durability, modifierDamage;
  10.  
  11.         private int customDurability = -1;
  12.  
  13.         Stabilizer(int durability, int modifierDamage) {
  14.             this.durability = durability;
  15.             this.modifierDamage = modifierDamage;
  16.         }
  17.  
  18.     }
  19.  
  20.     private static class QuantumModule {
  21.  
  22.         private final int production;
  23.  
  24.         private int damage;
  25.  
  26.         QuantumModule(int production, int damage) {
  27.             this.production = production;
  28.             this.damage = damage;
  29.         }
  30.  
  31.     }
  32.  
  33.     /*
  34.      *
  35.      *Stabilizers
  36.      *
  37.      * Т1/500/0%/0.2
  38.      * Т2/750/3%/0.5
  39.      * Т3/1000/6%/0.7
  40.      * Т4/1500/9%/1.0
  41.      * Т5/2000/12%/1.5
  42.      * Т6/3000/15%/3.0
  43.      *
  44.      * Modules
  45.      *  Т1/8/2000
  46.      *  Т2/32/8000
  47.      *  Т3/128/32.000
  48.      *  Т4/512/128.000
  49.      *  Т5/2048/512.000
  50.      *  Т6/8196/2.048.000
  51.      *
  52.      * Т1/3%/1/1
  53.         Т2/6%/2/2
  54.         Т3/9%/3/3
  55.         Т4/12%/4/4
  56.         Т5/15%/5/5
  57.         Т6/18%/6/6
  58.      *
  59.      *
  60.      */
  61.     public static void main(String[] args) {
  62.  
  63.  
  64.         QuantumModule module = new QuantumModule(10, 1); //T1
  65.  
  66.         Stabilizer[] stabilizers = new Stabilizer[]{
  67.  
  68.                 new Stabilizer(72000, 0),
  69.                 new Stabilizer(72000 * 4, 1),
  70.                 new Stabilizer(72000 * 8, 2),
  71.                 //new Stabilizer(72000 * 16, 3),
  72.                 //new Stabilizer(72000 * 32, 4),
  73.                 //new Stabilizer(72000 * 64, 5)
  74.  
  75.         };
  76.  
  77. /*        for (Stabilizer stabilizer : stabilizers) {
  78.             if (stabilizer == null) {
  79.                 return;
  80.             }
  81.         }*/
  82.  
  83.         for (int i = 0; i < 72000; i++) {
  84.  
  85.             addEnergy(module.production);
  86.  
  87.             for (Stabilizer stabilizer : stabilizers) {
  88.                 createCustomDurability(stabilizer);
  89.                 damage(stabilizer, module);
  90.                 System.out.println("---------------------------------------------------------------------------");
  91.             }
  92.  
  93.             System.out.println("=================================================================================");
  94.  
  95.         }
  96.  
  97.         for (Stabilizer stabilizer : stabilizers) {
  98.             System.out.println("stabilizer#customDurability: " + stabilizer.customDurability);
  99.         }
  100.  
  101.     }
  102.  
  103.     private static void createCustomDurability(Stabilizer stabilizer) {
  104.  
  105.         //System.out.println("call createCustomDurability: " + stabilizer.customDurability);
  106.  
  107.         if (stabilizer.customDurability == -1) {
  108.  
  109.             int p = random.nextInt(11);
  110.  
  111.             int newDurability = stabilizer.durability / 100 * p;
  112.             newDurability = random.nextBoolean() ? newDurability : -newDurability;
  113.  
  114.             stabilizer.customDurability = newDurability + stabilizer.durability;
  115.  
  116.             System.out.println("Set new durability: " + stabilizer.customDurability);
  117.  
  118.         }
  119.  
  120.     }
  121.  
  122.     private static final Random random = new Random();
  123.     private static int storage;
  124.  
  125.     private static void addEnergy(int production) {
  126.         //System.out.println("added energy to storage: " + production);
  127.         storage += production;
  128.         //System.out.println("storage: " + storage);
  129.     }
  130.  
  131.     private static void damage(Stabilizer stabilizer, QuantumModule module) {
  132.  
  133.         System.out.println("customDurability before damage: " + stabilizer.customDurability);
  134.  
  135.         int damage = module.damage - stabilizer.modifierDamage;
  136.  
  137.         System.out.println("Damage: " + damage);
  138.  
  139.         if (damage >= 1) {
  140.             System.out.println("DAMAGE TRUE");
  141.             stabilizer.customDurability -= damage;
  142.         } else {
  143.             System.out.println("[1] DAMAGE ELSE");
  144.             if (random.nextInt(20) < 20) {
  145.                 System.out.println("[2] DAMAGE ELSE");
  146.                 stabilizer.customDurability -= 1;
  147.             }
  148.         }
  149.  
  150.         System.out.println("customDurability after damage: " + stabilizer.customDurability);
  151.  
  152.     }
  153.  
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement