mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +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 toggled;
|
||||
private boolean tremorSense;
|
||||
private boolean illumination;
|
||||
private boolean chiBlocked;
|
||||
private long slowTime;
|
||||
private Player player;
|
||||
|
@ -78,6 +79,7 @@ public class BendingPlayer {
|
|||
this.player = Bukkit.getPlayer(uuid);
|
||||
this.toggled = true;
|
||||
this.tremorSense = true;
|
||||
this.illumination = true;
|
||||
this.chiBlocked = false;
|
||||
cooldowns = new ConcurrentHashMap<String, Long>();
|
||||
toggledElements = new ConcurrentHashMap<Element, Boolean>();
|
||||
|
@ -611,6 +613,15 @@ public class BendingPlayer {
|
|||
public boolean isTremorSensing() {
|
||||
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) {
|
||||
if (ability != null) {
|
||||
|
@ -714,6 +725,13 @@ public class BendingPlayer {
|
|||
public void toggleTremorSense() {
|
||||
tremorSense = !tremorSense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the {@link BendingPlayer}'s illumination.
|
||||
*/
|
||||
public void toggleIllumination() {
|
||||
illumination = !illumination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link BendingPlayer}'s chi blocked to false.
|
||||
|
|
|
@ -565,18 +565,18 @@ public class GeneralMethods {
|
|||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
|
||||
if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingPreview") == true) {
|
||||
if (ability != null) {
|
||||
if (bPlayer.isOnCooldown(ability)) {
|
||||
displayedMessage = ability.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + ability.getName();
|
||||
if (ability != null) {
|
||||
if (bPlayer.isOnCooldown(ability)) {
|
||||
displayedMessage = ability.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + ability.getName();
|
||||
} else {
|
||||
displayedMessage = ability.getElement().getColor() + ability.getName();
|
||||
}
|
||||
} 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) {
|
||||
|
|
|
@ -1615,7 +1615,7 @@ public class PKListener implements Listener {
|
|||
new HeatControlExtinguish(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Illumination")) {
|
||||
new Illumination(player);
|
||||
bPlayer.toggleIllumination();
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
FireBurst.coneBurst(player);
|
||||
|
|
|
@ -95,9 +95,6 @@ public class AirBubble extends AirAbility {
|
|||
radius = waterRadius;
|
||||
}
|
||||
|
||||
if (bPlayer.hasElement(Element.WATER) && isNight(player.getWorld())) {
|
||||
radius = WaterAbility.getNightFactor(waterRadius, player.getWorld());
|
||||
}
|
||||
if (airRadius > radius && bPlayer.hasElement(Element.AIR)) {
|
||||
radius = airRadius;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
package com.projectkorra.projectkorra.chiblocking;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
|
||||
public class Paralyze extends ChiAbility {
|
||||
|
||||
private static final Map<Entity, Long> ENTITIES = new ConcurrentHashMap<>();
|
||||
private static final Map<Entity, Long> COOLDOWNS = new ConcurrentHashMap<>();
|
||||
|
||||
private long cooldown;
|
||||
private Entity target;
|
||||
|
@ -33,14 +32,7 @@ public class Paralyze extends ChiAbility {
|
|||
|
||||
@Override
|
||||
public void progress() {
|
||||
if (bPlayer.canBendIgnoreCooldowns(this)) {
|
||||
if (COOLDOWNS.containsKey(target)) {
|
||||
if (System.currentTimeMillis() < COOLDOWNS.get(target) + cooldown) {
|
||||
return;
|
||||
} else {
|
||||
COOLDOWNS.remove(target);
|
||||
}
|
||||
}
|
||||
if (bPlayer.canBend(this)) {
|
||||
if (target instanceof Player) {
|
||||
if (Commands.invincible.contains(((Player) target).getName())) {
|
||||
remove();
|
||||
|
@ -48,7 +40,7 @@ public class Paralyze extends ChiAbility {
|
|||
}
|
||||
}
|
||||
paralyze(target);
|
||||
COOLDOWNS.put(target, System.currentTimeMillis());
|
||||
bPlayer.addCooldown(this);
|
||||
} else {
|
||||
remove();
|
||||
}
|
||||
|
@ -125,13 +117,5 @@ public class Paralyze extends ChiAbility {
|
|||
public static Map<Entity, Long> getEntities() {
|
||||
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;
|
||||
|
||||
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.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 static void handlePassive() {
|
||||
|
@ -20,6 +21,10 @@ public class FirePassive {
|
|||
if (player.getFireTicks() > 80) {
|
||||
player.setFireTicks(80);
|
||||
}
|
||||
|
||||
if (CoreAbility.getAbility(player, Illumination.class) == null) {
|
||||
new Illumination(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@ public class Illumination extends FireAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!bPlayer.isIlluminating()) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
this.range = getConfig().getDouble("Abilities.Fire.Illumination.Range");
|
||||
this.cooldown = getConfig().getLong("Abilities.Fire.Illumination.Cooldown");
|
||||
|
||||
|
@ -51,6 +56,12 @@ public class Illumination extends FireAbility {
|
|||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bPlayer.isIlluminating()) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
set();
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ public class WaterArmsWhip extends WaterAbility {
|
|||
|
||||
useArm();
|
||||
dragEntity(end);
|
||||
grapplePlayer(end);
|
||||
}
|
||||
|
||||
private boolean canPlaceBlock(Block block) {
|
||||
|
|
|
@ -53,6 +53,8 @@ public class WaterPassive {
|
|||
if (bPlayer.canBendPassive(Element.WATER)) {
|
||||
if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, EarthArmor.class)) {
|
||||
continue;
|
||||
} else if (CoreAbility.getAbility(player, WaterArms.class) != null) {
|
||||
continue;
|
||||
} else if (coreAbil == null || (coreAbil != null && !coreAbil.isSneakAbility())) {
|
||||
if (player.isSneaking() && WaterAbility.isWater(player.getLocation().getBlock())) {
|
||||
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimSpeed));
|
||||
|
|
Loading…
Reference in a new issue