diff --git a/src/main/java/electroblob/wizardry/registry/WizardryItems.java b/src/main/java/electroblob/wizardry/registry/WizardryItems.java index a90df322..92a67362 100644 --- a/src/main/java/electroblob/wizardry/registry/WizardryItems.java +++ b/src/main/java/electroblob/wizardry/registry/WizardryItems.java @@ -235,6 +235,7 @@ public final class WizardryItems { public static final Item ring_earth_melee = placeholder(); public static final Item ring_earth_biome = placeholder(); public static final Item ring_full_moon = placeholder(); + public static final Item ring_evoker = placeholder(); public static final Item ring_extraction = placeholder(); public static final Item ring_mana_return = placeholder(); public static final Item ring_blockwrangler = placeholder(); @@ -600,6 +601,7 @@ public final class WizardryItems { registerItem(registry, "ring_earth_melee", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.RING)); registerItem(registry, "ring_earth_biome", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.RING)); registerItem(registry, "ring_full_moon", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING)); + registerItem(registry, "ring_evoker", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING)); registerItem(registry, "ring_extraction", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.RING)); registerItem(registry, "ring_mana_return", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.RING)); registerItem(registry, "ring_blockwrangler", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.RING)); diff --git a/src/main/java/electroblob/wizardry/spell/Fangs.java b/src/main/java/electroblob/wizardry/spell/Fangs.java index f9a84313..607ab398 100644 --- a/src/main/java/electroblob/wizardry/spell/Fangs.java +++ b/src/main/java/electroblob/wizardry/spell/Fangs.java @@ -1,5 +1,6 @@ package electroblob.wizardry.spell; +import electroblob.wizardry.item.ItemArtefact; import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.registry.WizardryItems; import electroblob.wizardry.util.*; @@ -63,7 +64,10 @@ public class Fangs extends Spell { protected boolean spawnFangs(World world, Vec3d origin, Vec3d direction, @Nullable EntityLivingBase caster, SpellModifiers modifiers){ - if(direction.lengthSquared() == 0) return false; // Prevent casting directly down/up + boolean defensiveCircle = caster instanceof EntityPlayer && caster.isSneaking() + && ItemArtefact.isArtefactActive((EntityPlayer)caster, WizardryItems.ring_evoker); + + if(!defensiveCircle && direction.lengthSquared() == 0) return false; // Prevent casting directly down/up boolean flag = false; @@ -80,20 +84,26 @@ public class Fangs extends Spell { }else{ - int count = (int)(getProperty(RANGE).doubleValue() * modifiers.get(WizardryItems.range_upgrade)); - float yaw = (float)MathHelper.atan2(direction.z, direction.x); // Yes, this is the right way round! + if(defensiveCircle){ - for(int i = 0; i < count; i++){ + for(int i = 0; i < 5; i++){ + float yaw = i * (float)Math.PI * 0.4f; + flag |= this.spawnFangsAt(world, caster, modifiers, yaw, 0, origin.add(MathHelper.cos(yaw) * 1.5, 0, MathHelper.sin(yaw) * 1.5)); + } - Vec3d vec = origin.add(direction.scale((i + 1) * FANG_SPACING)); - // Not exactly the same as evokers but it's how constructs work so it kinda fits - Integer y = BlockUtils.getNearestFloor(world, new BlockPos(vec), 5); + for(int k = 0; k < 8; k++){ + float yaw = k * (float)Math.PI * 2f / 8f + ((float)Math.PI * 2f / 5f); + flag |= this.spawnFangsAt(world, caster, modifiers, yaw, 3, origin.add(MathHelper.cos(yaw) * 2.5, 0, MathHelper.sin(yaw) * 2.5)); + } - if(y != null){ - EntityEvokerFangs fangs = new EntityEvokerFangs(world, vec.x, y, vec.z, yaw, i, caster); // null is fine here - fangs.getEntityData().setFloat(SpellThrowable.DAMAGE_MODIFIER_NBT_KEY, modifiers.get(SpellModifiers.POTENCY)); - world.spawnEntity(fangs); - flag = true; + }else{ + + int count = (int)(getProperty(RANGE).doubleValue() * modifiers.get(WizardryItems.range_upgrade)); + float yaw = (float)MathHelper.atan2(direction.z, direction.x); // Yes, this is the right way round! + + for(int i = 0; i < count; i++){ + Vec3d vec = origin.add(direction.scale((i + 1) * FANG_SPACING)); + flag |= spawnFangsAt(world, caster, modifiers, yaw, i, vec); } } } @@ -101,6 +111,21 @@ public class Fangs extends Spell { return flag; } + private boolean spawnFangsAt(World world, @Nullable EntityLivingBase caster, SpellModifiers modifiers, float yaw, int delay, Vec3d vec){ + + // Not exactly the same as evokers but it's how constructs work so it kinda fits + Integer y = BlockUtils.getNearestFloor(world, new BlockPos(vec), 5); + + if(y != null){ + EntityEvokerFangs fangs = new EntityEvokerFangs(world, vec.x, y, vec.z, yaw, delay, caster); // null is fine here + fangs.getEntityData().setFloat(SpellThrowable.DAMAGE_MODIFIER_NBT_KEY, modifiers.get(SpellModifiers.POTENCY)); + world.spawnEntity(fangs); + return true; + } + + return false; + } + @SubscribeEvent(priority = EventPriority.HIGH) public static void onLivingAttackEvent(LivingAttackEvent event){ if(event.getSource().getImmediateSource() instanceof EntityEvokerFangs){ diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index 320c3792..025b4d4d 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -310,6 +310,8 @@ item.ebwizardry\:ring_earth_biome.name=Dryad's Ring item.ebwizardry\:ring_earth_biome.desc=Earth spells are 30%% more potent in forests and roofed forests item.ebwizardry\:ring_full_moon.name=Ring of the Howling Wolf item.ebwizardry\:ring_full_moon.desc=Earth spells have dramatically reduced cooldowns under a full moon +item.ebwizardry\:ring_evoker.name=Evoker's Ring +item.ebwizardry\:ring_evoker.desc=Sneaking while casting fangs summons a defensive circle instead of a line item.ebwizardry\:ring_extraction.name=Ring of Extraction item.ebwizardry\:ring_extraction.desc=Kills with sorcery spells grant bonus mana item.ebwizardry\:ring_mana_return.name=Ring of the Perfectionist diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index d0e4242a..d06cd120 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -310,6 +310,8 @@ item.ebwizardry\:ring_earth_biome.name=Dryad's Ring item.ebwizardry\:ring_earth_biome.desc=Earth spells are 30%% more potent in forests and roofed forests item.ebwizardry\:ring_full_moon.name=Ring of the Howling Wolf item.ebwizardry\:ring_full_moon.desc=Earth spells have dramatically reduced cooldowns under a full moon +item.ebwizardry\:ring_evoker.name=Evoker's Ring +item.ebwizardry\:ring_evoker.desc=Sneaking while casting fangs summons a defensive circle instead of a line item.ebwizardry\:ring_extraction.name=Ring of Extraction item.ebwizardry\:ring_extraction.desc=Kills with sorcery spells grant bonus mana item.ebwizardry\:ring_mana_return.name=Ring of the Perfectionist diff --git a/src/main/resources/assets/ebwizardry/models/item/ring_evoker.json b/src/main/resources/assets/ebwizardry/models/item/ring_evoker.json new file mode 100644 index 00000000..f2f4ac53 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/models/item/ring_evoker.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "ebwizardry:items/ring_evoker" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/textures/items/ring_evoker.png b/src/main/resources/assets/ebwizardry/textures/items/ring_evoker.png new file mode 100644 index 00000000..2ec9d27f Binary files /dev/null and b/src/main/resources/assets/ebwizardry/textures/items/ring_evoker.png differ