mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Catapult Fix (#732)
* Reload changes * Catapult Fixes * Catapult Adjustment * Changes
This commit is contained in:
parent
f2889b7fd4
commit
ca6ca2b08a
5 changed files with 76 additions and 92 deletions
|
@ -204,11 +204,9 @@ public class PKListener implements Listener {
|
|||
CoreAbility ability = null;
|
||||
if (abil != null && abil.equalsIgnoreCase("Surge")) {
|
||||
ability = CoreAbility.getAbility(SurgeWall.class);
|
||||
}
|
||||
else if (abil != null && abil.equalsIgnoreCase("Torrent")) {
|
||||
} else if (abil != null && abil.equalsIgnoreCase("Torrent")) {
|
||||
ability = CoreAbility.getAbility(Torrent.class);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ability = CoreAbility.getAbility(abil);
|
||||
}
|
||||
if (ability != null && ability instanceof WaterAbility && !((WaterAbility) ability).allowBreakPlants() && WaterAbility.isPlantbendable(player, block.getType(), false)) {
|
||||
|
@ -1349,11 +1347,9 @@ public class PKListener implements Listener {
|
|||
|
||||
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
|
||||
if (bPlayer.canCurrentlyBendWithWeapons()) {
|
||||
if (abil.equalsIgnoreCase("Catapult"))
|
||||
{
|
||||
new Catapult(player);
|
||||
}
|
||||
else if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
if (abil.equalsIgnoreCase("Catapult")) {
|
||||
new Catapult(player, true);
|
||||
} else if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
new EarthBlast(player);
|
||||
} else if (abil.equalsIgnoreCase("EarthArmor")) {
|
||||
new EarthArmor(player);
|
||||
|
@ -1545,7 +1541,7 @@ public class PKListener implements Listener {
|
|||
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
|
||||
if (bPlayer.canCurrentlyBendWithWeapons()) {
|
||||
if (abil.equalsIgnoreCase("Catapult")) {
|
||||
new Catapult(player);
|
||||
new Catapult(player, false);
|
||||
} else if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
EarthBlast.throwEarth(player);
|
||||
} else if (abil.equalsIgnoreCase("RaiseEarth")) {
|
||||
|
|
|
@ -78,7 +78,27 @@ public class DisplayCommand extends PKCommand {
|
|||
elementName = "avatarpassive";
|
||||
Element element = Element.fromString(elementName.replace("combos", "").replace("combo", "").replace("passives", "").replace("passive", ""));
|
||||
//combos
|
||||
if (element != null && elementName.contains("combo")) {
|
||||
if (elementName.contains("combo")) {
|
||||
if (element == null) {
|
||||
for (Element e : Element.getAllElements()) {
|
||||
ChatColor color = e != null ? e.getColor() : null;
|
||||
ArrayList<String> combos = ComboManager.getCombosForElement(e);
|
||||
|
||||
for (String comboAbil : combos) {
|
||||
ChatColor comboColor = color;
|
||||
if (!sender.hasPermission("bending.ability." + comboAbil)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CoreAbility coreAbil = CoreAbility.getAbility(comboAbil);
|
||||
if (coreAbil != null) {
|
||||
comboColor = coreAbil.getElement().getColor();
|
||||
}
|
||||
sender.sendMessage(comboColor + comboAbil);
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
ChatColor color = element != null ? element.getColor() : null;
|
||||
ArrayList<String> combos = ComboManager.getCombosForElement(element);
|
||||
|
||||
|
@ -99,6 +119,7 @@ public class DisplayCommand extends PKCommand {
|
|||
sender.sendMessage(comboColor + comboMove);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//passives
|
||||
} else if (elementName.contains("passive")) {
|
||||
if (element == null) {
|
||||
|
|
|
@ -957,9 +957,7 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Earth.Passive.FerroControl.Enabled", true);
|
||||
|
||||
config.addDefault("Abilities.Earth.Catapult.Enabled", true);
|
||||
config.addDefault("Abilities.Earth.Catapult.MaxDistance", 40);
|
||||
config.addDefault("Abilities.Earth.Catapult.Cooldown", 7000);
|
||||
config.addDefault("Abilities.Earth.Catapult.StageMult", 0.25);
|
||||
config.addDefault("Abilities.Earth.Catapult.StageTimeMult", 2.0);
|
||||
|
||||
config.addDefault("Abilities.Earth.Collapse.Enabled", true);
|
||||
|
|
|
@ -17,10 +17,7 @@ import com.projectkorra.projectkorra.util.ParticleEffect.BlockData;
|
|||
|
||||
public class Catapult extends EarthAbility {
|
||||
|
||||
private int maxDistance;
|
||||
private double stageMult;
|
||||
private double stageTimeMult;
|
||||
private int distance;
|
||||
private long cooldown;
|
||||
private Location origin;
|
||||
private Location target;
|
||||
|
@ -30,29 +27,28 @@ public class Catapult extends EarthAbility {
|
|||
private boolean charging;
|
||||
private boolean activationHandled;
|
||||
|
||||
public Catapult(Player player) {
|
||||
public Catapult(Player player, boolean sneak) {
|
||||
super(player);
|
||||
setFields();
|
||||
if (!isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) {
|
||||
return;
|
||||
}
|
||||
if (!bPlayer.canBend(this)) {
|
||||
return;
|
||||
}
|
||||
if (bPlayer.isAvatarState()) {
|
||||
this.maxDistance = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Catapult.MaxDistance");
|
||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown");
|
||||
}
|
||||
this.charging = sneak;
|
||||
start();
|
||||
}
|
||||
|
||||
private void setFields() {
|
||||
this.maxDistance = getConfig().getInt("Abilities.Earth.Catapult.MaxDistance");
|
||||
this.stageMult = getConfig().getDouble("Abilities.Earth.Catapult.StageMult");
|
||||
this.stageTimeMult = getConfig().getDouble("Abilities.Earth.Catapult.StageTimeMult");
|
||||
this.distance = 0;
|
||||
this.cooldown = getConfig().getLong("Abilities.Earth.Catapult.Cooldown");
|
||||
this.activationHandled = false;
|
||||
this.stage = 1;
|
||||
this.stageStart = System.currentTimeMillis();
|
||||
this.charging = true;
|
||||
}
|
||||
|
||||
private void moveEarth(Vector apply, Vector direction) {
|
||||
|
@ -75,16 +71,11 @@ public class Catapult extends EarthAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
if (charging)
|
||||
{
|
||||
if (stage == 4 || !player.isSneaking())
|
||||
{
|
||||
if (charging) {
|
||||
if (stage == 4 || !player.isSneaking()) {
|
||||
charging = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((System.currentTimeMillis() - this.stageStart) >= ((Math.max(0, this.stageTimeMult * (this.stage - 1))) * 1000))
|
||||
{
|
||||
} else {
|
||||
if ((System.currentTimeMillis() - this.stageStart) >= ((Math.max(0, this.stageTimeMult * (this.stage - 1))) * 1000)) {
|
||||
this.stage++;
|
||||
this.stageStart = System.currentTimeMillis();
|
||||
Random random = new Random();
|
||||
|
@ -92,13 +83,12 @@ public class Catapult extends EarthAbility {
|
|||
ParticleEffect.BLOCK_DUST.display(new BlockData(Material.DIRT, (byte) 0), random.nextFloat(), random.nextFloat(), random.nextFloat(), 0, 20, player.getLocation().add(0, 0.5, 0), 257);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.GHAST_SHOOT, 0, 10);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Vector direction = null;
|
||||
if (!this.activationHandled)
|
||||
{
|
||||
if (!this.activationHandled) {
|
||||
this.origin = player.getLocation().clone();
|
||||
direction = player.getEyeLocation().getDirection().clone().normalize();
|
||||
|
||||
|
@ -107,24 +97,10 @@ public class Catapult extends EarthAbility {
|
|||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEarthbendable(player.getLocation().getBlock()) || isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) {
|
||||
distance = this.maxDistance;
|
||||
}
|
||||
if (distance != 0) {
|
||||
distance = (int) (distance * (this.stageMult * this.stage));
|
||||
this.activationHandled = true;
|
||||
bPlayer.addCooldown(this);
|
||||
} else {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Location tar = this.origin.clone();
|
||||
while (tar.distanceSquared(this.origin) <= Math.pow(this.distance, 2))
|
||||
{
|
||||
tar.add(direction.clone().normalize());
|
||||
}
|
||||
Location tar = this.origin.clone().add(direction.clone().normalize().multiply(this.stage + 0.5));
|
||||
this.target = tar;
|
||||
Vector apply = this.target.clone().toVector().subtract(this.origin.clone().toVector());
|
||||
player.setVelocity(apply);
|
||||
|
@ -176,14 +152,6 @@ public class Catapult extends EarthAbility {
|
|||
this.target = target;
|
||||
}
|
||||
|
||||
public int getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(int distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ public class OctopusForm extends WaterAbility {
|
|||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
freezeBellow(player.getLocation().add(i / 3 - 1, 0, i % 3 - 1).getBlock());
|
||||
freezeBelow(player.getLocation().add(i / 3 - 1, 0, i / 3 - 1).getBlock());
|
||||
}
|
||||
|
||||
Vector eyeDir = player.getEyeLocation().getDirection();
|
||||
|
@ -404,15 +404,16 @@ public class OctopusForm extends WaterAbility {
|
|||
}
|
||||
newBlocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8));
|
||||
}
|
||||
freezeBelow(block);
|
||||
}
|
||||
|
||||
private void addBaseWater(Block block) {
|
||||
freezeBellow(block);
|
||||
freezeBelow(block);
|
||||
addWater(block);
|
||||
}
|
||||
|
||||
private void freezeBellow(Block block) {
|
||||
if (isWater(block.getRelative(BlockFace.DOWN)) && !GeneralMethods.isSolid(block) && !isWater(block)) {//&& !TempBlock.isTempBlock(block)) {
|
||||
private void freezeBelow(Block block) {
|
||||
if (isWater(block.getRelative(BlockFace.DOWN)) && !TempBlock.isTempBlock(block)) {
|
||||
if (hasAbility(player, PhaseChange.class)) {
|
||||
getAbility(player, PhaseChange.class).freeze(block);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue