mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
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:
parent
beec447bb1
commit
384b5662b8
9 changed files with 59 additions and 43 deletions
|
@ -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>();
|
||||||
|
@ -612,6 +614,15 @@ public class BendingPlayer {
|
||||||
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) {
|
||||||
removeCooldown(ability.getName());
|
removeCooldown(ability.getName());
|
||||||
|
@ -715,6 +726,13 @@ public class BendingPlayer {
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -126,12 +118,4 @@ public class Paralyze extends ChiAbility {
|
||||||
return ENTITIES;
|
return ENTITIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Entity, Long> getCooldowns() {
|
|
||||||
return COOLDOWNS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCooldown(long cooldown) {
|
|
||||||
this.cooldown = cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Reference in a new issue