Changes: Paralyze, WaterArms, AirBubble, Illumination (#564)

* Fix/Improvement to WaterArms Grapple, WaterArms FastSwim, Paralyze

* Fixed Illumination as passive, Fixed AirBubble taking Nightfactor
This commit is contained in:
Sobki 2016-08-29 07:23:43 +10:00 committed by OmniCypher
parent beec447bb1
commit 384b5662b8
9 changed files with 59 additions and 43 deletions

View file

@ -46,6 +46,7 @@ public class BendingPlayer {
private boolean permaRemoved; private boolean permaRemoved;
private boolean toggled; private boolean toggled;
private boolean tremorSense; private boolean tremorSense;
private boolean illumination;
private boolean chiBlocked; private boolean chiBlocked;
private long slowTime; private long slowTime;
private Player player; private Player player;
@ -78,6 +79,7 @@ public class BendingPlayer {
this.player = Bukkit.getPlayer(uuid); this.player = Bukkit.getPlayer(uuid);
this.toggled = true; this.toggled = true;
this.tremorSense = true; this.tremorSense = true;
this.illumination = true;
this.chiBlocked = false; this.chiBlocked = false;
cooldowns = new ConcurrentHashMap<String, Long>(); cooldowns = new ConcurrentHashMap<String, Long>();
toggledElements = new ConcurrentHashMap<Element, Boolean>(); toggledElements = new ConcurrentHashMap<Element, Boolean>();
@ -611,6 +613,15 @@ public class BendingPlayer {
public boolean isTremorSensing() { public boolean isTremorSensing() {
return this.tremorSense; return this.tremorSense;
} }
/**
* Checks if the {@link BendingPlayer} is using illumination.
*
* @return true if player is using illumination
*/
public boolean isIlluminating() {
return this.illumination;
}
public void removeCooldown(CoreAbility ability) { public void removeCooldown(CoreAbility ability) {
if (ability != null) { if (ability != null) {
@ -714,6 +725,13 @@ public class BendingPlayer {
public void toggleTremorSense() { public void toggleTremorSense() {
tremorSense = !tremorSense; tremorSense = !tremorSense;
} }
/**
* Toggles the {@link BendingPlayer}'s illumination.
*/
public void toggleIllumination() {
illumination = !illumination;
}
/** /**
* Sets the {@link BendingPlayer}'s chi blocked to false. * Sets the {@link BendingPlayer}'s chi blocked to false.

View file

@ -565,18 +565,18 @@ public class GeneralMethods {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingPreview") == true) { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingPreview") == true) {
if (ability != null) { if (ability != null) {
if (bPlayer.isOnCooldown(ability)) { if (bPlayer.isOnCooldown(ability)) {
displayedMessage = ability.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + ability.getName(); displayedMessage = ability.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + ability.getName();
} else {
displayedMessage = ability.getElement().getColor() + ability.getName();
}
} else { } else {
displayedMessage = ability.getElement().getColor() + ability.getName(); displayedMessage = "";
} }
} else {
displayedMessage = "";
}
ActionBar.sendActionBar(displayedMessage, player); ActionBar.sendActionBar(displayedMessage, player);
} }
} }
public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) { public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) {

View file

@ -1615,7 +1615,7 @@ public class PKListener implements Listener {
new HeatControlExtinguish(player); new HeatControlExtinguish(player);
} }
if (abil.equalsIgnoreCase("Illumination")) { if (abil.equalsIgnoreCase("Illumination")) {
new Illumination(player); bPlayer.toggleIllumination();
} }
if (abil.equalsIgnoreCase("FireBurst")) { if (abil.equalsIgnoreCase("FireBurst")) {
FireBurst.coneBurst(player); FireBurst.coneBurst(player);

View file

@ -95,9 +95,6 @@ public class AirBubble extends AirAbility {
radius = waterRadius; radius = waterRadius;
} }
if (bPlayer.hasElement(Element.WATER) && isNight(player.getWorld())) {
radius = WaterAbility.getNightFactor(waterRadius, player.getWorld());
}
if (airRadius > radius && bPlayer.hasElement(Element.AIR)) { if (airRadius > radius && bPlayer.hasElement(Element.AIR)) {
radius = airRadius; radius = airRadius;
} }

View file

@ -1,22 +1,21 @@
package com.projectkorra.projectkorra.chiblocking; package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.BendingPlayer; import java.util.Map;
import com.projectkorra.projectkorra.ability.ChiAbility; import java.util.concurrent.ConcurrentHashMap;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.command.Commands;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Map; import com.projectkorra.projectkorra.BendingPlayer;
import java.util.concurrent.ConcurrentHashMap; import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.command.Commands;
public class Paralyze extends ChiAbility { public class Paralyze extends ChiAbility {
private static final Map<Entity, Long> ENTITIES = new ConcurrentHashMap<>(); private static final Map<Entity, Long> ENTITIES = new ConcurrentHashMap<>();
private static final Map<Entity, Long> COOLDOWNS = new ConcurrentHashMap<>();
private long cooldown; private long cooldown;
private Entity target; private Entity target;
@ -33,14 +32,7 @@ public class Paralyze extends ChiAbility {
@Override @Override
public void progress() { public void progress() {
if (bPlayer.canBendIgnoreCooldowns(this)) { if (bPlayer.canBend(this)) {
if (COOLDOWNS.containsKey(target)) {
if (System.currentTimeMillis() < COOLDOWNS.get(target) + cooldown) {
return;
} else {
COOLDOWNS.remove(target);
}
}
if (target instanceof Player) { if (target instanceof Player) {
if (Commands.invincible.contains(((Player) target).getName())) { if (Commands.invincible.contains(((Player) target).getName())) {
remove(); remove();
@ -48,7 +40,7 @@ public class Paralyze extends ChiAbility {
} }
} }
paralyze(target); paralyze(target);
COOLDOWNS.put(target, System.currentTimeMillis()); bPlayer.addCooldown(this);
} else { } else {
remove(); remove();
} }
@ -125,13 +117,5 @@ public class Paralyze extends ChiAbility {
public static Map<Entity, Long> getEntities() { public static Map<Entity, Long> getEntities() {
return ENTITIES; return ENTITIES;
} }
public static Map<Entity, Long> getCooldowns() {
return COOLDOWNS;
}
public void setCooldown(long cooldown) {
this.cooldown = cooldown;
}
} }

View file

@ -1,13 +1,14 @@
package com.projectkorra.projectkorra.firebending; package com.projectkorra.projectkorra.firebending;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
public class FirePassive { public class FirePassive {
public static void handlePassive() { public static void handlePassive() {
@ -20,6 +21,10 @@ public class FirePassive {
if (player.getFireTicks() > 80) { if (player.getFireTicks() > 80) {
player.setFireTicks(80); player.setFireTicks(80);
} }
if (CoreAbility.getAbility(player, Illumination.class) == null) {
new Illumination(player);
}
} }
} }
} }

View file

@ -31,6 +31,11 @@ public class Illumination extends FireAbility {
return; return;
} }
if (!bPlayer.isIlluminating()) {
remove();
return;
}
this.range = getConfig().getDouble("Abilities.Fire.Illumination.Range"); this.range = getConfig().getDouble("Abilities.Fire.Illumination.Range");
this.cooldown = getConfig().getLong("Abilities.Fire.Illumination.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Fire.Illumination.Cooldown");
@ -51,6 +56,12 @@ public class Illumination extends FireAbility {
remove(); remove();
return; return;
} }
if (!bPlayer.isIlluminating()) {
remove();
return;
}
set(); set();
} }

View file

@ -221,7 +221,6 @@ public class WaterArmsWhip extends WaterAbility {
useArm(); useArm();
dragEntity(end); dragEntity(end);
grapplePlayer(end);
} }
private boolean canPlaceBlock(Block block) { private boolean canPlaceBlock(Block block) {

View file

@ -53,6 +53,8 @@ public class WaterPassive {
if (bPlayer.canBendPassive(Element.WATER)) { if (bPlayer.canBendPassive(Element.WATER)) {
if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, EarthArmor.class)) { if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, EarthArmor.class)) {
continue; continue;
} else if (CoreAbility.getAbility(player, WaterArms.class) != null) {
continue;
} else if (coreAbil == null || (coreAbil != null && !coreAbil.isSneakAbility())) { } else if (coreAbil == null || (coreAbil != null && !coreAbil.isSneakAbility())) {
if (player.isSneaking() && WaterAbility.isWater(player.getLocation().getBlock())) { if (player.isSneaking() && WaterAbility.isWater(player.getLocation().getBlock())) {
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimSpeed)); player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimSpeed));