From d607b606e2c02e3e7447689907cb60b1f4f64be4 Mon Sep 17 00:00:00 2001 From: PhanaticD Date: Thu, 23 Jan 2020 14:41:23 -0500 Subject: [PATCH] some protection changes, set low no damage ticks to make it more "beamlike", small radius for beams --- .../src/me/Pride/korra/Spirits/combos/Pandemonium.java | 7 +++++++ .../src/me/Pride/korra/Spirits/combos/Sanctuary.java | 8 +++++++- .../src/me/Pride/korra/Spirits/dark/DarkBeam.java | 9 +++++---- .../src/me/Pride/korra/Spirits/light/LightBeam.java | 7 ++++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Pandemonium.java b/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Pandemonium.java index 84a88ba..00b1786 100644 --- a/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Pandemonium.java +++ b/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Pandemonium.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Random; +import com.projectkorra.projectkorra.command.Commands; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.configuration.file.FileConfiguration; @@ -54,6 +55,9 @@ public Pandemonium(Player player) { if (bPlayer.isOnCooldown(this)) { return; } + if (GeneralMethods.isRegionProtectedFromBuild(this, player.getLocation())) { + return; + } cooldown = config.getLong(path + "Cooldown"); radius = config.getDouble(path + "Radius"); @@ -130,6 +134,9 @@ private void pandemonium() { rotation++; for (Entity entity : GeneralMethods.getEntitiesAroundPoint(origin, radius)) { if (entity.getUniqueId() != player.getUniqueId() && entity instanceof LivingEntity) { + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) { + continue; + } pullDirection = GeneralMethods.getDirection(entity.getLocation(), origin); entity.setVelocity(pullDirection.multiply(pull)); diff --git a/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Sanctuary.java b/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Sanctuary.java index ab58de9..c9d4908 100644 --- a/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Sanctuary.java +++ b/SpiritAbilities/src/me/Pride/korra/Spirits/combos/Sanctuary.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Random; +import com.projectkorra.projectkorra.command.Commands; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.configuration.file.FileConfiguration; @@ -81,7 +82,9 @@ public Sanctuary(Player player) { bPlayer.addCooldown(this); boolean enabled = ConfigManager.getConfig().getBoolean("ExtraAbilities.Prride.Spirits.Combos.Light.Sanctuary.Enabled"); - + if (GeneralMethods.isRegionProtectedFromBuild(this, player.getLocation())) { + return; + } if (enabled) { start(); } @@ -191,6 +194,9 @@ private void expandBarriers(double size) { if (GeneralMethods.locationEqualsIgnoreDirection(location, entity.getLocation())) { continue; } + if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) { + continue; + } direction = GeneralMethods.getDirection(location, entity.getLocation()); direction.setY(0.5); this.location = location; diff --git a/SpiritAbilities/src/me/Pride/korra/Spirits/dark/DarkBeam.java b/SpiritAbilities/src/me/Pride/korra/Spirits/dark/DarkBeam.java index 5540aed..3caab61 100644 --- a/SpiritAbilities/src/me/Pride/korra/Spirits/dark/DarkBeam.java +++ b/SpiritAbilities/src/me/Pride/korra/Spirits/dark/DarkBeam.java @@ -37,7 +37,7 @@ public class DarkBeam extends DarkAbility implements AddonAbility { public DarkBeam(Player player) { super(player); - + cooldown = config.getLong(path + "Cooldown"); duration = config.getLong(path + "Duration"); range = config.getDouble(path + "Range"); @@ -127,10 +127,11 @@ private void createBeam() { ParticleEffect.SPELL_WITCH.display(location, 5, (float) Math.random() / 5, 0.8F, (float) Math.random() / 5, 2F); - for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 1)) { + for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 0.5)) { if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) { - if (entity instanceof LivingEntity) { - DamageHandler.damageEntity(entity, damage, this); + DamageHandler.damageEntity(entity, damage, this); + if(((LivingEntity) entity).getNoDamageTicks() > 6) { + ((LivingEntity) entity).setNoDamageTicks(6); } } } diff --git a/SpiritAbilities/src/me/Pride/korra/Spirits/light/LightBeam.java b/SpiritAbilities/src/me/Pride/korra/Spirits/light/LightBeam.java index 732240a..2ef5b3d 100644 --- a/SpiritAbilities/src/me/Pride/korra/Spirits/light/LightBeam.java +++ b/SpiritAbilities/src/me/Pride/korra/Spirits/light/LightBeam.java @@ -127,10 +127,11 @@ private void createBeam() { ParticleEffect.CRIT_MAGIC.display(location, 6, (float) Math.random() / 3, 0.8F, (float) Math.random() / 3, 0.5F); - for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 1)) { + for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 0.5)) { if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) { - if (entity instanceof LivingEntity) { - DamageHandler.damageEntity(entity, damage, this); + DamageHandler.damageEntity(entity, damage, this); + if(((LivingEntity) entity).getNoDamageTicks() > 6) { + ((LivingEntity) entity).setNoDamageTicks(6); } } }