Fix Earth Armor and improve Healing Waters (#616)

* Fix EarthArmor and HealingWaters

* Remove commented code.

* Update HealingWaters Description
This commit is contained in:
Christopher Martin 2016-10-15 22:22:41 -07:00 committed by GitHub
parent 985eacd1e8
commit 53b35871ac
4 changed files with 75 additions and 54 deletions

View file

@ -976,12 +976,21 @@ public class PKListener implements Listener {
}
Player player = event.getPlayer();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
event.setCancelled(true);
}
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("HealingWaters")) {
HealingWaters instance = CoreAbility.getAbility(player, HealingWaters.class);
if(instance != null && instance.charged) {
instance.click();
event.setCancelled(true);
}
}
}
@EventHandler
@ -1496,10 +1505,6 @@ public class PKListener implements Listener {
else if (abil.equalsIgnoreCase("Torrent")) {
new Torrent(player);
}
if (abil.equalsIgnoreCase("HealingWaters")) {
HealingWaters instance = CoreAbility.getAbility(player, HealingWaters.class);
instance.click();
}
}
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {

View file

@ -250,7 +250,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.Bloodbending.Description", "This ability was made illegal for a reason. With this ability selected, sneak while " + "targetting something and you will bloodbend that target. Bloodbent targets cannot move, " + "bend or attack. You are free to control their actions by looking elsewhere - they will " + "be forced to move in that direction. Additionally, clicking while bloodbending will " + "launch that target off in the direction you're looking. " + "People who are capable of bloodbending are immune to your technique, and you are immune to theirs.");
config.addDefault("Abilities.Water.Bloodbending.DeathMessage", "{victim} was destroyed by {attacker}'s {ability}");
config.addDefault("Abilities.Water.Bloodbending.HorizontalVelocityDeath","{victim} experienced kinetic damage by {attacker}'s {ability}");
config.addDefault("Abilities.Water.HealingWaters.Description", "To use, the bender must be at least partially submerged in water. " + "Once in the water, hold shift to begin using the ability. " + "This will default to healing the user. To heal somebody else, left click while looking at them. " + "This will channel the healing to their target in front of them. " + "In order for this channel to be successful, the user must remain in water, while the target is in reach of the caster.");
config.addDefault("Abilities.Water.HealingWaters.Description", "To use, the bender must be at least partially submerged in water or have a water bottle. " + "Hold shift to begin using the ability. " + "This will default to healing the user. To heal somebody else, right click while looking at them. Right click them again to begin healing yourself again. " + "This will channel the healing to their target in front of them. " + "In order for this channel to be successful, the target is in reach of the bender and the bender must continue to look at them.");
config.addDefault("Abilities.Water.IceBlast.Description", "This ability offers a powerful ice utility for Waterbenders. It can be used to fire an explosive burst of ice at an opponent, spraying ice and snow around it. To use, simply tap sneak (Default: Shift) while targeting a block of ice to select it as a source. From there, you can just left click to send the blast off at your opponent.");
config.addDefault("Abilities.Water.IceBlast.DeathMessage", "{victim} was shattered by {attacker}'s {ability}");
config.addDefault("Abilities.Water.IceSpike.Description", "This ability has many functions. Clicking while targetting ice, or an entity over some ice, " + "will raise a spike of ice up, damaging and slowing the target. Tapping sneak (shift) while" + " selecting a water source will select that source that can then be fired with a click. Firing" + " this will launch a spike of ice at your target, dealing a bit of damage and slowing the target. " + "If you sneak (shift) while not selecting a source, many ice spikes will erupt from around you, " + "damaging and slowing those targets.");

View file

@ -103,12 +103,10 @@ public class EarthArmor extends EarthAbility {
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS, 1);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS, 1);
//Color disabled for now since the colors are all weird...
LeatherArmorMeta metaHead = (LeatherArmorMeta) head.getItemMeta();
LeatherArmorMeta metaChest = (LeatherArmorMeta) head.getItemMeta();
LeatherArmorMeta metaChest = (LeatherArmorMeta) chestplate.getItemMeta();
LeatherArmorMeta metaLegs = (LeatherArmorMeta) leggings.getItemMeta();
LeatherArmorMeta metaBottom = (LeatherArmorMeta) leggings.getItemMeta();
LeatherArmorMeta metaBottom = (LeatherArmorMeta) boots.getItemMeta();
metaHead.setColor(Color.fromRGB(getColor(headData.getItemType(), headData.getData())));
metaChest.setColor(Color.fromRGB(getColor(headData.getItemType(), headData.getData())));
@ -328,8 +326,6 @@ public class EarthArmor extends EarthAbility {
if (material == Material.QUARTZ_ORE) return 0x13139A; //Pinkish-red
if (material == Material.QUARTZ_BLOCK) return 0xFDFDFD; //White
return 0xCCCCCC; //Stone
}

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -45,7 +46,7 @@ public class HealingWaters extends HealingAbility {
private int tstage2;
private boolean healing = false;
private boolean healingSelf = false;
private boolean charged = false;
public boolean charged = false;
private boolean bottle = false;
private boolean hasReached = false;
private String hex;
@ -117,6 +118,12 @@ public class HealingWaters extends HealingAbility {
// If the ability is charged, try healing.
if (charged) {
if (target != null) {
displayHealingWater(target);
} else {
displayHealingWater((LivingEntity) player);
}
// Try to heal themselves/target with 'interval' millisecond intervals.
if (System.currentTimeMillis() - currTime >= interval) {
@ -136,25 +143,32 @@ public class HealingWaters extends HealingAbility {
}
public void click() {
Bukkit.broadcastMessage("Click!");
Entity target = GeneralMethods.getTargetedEntity(player, range);
if (target != null && target instanceof LivingEntity) {
if (target != null && !target.equals(this.target) && target instanceof LivingEntity) {
hasReached = false;
this.target = (LivingEntity) target;
Bukkit.broadcastMessage("New Target Found!");
} else if (target != null && target.equals(this.target) && target instanceof LivingEntity) {
hasReached = false;
this.target = null;
Bukkit.broadcastMessage("Target Removed!");
}
}
private void heal(Player player) {
if(!inWater(player) && !bottle){
remove();
Entity target = GeneralMethods.getTargetedEntity(player, range);
if (target != null && this.target != null && target instanceof LivingEntity) {
if (this.target.getEntityId() == target.getEntityId() && hasReached) {
giveHP((LivingEntity ) this.target);
}
if (this.target != null && GeneralMethods.getTargetedEntity(player, range).equals(target) && target instanceof LivingEntity && hasReached) {
giveHP(this.target);
} else {
if(hasReached) {
giveHP(player);
this.target = null;
}
}
}
private void giveHP(Player player) {
if (!player.isDead() && player.getHealth() < player.getMaxHealth()) {
@ -200,7 +214,6 @@ public class HealingWaters extends HealingAbility {
if (livingEntity.getHealth() < livingEntity.getMaxHealth()) {
livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, duration, 1));
AirAbility.breakBreathbendingHold(livingEntity);
this.target = livingEntity;
healing = true;
healingSelf = false;
}
@ -212,7 +225,7 @@ public class HealingWaters extends HealingAbility {
}
public void displayHealingParticlesSelf() {
if (hasReached) {
Location centre = player.getLocation().clone().add(0, 1, 0);
double increment = (2 * Math.PI) / 36;
double angle = pstage * increment;
@ -225,6 +238,7 @@ public class HealingWaters extends HealingAbility {
}
pstage++;
}
}
public void displayHealingParticlesOther() {
if (target != null) {
@ -252,26 +266,32 @@ public class HealingWaters extends HealingAbility {
tstage2++;
}
}
}
public void displayHealingWater(LivingEntity target) {
double factor = 0.2;
Location targetLoc = target.getLocation().clone().add(0, 1, 0);
double distance = 0;
if (origin.getWorld().equals(targetLoc.getWorld())) {
distance = origin.distance(targetLoc);
if (location.getWorld().equals(targetLoc.getWorld())) {
distance = location.distance(targetLoc);
}
Vector vec = new Vector(
targetLoc.getX() - location.getX(),
targetLoc.getY() - location.getY(),
targetLoc.getZ() - location.getZ()).normalize();
if (origin.getWorld().equals(location.getWorld()) && origin.distance(location) < distance) {
if (location.getWorld().equals(targetLoc.getWorld()) && location.distance(targetLoc) <= distance) {
location = location.clone().add(vec.clone().multiply(factor));
GeneralMethods.displayColoredParticle(location, hex);
} else if (origin.getWorld().equals(location.getWorld()) && origin.distance(location) >= distance) {
if(location.distance(targetLoc) <= 0.5) {
hasReached = true;
} else {
hasReached = false;
}
}
}
GeneralMethods.displayColoredParticle(location, hex);
}
private void fillBottle() {