That's one heck of a commit you've got there...

I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
Electroblob77
2019-08-18 00:04:18 +01:00
parent 2680d02304
commit f37812be3e
1564 changed files with 47652 additions and 12984 deletions
@@ -1,18 +1,9 @@
package electroblob.wizardry.spell;
import java.util.List;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.SpellType;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
@@ -20,12 +11,31 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import java.util.List;
public class Thunderstorm extends Spell {
public static final String LIGHTNING_BOLTS = "lightning_bolts";
public static final String SECONDARY_DAMAGE = "secondary_damage";
public static final String TERTIARY_DAMAGE = "tertiary_damage";
public static final String SECONDARY_RANGE = "secondary_range";
public static final String TERTIARY_RANGE = "tertiary_range";
public static final String SECONDARY_MAX_TARGETS = "secondary_max_targets";
public static final String TERTIARY_MAX_TARGETS = "tertiary_max_targets"; // This is per secondary target
private static final float CENTRE_RADIUS_FRACTION = 0.5f;
public Thunderstorm(){
super("thunderstorm", Tier.MASTER, Element.LIGHTNING, SpellType.ATTACK, 100, 250, EnumAction.BOW, false);
super("thunderstorm", EnumAction.BOW, false);
this.soundValues(1, 1.7f, 0.2f);
addProperties(EFFECT_RADIUS, LIGHTNING_BOLTS, SECONDARY_DAMAGE, TERTIARY_DAMAGE, SECONDARY_RANGE,
TERTIARY_RANGE, SECONDARY_MAX_TARGETS, TERTIARY_MAX_TARGETS);
}
@Override
@@ -43,77 +53,80 @@ public class Thunderstorm extends Spell {
if(world.canBlockSeeSky(new BlockPos(caster))){
for(int r = 0; r < 10; r++){
double maxRadius = getProperty(EFFECT_RADIUS).doubleValue();
double radius = 4 + world.rand.nextDouble() * 6 * modifiers.get(WizardryItems.blast_upgrade);
double angle = world.rand.nextDouble() * Math.PI * 2;
for(int i = 0; i < getProperty(LIGHTNING_BOLTS).intValue(); i++){
double x = caster.posX + radius * Math.cos(angle);
double z = caster.posZ + radius * Math.sin(angle);
double y = WizardryUtilities.getNearestFloorLevel(world, new BlockPos(x, caster.posY, z), 10);
double radius = maxRadius * CENTRE_RADIUS_FRACTION + world.rand.nextDouble() * maxRadius
* (1 - CENTRE_RADIUS_FRACTION) * modifiers.get(WizardryItems.blast_upgrade);
float angle = world.rand.nextFloat() * (float)Math.PI * 2;
if(!world.isRemote){
EntityLightningBolt entitylightning = new EntityLightningBolt(world, x, y, z, false);
world.addWeatherEffect(entitylightning);
}
double x = caster.posX + radius * MathHelper.cos(angle);
double z = caster.posZ + radius * MathHelper.sin(angle);
Integer y = WizardryUtilities.getNearestFloor(world, new BlockPos(x, caster.posY, z), (int)maxRadius);
// Code for eventhandler recognition; for achievements and such like. Left in for future use.
// NBTTagCompound entityNBT = entitylightning.getEntityData();
// entityNBT.setInteger("summoningPlayer", entityplayer.entityId);
if(y != null){
// Secondary chaining effect
double seekerRange = 10.0d;
if(!world.isRemote){
EntityLightningBolt entitylightning = new EntityLightningBolt(world, x, y, z, false);
world.addWeatherEffect(entitylightning);
}
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, x,
y + 1, z, world);
// Code for eventhandler recognition; for achievements and such like. Left in for future use.
// NBTTagCompound entityNBT = entitylightning.getEntityData();
// entityNBT.setInteger("summoningPlayer", entityplayer.entityId);
// For this spell there is no limit to the amount of secondary targets!
for(EntityLivingBase secondaryTarget : secondaryTargets){
// Secondary chaining effect
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(
getProperty(SECONDARY_RANGE).doubleValue(), x, y + 1, z, world);
if(WizardryUtilities.isValidTarget(caster, secondaryTarget)){
for(int j = 0; j < Math.min(secondaryTargets.size(), getProperty(SECONDARY_MAX_TARGETS).intValue()); j++){
if(world.isRemote){
EntityLivingBase secondaryTarget = secondaryTargets.get(j);
ParticleBuilder.create(Type.LIGHTNING).pos(x, y, z).target(secondaryTarget).spawn(world);
ParticleBuilder.spawnShockParticles(world, secondaryTarget.posX,
secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2,
secondaryTarget.posZ);
}
if(AllyDesignationSystem.isValidTarget(caster, secondaryTarget)){
secondaryTarget.playSound(WizardrySounds.SPELL_SPARK, 1.0F,
world.rand.nextFloat() * 0.4F + 1.5F);
if(world.isRemote){
secondaryTarget.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
10.0f * modifiers.get(SpellModifiers.POTENCY));
ParticleBuilder.create(Type.LIGHTNING).pos(x, y, z).target(secondaryTarget).spawn(world);
// Tertiary chaining effect
ParticleBuilder.spawnShockParticles(world, secondaryTarget.posX,
secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2,
secondaryTarget.posZ);
}
List<EntityLivingBase> tertiaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
secondaryTarget.posX, secondaryTarget.posY + secondaryTarget.height / 2,
secondaryTarget.posZ, world);
playSound(world, secondaryTarget, 0, -1, modifiers);
for(int j = 0; j < Math.min(tertiaryTargets.size(), 3); j++){
secondaryTarget.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
getProperty(SECONDARY_DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
EntityLivingBase tertiaryTarget = (EntityLivingBase)tertiaryTargets.get(j);
// Tertiary chaining effect
if(!secondaryTargets.contains(tertiaryTarget)
&& WizardryUtilities.isValidTarget(caster, tertiaryTarget)){
List<EntityLivingBase> tertiaryTargets = WizardryUtilities.getEntitiesWithinRadius(
getProperty(TERTIARY_RANGE).doubleValue(), secondaryTarget.posX,
secondaryTarget.posY + secondaryTarget.height / 2, secondaryTarget.posZ, world);
if(world.isRemote){
ParticleBuilder.create(Type.LIGHTNING).entity(secondaryTarget)
.pos(0, secondaryTarget.height/2, 0).target(tertiaryTarget).spawn(world);
ParticleBuilder.spawnShockParticles(world, tertiaryTarget.posX,
tertiaryTarget.getEntityBoundingBox().minY + tertiaryTarget.height / 2,
tertiaryTarget.posZ);
for(int k = 0; k < Math.min(tertiaryTargets.size(), getProperty(TERTIARY_MAX_TARGETS).intValue()); k++){
EntityLivingBase tertiaryTarget = tertiaryTargets.get(k);
if(!secondaryTargets.contains(tertiaryTarget)
&& AllyDesignationSystem.isValidTarget(caster, tertiaryTarget)){
if(world.isRemote){
ParticleBuilder.create(Type.LIGHTNING).entity(secondaryTarget)
.pos(0, secondaryTarget.height / 2, 0).target(tertiaryTarget).spawn(world);
ParticleBuilder.spawnShockParticles(world, tertiaryTarget.posX,
tertiaryTarget.getEntityBoundingBox().minY + tertiaryTarget.height / 2,
tertiaryTarget.posZ);
}
playSound(world, tertiaryTarget, 0, -1, modifiers);
tertiaryTarget.attackEntityFrom(
MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
getProperty(TERTIARY_DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
}
tertiaryTarget.playSound(WizardrySounds.SPELL_SPARK, 1.0F,
world.rand.nextFloat() * 0.4F + 1.5F);
tertiaryTarget.attackEntityFrom(
MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
8.0f * modifiers.get(SpellModifiers.POTENCY));
}
}
}