mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fix Earth Armor and improve Healing Waters (#616)
* Fix EarthArmor and HealingWaters * Remove commented code. * Update HealingWaters Description
This commit is contained in:
parent
985eacd1e8
commit
53b35871ac
4 changed files with 75 additions and 54 deletions
|
@ -962,7 +962,7 @@ public class PKListener implements Listener {
|
|||
|
||||
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("EarthSmash")) {
|
||||
new EarthSmash(player, ClickType.RIGHT_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
|
||||
event.setCancelled(true);
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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,23 +143,30 @@ 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();
|
||||
}
|
||||
|
||||
if (this.target != null && GeneralMethods.getTargetedEntity(player, range).equals(target) && target instanceof LivingEntity && hasReached) {
|
||||
giveHP(this.target);
|
||||
private void heal(Player player) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
giveHP(player);
|
||||
this.target = null;
|
||||
if(hasReached) {
|
||||
giveHP(player);
|
||||
this.target = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,18 +225,19 @@ public class HealingWaters extends HealingAbility {
|
|||
}
|
||||
|
||||
public void displayHealingParticlesSelf() {
|
||||
|
||||
Location centre = player.getLocation().clone().add(0, 1, 0);
|
||||
double increment = (2 * Math.PI) / 36;
|
||||
double angle = pstage * increment;
|
||||
double x = centre.getX() + (0.75 * Math.cos(angle));
|
||||
double z = centre.getZ() + (0.75 * Math.sin(angle));
|
||||
GeneralMethods.displayColoredParticle(new Location(centre.getWorld(), x, centre.getY(), z), hex);
|
||||
|
||||
if (pstage >= 36) {
|
||||
pstage = 0;
|
||||
if (hasReached) {
|
||||
Location centre = player.getLocation().clone().add(0, 1, 0);
|
||||
double increment = (2 * Math.PI) / 36;
|
||||
double angle = pstage * increment;
|
||||
double x = centre.getX() + (0.75 * Math.cos(angle));
|
||||
double z = centre.getZ() + (0.75 * Math.sin(angle));
|
||||
GeneralMethods.displayColoredParticle(new Location(centre.getWorld(), x, centre.getY(), z), hex);
|
||||
|
||||
if (pstage >= 36) {
|
||||
pstage = 0;
|
||||
}
|
||||
pstage++;
|
||||
}
|
||||
pstage++;
|
||||
}
|
||||
|
||||
public void displayHealingParticlesOther() {
|
||||
|
@ -252,28 +266,34 @@ public class HealingWaters extends HealingAbility {
|
|||
tstage2++;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
location = location.clone().add(vec.clone().multiply(factor));
|
||||
GeneralMethods.displayColoredParticle(location, hex);
|
||||
} else if (origin.getWorld().equals(location.getWorld()) && origin.distance(location) >= distance) {
|
||||
hasReached = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void displayHealingWater(LivingEntity target) {
|
||||
double factor = 0.2;
|
||||
|
||||
Location targetLoc = target.getLocation().clone().add(0, 1, 0);
|
||||
double distance = 0;
|
||||
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 (location.getWorld().equals(targetLoc.getWorld()) && location.distance(targetLoc) <= distance) {
|
||||
location = location.clone().add(vec.clone().multiply(factor));
|
||||
if(location.distance(targetLoc) <= 0.5) {
|
||||
hasReached = true;
|
||||
} else {
|
||||
hasReached = false;
|
||||
}
|
||||
}
|
||||
|
||||
GeneralMethods.displayColoredParticle(location, hex);
|
||||
}
|
||||
|
||||
private void fillBottle() {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
if (inventory.contains(Material.GLASS_BOTTLE)) {
|
||||
|
|
Loading…
Reference in a new issue