65 lines
1.8 KiB
Java
65 lines
1.8 KiB
Java
package com.thebrokenrail.reliccraft.data;
|
|
|
|
import java.util.Random;
|
|
|
|
public class RelicData {
|
|
public static class NameData {
|
|
public static final int VARIANT_MAX = 3;
|
|
public int variant = 0;
|
|
public static final int MAGIC_WORD_MAX = 7;
|
|
public int magicWord = 0;
|
|
}
|
|
|
|
public static final int[] COLORS = new int[]{
|
|
65535,
|
|
65280,
|
|
16776960,
|
|
16711935,
|
|
255,
|
|
16711680
|
|
};
|
|
|
|
public int color = COLORS[0];
|
|
|
|
public NameData name = new NameData();
|
|
|
|
public boolean enchantmentGlint = false;
|
|
|
|
public static final int MIN_DURABILITY = 20;
|
|
public static final int MAX_DURABILITY = 40;
|
|
|
|
public int maxDurability = 0;
|
|
|
|
public String[] attack = new String[0];
|
|
|
|
public static class UseData {
|
|
public enum Mode {
|
|
PROJECTILE,
|
|
TARGET,
|
|
SELF
|
|
}
|
|
|
|
public String[] actions = new String[0];
|
|
public Mode mode = Mode.SELF;
|
|
}
|
|
|
|
public UseData use = new UseData();
|
|
|
|
public static RelicData generate(Random random) {
|
|
RelicData data = new RelicData();
|
|
NameData name = new NameData();
|
|
name.variant = random.nextInt(NameData.VARIANT_MAX);
|
|
name.magicWord = random.nextInt(NameData.MAGIC_WORD_MAX);
|
|
data.name = name;
|
|
data.enchantmentGlint = random.nextBoolean();
|
|
data.maxDurability = random.nextInt(MAX_DURABILITY + 1) + MIN_DURABILITY;
|
|
data.attack = Actions.getRandomActions(random);
|
|
UseData use = new UseData();
|
|
use.mode = UseData.Mode.values()[random.nextInt(UseData.Mode.values().length)];
|
|
use.actions = Actions.getRandomActions(random);
|
|
data.use = use;
|
|
data.color = COLORS[random.nextInt(COLORS.length)];
|
|
return data;
|
|
}
|
|
}
|