From 6b27896859587a7eece5d790a11f5e256e9770bf Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 23 Oct 2016 20:59:49 -0400 Subject: [PATCH] Added more augmentations for the Lava Ritual. --- changelog.txt | 1 + .../bloodmagic/ritual/RitualLava.java | 105 +++++++++++++++++- .../java/WayofTime/bloodmagic/util/Utils.java | 5 + .../assets/bloodmagic/lang/en_US.lang | 8 ++ 4 files changed, 116 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7989f583..50240f4d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Version 2.1.0-67 ------------------------------------------------------ - Added the Destructive Will effect to the Ritual of the Green Grove. This ritual now is done~ +- Added more augmentations for the Lava Ritual. ------------------------------------------------------ Version 2.1.0-66 diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java index cb7cea0b..273e64be 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java @@ -7,10 +7,14 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; import net.minecraft.potion.PotionEffect; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; +import WayofTime.bloodmagic.api.BloodMagicAPI; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.ritual.AreaDescriptor; import WayofTime.bloodmagic.api.ritual.EnumRuneType; @@ -29,20 +33,32 @@ public class RitualLava extends Ritual { public static final String LAVA_RANGE = "lavaRange"; public static final String FIRE_FUSE_RANGE = "fireFuse"; + public static final String FIRE_RESIST_RANGE = "fireResist"; + public static final String FIRE_DAMAGE_RANGE = "fireDamage"; public static final double vengefulWillDrain = 1; + public static final double steadfastWillDrain = 0.5; + public static final double corrosiveWillDrain = 0.2; + + public int timer = 0; + public static final int corrosiveRefreshTime = 20; public RitualLava() { super("ritualLava", 0, 10000, "ritual." + Constants.Mod.MODID + ".lavaRitual"); addBlockRange(LAVA_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1)); addBlockRange(FIRE_FUSE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, -2, -2), 5)); + addBlockRange(FIRE_RESIST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 0, 0), 1)); + addBlockRange(FIRE_DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 0, 0), 1)); setMaximumVolumeAndDistanceOfRange(LAVA_RANGE, 9, 3, 3); setMaximumVolumeAndDistanceOfRange(FIRE_FUSE_RANGE, 0, 10, 10); + setMaximumVolumeAndDistanceOfRange(FIRE_RESIST_RANGE, 0, 10, 10); + setMaximumVolumeAndDistanceOfRange(FIRE_DAMAGE_RANGE, 0, 10, 10); } @Override public void performRitual(IMasterRitualStone masterRitualStone) { + timer++; World world = masterRitualStone.getWorldObj(); SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner()); int currentEssence = network.getCurrentEssence(); @@ -82,9 +98,10 @@ public class RitualLava extends Ritual } } - network.syphon(getRefreshCost() * totalEffects); - double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig); + double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig); + double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig); + if (vengefulWill >= vengefulWillDrain) { double vengefulDrained = 0; @@ -102,7 +119,7 @@ public class RitualLava extends Ritual if (entity instanceof EntityPlayer) { -// continue; + continue; } if (!entity.isPotionActive(ModPotions.fireFuse)) @@ -119,6 +136,72 @@ public class RitualLava extends Ritual WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrained, true); } } + + if (steadfastWill >= steadfastWillDrain) + { + double steadfastDrained = 0; + AreaDescriptor resistRange = getBlockRange(FIRE_RESIST_RANGE); + + int duration = getFireResistForWill(steadfastWill); + + AxisAlignedBB resistArea = resistRange.getAABB(pos); + List entities = world.getEntitiesWithinAABB(EntityPlayer.class, resistArea); + + for (EntityPlayer entity : entities) + { + if (steadfastWill < steadfastWillDrain) + { + break; + } + if (!entity.isPotionActive(MobEffects.FIRE_RESISTANCE) || (entity.getActivePotionEffect(MobEffects.FIRE_RESISTANCE).getDuration() < 2)) + { + entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 100, 0)); + + steadfastDrained += steadfastWillDrain; + steadfastWill -= steadfastWillDrain; + } + } + + if (steadfastDrained > 0) + { + WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrained, true); + } + } + + if (timer % corrosiveRefreshTime == 0 && corrosiveWill >= corrosiveWillDrain) + { + double corrosiveDrained = 0; + AreaDescriptor resistRange = getBlockRange(FIRE_DAMAGE_RANGE); + + float damage = getCorrosiveDamageForWill(corrosiveWill); + + AxisAlignedBB damageArea = resistRange.getAABB(pos); + List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, damageArea); + + for (EntityLivingBase entity : entities) + { + if (corrosiveWill < corrosiveWillDrain) + { + break; + } + + if (!entity.isDead && entity.hurtTime <= 0 && Utils.isImmuneToFireDamage(entity)) + { + if (entity.attackEntityFrom(BloodMagicAPI.getDamageSource(), damage)) + { + corrosiveDrained += corrosiveWillDrain; + corrosiveWill -= corrosiveWillDrain; + } + } + } + + if (corrosiveDrained > 0) + { + WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrained, true); + } + } + + network.syphon(getRefreshCost() * totalEffects); } @Override @@ -133,6 +216,12 @@ public class RitualLava extends Ritual return 500; } + @Override + public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player) + { + return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") }; + } + @Override public ArrayList getComponents() { @@ -193,4 +282,14 @@ public class RitualLava extends Ritual return horizontalRangeMap.get(range); } + + public int getFireResistForWill(double steadfastWill) + { + return (int) (200 + steadfastWill * 3); + } + + public float getCorrosiveDamageForWill(double corrosiveWill) + { + return (float) (1 + corrosiveWill * 0.05); + } } diff --git a/src/main/java/WayofTime/bloodmagic/util/Utils.java b/src/main/java/WayofTime/bloodmagic/util/Utils.java index e39e3f8c..4cf9471b 100644 --- a/src/main/java/WayofTime/bloodmagic/util/Utils.java +++ b/src/main/java/WayofTime/bloodmagic/util/Utils.java @@ -93,6 +93,11 @@ public class Utils return null; } + public static boolean isImmuneToFireDamage(EntityLivingBase entity) + { + return entity.isImmuneToFire() || entity.isPotionActive(MobEffects.FIRE_RESISTANCE); + } + public static boolean isPlayerBesideSolidBlockFace(EntityPlayer player) { World world = player.worldObj; diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index 3bfc1d7b..72ae2624 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -605,6 +605,12 @@ ritual.BloodMagic.downgradeRitual=Downgrade Ritual ritual.BloodMagic.waterRitual.info=Generates a source of water from the master ritual stone. ritual.BloodMagic.lavaRitual.info=Generates a source of lava from the master ritual stone. +ritual.BloodMagic.lavaRitual.default.info=(Raw) Decreases the LP cost of placing lava and allows lava to be placed insided of a linked container. +ritual.BloodMagic.lavaRitual.corrosive.info=(Corrosive) Entities within range that are immune to fire are damaged severely. +ritual.BloodMagic.lavaRitual.destructive.info=(Destructive) Lava placement range is increased based on total Will. +ritual.BloodMagic.lavaRitual.vengeful.info=(Vengeful) Entities within range have Fire Fuse applied to them. +ritual.BloodMagic.lavaRitual.steadfast.info=(Steadfast) Players within a designated range have Fire Resistance applied to them. + ritual.BloodMagic.greenGroveRitual.info=Grows crops within its area. ritual.BloodMagic.jumpRitual.info=Causes entities to leap up into the air. ritual.BloodMagic.wellOfSufferingRitual.info=Attacks mobs within its damage zone and puts the LP into a nearby blood altar. @@ -644,6 +650,8 @@ ritual.BloodMagic.meteorRitual.info=Consumes an item inside of its item range to ritual.BloodMagic.waterRitual.waterRange.info=(Water) The area that the ritual will place water source blocks. ritual.BloodMagic.lavaRitual.lavaRange.info=(Lava) The area that the ritual will place lava source blocks. ritual.BloodMagic.lavaRitual.fireFuse.info=(Vengeful) Entities in this range are afflicted by Fire Fuse. +ritual.BloodMagic.lavaRitual.fireResist.info=(Steadfast) Players in this range have Fire Resist applied. +ritual.BloodMagic.lavaRitual.fireDamage.info=(Corrosive) Entities within this range that are immune to fire damage are hurt proportional to the Will. ritual.BloodMagic.greenGroveRitual.growing.info=(Growth) The area that the ritual will grow plants in. ritual.BloodMagic.greenGroveRitual.leech.info=(Corrosive) Entities in this area have their life drained to grow nearby crops. ritual.BloodMagic.greenGroveRitual.hydrate.info=(Steadfast) Blocks within this range are rehydrated into farmland, and seeds within the area are planted nearby.