use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.
the class RitualEffectWellOfSuffering method performEffect.
@Override
public void performEffect(IMasterRitualStone ritualStone) {
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getWorldTime() % this.timeDelay != 0) {
return;
}
IBloodAltar tileAltar = null;
boolean testFlag = false;
for (int i = -5; i <= 5; i++) {
for (int j = -5; j <= 5; j++) {
for (int k = -10; k <= 10; k++) {
if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) {
tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j);
testFlag = true;
}
}
}
}
if (!testFlag) {
return;
}
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int d0 = 10;
int vertRange = hasPotentia ? 20 : 10;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
int entityCount = 0;
boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
if (currentEssence < this.getCostPerRefresh() * list.size()) {
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else {
for (EntityLivingBase livingEntity : list) {
if (!livingEntity.isEntityAlive() || livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass())) {
continue;
}
hasOffensa = hasOffensa && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1)) {
hasTennebrae = hasTennebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true);
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
if (hasPotentia) {
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
}
}
use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.
the class DaggerOfSacrifice method findAndNotifyAltarOfDemon.
public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice) {
int posX = (int) Math.round(sacrifice.posX - 0.5f);
int posY = (int) sacrifice.posY;
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
if (altarEntity == null) {
return false;
}
altarEntity.addToDemonBloodDuration(50);
return true;
}
use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.
the class DaggerOfSacrifice method findAndFillAltar.
public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount) {
int posX = (int) Math.round(sacrifice.posX - 0.5f);
int posY = (int) sacrifice.posY;
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
if (altarEntity == null) {
return false;
}
altarEntity.sacrificialDaggerCall(amount, true);
altarEntity.startCycle();
return true;
}
use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.
the class SacrificialDagger method findAndFillAltar.
public void findAndFillAltar(World world, EntityPlayer player, int amount) {
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
IBloodAltar altarEntity = getAltar(world, posX, posY, posZ);
if (altarEntity == null) {
return;
}
altarEntity.sacrificialDaggerCall(amount, false);
altarEntity.startCycle();
}
Aggregations