use of com.teamwizardry.wizardry.api.spell.annotation.ModuleOverride in project Wizardry by TeamWizardry.
the class ModuleEffectTimeSlow method onRunZone.
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);
Vec3d targetPos = data.getTarget(world);
if (targetPos == null)
return false;
Vec3d min = targetPos.subtract(aoe, range, aoe);
Vec3d max = targetPos.add(aoe, range, aoe);
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
for (Entity entity : entities) {
if (entity instanceof EntityLivingBase) {
if (!((EntityLivingBase) entity).isPotionActive(ModPotions.TIME_SLOW) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
data.processEntity(entity, false);
runOnStart(world, data, childRing);
}
}
}
return true;
}
use of com.teamwizardry.wizardry.api.spell.annotation.ModuleOverride in project Wizardry by TeamWizardry.
the class ModuleEffectFrost method onRunZone.
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
if (!world.isRemote)
return false;
double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);
Vec3d targetPos = data.getTarget(world);
if (targetPos == null)
return false;
Vec3d min = targetPos.subtract(aoe, range, aoe);
Vec3d max = targetPos.add(aoe, range, aoe);
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
for (Entity entity : entities) {
entity.extinguish();
if (entity instanceof EntityLivingBase) {
if (!((EntityLivingBase) entity).isPotionActive(ModPotions.SLIPPERY) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
double time = childRing.getAttributeValue(world, AttributeRegistry.DURATION, data) * 10;
world.playSound(null, entity.getPosition(), ModSounds.FROST_FORM, SoundCategory.NEUTRAL, 1, 1);
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(ModPotions.SLIPPERY, (int) time, 0, true, false));
}
}
}
return false;
}
use of com.teamwizardry.wizardry.api.spell.annotation.ModuleOverride in project Wizardry by TeamWizardry.
the class ModuleEffectLowGravity method onRunZone.
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);
Vec3d targetPos = data.getTarget(world);
if (targetPos == null)
return false;
Vec3d min = targetPos.subtract(aoe, range, aoe);
Vec3d max = targetPos.add(aoe, range, aoe);
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
for (Entity entity : entities) {
if (entity instanceof EntityLivingBase) {
if (!((EntityLivingBase) entity).isPotionActive(ModPotions.LOW_GRAVITY) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
data.processEntity(entity, false);
run(world, (ModuleInstanceEffect) childRing.getModule(), data, childRing);
}
}
}
return true;
}
use of com.teamwizardry.wizardry.api.spell.annotation.ModuleOverride in project Wizardry by TeamWizardry.
the class ModuleEffectLightning method onRunTouch.
@ModuleOverride("shape_touch_run")
public void onRunTouch(@ContextSuper ModuleOverrideSuper ovdSuper, World world, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) {
if (ovdSuper.hasSuper())
ovdSuper.invoke(true, world, data, shape);
Vec3d look = data.getData(LOOK);
Entity caster = data.getCaster(world);
Vec3d origin = data.getOriginWithFallback(world);
if (look == null || caster == null || origin == null)
return;
if (!childRing.taxCaster(world, data, true))
return;
double range = childRing.getAttributeValue(world, AttributeRegistry.RANGE, data);
double potency = childRing.getAttributeValue(world, AttributeRegistry.POTENCY, data);
double duration = childRing.getAttributeValue(world, AttributeRegistry.DURATION, data);
RayTraceResult trace = new RayTrace(world, look, origin, caster instanceof EntityLivingBase ? ((EntityLivingBase) caster).getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue() : 5).setEntityFilter(input -> input != caster).setReturnLastUncollidableBlock(true).setIgnoreBlocksWithoutBoundingBoxes(true).trace();
doLightning(RandUtil.nextLong(100, 100000), world, caster, origin, trace.hitVec, range, potency, duration);
}
use of com.teamwizardry.wizardry.api.spell.annotation.ModuleOverride in project Wizardry by TeamWizardry.
the class ModuleEffectLightning method onRunZone.
@ModuleOverride("shape_zone_run")
public boolean onRunZone(@ContextSuper ModuleOverrideSuper ovdSuper, World world, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) {
if (ovdSuper.hasSuper())
ovdSuper.invoke(true, world, data, shape);
Entity caster = data.getCaster(world);
Vec3d targetPos = data.getTargetWithFallback(world);
if (targetPos == null)
return true;
if (!childRing.taxCaster(world, data, true))
return true;
double lightningRange = childRing.getAttributeValue(world, AttributeRegistry.RANGE, data);
double lightningPotency = childRing.getAttributeValue(world, AttributeRegistry.POTENCY, data);
double lightningDuration = childRing.getAttributeValue(world, AttributeRegistry.DURATION, data);
double zoneAoE = shape.getAttributeValue(world, AttributeRegistry.AREA, data);
double zoneRange = shape.getAttributeValue(world, AttributeRegistry.RANGE, data);
Vec3d min = targetPos.subtract(zoneAoE / 2, zoneRange / 2, zoneAoE / 2);
Vec3d max = targetPos.add(zoneAoE / 2, zoneRange / 2, zoneAoE / 2);
RandUtilSeed rand = new RandUtilSeed(RandUtil.nextLong(100, 100000));
Vec3d from = new Vec3d(rand.nextDouble(min.x, max.x), rand.nextDouble(min.y, max.y), rand.nextDouble(min.z, max.z));
float pitch = (float) (180 * Math.asin(2 * rand.nextDouble() - 1) / Math.PI);
float yaw = (float) rand.nextDouble(360);
Vec3d to = Vec3d.fromPitchYaw(pitch, yaw).normalize().scale(lightningRange).add(from);
doLightning(rand.nextLong(100, 100000), world, caster, from, to, lightningRange, lightningPotency, lightningDuration);
return true;
}
Aggregations