From db4c68e5f3f395067a4cd9496ed26940953d5223 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Mon, 15 Feb 2016 17:13:50 -0500 Subject: [PATCH] Added Ritual: Ritual of Living Evolution, which is used to set the living armour's max upgrade points to 300. --- changelog.txt | 2 + .../WayofTime/bloodmagic/ConfigHandler.java | 2 + .../item/armour/ItemLivingArmour.java | 2 + .../bloodmagic/livingArmour/LivingArmour.java | 4 + .../bloodmagic/registry/ModRituals.java | 4 + .../bloodmagic/ritual/RitualArmourEvolve.java | 106 ++++++++++++++++++ .../ritual/RitualUpgradeRemove.java | 2 +- .../assets/bloodmagic/lang/en_US.lang | 4 +- 8 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/ritual/RitualArmourEvolve.java diff --git a/changelog.txt b/changelog.txt index 3ee6ac21..0b42a4af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,8 @@ Version 2.0.0-18 - Added upgrade trainer - Fixed step height issue with C&B stuff. Apparently step height is now 0.6 by default instead of 0.5. - Added Ritual: Song of the Cleansing Soul to remove Living Armour upgrades from the armour. +- Added Ritual: Ritual of Living Evolution, which is used to set the living armour's max upgrade points to 300. +- Added tooltip to living armour to show the current upgrade points of the armour. ------------------------------------------------------ Version 2.0.0-17 diff --git a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java index 88e5863e..580a502b 100644 --- a/src/main/java/WayofTime/bloodmagic/ConfigHandler.java +++ b/src/main/java/WayofTime/bloodmagic/ConfigHandler.java @@ -57,6 +57,7 @@ public class ConfigHandler public static boolean ritualWellOfSuffering; public static boolean ritualZephyr; public static boolean ritualUpgradeRemove; + public static boolean ritualArmourEvolve; // Imperfect Rituals public static boolean imperfectRitualNight; @@ -236,6 +237,7 @@ public class ConfigHandler ritualWellOfSuffering = config.get(category, "ritualWellOfSuffering", true).getBoolean(); ritualZephyr = config.get(category, "ritualZephyr", true).getBoolean(); ritualUpgradeRemove = config.get(category, "ritualRemove", true).getBoolean(); + ritualArmourEvolve = config.get(category, "ritualArmourEvolve", true).getBoolean(); category = "Rituals.Imperfect"; imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean(); diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 6ae11933..07f83561 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -187,6 +187,8 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), (upgrade.getUpgradeLevel() + 1))); } } + + tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour.upgrade.points", armour.totalUpgradePoints, armour.maxUpgradePoints)); } super.addInformation(stack, player, tooltip, advanced); diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmour.java b/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmour.java index a60d314e..cf03ab31 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmour.java @@ -181,6 +181,8 @@ public class LivingArmour implements ILivingArmour @Override public void readFromNBT(NBTTagCompound tag) { + maxUpgradePoints = Math.max(100, tag.getInteger("maxUpgradePoints")); + NBTTagList upgradeTags = tag.getTagList("upgrades", 10); if (upgradeTags != null) { @@ -227,6 +229,8 @@ public class LivingArmour implements ILivingArmour @Override public void writeToNBT(NBTTagCompound tag, boolean forceWrite) { + tag.setInteger("maxUpgradePoints", maxUpgradePoints); + NBTTagList tags = new NBTTagList(); for (Entry entry : upgradeMap.entrySet()) diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java index e42e095f..3ff6cb59 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java @@ -9,6 +9,7 @@ import WayofTime.bloodmagic.api.registry.RitualRegistry; import WayofTime.bloodmagic.api.ritual.Ritual; import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual; import WayofTime.bloodmagic.ritual.RitualAnimalGrowth; +import WayofTime.bloodmagic.ritual.RitualArmourEvolve; import WayofTime.bloodmagic.ritual.RitualContainment; import WayofTime.bloodmagic.ritual.RitualCrushing; import WayofTime.bloodmagic.ritual.RitualExpulsion; @@ -56,6 +57,7 @@ public class ModRituals public static Ritual expulsionRitual; public static Ritual zephyrRitual; public static Ritual upgradeRemoveRitual; + public static Ritual armourEvolveRitual; public static ImperfectRitual imperfectNight; public static ImperfectRitual imperfectRain; @@ -103,6 +105,8 @@ public class ModRituals RitualRegistry.registerRitual(expulsionRitual, ConfigHandler.ritualExpulsion); upgradeRemoveRitual = new RitualUpgradeRemove(); RitualRegistry.registerRitual(upgradeRemoveRitual, ConfigHandler.ritualUpgradeRemove); + armourEvolveRitual = new RitualArmourEvolve(); + RitualRegistry.registerRitual(armourEvolveRitual, ConfigHandler.ritualArmourEvolve); } public static void initImperfectRituals() diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualArmourEvolve.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualArmourEvolve.java new file mode 100644 index 00000000..06063819 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualArmourEvolve.java @@ -0,0 +1,106 @@ +package WayofTime.bloodmagic.ritual; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.ritual.AreaDescriptor; +import WayofTime.bloodmagic.api.ritual.EnumRuneType; +import WayofTime.bloodmagic.api.ritual.IMasterRitualStone; +import WayofTime.bloodmagic.api.ritual.Ritual; +import WayofTime.bloodmagic.api.ritual.RitualComponent; +import WayofTime.bloodmagic.item.armour.ItemLivingArmour; +import WayofTime.bloodmagic.livingArmour.LivingArmour; + +public class RitualArmourEvolve extends Ritual +{ + public static final String CHECK_RANGE = "fillRange"; + + public RitualArmourEvolve() + { + super("ritualArmourEvolve", 0, 50000, "ritual." + Constants.Mod.MODID + ".armourEvolveRitual"); + addBlockRange(CHECK_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1, 2, 1)); + } + + @Override + public void performRitual(IMasterRitualStone masterRitualStone) + { + World world = masterRitualStone.getWorldObj(); + + if (world.isRemote) + { + return; + } + + BlockPos pos = masterRitualStone.getBlockPos(); + + AreaDescriptor checkRange = getBlockRange(CHECK_RANGE); + + List playerList = world.getEntitiesWithinAABB(EntityPlayer.class, checkRange.getAABB(pos)); + + for (EntityPlayer player : playerList) + { + if (LivingArmour.hasFullSet(player)) + { + ItemStack chestStack = player.getCurrentArmor(2); + LivingArmour armour = ItemLivingArmour.armourMap.get(chestStack); + if (armour != null) + { + if (armour.maxUpgradePoints < 300) + { + armour.maxUpgradePoints = 300; + ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true); + + masterRitualStone.setActive(false); + + world.spawnEntityInWorld(new EntityLightningBolt(world, pos.getX(), pos.getY() - 1, pos.getZ())); + } + } + } + } + } + + @Override + public int getRefreshTime() + { + return 1; + } + + @Override + public int getRefreshCost() + { + return 0; + } + + @Override + public ArrayList getComponents() + { + ArrayList components = new ArrayList(); + + this.addCornerRunes(components, 1, 0, EnumRuneType.DUSK); + this.addCornerRunes(components, 2, 0, EnumRuneType.FIRE); + this.addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE); + this.addCornerRunes(components, 1, 1, EnumRuneType.DUSK); + this.addParallelRunes(components, 4, 0, EnumRuneType.EARTH); + this.addCornerRunes(components, 1, 3, EnumRuneType.DUSK); + this.addParallelRunes(components, 1, 4, EnumRuneType.EARTH); + + for (int i = 0; i < 4; i++) + { + this.addCornerRunes(components, 3, i, EnumRuneType.EARTH); + } + + return components; + } + + @Override + public Ritual getNewCopy() + { + return new RitualArmourEvolve(); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualUpgradeRemove.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualUpgradeRemove.java index d96490ff..b034133b 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualUpgradeRemove.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualUpgradeRemove.java @@ -30,7 +30,7 @@ public class RitualUpgradeRemove extends Ritual public RitualUpgradeRemove() { - super("ritualUpgradeRemove", 0, 25000, "ritual." + Constants.Mod.MODID + ".fullUpgradeRemove"); + super("ritualUpgradeRemove", 0, 25000, "ritual." + Constants.Mod.MODID + ".upgradeRemoveRitual"); addBlockRange(CHECK_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1, 2, 1)); } diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index e9995f97..269e4ec0 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -291,6 +291,7 @@ tooltip.BloodMagic.livingArmour.upgrade.solarPowered=Solar Powered tooltip.BloodMagic.livingArmour.upgrade.thaumRunicShielding=Runic Shielding tooltip.BloodMagic.livingArmour.upgrade.revealing=Revealing tooltip.BloodMagic.livingArmour.upgrade.level=%s (Level %d) +tooltip.BloodMagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s tooltip.BloodMagic.will=Will Quality: %1$,.2f tooltip.BloodMagic.sentientSword.desc=Uses demon will to unleash its full potential. @@ -325,7 +326,8 @@ ritual.BloodMagic.speedRitual=Ritual of Speed ritual.BloodMagic.suppressionRitual=Ritual of Suppression ritual.BloodMagic.expulsionRitual=Aura of Expulsion ritual.BloodMagic.zephyrRitual=Call of the Zephyr -ritual.BloodMagic.fullUpgradeRemove=Sound of the Cleansing Soul +ritual.BloodMagic.upgradeRemoveRitual=Sound of the Cleansing Soul +ritual.BloodMagic.armourEvolveRitual=Ritual of Living Evolution # Chat chat.BloodMagic.altarMaker.setTier=Set Tier to: %d