mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fixed passives being enabled/disabled at wrong times (#711)
This commit is contained in:
parent
2de9ce3281
commit
047224a4cb
5 changed files with 6 additions and 18 deletions
|
@ -21,7 +21,6 @@ import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.chiblocking.Paralyze;
|
import com.projectkorra.projectkorra.chiblocking.Paralyze;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
@ -249,8 +248,6 @@ public class BendingPlayer {
|
||||||
return false;
|
return false;
|
||||||
} else if (!hasElement(element)) {
|
} else if (!hasElement(element)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (isChiBlocked() || isParalyzed() || isBloodbent()) {
|
|
||||||
return false;
|
|
||||||
} else if (disabledWorlds != null && disabledWorlds.contains(player.getWorld().getName())) {
|
} else if (disabledWorlds != null && disabledWorlds.contains(player.getWorld().getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -745,7 +742,6 @@ public class BendingPlayer {
|
||||||
*/
|
*/
|
||||||
public void toggleBending() {
|
public void toggleBending() {
|
||||||
toggled = !toggled;
|
toggled = !toggled;
|
||||||
PassiveManager.registerPassives(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleElement(Element element) {
|
public void toggleElement(Element element) {
|
||||||
|
|
|
@ -765,7 +765,7 @@ public class PKListener implements Listener {
|
||||||
new Shockwave(player, true);
|
new Shockwave(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.AIR)) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.AIR) && bPlayer.canUsePassive(Element.AIR)) {
|
||||||
new AirBurst(player, true);
|
new AirBurst(player, true);
|
||||||
if (CoreAbility.getAbility(GracefulDescent.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(GracefulDescent.class))) {
|
if (CoreAbility.getAbility(GracefulDescent.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(GracefulDescent.class))) {
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
|
@ -773,21 +773,21 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.WATER) && CoreAbility.getAbility(Hydrosink.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(Hydrosink.class))) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.WATER) && bPlayer.canUsePassive(Element.WATER) && CoreAbility.getAbility(Hydrosink.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(Hydrosink.class))) {
|
||||||
if (WaterPassive.applyNoFall(player)) {
|
if (WaterPassive.applyNoFall(player)) {
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.EARTH) && CoreAbility.getAbility(DensityShift.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(DensityShift.class))) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.EARTH) && bPlayer.canUsePassive(Element.EARTH) && CoreAbility.getAbility(DensityShift.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(DensityShift.class))) {
|
||||||
if (EarthPassive.softenLanding(player)) {
|
if (EarthPassive.softenLanding(player)) {
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.CHI) && CoreAbility.getAbility(Acrobatics.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(Acrobatics.class))) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.CHI) && bPlayer.canUsePassive(Element.CHI) && CoreAbility.getAbility(Acrobatics.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(Acrobatics.class))) {
|
||||||
double initdamage = event.getDamage();
|
double initdamage = event.getDamage();
|
||||||
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
||||||
double finaldamage = initdamage - newdamage;
|
double finaldamage = initdamage - newdamage;
|
||||||
|
@ -803,7 +803,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE) && (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE) && bPlayer.canUsePassive(Element.FIRE) && (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
||||||
event.setCancelled(!HeatControl.canBurn(player));
|
event.setCancelled(!HeatControl.canBurn(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
|
||||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
|
||||||
|
@ -73,9 +72,6 @@ public class Paralyze extends ChiAbility {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ENTITIES.remove(entity);
|
ENTITIES.remove(entity);
|
||||||
if (entity instanceof Player) {
|
|
||||||
PassiveManager.registerPassives((Player) entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class FirePassive {
|
||||||
}
|
}
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer != null && bPlayer.canBendPassive(Element.FIRE)) {
|
if (bPlayer != null && bPlayer.canBendPassive(Element.FIRE) && bPlayer.canUsePassive(Element.FIRE)) {
|
||||||
if (player.getFireTicks() > 80) {
|
if (player.getFireTicks() > 80) {
|
||||||
player.setFireTicks(80);
|
player.setFireTicks(80);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.BloodAbility;
|
import com.projectkorra.projectkorra.ability.BloodAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
|
@ -286,9 +285,6 @@ public class Bloodbending extends BloodAbility {
|
||||||
for (Entity e : TARGETED_ENTITIES.keySet()) {
|
for (Entity e : TARGETED_ENTITIES.keySet()) {
|
||||||
if (TARGETED_ENTITIES.get(e) == player) {
|
if (TARGETED_ENTITIES.get(e) == player) {
|
||||||
TARGETED_ENTITIES.remove(e);
|
TARGETED_ENTITIES.remove(e);
|
||||||
if (e instanceof Player) {
|
|
||||||
PassiveManager.registerPassives((Player) e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue