Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.prototype.testmodule.qg;
- import java.util.Random;
- public class QGTest2 {
- private static class Stabilizer {
- private int durability, modifierDamage;
- private int customDurability = -1;
- Stabilizer(int durability, int modifierDamage) {
- this.durability = durability;
- this.modifierDamage = modifierDamage;
- }
- }
- private static class QuantumModule {
- private final int production;
- private int damage;
- QuantumModule(int production, int damage) {
- this.production = production;
- this.damage = damage;
- }
- }
- /*
- *
- *Stabilizers
- *
- * Т1/500/0%/0.2
- * Т2/750/3%/0.5
- * Т3/1000/6%/0.7
- * Т4/1500/9%/1.0
- * Т5/2000/12%/1.5
- * Т6/3000/15%/3.0
- *
- * Modules
- * Т1/8/2000
- * Т2/32/8000
- * Т3/128/32.000
- * Т4/512/128.000
- * Т5/2048/512.000
- * Т6/8196/2.048.000
- *
- * Т1/3%/1/1
- Т2/6%/2/2
- Т3/9%/3/3
- Т4/12%/4/4
- Т5/15%/5/5
- Т6/18%/6/6
- *
- *
- */
- public static void main(String[] args) {
- QuantumModule module = new QuantumModule(10, 1); //T1
- Stabilizer[] stabilizers = new Stabilizer[]{
- new Stabilizer(72000, 0),
- new Stabilizer(72000 * 4, 1),
- new Stabilizer(72000 * 8, 2),
- //new Stabilizer(72000 * 16, 3),
- //new Stabilizer(72000 * 32, 4),
- //new Stabilizer(72000 * 64, 5)
- };
- /* for (Stabilizer stabilizer : stabilizers) {
- if (stabilizer == null) {
- return;
- }
- }*/
- for (int i = 0; i < 72000; i++) {
- addEnergy(module.production);
- for (Stabilizer stabilizer : stabilizers) {
- createCustomDurability(stabilizer);
- damage(stabilizer, module);
- System.out.println("---------------------------------------------------------------------------");
- }
- System.out.println("=================================================================================");
- }
- for (Stabilizer stabilizer : stabilizers) {
- System.out.println("stabilizer#customDurability: " + stabilizer.customDurability);
- }
- }
- private static void createCustomDurability(Stabilizer stabilizer) {
- //System.out.println("call createCustomDurability: " + stabilizer.customDurability);
- if (stabilizer.customDurability == -1) {
- int p = random.nextInt(11);
- int newDurability = stabilizer.durability / 100 * p;
- newDurability = random.nextBoolean() ? newDurability : -newDurability;
- stabilizer.customDurability = newDurability + stabilizer.durability;
- System.out.println("Set new durability: " + stabilizer.customDurability);
- }
- }
- private static final Random random = new Random();
- private static int storage;
- private static void addEnergy(int production) {
- //System.out.println("added energy to storage: " + production);
- storage += production;
- //System.out.println("storage: " + storage);
- }
- private static void damage(Stabilizer stabilizer, QuantumModule module) {
- System.out.println("customDurability before damage: " + stabilizer.customDurability);
- int damage = module.damage - stabilizer.modifierDamage;
- System.out.println("Damage: " + damage);
- if (damage >= 1) {
- System.out.println("DAMAGE TRUE");
- stabilizer.customDurability -= damage;
- } else {
- System.out.println("[1] DAMAGE ELSE");
- if (random.nextInt(20) < 20) {
- System.out.println("[2] DAMAGE ELSE");
- stabilizer.customDurability -= 1;
- }
- }
- System.out.println("customDurability after damage: " + stabilizer.customDurability);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement