- Changed the growth behavior of the crystals

- Fixed Potion getting for various methods
- Started work on crystal automation ritual
- Finished first iteration of the iterator of AreaDescriptor
This commit is contained in:
WayofTime 2016-03-24 14:11:05 -04:00
parent 78ed6a18e4
commit f0730791f7
20 changed files with 298 additions and 109 deletions

View file

@ -0,0 +1,135 @@
package WayofTime.bloodmagic.ritual;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.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.util.helper.NetworkHelper;
import WayofTime.bloodmagic.tile.TileDemonCrystal;
public class RitualForsakenSoul extends Ritual
{
public static final String CRYSTAL_RANGE = "altar";
public static final String DAMAGE_RANGE = "damage";
public RitualForsakenSoul()
{
super("ritualForsakenSoul", 0, 40000, "ritual." + Constants.Mod.MODID + ".forsakenSoulRitual");
addBlockRange(CRYSTAL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, -1, -1), 3));
addBlockRange(DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -10, -10), 21));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
BlockPos pos = masterRitualStone.getBlockPos();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
int maxEffects = 100;
int totalEffects = 0;
List<TileDemonCrystal> crystalList = new ArrayList<TileDemonCrystal>();
AreaDescriptor crystalRange = getBlockRange(CRYSTAL_RANGE);
crystalRange.resetIterator();
while (crystalRange.hasNext())
{
BlockPos nextPos = crystalRange.next().add(pos);
TileEntity tile = world.getTileEntity(nextPos);
if (tile instanceof TileDemonCrystal)
{
crystalList.add((TileDemonCrystal) tile);
}
}
if (crystalList.size() > 0)
{
TileDemonCrystal chosenCrystal = crystalList.get(world.rand.nextInt(crystalList.size()));
chosenCrystal.growCrystalWithWillAmount(40, 1);
}
// if (tile instanceof TileAltar)
// {
// TileAltar tileAltar = (TileAltar) tile;
//
// AreaDescriptor damageRange = getBlockRange(DAMAGE_RANGE);
// AxisAlignedBB range = damageRange.getAABB(pos);
//
// List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, range);
//
// for (EntityLivingBase entity : entities)
// {
// if (!ConfigHandler.wellOfSufferingBlacklist.contains(entity.getClass().getSimpleName()))
// {
// if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
// {
// if (entity.attackEntityFrom(DamageSource.outOfWorld, 1))
// {
// tileAltar.sacrificialDaggerCall(SACRIFICE_AMOUNT, true);
//
// totalEffects++;
//
// if (totalEffects >= maxEffects)
// {
// break;
// }
// }
// }
// }
// }
// }
network.syphon(getRefreshCost() * totalEffects);
}
@Override
public int getRefreshTime()
{
return 25;
}
@Override
public int getRefreshCost()
{
return 0;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
this.addCornerRunes(components, 2, -1, EnumRuneType.DUSK);
this.addParallelRunes(components, 2, -1, EnumRuneType.EARTH);
this.addCornerRunes(components, -3, -1, EnumRuneType.DUSK);
this.addOffsetRunes(components, 2, 4, -1, EnumRuneType.WATER);
this.addOffsetRunes(components, 1, 4, 0, EnumRuneType.WATER);
this.addParallelRunes(components, 4, 1, EnumRuneType.AIR);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualForsakenSoul();
}
}

View file

@ -6,6 +6,7 @@ import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.AxisAlignedBB;
@ -55,7 +56,7 @@ public class RitualRegeneration extends Ritual
float health = player.getHealth();
if (health <= player.getMaxHealth() - 1)
{
player.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("regeneration"), 50, 0, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.regeneration, 50, 0, false, false));
totalEffects++;

View file

@ -6,6 +6,7 @@ import WayofTime.bloodmagic.api.ritual.imperfect.IImperfectRitualStone;
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -20,7 +21,7 @@ public class ImperfectRitualResistance extends ImperfectRitual
public boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("resistance"), 1200, 1));
player.addPotionEffect(new PotionEffect(MobEffects.fireResistance, 1200, 1));
return true;
}

View file

@ -7,6 +7,7 @@ import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -22,9 +23,9 @@ public class ImperfectRitualZombie extends ImperfectRitual
{
EntityZombie zombie = new EntityZombie(imperfectRitualStone.getRitualWorld());
zombie.setPosition(imperfectRitualStone.getRitualPos().getX() + 0.5, imperfectRitualStone.getRitualPos().getY() + 2.1, imperfectRitualStone.getRitualPos().getZ() + 0.5);
zombie.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("fireResistance"), 2000));
zombie.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("damageBoost"), 20000, 7));
zombie.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("resistance"), 20000, 3));
zombie.addPotionEffect(new PotionEffect(MobEffects.fireResistance, 2000));
zombie.addPotionEffect(new PotionEffect(MobEffects.damageBoost, 20000, 7));
zombie.addPotionEffect(new PotionEffect(MobEffects.resistance, 20000, 3));
if (!imperfectRitualStone.getRitualWorld().isRemote)
imperfectRitualStone.getRitualWorld().spawnEntityInWorld(zombie);