Bug Fixes (#664)

* Fixes AirScooter Speed Glitch

Fixes being able to autorun with AirScooter (CTRL) to go insanely fast

* Adds golden tools

Fixes an issue that didn’t include golden tools in CanBendWithWeapons.

* Adds cooldown to QuickStrike, fixes QuickStrike and SwiftKick not activating

* Fixes HighJump cooldown activating when the ability hasn't worked

* Fixes SwiftKick and QuickStrike not working properly and RapidPunch not working half the time

* Fixes FireWheel and AirSwipe being stopped by snow on the ground

* Makes QuickStrike do one heart
This commit is contained in:
Loony 2016-12-27 06:26:06 +00:00 committed by Christopher Martin
parent 45d2230376
commit 9d15d8b122
9 changed files with 340 additions and 301 deletions

View file

@ -1413,7 +1413,7 @@ public class GeneralMethods {
} }
public static boolean isWeapon(Material mat) { public static boolean isWeapon(Material mat) {
return mat != null && (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE); return mat != null && (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE || mat == Material.GOLD_AXE || mat == Material.GOLD_HOE || mat == Material.GOLD_SWORD || mat == Material.GOLD_PICKAXE || mat == Material.GOLD_SPADE);
} }
public static void loadBendingPlayer(BendingPlayer pl) { public static void loadBendingPlayer(BendingPlayer pl) {

File diff suppressed because it is too large Load diff

View file

@ -131,7 +131,8 @@ public class AirSwipe extends AirAbility {
location = location.clone().add(direction.clone().multiply(speed)); location = location.clone().add(direction.clone().multiply(speed));
elements.put(direction, location); elements.put(direction, location);
if (location.distanceSquared(origin) > range * range || GeneralMethods.isRegionProtectedFromBuild(this, location)) { if (location.distanceSquared(origin) > range * range
|| GeneralMethods.isRegionProtectedFromBuild(this, location)) {
elements.remove(direction); elements.remove(direction);
} else { } else {
Block block = location.getBlock(); Block block = location.getBlock();
@ -152,7 +153,11 @@ public class AirSwipe extends AirAbility {
if (block.getType() != Material.AIR) { if (block.getType() != Material.AIR) {
if (isBlockBreakable(block)) { if (isBlockBreakable(block)) {
GeneralMethods.breakBlock(block); GeneralMethods.breakBlock(block);
}
if (block.getType().equals(Material.SNOW)) {
continue;
} else { } else {
elements.remove(direction); elements.remove(direction);
} }
if (isLava(block)) { if (isLava(block)) {
@ -197,7 +202,8 @@ public class AirSwipe extends AirAbility {
} }
if (entities.size() < MAX_AFFECTABLE_ENTITIES) { if (entities.size() < MAX_AFFECTABLE_ENTITIES) {
if (bPlayer.isAvatarState()) { if (bPlayer.isAvatarState()) {
GeneralMethods.setVelocity(entity, fDirection.multiply(AvatarState.getValue(pushFactor))); GeneralMethods.setVelocity(entity,
fDirection.multiply(AvatarState.getValue(pushFactor)));
} else { } else {
GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor)); GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor));
} }
@ -282,7 +288,8 @@ public class AirSwipe extends AirAbility {
} else if (bPlayer.isAvatarState()) { } else if (bPlayer.isAvatarState()) {
factor = AvatarState.getValue(factor); factor = AvatarState.getValue(factor);
} else { } else {
factor = maxChargeFactor * (double) (System.currentTimeMillis() - getStartTime()) / (double) maxChargeTime; factor = maxChargeFactor * (double) (System.currentTimeMillis() - getStartTime())
/ (double) maxChargeTime;
} }
charging = false; charging = false;

View file

@ -27,11 +27,13 @@ public class HighJump extends ChiAbility {
private void jump(Player p) { private void jump(Player p) {
if (!GeneralMethods.isSolid(p.getLocation().getBlock().getRelative(BlockFace.DOWN))) { if (!GeneralMethods.isSolid(p.getLocation().getBlock().getRelative(BlockFace.DOWN))) {
remove();
return; return;
} }
Vector vec = p.getVelocity(); Vector vec = p.getVelocity();
vec.setY(height); vec.setY(height);
p.setVelocity(vec); p.setVelocity(vec);
bPlayer.addCooldown(this);
return; return;
} }
@ -47,7 +49,7 @@ public class HighJump extends ChiAbility {
if (waw != null) { if (waw != null) {
waw.setGrabbed(false); waw.setGrabbed(false);
} }
bPlayer.addCooldown(this);
} }
@Override @Override

View file

@ -1,27 +1,28 @@
package com.projectkorra.projectkorra.chiblocking; package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
public class QuickStrike extends ChiAbility { public class QuickStrike extends ChiAbility {
private int damage; private int damage;
private int blockChance; private int blockChance;
private Entity target; private Entity target;
private long cooldown;
public QuickStrike(Player player) { public QuickStrike(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }
this.damage = getConfig().getInt("Abilities.Chi.QuickStrike.Damage"); this.damage = getConfig().getInt("Abilities.Chi.QuickStrike.Damage");
this.cooldown = getConfig().getLong("Abilities.Chi.QuickStrike.Cooldown");
this.blockChance = getConfig().getInt("Abilities.Chi.QuickStrike.ChiBlockChance"); this.blockChance = getConfig().getInt("Abilities.Chi.QuickStrike.ChiBlockChance");
target = GeneralMethods.getTargetedEntity(player, 2); target = targetentity;
if (target == null) { if (target == null) {
return; return;
} }
@ -30,15 +31,20 @@ public class QuickStrike extends ChiAbility {
@Override @Override
public void progress() { public void progress() {
if (bPlayer.isOnCooldown(this)) {
return;
}
if (target == null) { if (target == null) {
remove(); remove();
return; return;
} }
DamageHandler.damageEntity(target, damage, this); DamageHandler.damageEntity(target, damage, this);
bPlayer.addCooldown(this);
if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) { if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) {
ChiPassive.blockChi((Player) target); ChiPassive.blockChi((Player) target);
} }
remove(); remove();
} }
@ -54,7 +60,7 @@ public class QuickStrike extends ChiAbility {
@Override @Override
public long getCooldown() { public long getCooldown() {
return 0; return cooldown;
} }
@Override @Override

View file

@ -19,8 +19,8 @@ public class RapidPunch extends ChiAbility {
private int numPunches; private int numPunches;
private Entity target; private Entity target;
public RapidPunch(Player player) { public RapidPunch(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }

View file

@ -1,14 +1,13 @@
package com.projectkorra.projectkorra.chiblocking; package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
public class SwiftKick extends ChiAbility { public class SwiftKick extends ChiAbility {
private int damage; private int damage;
@ -16,15 +15,15 @@ public class SwiftKick extends ChiAbility {
private long cooldown; private long cooldown;
private Entity target; private Entity target;
public SwiftKick(Player player) { public SwiftKick(Player sourceplayer, Entity targetentity) {
super(player); super(sourceplayer);
if (!bPlayer.canBend(this)) { if (!bPlayer.canBend(this)) {
return; return;
} }
this.damage = getConfig().getInt("Abilities.Chi.SwiftKick.Damage"); this.damage = getConfig().getInt("Abilities.Chi.SwiftKick.Damage");
this.blockChance = getConfig().getInt("Abilities.Chi.SwiftKick.ChiBlockChance"); this.blockChance = getConfig().getInt("Abilities.Chi.SwiftKick.ChiBlockChance");
this.cooldown = getConfig().getInt("Abilities.Chi.SwiftKick.Cooldown"); this.cooldown = getConfig().getInt("Abilities.Chi.SwiftKick.Cooldown");
this.target = GeneralMethods.getTargetedEntity(player, 4); this.target = targetentity;
start(); start();
} }

View file

@ -1139,7 +1139,8 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.WarriorStance.Resistance", -1); config.addDefault("Abilities.Chi.WarriorStance.Resistance", -1);
config.addDefault("Abilities.Chi.QuickStrike.Enabled", true); config.addDefault("Abilities.Chi.QuickStrike.Enabled", true);
config.addDefault("Abilities.Chi.QuickStrike.Damage", 1); config.addDefault("Abilities.Chi.QuickStrike.Damage", 2);
config.addDefault("Abilities.Chi.QuickStrike.Cooldown", 3000);
config.addDefault("Abilities.Chi.QuickStrike.ChiBlockChance", 10); config.addDefault("Abilities.Chi.QuickStrike.ChiBlockChance", 10);
config.addDefault("Abilities.Chi.SwiftKick.Enabled", true); config.addDefault("Abilities.Chi.SwiftKick.Enabled", true);

View file

@ -365,7 +365,12 @@ public class FireCombo extends FireAbility implements ComboAbility {
} }
Block topBlock = GeneralMethods.getTopBlock(location, 2, -4); Block topBlock = GeneralMethods.getTopBlock(location, 2, -4);
if (topBlock.getType().equals(Material.SNOW)){
topBlock = topBlock.getLocation().add(0, -1, 0).getBlock();
}
if (topBlock == null || (WaterAbility.isWaterbendable(player, ability, topBlock) && !isPlant(topBlock))) { if (topBlock == null || (WaterAbility.isWaterbendable(player, ability, topBlock) && !isPlant(topBlock))) {
remove(); remove();
return; return;
} else if (topBlock.getType() == Material.FIRE || ElementalAbility.isPlant(topBlock)) { } else if (topBlock.getType() == Material.FIRE || ElementalAbility.isPlant(topBlock)) {