Add Lokenzen's ring
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package electroblob.wizardry.entity.construct;
|
||||
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
@@ -8,8 +10,12 @@ import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityStormcloud extends EntityScaledConstruct {
|
||||
@@ -28,6 +34,8 @@ public class EntityStormcloud extends EntityScaledConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
this.move(MoverType.SELF, motionX, 0, motionZ);
|
||||
|
||||
if(this.world.isRemote){
|
||||
|
||||
float areaFactor = (width * width) / 36; // Ensures cloud/raindrop density stays the same for different sizes
|
||||
@@ -36,32 +44,44 @@ public class EntityStormcloud extends EntityScaledConstruct {
|
||||
.clr(0.3f, 0.3f, 0.3f).shaded(true).spawn(world);
|
||||
}
|
||||
|
||||
boolean stormcloudRingActive = getCaster() instanceof EntityPlayer && ItemArtefact.isArtefactActive((EntityPlayer)getCaster(), WizardryItems.ring_stormcloud);
|
||||
|
||||
List<EntityLivingBase> targets = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
this.getEntityBoundingBox().expand(0, -10, 0));
|
||||
|
||||
targets.removeIf(t -> !this.isValidTarget(t));
|
||||
|
||||
float damage = Spells.stormcloud.getProperty(Spell.DAMAGE).floatValue() * this.damageMultiplier;
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
if(target.ticksExisted % 150 == 0){ // Use target's lifetime so they don't all get hit at once, looks better
|
||||
|
||||
if(target.ticksExisted % 150 == 0){ // Use target's lifetime so they don't all get hit at once, looks better
|
||||
|
||||
if(!this.world.isRemote){
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, this.getCaster(), MagicDamage.DamageType.SHOCK), damage);
|
||||
}else{
|
||||
ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ)
|
||||
.target(target).scale(2).spawn(world);
|
||||
ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height, target.posZ);
|
||||
}
|
||||
|
||||
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_THUNDER, 1, 1.6f);
|
||||
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_ATTACK, 1, 1);
|
||||
if(!this.world.isRemote){
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, this.getCaster(), MagicDamage.DamageType.SHOCK), damage);
|
||||
}else{
|
||||
ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ)
|
||||
.target(target).scale(2).spawn(world);
|
||||
ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height, target.posZ);
|
||||
}
|
||||
|
||||
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_THUNDER, 1, 1.6f);
|
||||
target.playSound(WizardrySounds.ENTITY_STORMCLOUD_ATTACK, 1, 1);
|
||||
|
||||
if(stormcloudRingActive) this.lifetime -= 40; // Each strike prolongs the lifetime by 2 seconds with the ring
|
||||
}
|
||||
}
|
||||
|
||||
if(stormcloudRingActive){
|
||||
EntityUtils.getLivingWithinRadius(width * 3, posX, posY, posZ, world).stream()
|
||||
.filter(this::isValidTarget).min(Comparator.comparingDouble(this::getDistanceSq)).ifPresent(e -> {
|
||||
Vec3d vel = e.getPositionVector().subtract(this.getPositionVector()).normalize().scale(0.2);
|
||||
this.motionX = vel.x;
|
||||
this.motionZ = vel.z;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -229,6 +229,7 @@ public final class WizardryItems {
|
||||
public static final Item ring_storm = placeholder();
|
||||
public static final Item ring_seeking = placeholder();
|
||||
public static final Item ring_hammer = placeholder();
|
||||
public static final Item ring_stormcloud = placeholder();
|
||||
public static final Item ring_soulbinding = placeholder();
|
||||
public static final Item ring_leeching = placeholder();
|
||||
public static final Item ring_necromancy_melee = placeholder();
|
||||
@@ -599,6 +600,7 @@ public final class WizardryItems {
|
||||
registerItem(registry, "ring_storm", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_seeking", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_hammer", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_stormcloud", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_soulbinding", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_leeching", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING));
|
||||
registerItem(registry, "ring_necromancy_melee", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.RING));
|
||||
|
||||
@@ -299,6 +299,8 @@ item.ebwizardry\:ring_seeking.name=Ring of Attraction
|
||||
item.ebwizardry\:ring_seeking.desc=All projectile spells seek their targets
|
||||
item.ebwizardry\:ring_hammer.name=Ring of Thalek the Almighty
|
||||
item.ebwizardry\:ring_hammer.desc=Lightning hammers can be picked up and thrown
|
||||
item.ebwizardry\:ring_stormcloud.name=Lokenzen's Ring
|
||||
item.ebwizardry\:ring_stormcloud.desc=Stormcloud moves towards targets and lasts longer with every strike
|
||||
item.ebwizardry\:ring_soulbinding.name=Soulwalker's Ring
|
||||
item.ebwizardry\:ring_soulbinding.desc=Creatures damaged by necromancy spells become soulbound to you
|
||||
item.ebwizardry\:ring_leeching.name=Ring of Leeching
|
||||
|
||||
@@ -299,6 +299,8 @@ item.ebwizardry\:ring_seeking.name=Ring of Attraction
|
||||
item.ebwizardry\:ring_seeking.desc=All projectile spells seek their targets
|
||||
item.ebwizardry\:ring_hammer.name=Ring of Thalek the Almighty
|
||||
item.ebwizardry\:ring_hammer.desc=Lightning hammers can be picked up and thrown
|
||||
item.ebwizardry\:ring_stormcloud.name=Lokenzen's Ring
|
||||
item.ebwizardry\:ring_stormcloud.desc=Stormcloud moves towards targets and lasts longer with every strike
|
||||
item.ebwizardry\:ring_soulbinding.name=Soulwalker's Ring
|
||||
item.ebwizardry\:ring_soulbinding.desc=Creatures damaged by necromancy spells become soulbound to you
|
||||
item.ebwizardry\:ring_leeching.name=Ring of Leeching
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "ebwizardry:items/ring_stormcloud"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
Reference in New Issue
Block a user