Work on the Lava Ritual's demon Will shenanigans

This commit is contained in:
WayofTime 2016-07-12 18:24:19 -04:00
parent acde7ceccd
commit c5f6495859
5 changed files with 71 additions and 7 deletions

View file

@ -4,7 +4,11 @@ import java.util.ArrayList;
import java.util.List;
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.potion.PotionEffect;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
@ -18,18 +22,22 @@ import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.Utils;
public class RitualLava extends Ritual
{
public static final String LAVA_RANGE = "lavaRange";
public static int destructiveWillDrain = 10;
public static final String FIRE_FUSE_RANGE = "fireFuse";
public static final double vengefulWillDrain = 1;
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));
setMaximumVolumeAndDistanceOfRange(LAVA_RANGE, 9, 3, 3);
setMaximumVolumeAndDistanceOfRange(FIRE_FUSE_RANGE, 0, 10, 10);
}
@Override
@ -56,7 +64,6 @@ public class RitualLava extends Ritual
int maxLavaVolume = getMaxVolumeForRange(LAVA_RANGE, willConfig, holder);
if (!lavaRange.isWithinRange(getMaxVerticalRadiusForRange(LAVA_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(LAVA_RANGE, willConfig, holder)) || (maxLavaVolume != 0 && lavaRange.getVolume() > maxLavaVolume))
{
return;
}
@ -76,6 +83,42 @@ public class RitualLava extends Ritual
}
network.syphon(getRefreshCost() * totalEffects);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
if (vengefulWill >= vengefulWillDrain)
{
double vengefulDrained = 0;
AreaDescriptor fuseRange = getBlockRange(FIRE_FUSE_RANGE);
AxisAlignedBB fuseArea = fuseRange.getAABB(pos);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, fuseArea);
for (EntityLivingBase entity : entities)
{
if (vengefulWill < vengefulWillDrain)
{
break;
}
if (entity instanceof EntityPlayer)
{
// continue;
}
if (!entity.isPotionActive(ModPotions.fireFuse))
{
entity.addPotionEffect(new PotionEffect(ModPotions.fireFuse, 100, 0));
vengefulDrained += vengefulWillDrain;
vengefulWill -= vengefulWillDrain;
}
}
if (vengefulDrained > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrained, true);
}
}
}
@Override