From de135a85283e5a224f4a14173d6e946bb1cc25dc Mon Sep 17 00:00:00 2001 From: WinDanesz <31292708+WinDanesz@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:44:44 +0200 Subject: [PATCH] feat: Added new config options: Gameplay Category: - manaPerShard: Amount of mana a crystal shard is worth (default: 10) - manaPerCrystal: Amount of mana each magic crystal is worth (default: 100) - grandCrystalMana: Amount of mana a grand magic crystal is worth (default: 400) - nonElementalUpgradeBonus: Bonus wand upgrades for non-elemental wands (default: 3) - siphonManaPerLevel: Mana gained per siphon upgrade level (default: 5) - condenserTickInterval: Ticks between condenser mana increases (default: 50) Tweaks Category: - storageIncreasePerLevel: Charge increase per storage upgrade level (default: 0.15) --- .../java/electroblob/wizardry/Settings.java | 97 ++++++++++++++++++- .../java/electroblob/wizardry/Wizardry.java | 3 + .../wizardry/constants/Constants.java | 38 +++++--- .../assets/ebwizardry/lang/en_us.lang | 16 +++ 4 files changed, 138 insertions(+), 16 deletions(-) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index ccf01dec..1996f08f 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -266,6 +266,24 @@ public final class Settings { /** [Server-only] List of registry names of biomes in which wizardry's hostile mobs cannot spawn. */ public ResourceLocation[] mobSpawnBiomeBlacklist = toResourceLocations("mushroom_island", "mushroom_island_shore"); + // Mana and upgrade constants + /** [Server-only] The amount of mana a crystal shard is worth */ + public int manaPerShard = 10; + /** [Server-only] The amount of mana each magic crystal is worth */ + public int manaPerCrystal = 100; + /** [Server-only] The amount of mana a grand magic crystal is worth */ + public int grandCrystalMana = 400; + /** [Server-only] The maximum number of one type of wand upgrade which can be applied to a wand. */ + public int upgradeStackLimit = 3; + /** [Server-only] The bonus amount of wand upgrades that can be applied to a non-elemental wand. */ + public int nonElementalUpgradeBonus = 3; + /** [Server-only] The fraction by which maximum charge is increased for each level of storage upgrade. */ + public float storageIncreasePerLevel = 0.15f; + /** [Server-only] The amount of mana given for a kill for each level of siphon upgrade. */ + public int siphonManaPerLevel = 5; + /** [Server-only] The number of ticks between each mana increase for wands with the condenser upgrade. */ + public int condenserTickInterval = 50; + // Commands (these don't need synchronising since typing a command always queries the server). /** * [Server-only] The maximum allowed multiplier for the /cast command. This limit is here to stop people from @@ -533,9 +551,30 @@ public final class Settings { setupArtefactsConfig(); setupResistancesConfig(); + // Update the constants with new values + updateConstantsFromSettings(); + config.save(); } + /** Updates the Constants class with the current settings values */ + public void updateConstantsFromSettings(){ + electroblob.wizardry.constants.Constants.MANA_PER_SHARD = this.manaPerShard; + electroblob.wizardry.constants.Constants.MANA_PER_CRYSTAL = this.manaPerCrystal; + electroblob.wizardry.constants.Constants.GRAND_CRYSTAL_MANA = this.grandCrystalMana; + electroblob.wizardry.constants.Constants.UPGRADE_STACK_LIMIT = this.upgradeStackLimit; + electroblob.wizardry.constants.Constants.NON_ELEMENTAL_UPGRADE_BONUS = this.nonElementalUpgradeBonus; + electroblob.wizardry.constants.Constants.COOLDOWN_REDUCTION_PER_LEVEL = (float) this.cooldownReductionPerLevel; + electroblob.wizardry.constants.Constants.STORAGE_INCREASE_PER_LEVEL = this.storageIncreasePerLevel; + electroblob.wizardry.constants.Constants.POTENCY_INCREASE_PER_TIER = (float) this.potencyIncreasePerTier; + electroblob.wizardry.constants.Constants.DURATION_INCREASE_PER_LEVEL = (float) this.durationIncreasePerLevel; + electroblob.wizardry.constants.Constants.RANGE_INCREASE_PER_LEVEL = (float) this.rangeIncreasePerLevel; + electroblob.wizardry.constants.Constants.BLAST_RADIUS_INCREASE_PER_LEVEL = (float) this.blastIncreasePerLevel; + electroblob.wizardry.constants.Constants.FROST_SLOWNESS_PER_LEVEL = (float) this.frostSlownessIncreasePerLevel; + electroblob.wizardry.constants.Constants.SIPHON_MANA_PER_LEVEL = this.siphonManaPerLevel; + electroblob.wizardry.constants.Constants.CONDENSER_TICK_INTERVAL = this.condenserTickInterval; + } + void checkForRedundantOptions(String categoryName, Collection validKeys){ ConfigCategory category = config.getCategory(categoryName); @@ -665,6 +704,55 @@ public final class Settings { preventBindingSameSpellTwiceToWands = property.getBoolean(); propOrder.add(property.getName()); + property = config.get(GAMEPLAY_CATEGORY, "manaPerShard", 10, + "The amount of mana a crystal shard is worth.", 1, 1000); + property.setLanguageKey("config." + Wizardry.MODID + ".mana_per_shard"); + Wizardry.proxy.setToNumberSliderEntry(property); + manaPerShard = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "manaPerCrystal", 100, + "The amount of mana each magic crystal is worth.", 1, 10000); + property.setLanguageKey("config." + Wizardry.MODID + ".mana_per_crystal"); + Wizardry.proxy.setToNumberSliderEntry(property); + manaPerCrystal = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "grandCrystalMana", 400, + "The amount of mana a grand magic crystal is worth.", 1, 10000); + property.setLanguageKey("config." + Wizardry.MODID + ".grand_crystal_mana"); + Wizardry.proxy.setToNumberSliderEntry(property); + grandCrystalMana = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "upgradeStackLimit", 3, + "The maximum number of one type of wand upgrade which can be applied to a wand.", 1, 10); + property.setLanguageKey("config." + Wizardry.MODID + ".upgrade_stack_limit"); + Wizardry.proxy.setToNumberSliderEntry(property); + upgradeStackLimit = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "nonElementalUpgradeBonus", 3, + "The bonus amount of wand upgrades that can be applied to a non-elemental wand.", 0, 10); + property.setLanguageKey("config." + Wizardry.MODID + ".non_elemental_upgrade_bonus"); + Wizardry.proxy.setToNumberSliderEntry(property); + nonElementalUpgradeBonus = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "siphonManaPerLevel", 5, + "The amount of mana given for a kill for each level of siphon upgrade.", 0, 100); + property.setLanguageKey("config." + Wizardry.MODID + ".siphon_mana_per_level"); + Wizardry.proxy.setToNumberSliderEntry(property); + siphonManaPerLevel = property.getInt(); + propOrder.add(property.getName()); + + property = config.get(GAMEPLAY_CATEGORY, "condenserTickInterval", 50, + "The number of ticks between each mana increase for wands with the condenser upgrade.", 1, 1000); + property.setLanguageKey("config." + Wizardry.MODID + ".condenser_tick_interval"); + Wizardry.proxy.setToNumberSliderEntry(property); + condenserTickInterval = property.getInt(); + propOrder.add(property.getName()); + property = config.get(GAMEPLAY_CATEGORY, "playersMoveEachOther", true, "Whether to allow players to move other players around using magic."); property.setLanguageKey("config." + Wizardry.MODID + ".players_move_each_other"); @@ -992,10 +1080,17 @@ public final class Settings { property = config.get(TWEAKS_CATEGORY, "cooldown_reduction_per_level", 0.15, "The fraction by which cooldowns are reduced for each level of cooldown upgrade.", 0.05, Integer.MAX_VALUE); // Sure, I mean you COULD set it to 2^31-1... what could possibly go wrong? - property.setLanguageKey("config." + Wizardry.MODID + ".cast_command_multiplier_limit"); + property.setLanguageKey("config." + Wizardry.MODID + ".cooldown_reduction_per_level"); cooldownReductionPerLevel = property.getDouble(); propOrder.add(property.getName()); + property = config.get(TWEAKS_CATEGORY, "storage_increase_per_level", 0.15, + "The fraction by which maximum charge is increased for each level of storage upgrade.", + 0.05, Integer.MAX_VALUE); + property.setLanguageKey("config." + Wizardry.MODID + ".storage_increase_per_level"); + storageIncreasePerLevel = (float) property.getDouble(); + propOrder.add(property.getName()); + property = config.get(TWEAKS_CATEGORY, "potency_increase_per_tier", 0.15, "The fraction by which potency is increased for each tier of matching wand. May cause extreme lag with high values!", 0.05, Integer.MAX_VALUE); diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index ba56c107..41279087 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -164,6 +164,9 @@ public class Wizardry { settings.initConfigExtras(); + // Update constants with configured values + settings.updateConstantsFromSettings(); + // World generators // Weight is a misnomer, it's actually the priority (where lower numbers get generated first) // Literally nothing on typical 'weight' values here, there isn't even an upper limit diff --git a/src/main/java/electroblob/wizardry/constants/Constants.java b/src/main/java/electroblob/wizardry/constants/Constants.java index aab2b8b0..08b3fc7f 100644 --- a/src/main/java/electroblob/wizardry/constants/Constants.java +++ b/src/main/java/electroblob/wizardry/constants/Constants.java @@ -8,40 +8,40 @@ public final class Constants { /** The amount of mana a crystal shard is worth */ // 100 doesn't divide nicely by 9 so we're calling this 10. I guess you lose a little bit by smashing a crystal. - public static final int MANA_PER_SHARD = 10; + public static int MANA_PER_SHARD; /** The amount of mana each magic crystal is worth */ - public static final int MANA_PER_CRYSTAL = 100; + public static int MANA_PER_CRYSTAL; /** The amount of mana a grand magic crystal is worth */ - public static final int GRAND_CRYSTAL_MANA = 400; + public static int GRAND_CRYSTAL_MANA; /** The maximum number of one type of wand upgrade which can be applied to a wand. */ - public static final int UPGRADE_STACK_LIMIT = 3; + public static int UPGRADE_STACK_LIMIT; /** The bonus amount of wand upgrades that can be applied to a non-elemental wand. */ - public static final int NON_ELEMENTAL_UPGRADE_BONUS = 3; + public static int NON_ELEMENTAL_UPGRADE_BONUS; /** The fraction by which cooldowns are reduced for each level of cooldown upgrade. */ - public static float COOLDOWN_REDUCTION_PER_LEVEL = 0.15f; + public static float COOLDOWN_REDUCTION_PER_LEVEL; /** The fraction by which maximum charge is increased for each level of storage upgrade. */ - public static final float STORAGE_INCREASE_PER_LEVEL = 0.15f; + public static float STORAGE_INCREASE_PER_LEVEL; /** The fraction by which potency is increased for each tier of matching wand. */ - public static float POTENCY_INCREASE_PER_TIER = 0.15f; + public static float POTENCY_INCREASE_PER_TIER; /** The fraction by which spell duration is increased for each level of duration upgrade. */ - public static float DURATION_INCREASE_PER_LEVEL = 0.25f; + public static float DURATION_INCREASE_PER_LEVEL; /** The fraction by which spell range is increased for each level of range upgrade. */ - public static float RANGE_INCREASE_PER_LEVEL = 0.25f; + public static float RANGE_INCREASE_PER_LEVEL; /** The fraction by which spell blast radius is increased for each level of range upgrade. */ - public static float BLAST_RADIUS_INCREASE_PER_LEVEL = 0.25f; + public static float BLAST_RADIUS_INCREASE_PER_LEVEL; /** The fraction by which movement speed is reduced per level of frost effect. */ - public static double FROST_SLOWNESS_PER_LEVEL = 0.5; + public static double FROST_SLOWNESS_PER_LEVEL; /** The fraction by which movement speed is reduced per level of decay effect. */ public static final double DECAY_SLOWNESS_PER_LEVEL = 0.2; /** The fraction by which dig speed is reduced per level of frostbite effect. */ public static final float FROST_FATIGUE_PER_LEVEL = 0.45f; /** The number of ticks between each mana increase for wands with the condenser upgrade. */ - public static final int CONDENSER_TICK_INTERVAL = 50; + public static int CONDENSER_TICK_INTERVAL; /** * The amount of mana given for a kill for each level of siphon upgrade. A random amount from 0 to this number - 1 * is also added. See {@link WizardryEventHandler#onLivingDeathEvent} for more details. */ - public static final int SIPHON_MANA_PER_LEVEL = 5; + public static int SIPHON_MANA_PER_LEVEL; /** * The number of ticks between the spawning of patches of decay when an entity has the decay effect. Note that decay * won't spawn again if something is already standing in it. @@ -51,11 +51,19 @@ public final class Constants { // making this as an update to the existing values to not break addons directly relying on the fields static { - POTENCY_INCREASE_PER_TIER = (float) Wizardry.settings.potencyIncreasePerTier; + MANA_PER_SHARD = Wizardry.settings.manaPerShard; + MANA_PER_CRYSTAL = Wizardry.settings.manaPerCrystal; + GRAND_CRYSTAL_MANA = Wizardry.settings.grandCrystalMana; + UPGRADE_STACK_LIMIT = Wizardry.settings.upgradeStackLimit; + NON_ELEMENTAL_UPGRADE_BONUS = Wizardry.settings.nonElementalUpgradeBonus; COOLDOWN_REDUCTION_PER_LEVEL = (float) Wizardry.settings.cooldownReductionPerLevel; + STORAGE_INCREASE_PER_LEVEL = Wizardry.settings.storageIncreasePerLevel; + POTENCY_INCREASE_PER_TIER = (float) Wizardry.settings.potencyIncreasePerTier; DURATION_INCREASE_PER_LEVEL = (float) Wizardry.settings.durationIncreasePerLevel; RANGE_INCREASE_PER_LEVEL = (float) Wizardry.settings.rangeIncreasePerLevel; BLAST_RADIUS_INCREASE_PER_LEVEL = (float) Wizardry.settings.blastIncreasePerLevel; FROST_SLOWNESS_PER_LEVEL = (float) Wizardry.settings.frostSlownessIncreasePerLevel; + SIPHON_MANA_PER_LEVEL = Wizardry.settings.siphonManaPerLevel; + CONDENSER_TICK_INTERVAL = Wizardry.settings.condenserTickInterval; } } diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 34f6d9bd..d508ebb8 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -1541,6 +1541,20 @@ config.ebwizardry.single_use_spell_books=Spell Books Are Consumed By Wands config.ebwizardry.single_use_spell_books.tooltip=Whether spell books are consumed when they are bound to a wand. config.ebwizardry.prevent_binding_same_spell_twice_to_wands=Prevent Binding The Same Spell To A Wand Multiple Times config.ebwizardry.prevent_binding_same_spell_twice_to_wands.tooltip=Whether to prevent binding the same spell to a wand multiple times +config.ebwizardry.mana_per_shard=Mana Per Crystal Shard +config.ebwizardry.mana_per_shard.tooltip=The amount of mana a crystal shard is worth. +config.ebwizardry.mana_per_crystal=Mana Per Crystal +config.ebwizardry.mana_per_crystal.tooltip=The amount of mana each magic crystal is worth. +config.ebwizardry.grand_crystal_mana=Grand Crystal Mana +config.ebwizardry.grand_crystal_mana.tooltip=The amount of mana a grand magic crystal is worth. +config.ebwizardry.upgrade_stack_limit=Upgrade Stack Limit +config.ebwizardry.upgrade_stack_limit.tooltip=The maximum number of one type of wand upgrade which can be applied to a wand. +config.ebwizardry.non_elemental_upgrade_bonus=Non-Elemental Upgrade Bonus +config.ebwizardry.non_elemental_upgrade_bonus.tooltip=The bonus amount of wand upgrades that can be applied to a non-elemental wand. +config.ebwizardry.siphon_mana_per_level=Siphon Mana Per Level +config.ebwizardry.siphon_mana_per_level.tooltip=The amount of mana given for a kill for each level of siphon upgrade. +config.ebwizardry.condenser_tick_interval=Condenser Tick Interval +config.ebwizardry.condenser_tick_interval.tooltip=The number of ticks between each mana increase for wands with the condenser upgrade. config.ebwizardry.telekinetic_disarmament=Telekinetic Disarmament config.ebwizardry.telekinetic_disarmament.tooltip=Whether to allow players to disarm other players using the telekinesis spell. Disable to prevent stealing of items. config.ebwizardry.telekinetic_disarmament.true=Yes - let people steal things @@ -1575,6 +1589,8 @@ config.ebwizardry.blast_increase_per_level=Blast Increase Per Level config.ebwizardry.blast_increase_per_level.tooltip=The fraction by which spell blast is increased for each level of blast upgrade. May cause extreme lag with high values! config.ebwizardry.frost_slowness_increase_per_level=Frost Slowness Increase Per Level config.ebwizardry.frost_slowness_increase_per_level.tooltip=The fraction by which movement speed is reduced per level of frost effect. +config.ebwizardry.storage_increase_per_level=Storage Increase Per Level +config.ebwizardry.storage_increase_per_level.tooltip=The fraction by which maximum charge is increased for each level of storage upgrade. config.ebwizardry.category.difficulty=Difficulty Settings config.ebwizardry.category.difficulty.tooltip=Configure wizardry's difficulty