diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index c94c16a2..b987d4cd 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -204,18 +204,16 @@ public class PKListener implements Listener { CoreAbility ability = null; if (abil != null && abil.equalsIgnoreCase("Surge")) { ability = CoreAbility.getAbility(SurgeWall.class); - } - else if (abil != null && abil.equalsIgnoreCase("Torrent")) { + } else if (abil != null && abil.equalsIgnoreCase("Torrent")) { ability = CoreAbility.getAbility(Torrent.class); - } - else { + } else { ability = CoreAbility.getAbility(abil); } - if (ability != null && ability instanceof WaterAbility && !((WaterAbility)ability).allowBreakPlants() && WaterAbility.isPlantbendable(player, block.getType(), false)) { + if (ability != null && ability instanceof WaterAbility && !((WaterAbility) ability).allowBreakPlants() && WaterAbility.isPlantbendable(player, block.getType(), false)) { event.setCancelled(true); return; } - + EarthBlast blast = EarthBlast.getBlastFromSource(block); if (blast != null) { blast.remove(); @@ -1349,11 +1347,9 @@ public class PKListener implements Listener { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (bPlayer.canCurrentlyBendWithWeapons()) { - if (abil.equalsIgnoreCase("Catapult")) - { - new Catapult(player); - } - else if (abil.equalsIgnoreCase("EarthBlast")) { + if (abil.equalsIgnoreCase("Catapult")) { + new Catapult(player, true); + } else if (abil.equalsIgnoreCase("EarthBlast")) { new EarthBlast(player); } else if (abil.equalsIgnoreCase("EarthArmor")) { new EarthArmor(player); @@ -1545,7 +1541,7 @@ public class PKListener implements Listener { if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) { if (bPlayer.canCurrentlyBendWithWeapons()) { if (abil.equalsIgnoreCase("Catapult")) { - new Catapult(player); + new Catapult(player, false); } else if (abil.equalsIgnoreCase("EarthBlast")) { EarthBlast.throwEarth(player); } else if (abil.equalsIgnoreCase("RaiseEarth")) { diff --git a/src/com/projectkorra/projectkorra/command/DisplayCommand.java b/src/com/projectkorra/projectkorra/command/DisplayCommand.java index 04a6547b..7d05bc46 100644 --- a/src/com/projectkorra/projectkorra/command/DisplayCommand.java +++ b/src/com/projectkorra/projectkorra/command/DisplayCommand.java @@ -78,27 +78,48 @@ public class DisplayCommand extends PKCommand { elementName = "avatarpassive"; Element element = Element.fromString(elementName.replace("combos", "").replace("combo", "").replace("passives", "").replace("passive", "")); //combos - if (element != null && elementName.contains("combo")) { - ChatColor color = element != null ? element.getColor() : null; - ArrayList combos = ComboManager.getCombosForElement(element); + if (elementName.contains("combo")) { + if (element == null) { + for (Element e : Element.getAllElements()) { + ChatColor color = e != null ? e.getColor() : null; + ArrayList combos = ComboManager.getCombosForElement(e); + + for (String comboAbil : combos) { + ChatColor comboColor = color; + if (!sender.hasPermission("bending.ability." + comboAbil)) { + continue; + } - if (combos.isEmpty()) { - GeneralMethods.sendBrandingMessage(sender, color + noCombosAvailable.replace("{element}", element.getName())); + CoreAbility coreAbil = CoreAbility.getAbility(comboAbil); + if (coreAbil != null) { + comboColor = coreAbil.getElement().getColor(); + } + sender.sendMessage(comboColor + comboAbil); + } + } + return; + } else { + ChatColor color = element != null ? element.getColor() : null; + ArrayList combos = ComboManager.getCombosForElement(element); + + if (combos.isEmpty()) { + GeneralMethods.sendBrandingMessage(sender, color + noCombosAvailable.replace("{element}", element.getName())); + return; + } + for (String comboMove : combos) { + ChatColor comboColor = color; + if (!sender.hasPermission("bending.ability." + comboMove)) { + continue; + } + + CoreAbility coreAbil = CoreAbility.getAbility(comboMove); + if (coreAbil != null) { + comboColor = coreAbil.getElement().getColor(); + } + sender.sendMessage(comboColor + comboMove); + } return; } - for (String comboMove : combos) { - ChatColor comboColor = color; - if (!sender.hasPermission("bending.ability." + comboMove)) { - continue; - } - - CoreAbility coreAbil = CoreAbility.getAbility(comboMove); - if (coreAbil != null) { - comboColor = coreAbil.getElement().getColor(); - } - sender.sendMessage(comboColor + comboMove); - } - return; //passives } else if (elementName.contains("passive")) { if (element == null) { @@ -341,4 +362,4 @@ public class DisplayCommand extends PKCommand { return list; } -} +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 775b0daa..0cc8a8aa 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -957,9 +957,7 @@ public class ConfigManager { config.addDefault("Abilities.Earth.Passive.FerroControl.Enabled", true); config.addDefault("Abilities.Earth.Catapult.Enabled", true); - config.addDefault("Abilities.Earth.Catapult.MaxDistance", 40); config.addDefault("Abilities.Earth.Catapult.Cooldown", 7000); - config.addDefault("Abilities.Earth.Catapult.StageMult", 0.25); config.addDefault("Abilities.Earth.Catapult.StageTimeMult", 2.0); config.addDefault("Abilities.Earth.Collapse.Enabled", true); diff --git a/src/com/projectkorra/projectkorra/earthbending/Catapult.java b/src/com/projectkorra/projectkorra/earthbending/Catapult.java index a79a5649..b1dfe2ce 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Catapult.java +++ b/src/com/projectkorra/projectkorra/earthbending/Catapult.java @@ -16,43 +16,39 @@ import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect.BlockData; public class Catapult extends EarthAbility { - - private int maxDistance; - private double stageMult; + private double stageTimeMult; - private int distance; private long cooldown; private Location origin; private Location target; - + private int stage; private long stageStart; private boolean charging; private boolean activationHandled; - public Catapult(Player player) { + public Catapult(Player player, boolean sneak) { super(player); setFields(); + if (!isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { + return; + } if (!bPlayer.canBend(this)) { return; } if (bPlayer.isAvatarState()) { - this.maxDistance = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Catapult.MaxDistance"); this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown"); } + this.charging = sneak; start(); } private void setFields() { - this.maxDistance = getConfig().getInt("Abilities.Earth.Catapult.MaxDistance"); - this.stageMult = getConfig().getDouble("Abilities.Earth.Catapult.StageMult"); this.stageTimeMult = getConfig().getDouble("Abilities.Earth.Catapult.StageTimeMult"); - this.distance = 0; this.cooldown = getConfig().getLong("Abilities.Earth.Catapult.Cooldown"); this.activationHandled = false; this.stage = 1; this.stageStart = System.currentTimeMillis(); - this.charging = true; } private void moveEarth(Vector apply, Vector direction) { @@ -74,31 +70,25 @@ public class Catapult extends EarthAbility { remove(); return; } - - if (charging) - { - if (stage == 4 || !player.isSneaking()) - { + + if (charging) { + if (stage == 4 || !player.isSneaking()) { charging = false; - } - else - { - if ((System.currentTimeMillis() - this.stageStart) >= ((Math.max(0, this.stageTimeMult * (this.stage - 1))) * 1000)) - { + } else { + if ((System.currentTimeMillis() - this.stageStart) >= ((Math.max(0, this.stageTimeMult * (this.stage - 1))) * 1000)) { this.stage++; this.stageStart = System.currentTimeMillis(); Random random = new Random(); - ParticleEffect.BLOCK_DUST.display(new BlockData(Material.DIRT, (byte)0), random.nextFloat(), random.nextFloat(), random.nextFloat(), 0, 20, player.getLocation(), 257); - ParticleEffect.BLOCK_DUST.display(new BlockData(Material.DIRT, (byte)0), random.nextFloat(), random.nextFloat(), random.nextFloat(), 0, 20, player.getLocation().add(0, 0.5, 0), 257); + ParticleEffect.BLOCK_DUST.display(new BlockData(Material.DIRT, (byte) 0), random.nextFloat(), random.nextFloat(), random.nextFloat(), 0, 20, player.getLocation(), 257); + ParticleEffect.BLOCK_DUST.display(new BlockData(Material.DIRT, (byte) 0), random.nextFloat(), random.nextFloat(), random.nextFloat(), 0, 20, player.getLocation().add(0, 0.5, 0), 257); player.getWorld().playEffect(player.getLocation(), Effect.GHAST_SHOOT, 0, 10); } - return; } + return; } - + Vector direction = null; - if (!this.activationHandled) - { + if (!this.activationHandled) { this.origin = player.getLocation().clone(); direction = player.getEyeLocation().getDirection().clone().normalize(); @@ -107,24 +97,10 @@ public class Catapult extends EarthAbility { remove(); return; } - - if (isEarthbendable(player.getLocation().getBlock()) || isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { - distance = this.maxDistance; - } - if (distance != 0) { - distance = (int) (distance * (this.stageMult * this.stage)); - this.activationHandled = true; - bPlayer.addCooldown(this); - } else { - remove(); - return; - } - } - Location tar = this.origin.clone(); - while (tar.distanceSquared(this.origin) <= Math.pow(this.distance, 2)) - { - tar.add(direction.clone().normalize()); + this.activationHandled = true; + bPlayer.addCooldown(this); } + Location tar = this.origin.clone().add(direction.clone().normalize().multiply(this.stage + 0.5)); this.target = tar; Vector apply = this.target.clone().toVector().subtract(this.origin.clone().toVector()); player.setVelocity(apply); @@ -167,24 +143,16 @@ public class Catapult extends EarthAbility { public void setOrigin(Location origin) { this.origin = origin; } - + public Location getTarget() { return target; } - + public void setTarget(Location target) { this.target = target; } - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - public void setCooldown(long cooldown) { this.cooldown = cooldown; } -} \ No newline at end of file +} diff --git a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java index 6da92688..5117d2f7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java @@ -313,7 +313,7 @@ public class OctopusForm extends WaterAbility { } } for (int i = 0; i < 9; i++) { - freezeBellow(player.getLocation().add(i / 3 - 1, 0, i % 3 - 1).getBlock()); + freezeBelow(player.getLocation().add(i / 3 - 1, 0, i / 3 - 1).getBlock()); } Vector eyeDir = player.getEyeLocation().getDirection(); @@ -404,15 +404,16 @@ public class OctopusForm extends WaterAbility { } newBlocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8)); } + freezeBelow(block); } private void addBaseWater(Block block) { - freezeBellow(block); + freezeBelow(block); addWater(block); } - private void freezeBellow(Block block) { - if (isWater(block.getRelative(BlockFace.DOWN)) && !GeneralMethods.isSolid(block) && !isWater(block)) {//&& !TempBlock.isTempBlock(block)) { + private void freezeBelow(Block block) { + if (isWater(block.getRelative(BlockFace.DOWN)) && !TempBlock.isTempBlock(block)) { if (hasAbility(player, PhaseChange.class)) { getAbility(player, PhaseChange.class).freeze(block); } else {