mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-10-31 17:29:25 +00:00
Changes to Airscooter (#617)
* Changes to EarthGrab (PR Fixed, I hope.) - Move now has travel time. - Added particles that travel along the ground, to represent the travel time. - Changed the functions of the move to be: Shift + click = grab other - entity, left click ground = self-grab. - Edited the default config for the description. - Edited the default range of the move, changed from 14 to 20. - Edited the default cooldown time, it is now set to 2 seconds by default. * Fixed issues with Earthgrab. * Add Changes to HealingWaters and Fix for Distance bug (#610) * Add Changes to HealingWaters and Fix for Distance bug * Fix conflicts in EarthGrab.java * Fix conflicts in ConfigManager.java * Fix conflicts in EarthGrab.java * Fix for Distance Bug in EarthGrab * Re-added Sorin's Changes * Colored EarthArmor + Combo Fix (#608) • Re-enabled colored EarthArmor, since it works now • Combos are now created 1 tick later then before. Reason for this is because if a combo requires the player to be shifting but the last combo trigger was a shift trigger, the combo would be created BEFORE the player actually changes shift states. * Fix Earth Armor and improve Healing Waters (#616) * Fix EarthArmor and HealingWaters * Remove commented code. * Update HealingWaters Description * Changes to AirScooter - Particles are now sphered - Added comments to some areas to explain things - Tweaked some variables - Also removed the debug message for "PKListener" Side note: I wasn't able to find a way to make the player "sit" on the sphere of air without things getting super buggy. The issues I ran into while trying to do so: The player's body wouldn't rotate, and the entity they were riding wouldn't rotate, so their body direction wouldn't match up with their head. The player was being displayed in a location that wasn't actually coherent with where they actually where, making the particles seem off centered. The move would also hesitate to go up and down blocks sometimes. The player would also appear 4-5 blocks above the move if they did go up a block a certain way.
This commit is contained in:
parent
53b35871ac
commit
05ce38c5b7
|
@ -1447,8 +1447,6 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
else if (abil.equalsIgnoreCase("AirScooter")) {
|
else if (abil.equalsIgnoreCase("AirScooter")) {
|
||||||
new AirScooter(player);
|
new AirScooter(player);
|
||||||
player.sendMessage("Pitch: " + player.getLocation().getPitch());
|
|
||||||
player.sendMessage("Yaw: " + player.getLocation().getYaw());
|
|
||||||
}
|
}
|
||||||
else if (abil.equalsIgnoreCase("AirSpout")) {
|
else if (abil.equalsIgnoreCase("AirSpout")) {
|
||||||
new AirSpout(player);
|
new AirSpout(player);
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.projectkorra.projectkorra.airbending;
|
package com.projectkorra.projectkorra.airbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import java.util.ArrayList;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import java.util.Random;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
|
||||||
import com.projectkorra.projectkorra.util.Flight;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -12,8 +10,10 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import java.util.Random;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
|
import com.projectkorra.projectkorra.util.Flight;
|
||||||
|
|
||||||
public class AirScooter extends AirAbility {
|
public class AirScooter extends AirAbility {
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ public class AirScooter extends AirAbility {
|
||||||
|
|
||||||
private boolean canFly;
|
private boolean canFly;
|
||||||
private boolean hadFly;
|
private boolean hadFly;
|
||||||
|
private double phi = 0;
|
||||||
|
|
||||||
public AirScooter(Player player) {
|
public AirScooter(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
|
@ -55,7 +56,9 @@ public class AirScooter extends AirAbility {
|
||||||
new Flight(player);
|
new Flight(player);
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
player.setFlying(true);
|
player.setFlying(true);
|
||||||
|
|
||||||
player.setSprinting(false);
|
player.setSprinting(false);
|
||||||
|
player.setSneaking(false);
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
angles.add((double) (60 * i));
|
angles.add((double) (60 * i));
|
||||||
|
@ -78,6 +81,10 @@ public class AirScooter extends AirAbility {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Looks for a block under the player and sets "floorBlock" to a block
|
||||||
|
* under the player if it within the maximum height
|
||||||
|
*/
|
||||||
private void getFloor() {
|
private void getFloor() {
|
||||||
floorblock = null;
|
floorblock = null;
|
||||||
for (int i = 0; i <= maxHeightFromGround; i++) {
|
for (int i = 0; i <= maxHeightFromGround; i++) {
|
||||||
|
@ -102,24 +109,28 @@ public class AirScooter extends AirAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector velocity = player.getEyeLocation().getDirection().clone();
|
Vector velocity = player.getEyeLocation().getDirection().clone().normalize();
|
||||||
velocity.setY(0);
|
|
||||||
velocity = velocity.clone().normalize().multiply(speed);
|
velocity = velocity.clone().normalize().multiply(speed);
|
||||||
|
/*
|
||||||
|
* checks the players speed and ends the move if they are going too slow
|
||||||
|
*/
|
||||||
if (System.currentTimeMillis() > startTime + interval) {
|
if (System.currentTimeMillis() > startTime + interval) {
|
||||||
if (player.getVelocity().length() < speed * .5) {
|
if (player.getVelocity().length() < speed * 0.3) {
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
spinScooter();
|
spinScooter();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Checks for how far the ground is away from the player
|
||||||
|
* it elevates or lowers the player based on their distance from the ground.
|
||||||
|
*/
|
||||||
double distance = player.getLocation().getY() - (double) floorblock.getY();
|
double distance = player.getLocation().getY() - (double) floorblock.getY();
|
||||||
double dx = Math.abs(distance - 2.4);
|
double dx = Math.abs(distance - 2.4);
|
||||||
if (distance > 2.75) {
|
if (distance > 2.75) {
|
||||||
velocity.setY(-.25 * dx * dx);
|
velocity.setY(-.40 * dx * dx);
|
||||||
} else if (distance < 2) {
|
} else if (distance < 2) {
|
||||||
velocity.setY(.25 * dx * dx);
|
velocity.setY(.40 * dx * dx);
|
||||||
} else {
|
} else {
|
||||||
velocity.setY(0);
|
velocity.setY(0);
|
||||||
}
|
}
|
||||||
|
@ -130,38 +141,58 @@ public class AirScooter extends AirAbility {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setSprinting(false);
|
player.setSprinting(false);
|
||||||
player.removePotionEffect(PotionEffectType.SPEED);
|
player.removePotionEffect(PotionEffectType.SPEED);
|
||||||
player.setVelocity(velocity);
|
player.setVelocity(velocity);
|
||||||
|
|
||||||
if (random.nextInt(4) == 0) {
|
if (random.nextInt(4) == 0) {
|
||||||
playAirbendingSound(player.getLocation());
|
playAirbendingSound(player.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Updates the players flight, also adds the cooldown.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
super.remove();
|
super.remove();
|
||||||
bPlayer.addCooldown(this);
|
|
||||||
player.setAllowFlight(canFly);
|
player.setAllowFlight(canFly);
|
||||||
player.setFlying(hadFly);
|
player.setFlying(hadFly);
|
||||||
|
bPlayer.addCooldown(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The particles used for AirScooter
|
||||||
|
* phi = how many rings of particles the sphere has.
|
||||||
|
* theta = how dense the rings are.
|
||||||
|
* r = Radius of the sphere
|
||||||
|
*/
|
||||||
private void spinScooter() {
|
private void spinScooter() {
|
||||||
Location origin = player.getLocation().clone();
|
Location origin = player.getLocation();
|
||||||
origin.add(0, -radius, 0);
|
Location origin2 = player.getLocation();
|
||||||
|
phi += Math.PI/10*4;
|
||||||
for (int i = 0; i < 5; i++) {
|
for(double theta = 0; theta <= 2*Math.PI; theta += Math.PI/10) {
|
||||||
double x = Math.cos(Math.toRadians(angles.get(i))) * radius;
|
double r = 0.6;
|
||||||
double y = ((double) i) / 2 * radius - radius;
|
double x = r*Math.cos(theta)*Math.sin(phi);
|
||||||
double z = Math.sin(Math.toRadians(angles.get(i))) * radius;
|
double y = r*Math.cos(phi);
|
||||||
playAirbendingParticles(origin.clone().add(x, y, z), 7);
|
double z = r*Math.sin(theta)*Math.sin(phi);
|
||||||
|
origin.add(x, y, z);
|
||||||
|
playAirbendingParticles(origin, 1, 0F, 0F, 0F);
|
||||||
|
origin.subtract(x, y, z);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 5; i++) {
|
for(double theta = 0; theta <= 2*Math.PI; theta += Math.PI/10) {
|
||||||
angles.set(i, angles.get(i) + 10);
|
double r = 0.6;
|
||||||
|
double x = r*Math.cos(theta)*Math.sin(phi);
|
||||||
|
double y = r*Math.cos(phi);
|
||||||
|
double z = r*Math.sin(theta)*Math.sin(phi);
|
||||||
|
origin2.subtract(x, y, z);
|
||||||
|
playAirbendingParticles(origin2, 1, 0F, 0F, 0F);
|
||||||
|
origin2.add(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "AirScooter";
|
return "AirScooter";
|
||||||
|
|
Loading…
Reference in a new issue