diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index 37bacf1c..e015c61e 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -310,6 +310,8 @@ public final class Settings { public boolean replaceVanillaFallDamage = true; /** [Synchronised] Chance of 'misreading' an undiscovered spell and triggering a forfeit instead. */ public double forfeitChance = 0.2; + /** [Synchronised] Progression requirements for upgrading a wand to each tier. */ + public int[] progressionRequirements = {1500, 3500, 6000}; /** * [Synchronised] The maximum number of blocks a bookshelf can be from an arcane workbench or lectern to be * able to link to it. @@ -679,6 +681,13 @@ public final class Settings { forfeitChance = property.getDouble(); propOrder.add(property.getName()); + property = config.get(DIFFICULTY_CATEGORY, "progressionRequirements", new int[]{1500, 3500, 6000}, + "The amount of progression required to upgrade a wand to each tier (apprentice, advanced and master respectively)."); + property.setLanguageKey("config." + Wizardry.MODID + ".progression_requirements"); + property.setRequiresWorldRestart(true); + progressionRequirements = property.getIntList(); + propOrder.add(property.getName()); + // These two aren't sliders because using a slider makes it difficult to fine-tune the numbers; the nature of a // scaling factor means that 0.5 is as big a change as 2.0, so whilst a slider is fine for increasing the // damage, it doesn't give fine enough control for values less than 1. diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiArcaneWorkbench.java b/src/main/java/electroblob/wizardry/client/gui/GuiArcaneWorkbench.java index 8c8e5280..76445c10 100644 --- a/src/main/java/electroblob/wizardry/client/gui/GuiArcaneWorkbench.java +++ b/src/main/java/electroblob/wizardry/client/gui/GuiArcaneWorkbench.java @@ -718,7 +718,7 @@ public class GuiArcaneWorkbench extends GuiContainer { float progressFraction = 1; if(tier != Tier.MASTER){ - progressFraction = (float)WandHelper.getProgression(stack) / Tier.values()[tier.level + 1].progression; + progressFraction = (float)WandHelper.getProgression(stack) / Tier.values()[tier.level + 1].getProgression(); } DrawingUtils.drawTexturedRect(x, y, MAIN_GUI_WIDTH, ySize + PROGRESSION_BAR_HEIGHT, PROGRESSION_BAR_WIDTH, PROGRESSION_BAR_HEIGHT, TEXTURE_WIDTH, TEXTURE_HEIGHT); @@ -736,7 +736,7 @@ public class GuiArcaneWorkbench extends GuiContainer { if(tier != Tier.MASTER){ Tier nextTier = Tier.values()[tier.level + 1]; String s = TextFormatting.DARK_GRAY.toString() + nextTier.getDisplayName(); - if(WandHelper.getProgression(stack) >= nextTier.progression) s = nextTier.getDisplayNameWithFormatting(); + if(WandHelper.getProgression(stack) >= nextTier.getProgression()) s = nextTier.getDisplayNameWithFormatting(); fontRenderer.drawStringWithShadow(s, x + TOOLTIP_WIDTH - TOOLTIP_BORDER * 2 - fontRenderer.getStringWidth(s), y, 0); } } diff --git a/src/main/java/electroblob/wizardry/constants/Tier.java b/src/main/java/electroblob/wizardry/constants/Tier.java index 0c8eaadb..c0c9051e 100644 --- a/src/main/java/electroblob/wizardry/constants/Tier.java +++ b/src/main/java/electroblob/wizardry/constants/Tier.java @@ -10,10 +10,10 @@ import java.util.Random; public enum Tier { - NOVICE(700, 3, 12, 0, new Style().setColor(TextFormatting.WHITE), "novice"), - APPRENTICE(1000, 5, 5, 1500, new Style().setColor(TextFormatting.AQUA), "apprentice"), - ADVANCED(1500, 7, 2, 3500, new Style().setColor(TextFormatting.DARK_BLUE), "advanced"), - MASTER(2500, 9, 1, 6000, new Style().setColor(TextFormatting.DARK_PURPLE), "master"); + NOVICE(700, 3, 12, new Style().setColor(TextFormatting.WHITE), "novice"), + APPRENTICE(1000, 5, 5, new Style().setColor(TextFormatting.AQUA), "apprentice"), + ADVANCED(1500, 7, 2, new Style().setColor(TextFormatting.DARK_BLUE), "advanced"), + MASTER(2500, 9, 1, new Style().setColor(TextFormatting.DARK_PURPLE), "master"); /** Maximum mana a wand of this tier can store. */ public final int maxCharge; @@ -23,20 +23,17 @@ public enum Tier { public final int upgradeLimit; /** The weight given to this tier in the standard weighting. */ public final int weight; - /** The progression required for a wand to be upgraded to this tier. */ - public final int progression; /** The colour of text associated with this tier. */ // Changed to a Style object for consistency. private final Style colour; private final String unlocalisedName; - Tier(int maxCharge, int upgradeLimit, int weight, int progression, Style colour, String name){ + Tier(int maxCharge, int upgradeLimit, int weight, Style colour, String name){ this.maxCharge = maxCharge; this.level = ordinal(); this.upgradeLimit = upgradeLimit; this.weight = weight; - this.progression = progression; this.colour = colour; this.unlocalisedName = name; } @@ -96,6 +93,11 @@ public enum Tier { return colour.getFormattingCode(); } + /** The progression required for a wand to be upgraded to this tier. */ + public int getProgression(){ + return Wizardry.settings.progressionRequirements[this.ordinal() - 1]; + } + /** * Returns a random tier based on the standard weighting. Currently, the standard weighting is: Basic (Novice) 60%, * Apprentice 25%, Advanced 10%, Master 5%. If an array of tiers is given, it picks a tier from the array, with the @@ -121,4 +123,5 @@ public enum Tier { // This will never happen, but it might as well be a sensible result. return tiers[tiers.length - 1]; } + } diff --git a/src/main/java/electroblob/wizardry/item/ItemWand.java b/src/main/java/electroblob/wizardry/item/ItemWand.java index 15c1b6f2..1cfae54f 100644 --- a/src/main/java/electroblob/wizardry/item/ItemWand.java +++ b/src/main/java/electroblob/wizardry/item/ItemWand.java @@ -204,7 +204,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, @Override public boolean hasEffect(ItemStack stack){ return !Wizardry.settings.legacyWandLevelling && this.tier.level < Tier.MASTER.level - && WandHelper.getProgression(stack) >= tier.next().progression; + && WandHelper.getProgression(stack) >= tier.next().getProgression(); } @Override @@ -350,7 +350,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, this.getMana(stack), this.getManaCapacity(stack))); text.add(Wizardry.proxy.translate("item." + Wizardry.MODID + ":wand.progression", new Style().setColor(TextFormatting.GRAY), - WandHelper.getProgression(stack), this.tier.level < Tier.MASTER.level ? tier.next().progression : 0)); + WandHelper.getProgression(stack), this.tier.level < Tier.MASTER.level ? tier.next().getProgression() : 0)); } } @@ -514,7 +514,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, if(!Wizardry.settings.legacyWandLevelling){ // Don't display the message if legacy wand levelling is enabled // If the wand just gained enough progression to be upgraded... Tier nextTier = tier.next(); - int excess = WandHelper.getProgression(stack) - nextTier.progression; + int excess = WandHelper.getProgression(stack) - nextTier.getProgression(); if(excess >= 0 && excess < progression){ // ...display a message above the player's hotbar caster.playSound(WizardrySounds.ITEM_WAND_LEVELUP, 1.25f, 1); @@ -694,7 +694,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, // Checks the wand upgrade is for the tier above the wand's tier, and that either the wand has enough // progression or the player is in creative mode. if((player == null || player.isCreative() || Wizardry.settings.legacyWandLevelling - || WandHelper.getProgression(wand) >= tier.progression) + || WandHelper.getProgression(wand) >= tier.getProgression()) && tier == this.tier.next() && this.tier != Tier.MASTER){ if(Wizardry.settings.legacyWandLevelling){ @@ -704,7 +704,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, WandHelper.setProgression(wand, 0); }else{ // Carry excess progression over to the new stack - WandHelper.setProgression(wand, WandHelper.getProgression(wand) - tier.progression); + WandHelper.setProgression(wand, WandHelper.getProgression(wand) - tier.getProgression()); } if(player != null) WizardData.get(player).setTierReached(tier); diff --git a/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java b/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java index 16659524..6be7e380 100644 --- a/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java +++ b/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java @@ -2,6 +2,7 @@ package electroblob.wizardry.packet; import electroblob.wizardry.Settings; import electroblob.wizardry.Wizardry; +import electroblob.wizardry.constants.Tier; import electroblob.wizardry.packet.PacketSyncSettings.Message; import io.netty.buffer.ByteBuf; import net.minecraft.util.ResourceLocation; @@ -40,6 +41,7 @@ public class PacketSyncSettings implements IMessageHandler { Wizardry.settings.replaceVanillaFireballs = message.settings.replaceVanillaFireballs; Wizardry.settings.replaceVanillaFallDamage = message.settings.replaceVanillaFallDamage; Wizardry.settings.forfeitChance = message.settings.forfeitChance; + Wizardry.settings.progressionRequirements = message.settings.progressionRequirements; Wizardry.settings.bookshelfSearchRadius = message.settings.bookshelfSearchRadius; Wizardry.settings.bookshelfBlocks = message.settings.bookshelfBlocks; Wizardry.settings.bookItems = message.settings.bookItems; @@ -71,6 +73,8 @@ public class PacketSyncSettings implements IMessageHandler { settings.replaceVanillaFireballs = buf.readBoolean(); settings.replaceVanillaFallDamage = buf.readBoolean(); settings.forfeitChance = buf.readFloat(); + settings.progressionRequirements = new int[Tier.values().length - 1]; + for(int i = 0; i < settings.progressionRequirements.length; i++) settings.progressionRequirements[i] = buf.readInt(); settings.bookshelfSearchRadius = buf.readInt(); settings.bookshelfBlocks = readMetaItems(buf); settings.bookItems = readMetaItems(buf); @@ -85,6 +89,7 @@ public class PacketSyncSettings implements IMessageHandler { buf.writeBoolean(settings.replaceVanillaFireballs); buf.writeBoolean(settings.replaceVanillaFallDamage); buf.writeFloat((float)settings.forfeitChance); // Configs don't have floats but this can only be 0-1 anyway + for(int i = 0; i < settings.progressionRequirements.length; i++) buf.writeInt(settings.progressionRequirements[i]); buf.writeInt(settings.bookshelfSearchRadius); writeMetaItems(buf, settings.bookshelfBlocks); writeMetaItems(buf, settings.bookItems); diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index e98f2c58..be9ae190 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -1401,6 +1401,8 @@ config.ebwizardry.minion_revenge_targeting.true=Yes - I'd never hurt them! config.ebwizardry.minion_revenge_targeting.false=No - they must always obey me! config.ebwizardry.forfeit_chance=Forfeit Chance config.ebwizardry.forfeit_chance.tooltip=The chance to 'misread' an undiscovered spell and trigger a forfeit instead. Setting this to 0 effectively disables the forfeit mechanic. Has no effect if discovery mode is disabled. +config.ebwizardry.progression_requirements=Progression Requirements +config.ebwizardry.progression_requirements.tooltip=The progression required to upgrade a wand to each tier (apprentice, advanced and master respectively). config.ebwizardry.player_damage_scaling=Player Damage Scaling Factor config.ebwizardry.player_damage_scaling.tooltip=Global damage scaling factor for the damage dealt by players casting spells, relative to 1. config.ebwizardry.npc_damage_scaling=NPC Damage Scaling Factor diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 0dbe5579..af2ab928 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -1401,6 +1401,8 @@ config.ebwizardry.minion_revenge_targeting.true=Yes - I'd never hurt them! config.ebwizardry.minion_revenge_targeting.false=No - they must always obey me! config.ebwizardry.forfeit_chance=Forfeit Chance config.ebwizardry.forfeit_chance.tooltip=The chance to 'misread' an undiscovered spell and trigger a forfeit instead. Setting this to 0 effectively disables the forfeit mechanic. Has no effect if discovery mode is disabled. +config.ebwizardry.progression_requirements=Progression Requirements +config.ebwizardry.progression_requirements.tooltip=The progression required to upgrade a wand to each tier (apprentice, advanced and master respectively). config.ebwizardry.player_damage_scaling=Player Damage Scaling Factor config.ebwizardry.player_damage_scaling.tooltip=Global damage scaling factor for the damage dealt by players casting spells, relative to 1. config.ebwizardry.npc_damage_scaling=NPC Damage Scaling Factor