package com.xfestudio.mydimensionlord.equipment;
/** Deterministic reward and targeting rules shared by all loaders. */
public final class EquipmentRules {
public static final int SHARD_CHANCE_PERCENT = 25;
public static final int BOSS_SHARDS = 4;
public static final double SLASH_RANGE = 6.0;
public static final float SLASH_DAMAGE = 16.0F;
public static final double SLASH_MAX_RANGE = 14.0;
public static final float SLASH_MAX_DAMAGE = 64.0F;
public static final int BLADE_ATTACK_BONUS = 17; // +4 tool tier +1 player base = 22
public static final int BLADE_CHARGE_TICKS = 40;
public static final int BLADE_USE_DURATION = 72000;
public static final int MIND_REPAIR_INTERVAL = 20;
public static final int SLASH_COOLDOWN = 160;
public static final int SLASH_DURABILITY_COST = 12;
public static final int BLADE_DURABILITY = 2600;
private EquipmentRules() {}
public static int shardCount(String dimensionNamespace, boolean hostile, boolean boss,
boolean realPlayerKill, int roll) {
if (!"mydimension".equals(dimensionNamespace) || !realPlayerKill || !(hostile || boss)) return 0;
if (boss) return BOSS_SHARDS;
return roll >= 0 && roll < SHARD_CHANCE_PERCENT ? 1 : 0;
}
public static boolean withinSlash(double distanceSquared, double facingDot) {
return withinSlash(distanceSquared, facingDot, 0);
}
public static float chargeFraction(float ticks) {
if (!Float.isFinite(ticks)) return 0;
return Math.max(0, Math.min(1, ticks / BLADE_CHARGE_TICKS));
}
public static double slashRange(int chargeTicks) {
return SLASH_RANGE + (SLASH_MAX_RANGE - SLASH_RANGE) * chargeFraction(chargeTicks);
}
public static float slashDamage(int chargeTicks) {
return SLASH_DAMAGE + (SLASH_MAX_DAMAGE - SLASH_DAMAGE) * chargeFraction(chargeTicks);
}
public static boolean withinSlash(double distanceSquared, double facingDot, int chargeTicks) {
double range = slashRange(chargeTicks);
return distanceSquared > 0 && distanceSquared <= range * range && facingDot >= 0.5;
}
public static boolean repairTick(int tick, String dimensionNamespace) {
return tick % MIND_REPAIR_INTERVAL == 0 && "mydimension".equals(dimensionNamespace);
}
}
package com.xfestudio.mydimensionlord.equipment;
/** Deterministic reward and targeting rules shared by all loaders. */
public final class EquipmentRules {
public static final int SHARD_CHANCE_PERCENT = 25;
public static final int BOSS_SHARDS = 4;
public static final double SLASH_RANGE = 6.0;
public static final float SLASH_DAMAGE = 16.0F;
public static final double SLASH_MAX_RANGE = 14.0;
public static final float SLASH_MAX_DAMAGE = 64.0F;
public static final int BLADE_ATTACK_BONUS = 17; // +4 tool tier +1 player base = 22
public static final int BLADE_CHARGE_TICKS = 40;
public static final int BLADE_USE_DURATION = 72000;
public static final int MIND_REPAIR_INTERVAL = 20;
public static final int SLASH_COOLDOWN = 160;
public static final int SLASH_DURABILITY_COST = 12;
public static final int BLADE_DURABILITY = 2600;
private EquipmentRules() {}
public static int shardCount(String dimensionNamespace, boolean hostile, boolean boss,
boolean realPlayerKill, int roll) {
if (!"mydimension".equals(dimensionNamespace) || !realPlayerKill || !(hostile || boss)) return 0;
if (boss) return BOSS_SHARDS;
return roll >= 0 && roll < SHARD_CHANCE_PERCENT ? 1 : 0;
}
public static boolean withinSlash(double distanceSquared, double facingDot) {
return withinSlash(distanceSquared, facingDot, 0);
}
public static float chargeFraction(float ticks) {
if (!Float.isFinite(ticks)) return 0;
return Math.max(0, Math.min(1, ticks / BLADE_CHARGE_TICKS));
}
public static double slashRange(int chargeTicks) {
return SLASH_RANGE + (SLASH_MAX_RANGE - SLASH_RANGE) * chargeFraction(chargeTicks);
}
public static float slashDamage(int chargeTicks) {
return SLASH_DAMAGE + (SLASH_MAX_DAMAGE - SLASH_DAMAGE) * chargeFraction(chargeTicks);
}
public static boolean withinSlash(double distanceSquared, double facingDot, int chargeTicks) {
double range = slashRange(chargeTicks);
return distanceSquared > 0 && distanceSquared <= range * range && facingDot >= 0.5;
}
public static boolean repairTick(int tick, String dimensionNamespace) {
return tick % MIND_REPAIR_INTERVAL == 0 && "mydimension".equals(dimensionNamespace);
}
}