mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 08:25:07 +00:00
Fix cooldowns of fire abilities with a duration, getClosestEntity, and Surge Wall diagonal check (#1016)
## Fixes * Fixes getClosestEntity to not rely on a distance check for if the entity is returned, but instead purely get the closest entity from getEntitiesAroundPoint * Fixes SurgeWall to not do that new diagonal check, fixes Ice wall glitching out ## Misc. Changes * Changes JetBlaze hitbox size, was way too big * Changes FireJet, WallOfFire, and the FireJet Combos cooldowns to activate when the move completes
This commit is contained in:
parent
5d9e1d5b05
commit
34fa6d08b8
6 changed files with 18 additions and 14 deletions
|
@ -872,17 +872,17 @@ public class GeneralMethods {
|
||||||
*/
|
*/
|
||||||
public static Entity getClosestEntity(Location center, double radius) {
|
public static Entity getClosestEntity(Location center, double radius) {
|
||||||
Entity found = null;
|
Entity found = null;
|
||||||
double distance = radius * radius;
|
Double distance = null;
|
||||||
|
|
||||||
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
||||||
double check = center.distance(entity.getLocation());
|
double check = center.distanceSquared(entity.getLocation());
|
||||||
|
|
||||||
if (check < distance) {
|
if (distance == null || check < distance) {
|
||||||
found = entity;
|
found = entity;
|
||||||
distance = check;
|
distance = check;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,12 +894,12 @@ public class GeneralMethods {
|
||||||
*/
|
*/
|
||||||
public static LivingEntity getClosestLivingEntity(Location center, double radius) {
|
public static LivingEntity getClosestLivingEntity(Location center, double radius) {
|
||||||
LivingEntity le = null;
|
LivingEntity le = null;
|
||||||
double distance = radius * radius;
|
Double distance = null;
|
||||||
|
|
||||||
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
||||||
double check = center.distance(entity.getLocation());
|
double check = center.distanceSquared(entity.getLocation());
|
||||||
|
|
||||||
if (entity instanceof LivingEntity && check < distance) {
|
if (entity instanceof LivingEntity && (distance == null || check < distance)) {
|
||||||
le = (LivingEntity) entity;
|
le = (LivingEntity) entity;
|
||||||
distance = check;
|
distance = check;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ public class FireJet extends FireAbility {
|
||||||
this.previousGlidingState = player.isGliding();
|
this.previousGlidingState = player.isGliding();
|
||||||
player.setGliding(true);
|
player.setGliding(true);
|
||||||
}
|
}
|
||||||
this.bPlayer.addCooldown(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +117,7 @@ public class FireJet extends FireAbility {
|
||||||
}
|
}
|
||||||
this.flightHandler.removeInstance(this.player, this.getName());
|
this.flightHandler.removeInstance(this.player, this.getName());
|
||||||
this.player.setFallDistance(0);
|
this.player.setFallDistance(0);
|
||||||
|
this.bPlayer.addCooldown(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -102,7 +102,6 @@ public class WallOfFire extends FireAbility {
|
||||||
|
|
||||||
this.initializeBlocks();
|
this.initializeBlocks();
|
||||||
this.start();
|
this.start();
|
||||||
this.bPlayer.addCooldown(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void affect(final Entity entity) {
|
private void affect(final Entity entity) {
|
||||||
|
@ -210,6 +209,12 @@ public class WallOfFire extends FireAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
super.remove();
|
||||||
|
this.bPlayer.addCooldown(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "WallOfFire";
|
return "WallOfFire";
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class JetBlast extends FireAbility implements ComboAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bPlayer.addCooldown("JetBlast", this.cooldown);
|
|
||||||
this.firstTime = false;
|
this.firstTime = false;
|
||||||
final float spread = 0F;
|
final float spread = 0F;
|
||||||
ParticleEffect.EXPLOSION_LARGE.display(this.player.getLocation(), 1, spread, spread, spread, 0);
|
ParticleEffect.EXPLOSION_LARGE.display(this.player.getLocation(), 1, spread, spread, spread, 0);
|
||||||
|
@ -106,6 +105,7 @@ public class JetBlast extends FireAbility implements ComboAbility {
|
||||||
task.remove();
|
task.remove();
|
||||||
}
|
}
|
||||||
super.remove();
|
super.remove();
|
||||||
|
this.bPlayer.addCooldown("JetBlast", this.cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -88,7 +88,6 @@ public class JetBlaze extends FireAbility implements ComboAbility {
|
||||||
this.remove();
|
this.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bPlayer.addCooldown("JetBlaze", this.cooldown);
|
|
||||||
this.firstTime = false;
|
this.firstTime = false;
|
||||||
} else if (System.currentTimeMillis() - this.time > this.duration) {
|
} else if (System.currentTimeMillis() - this.time > this.duration) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
@ -103,7 +102,7 @@ public class JetBlaze extends FireAbility implements ComboAbility {
|
||||||
fs.setDensity(8);
|
fs.setDensity(8);
|
||||||
fs.setSpread(1.0F);
|
fs.setSpread(1.0F);
|
||||||
fs.setUseNewParticles(true);
|
fs.setUseNewParticles(true);
|
||||||
fs.setCollisionRadius(3);
|
fs.setCollisionRadius(2);
|
||||||
fs.setParticleEffect(ParticleEffect.SMOKE_LARGE);
|
fs.setParticleEffect(ParticleEffect.SMOKE_LARGE);
|
||||||
fs.setDamage(this.damage);
|
fs.setDamage(this.damage);
|
||||||
fs.setFireTicks(this.fireTicks);
|
fs.setFireTicks(this.fireTicks);
|
||||||
|
@ -121,6 +120,7 @@ public class JetBlaze extends FireAbility implements ComboAbility {
|
||||||
task.remove();
|
task.remove();
|
||||||
}
|
}
|
||||||
super.remove();
|
super.remove();
|
||||||
|
this.bPlayer.addCooldown("JetBlaze", this.cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -255,12 +255,11 @@ public class SurgeWall extends WaterAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<Block> blocks = new ArrayList<Block>();
|
final ArrayList<Block> blocks = new ArrayList<Block>();
|
||||||
final Location targetLoc = GeneralMethods.getTargetedLocation(this.player, (int) this.range, Material.WATER, Material.ICE);
|
final Location targetLoc = GeneralMethods.getTargetedLocation(this.player, (int) this.range, false, false, Material.WATER, Material.ICE);
|
||||||
this.location = targetLoc.clone();
|
this.location = targetLoc.clone();
|
||||||
final Vector eyeDir = this.player.getEyeLocation().getDirection();
|
final Vector eyeDir = this.player.getEyeLocation().getDirection();
|
||||||
Vector vector;
|
Vector vector;
|
||||||
Block block;
|
Block block;
|
||||||
|
|
||||||
for (double i = 0; i <= this.getNightFactor(this.radius); i += 0.5) {
|
for (double i = 0; i <= this.getNightFactor(this.radius); i += 0.5) {
|
||||||
for (double angle = 0; angle < 360; angle += 10) {
|
for (double angle = 0; angle < 360; angle += 10) {
|
||||||
vector = GeneralMethods.getOrthogonalVector(eyeDir.clone(), angle, i);
|
vector = GeneralMethods.getOrthogonalVector(eyeDir.clone(), angle, i);
|
||||||
|
|
Loading…
Reference in a new issue