Java Examples for WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone
The following java examples will help you to understand the usage of WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone. These source code samples are taken from different open source projects.
Example 1
Project: ForbiddenMagic-master File: RitualSanity.java View source code |
@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();
int timeDelay = 600;
if (world.getWorldTime() % timeDelay != 0) {
return;
}
boolean crazy = world.getWorldTime() % (timeDelay * 4) == 0;
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
int range = 15 * (hasCrystallos ? 3 : 1);
int vertRange = 15 * (hasCrystallos ? 3 : 1);
float posX = x + 0.5f;
float posY = y + 0.5f;
float posZ = z + 0.5f;
List<EntityPlayer> list = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, vertRange, range));
int entityCount = 0;
for (EntityPlayer player : list) {
entityCount++;
}
int cost = this.getCostPerRefresh();
if (currentEssence < cost * entityCount) {
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else {
entityCount = 0;
for (EntityPlayer player : list) {
PotionEffect effect = player.getActivePotionEffect(PotionWarpWard.instance);
if (effect == null || effect.getDuration() <= timeDelay) {
PotionEffect ward = new PotionEffect(PotionWarpWard.instance.id, timeDelay + 2, 0, true);
ward.getCurativeItems().clear();
player.addPotionEffect(ward);
entityCount++;
if (crazy && world.rand.nextInt(35) <= 3)
Thaumcraft.proxy.getPlayerKnowledge().addWarpTemp(player.getDisplayName(), 1 + world.rand.nextInt(3));
}
}
if (entityCount > 0) {
if (hasCrystallos) {
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, cost * entityCount);
}
}
}