Optimise Dragon Escape

This commit is contained in:
Sam 2018-07-10 22:19:20 +01:00 committed by Alexander Meech
parent aa1c53eb31
commit 1687e48bcd
1 changed files with 9 additions and 27 deletions

View File

@ -10,17 +10,17 @@ import org.bukkit.util.Vector;
public class DragonEscapeData public class DragonEscapeData
{ {
public DragonEscape Host;
public EnderDragon Dragon; public final DragonEscape Host;
public final EnderDragon Dragon;
public Location Target = null; public Location Target;
public Location Location = null; public Location Location;
public float Pitch = 0; private float Pitch;
public Vector Velocity = new Vector(0,0,0); public Vector Velocity;
public DragonEscapeData(DragonEscape host, EnderDragon dragon, Location target) DragonEscapeData(DragonEscape host, EnderDragon dragon, Location target)
{ {
Host = host; Host = host;
@ -40,26 +40,8 @@ public class DragonEscapeData
public void Move() public void Move()
{ {
Turn(); Turn();
//Speed
double speed = 0.20;
//speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
//Speed Distance Boost
/*
if (!Host.GetScores().isEmpty())
{
double score = Host.GetScore(Dragon);
double best = Host.GetScores().get(0).Score;
double lead = (best-score)/10000d;
speed += lead * 0.0025;
}
*/
speed = speed * Host.GetSpeedMult(); double speed = 0.2 * Host.GetSpeedMult();
Location.add(Velocity.clone().multiply(speed)); Location.add(Velocity.clone().multiply(speed));
Location.add(0, -Pitch, 0); Location.add(0, -Pitch, 0);
@ -67,7 +49,7 @@ public class DragonEscapeData
Location.setPitch(-1 * Pitch); Location.setPitch(-1 * Pitch);
Location.setYaw(180 + UtilAlg.GetYaw(Velocity)); Location.setYaw(180 + UtilAlg.GetYaw(Velocity));
Dragon.teleport(Location); UtilEnt.setPosition(Dragon, Location);
} }
private void Turn() private void Turn()