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:
Jay Stannon 2016-10-17 10:41:12 +11:00 committed by Christopher Martin
parent 53b35871ac
commit 05ce38c5b7
2 changed files with 57 additions and 28 deletions

View file

@ -1447,8 +1447,6 @@ public class PKListener implements Listener {
}
else if (abil.equalsIgnoreCase("AirScooter")) {
new AirScooter(player);
player.sendMessage("Pitch: " + player.getLocation().getPitch());
player.sendMessage("Yaw: " + player.getLocation().getYaw());
}
else if (abil.equalsIgnoreCase("AirSpout")) {
new AirSpout(player);

View file

@ -1,9 +1,7 @@
package com.projectkorra.projectkorra.airbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.Flight;
import java.util.ArrayList;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -12,8 +10,10 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Random;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.Flight;
public class AirScooter extends AirAbility {
@ -28,6 +28,7 @@ public class AirScooter extends AirAbility {
private boolean canFly;
private boolean hadFly;
private double phi = 0;
public AirScooter(Player player) {
super(player);
@ -55,7 +56,9 @@ public class AirScooter extends AirAbility {
new Flight(player);
player.setAllowFlight(true);
player.setFlying(true);
player.setSprinting(false);
player.setSneaking(false);
for (int i = 0; i < 5; i++) {
angles.add((double) (60 * i));
@ -78,6 +81,10 @@ public class AirScooter extends AirAbility {
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() {
floorblock = null;
for (int i = 0; i <= maxHeightFromGround; i++) {
@ -102,24 +109,28 @@ public class AirScooter extends AirAbility {
return;
}
Vector velocity = player.getEyeLocation().getDirection().clone();
velocity.setY(0);
Vector velocity = player.getEyeLocation().getDirection().clone().normalize();
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 (player.getVelocity().length() < speed * .5) {
if (player.getVelocity().length() < speed * 0.3) {
remove();
return;
}
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 dx = Math.abs(distance - 2.4);
if (distance > 2.75) {
velocity.setY(-.25 * dx * dx);
velocity.setY(-.40 * dx * dx);
} else if (distance < 2) {
velocity.setY(.25 * dx * dx);
velocity.setY(.40 * dx * dx);
} else {
velocity.setY(0);
}
@ -134,33 +145,53 @@ public class AirScooter extends AirAbility {
player.setSprinting(false);
player.removePotionEffect(PotionEffectType.SPEED);
player.setVelocity(velocity);
if (random.nextInt(4) == 0) {
playAirbendingSound(player.getLocation());
}
}
/*
* Updates the players flight, also adds the cooldown.
*/
@Override
public void remove() {
super.remove();
bPlayer.addCooldown(this);
player.setAllowFlight(canFly);
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() {
Location origin = player.getLocation().clone();
origin.add(0, -radius, 0);
Location origin = player.getLocation();
Location origin2 = player.getLocation();
phi += Math.PI/10*4;
for(double theta = 0; theta <= 2*Math.PI; theta += Math.PI/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);
origin.add(x, y, z);
playAirbendingParticles(origin, 1, 0F, 0F, 0F);
origin.subtract(x, y, z);
}
for(double theta = 0; theta <= 2*Math.PI; theta += Math.PI/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);
}
}
for (int i = 0; i < 5; i++) {
double x = Math.cos(Math.toRadians(angles.get(i))) * radius;
double y = ((double) i) / 2 * radius - radius;
double z = Math.sin(Math.toRadians(angles.get(i))) * radius;
playAirbendingParticles(origin.clone().add(x, y, z), 7);
}
for (int i = 0; i < 5; i++) {
angles.set(i, angles.get(i) + 10);
}
}
@Override
public String getName() {