Initial commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import electroblob.wizardry.WizardryEventHandler;
|
||||
|
||||
/** Stores various global constants used in Wizardry. */
|
||||
public final class Constants {
|
||||
|
||||
/** The amount of mana each magic crystal is worth */
|
||||
public static final int MANA_PER_CRYSTAL = 100;
|
||||
/** The amount of mana each mana flask can hold */
|
||||
public static final int MANA_PER_FLASK = 700;
|
||||
/** The maximum number of one type of wand upgrade which can be applied to a wand. */
|
||||
public static final int UPGRADE_STACK_LIMIT = 3;
|
||||
/** The fraction by which cooldowns are reduced for each level of cooldown upgrade. */
|
||||
public static final float COOLDOWN_REDUCTION_PER_LEVEL = 0.15f;
|
||||
/** The fraction by which maximum charge is increased for each level of storage upgrade. */
|
||||
public static final float STORAGE_INCREASE_PER_LEVEL = 0.15f;
|
||||
/** The fraction by which damage is increased for each tier of matching wand. */
|
||||
public static final float DAMAGE_INCREASE_PER_TIER = 0.15f;
|
||||
/** The fraction by which costs are reduced for each piece of matching armour. Note that changing this value will not
|
||||
* affect continuous spells, since they are handled differently. */
|
||||
public static final float COST_REDUCTION_PER_ARMOUR = 0.2f;
|
||||
/** The fraction by which spell duration is increased for each level of duration upgrade. */
|
||||
public static final float DURATION_INCREASE_PER_LEVEL = 0.25f;
|
||||
/** The fraction by which spell range is increased for each level of range upgrade. */
|
||||
public static final float RANGE_INCREASE_PER_LEVEL = 0.25f;
|
||||
/** The fraction by which spell blast radius is increased for each level of range upgrade. */
|
||||
public static final float BLAST_RADIUS_INCREASE_PER_LEVEL = 0.25f;
|
||||
/** The fraction by which movement speed is reduced per level of frost effect. */
|
||||
public static final double FROST_SLOWNESS_PER_LEVEL = 0.5;
|
||||
/** 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 frost 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;
|
||||
/** 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 = 3;
|
||||
/** 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. */
|
||||
public static final int DECAY_SPREAD_INTERVAL = 8;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum Element {
|
||||
|
||||
/** The 'default' element, with {@link electroblob.wizardry.spell.MagicMissile MagicMissile} being its only spell. */
|
||||
MAGIC(new Style().setColor(TextFormatting.GRAY), "simple", Wizardry.MODID),
|
||||
FIRE(new Style().setColor(TextFormatting.DARK_RED), "fire", Wizardry.MODID),
|
||||
ICE(new Style().setColor(TextFormatting.AQUA), "ice", Wizardry.MODID),
|
||||
LIGHTNING(new Style().setColor(TextFormatting.DARK_AQUA), "lightning", Wizardry.MODID),
|
||||
NECROMANCY(new Style().setColor(TextFormatting.DARK_PURPLE), "necromancy", Wizardry.MODID),
|
||||
EARTH(new Style().setColor(TextFormatting.DARK_GREEN), "earth", Wizardry.MODID),
|
||||
SORCERY(new Style().setColor(TextFormatting.GREEN), "sorcery", Wizardry.MODID),
|
||||
HEALING(new Style().setColor(TextFormatting.YELLOW), "healing", Wizardry.MODID);
|
||||
|
||||
/** Display colour for this element */
|
||||
private final Style colour;
|
||||
/** Unlocalised name for this element */
|
||||
private final String unlocalisedName;
|
||||
/** The {@link ResourceLocation} for this element's 8x8 icon (displayed in the arcane workbench GUI) */
|
||||
private final ResourceLocation icon;
|
||||
|
||||
private Element(Style colour, String name, String modid){
|
||||
this.colour = colour;
|
||||
this.unlocalisedName = name;
|
||||
this.icon = new ResourceLocation(modid, "textures/gui/element_icon_" + unlocalisedName + ".png");
|
||||
}
|
||||
|
||||
/** Returns the translated display name of this element, without formatting. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName(){
|
||||
return net.minecraft.client.resources.I18n.format("element." + getUnlocalisedName());
|
||||
}
|
||||
|
||||
/** Returns the {@link Style} object representing the colour of this element. */
|
||||
public Style getColour(){
|
||||
return colour;
|
||||
}
|
||||
|
||||
/** Returns the string formatting code which corresponds to the colour of this element. */
|
||||
public String getFormattingCode(){
|
||||
return colour.getFormattingCode();
|
||||
}
|
||||
|
||||
/** Returns the translated display name for wizards of this element, shown in the trading GUI. */
|
||||
public ITextComponent getWizardName(){
|
||||
return new TextComponentTranslation("element." + getUnlocalisedName() + ".wizard");
|
||||
}
|
||||
|
||||
/** Returns this element's unlocalised name. */
|
||||
public String getUnlocalisedName(){
|
||||
return unlocalisedName;
|
||||
}
|
||||
|
||||
/** Returns the {@link ResourceLocation} for this element's 8x8 icon (displayed in the arcane workbench GUI). */
|
||||
public ResourceLocation getIcon(){
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum SpellType {
|
||||
|
||||
ATTACK("attack"),
|
||||
DEFENCE("defence"),
|
||||
UTILITY("utility"),
|
||||
MINION("minion");
|
||||
|
||||
private final String unlocalisedName;
|
||||
|
||||
SpellType(String name){
|
||||
this.unlocalisedName = name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName(){
|
||||
return net.minecraft.client.resources.I18n.format("spelltype." + unlocalisedName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum Tier {
|
||||
|
||||
BASIC(700, 3, 12, new Style().setColor(TextFormatting.WHITE), "basic"),
|
||||
APPRENTICE(1000, 4, 5, new Style().setColor(TextFormatting.AQUA), "apprentice"),
|
||||
ADVANCED(1500, 5, 2, new Style().setColor(TextFormatting.DARK_BLUE), "advanced"),
|
||||
MASTER(2500, 6, 1, new Style().setColor(TextFormatting.DARK_PURPLE), "master");
|
||||
|
||||
/** Maximum mana a wand of this tier can store. */
|
||||
public final int maxCharge;
|
||||
/** Just an ordinal. Shouldn't really be needed but no point changing it now. */
|
||||
public final int level;
|
||||
/** The maximum number of upgrades that can be applied to a wand of this tier. */
|
||||
public final int upgradeLimit;
|
||||
/** The weight given to this tier in the standard weighting. */
|
||||
public final int weight;
|
||||
/** The colour of text associated with this tier. */
|
||||
// Changed to a Style object for consistency.
|
||||
private final Style colour;
|
||||
|
||||
private final String unlocalisedName;
|
||||
|
||||
private Tier(int maxCharge, int upgradeLimit, int weight, Style colour, String name){
|
||||
this.maxCharge = maxCharge;
|
||||
this.level = ordinal();
|
||||
this.upgradeLimit = upgradeLimit;
|
||||
this.weight = weight;
|
||||
this.colour = colour;
|
||||
this.unlocalisedName = name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName() {
|
||||
return net.minecraft.client.resources.I18n.format("tier." + unlocalisedName);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayNameWithFormatting() {
|
||||
return this.getFormattingCode() + net.minecraft.client.resources.I18n.format("tier." + unlocalisedName);
|
||||
}
|
||||
|
||||
public String getUnlocalisedName(){
|
||||
return unlocalisedName;
|
||||
}
|
||||
|
||||
public String getFormattingCode(){
|
||||
return colour.getFormattingCode();
|
||||
}
|
||||
|
||||
/** 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
|
||||
* same relative weights for each. For example, if the array contains APPRENTICE and MASTER, then the weighting will
|
||||
* become: Apprentice 83.3%, Master 16.7%. */
|
||||
public static Tier getWeightedRandomTier(Random random, Tier... tiers){
|
||||
|
||||
if(tiers.length == 0) tiers = values();
|
||||
|
||||
int totalWeight = 0;
|
||||
|
||||
for(Tier tier : tiers) totalWeight += tier.weight;
|
||||
|
||||
int randomiser = random.nextInt(totalWeight);
|
||||
int cumulativeWeight = 0;
|
||||
|
||||
for(Tier tier : tiers){
|
||||
cumulativeWeight += tier.weight;
|
||||
if(randomiser < cumulativeWeight) return tier;
|
||||
}
|
||||
|
||||
// This will never happen, but it might as well be a sensible result.
|
||||
return tiers[tiers.length-1];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user