From 1ed7821b6f2b02aa834e9d6e3baf28c3a805ccb3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 7 Oct 2019 00:48:51 +0200 Subject: [PATCH] Added configuration for force field damage factors --- .../cr0s/warpdrive/config/WarpDriveConfig.java | 14 ++++++++++++++ .../java/cr0s/warpdrive/data/ForceFieldSetup.java | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java index b7b4bc35..2140f711 100644 --- a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java +++ b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java @@ -512,6 +512,8 @@ public class WarpDriveConfig { // Enantiomorphic power reactor public static int[] FORCE_FIELD_PROJECTOR_MAX_ENERGY_STORED_BY_TIER = { 20000000, 30000, 90000, 150000 }; // 30000 * (1 + 2 * tier) + public static double FORCE_FIELD_PROJECTOR_EXPLOSION_SCALE = 1000.0D; + public static double FORCE_FIELD_PROJECTOR_MAX_LASER_REQUIRED = 10.0D; // Subspace capacitor public static int[] CAPACITOR_MAX_ENERGY_STORED_BY_TIER = { 20000000, 800000, 4000000, 20000000 }; @@ -1250,6 +1252,18 @@ public class WarpDriveConfig { config.get("enantiomorphic_reactor", "max_generation_RF_by_tier", ENAN_REACTOR_GENERATION_MAX_RF_BY_TIER, "Maximum energy added to the core when enabled, measured in RF/t, for a given tier").getIntList(); clampByTier(1, Integer.MAX_VALUE, ENAN_REACTOR_GENERATION_MAX_RF_BY_TIER); + // Force field projector + FORCE_FIELD_PROJECTOR_MAX_ENERGY_STORED_BY_TIER = config.get("force_field", "projector_max_energy_stored_by_tier", FORCE_FIELD_PROJECTOR_MAX_ENERGY_STORED_BY_TIER, "Maximum energy stored for each projector tier").getIntList(); + clampByTier(0, Integer.MAX_VALUE, FORCE_FIELD_PROJECTOR_MAX_ENERGY_STORED_BY_TIER); + + FORCE_FIELD_PROJECTOR_EXPLOSION_SCALE = Commons.clamp(1.0D, 1000.0D, + config.get("force_field", "projector_explosion_scale", FORCE_FIELD_PROJECTOR_EXPLOSION_SCALE, + "Scale applied to explosion strength, increase the value to reduce explosion impact on a force field. Enable weapon logs to see the damage level.").getDouble(FORCE_FIELD_PROJECTOR_EXPLOSION_SCALE)); + + FORCE_FIELD_PROJECTOR_MAX_LASER_REQUIRED = Commons.clamp(1.0D, 1000.0D, + config.get("force_field", "projector_max_laser_required", FORCE_FIELD_PROJECTOR_MAX_LASER_REQUIRED, + "Number of maxed out laser cannons required to break a superior force field.").getDouble(FORCE_FIELD_PROJECTOR_MAX_LASER_REQUIRED)); + // Subspace capacitor CAPACITOR_MAX_ENERGY_STORED_BY_TIER = config.get("capacitor", "max_energy_stored_by_tier", CAPACITOR_MAX_ENERGY_STORED_BY_TIER, "Maximum energy stored for each subspace capacitor tier").getIntList(); clampByTier(0, Integer.MAX_VALUE, CAPACITOR_MAX_ENERGY_STORED_BY_TIER); diff --git a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java index 47179116..a1750a3b 100644 --- a/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java +++ b/src/main/java/cr0s/warpdrive/data/ForceFieldSetup.java @@ -329,9 +329,12 @@ public class ForceFieldSetup extends GlobalPosition { if (tileEntity instanceof TileEntityForceFieldProjector) { final double scaledDamage; if (damageSource.damageType.contains("explosion")) { - scaledDamage = damageLevel / 1000.0D + entityEnergyCost * 0.1D; + scaledDamage = damageLevel / WarpDriveConfig.FORCE_FIELD_PROJECTOR_EXPLOSION_SCALE + entityEnergyCost * 0.1D; } else if (damageSource.damageType.contains("laser")) { - scaledDamage = damageLevel / 500.0D + entityEnergyCost * 5.0D; + final double scaleLaserEnergyPerFullProjector = WarpDriveConfig.FORCE_FIELD_PROJECTOR_MAX_LASER_REQUIRED + * (WarpDriveConfig.LASER_CANNON_MAX_LASER_ENERGY - WarpDriveConfig.LASER_CANNON_BLOCK_HIT_ENERGY_MAX) + / WarpDriveConfig.FORCE_FIELD_PROJECTOR_MAX_ENERGY_STORED_BY_TIER[EnumTier.SUPERIOR.getIndex()]; + scaledDamage = damageLevel / scaleLaserEnergyPerFullProjector + entityEnergyCost * 5.0D; } else { WarpDrive.logger.warn(String.format("%s Unknown damage source %s '%s' %.1f", this, damageSource, damageSource.getDamageType(), damageLevel));