Fixed passives being enabled/disabled at wrong times (#711)

This commit is contained in:
Sobki 2017-01-26 12:47:20 +10:00 committed by Christopher Martin
parent 2de9ce3281
commit 047224a4cb
5 changed files with 6 additions and 18 deletions

View file

@ -21,7 +21,6 @@ import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.chiblocking.Paralyze;
import com.projectkorra.projectkorra.command.Commands;
@ -249,8 +248,6 @@ public class BendingPlayer {
return false;
} else if (!hasElement(element)) {
return false;
} else if (isChiBlocked() || isParalyzed() || isBloodbent()) {
return false;
} else if (disabledWorlds != null && disabledWorlds.contains(player.getWorld().getName())) {
return false;
}
@ -745,7 +742,6 @@ public class BendingPlayer {
*/
public void toggleBending() {
toggled = !toggled;
PassiveManager.registerPassives(player);
}
public void toggleElement(Element element) {

View file

@ -765,7 +765,7 @@ public class PKListener implements Listener {
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);
if (CoreAbility.getAbility(GracefulDescent.class).isEnabled() && PassiveManager.hasPassive(player, CoreAbility.getAbility(GracefulDescent.class))) {
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)) {
event.setDamage(0D);
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)) {
event.setDamage(0D);
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 newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
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));
}

View file

@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.command.Commands;
@ -73,9 +72,6 @@ public class Paralyze extends ChiAbility {
return true;
}
ENTITIES.remove(entity);
if (entity instanceof Player) {
PassiveManager.registerPassives((Player) entity);
}
}
return false;

View file

@ -18,7 +18,7 @@ public class FirePassive {
}
for (Player player : Bukkit.getOnlinePlayers()) {
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) {
player.setFireTicks(80);
}

View file

@ -19,7 +19,6 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.BloodAbility;
import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -286,9 +285,6 @@ public class Bloodbending extends BloodAbility {
for (Entity e : TARGETED_ENTITIES.keySet()) {
if (TARGETED_ENTITIES.get(e) == player) {
TARGETED_ENTITIES.remove(e);
if (e instanceof Player) {
PassiveManager.registerPassives((Player) e);
}
}
}