Finished the Augments for the Ritual of the Crusher.
This commit is contained in:
parent
655c2880dc
commit
da4de55c2e
6 changed files with 206 additions and 10 deletions
|
@ -1,26 +1,35 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
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.Constants;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
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.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualSpeed extends Ritual
|
||||
{
|
||||
public static final String SPEED_RANGE = "sanicRange";
|
||||
|
||||
public static final double vengefulWillDrain = 0.05;
|
||||
public static final double destructiveWillDrain = 0.05;
|
||||
public static final double rawWillDrain = 0.1;
|
||||
|
||||
public RitualSpeed()
|
||||
{
|
||||
super("ritualSpeed", 0, 1000, "ritual." + Constants.Mod.MODID + ".speedRitual");
|
||||
|
@ -41,17 +50,67 @@ public class RitualSpeed extends Ritual
|
|||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
|
||||
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
|
||||
|
||||
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
|
||||
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
|
||||
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
|
||||
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
|
||||
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
|
||||
|
||||
AreaDescriptor speedRange = getBlockRange(SPEED_RANGE);
|
||||
|
||||
double vengefulDrain = 0;
|
||||
double destructiveDrain = 0;
|
||||
double rawDrain = 0;
|
||||
|
||||
if (rawWill < rawWillDrain)
|
||||
{
|
||||
rawWill = 0; //Simplifies later calculations
|
||||
}
|
||||
|
||||
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
if (entity.isSneaking())
|
||||
continue;
|
||||
|
||||
double motionY = 1.2;
|
||||
double speed = 3;
|
||||
boolean transportChildren = destructiveWill < destructiveWillDrain;
|
||||
boolean transportAdults = vengefulWill < vengefulWillDrain;
|
||||
|
||||
if ((entity.isChild() && !transportChildren) || (!entity.isChild() && !transportAdults))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer && (transportChildren ^ transportAdults))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!transportChildren)
|
||||
{
|
||||
destructiveWill -= destructiveWillDrain;
|
||||
destructiveDrain += destructiveWillDrain;
|
||||
}
|
||||
|
||||
if (!transportAdults)
|
||||
{
|
||||
vengefulWill -= vengefulWillDrain;
|
||||
vengefulDrain += vengefulWillDrain;
|
||||
}
|
||||
|
||||
double motionY = getVerticalSpeedForWill(rawWill);
|
||||
double speed = getHorizontalSpeedForWill(rawWill);
|
||||
EnumFacing direction = masterRitualStone.getDirection();
|
||||
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
rawWill -= rawWillDrain;
|
||||
rawDrain += rawWillDrain;
|
||||
}
|
||||
|
||||
entity.motionY = motionY;
|
||||
entity.fallDistance = 0;
|
||||
|
||||
|
@ -89,6 +148,21 @@ public class RitualSpeed extends Ritual
|
|||
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (rawDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
|
||||
}
|
||||
|
||||
if (vengefulDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
|
||||
}
|
||||
|
||||
if (destructiveDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,4 +199,20 @@ public class RitualSpeed extends Ritual
|
|||
{
|
||||
return new RitualSpeed();
|
||||
}
|
||||
|
||||
@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") };
|
||||
}
|
||||
|
||||
public double getVerticalSpeedForWill(double rawWill)
|
||||
{
|
||||
return 1.2 + rawWill / 200;
|
||||
}
|
||||
|
||||
public double getHorizontalSpeedForWill(double rawWill)
|
||||
{
|
||||
return 3 + rawWill / 40;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue