mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Changes to EarthGrab (PR Fixed, I hope.) (#599)
- 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.
This commit is contained in:
parent
41aa71aa2b
commit
3de75dade4
3 changed files with 93 additions and 36 deletions
|
@ -1288,9 +1288,6 @@ public class PKListener implements Listener {
|
||||||
else if (abil.equalsIgnoreCase("Shockwave")) {
|
else if (abil.equalsIgnoreCase("Shockwave")) {
|
||||||
new Shockwave(player, false);
|
new Shockwave(player, false);
|
||||||
}
|
}
|
||||||
else if (abil.equalsIgnoreCase("EarthGrab")) {
|
|
||||||
new EarthGrab(player, false);
|
|
||||||
}
|
|
||||||
else if (abil.equalsIgnoreCase("EarthTunnel")) {
|
else if (abil.equalsIgnoreCase("EarthTunnel")) {
|
||||||
new EarthTunnel(player);
|
new EarthTunnel(player);
|
||||||
}
|
}
|
||||||
|
@ -1521,7 +1518,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (abil.equalsIgnoreCase("EarthGrab")) {
|
else if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||||
new EarthGrab(player, true);
|
new EarthGrab(player);
|
||||||
}
|
}
|
||||||
else if (abil.equalsIgnoreCase("Tremorsense")) {
|
else if (abil.equalsIgnoreCase("Tremorsense")) {
|
||||||
new Tremorsense(player, true);
|
new Tremorsense(player, true);
|
||||||
|
|
|
@ -283,7 +283,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Earth.EarthArmor.Description", "This ability encases the Earthbender in temporary armor. To use, hold shift while looking at an earthbendable block and that block will travel towards you and grant you temporary armor and resistance. Shift click while on the move's slot to manually remove it.");
|
config.addDefault("Abilities.Earth.EarthArmor.Description", "This ability encases the Earthbender in temporary armor. To use, hold shift while looking at an earthbendable block and that block will travel towards you and grant you temporary armor and resistance. Shift click while on the move's slot to manually remove it.");
|
||||||
config.addDefault("Abilities.Earth.EarthBlast.Description", "To use, place your cursor over an earthbendable object (dirt, rock, ores, etc) " + "and tap sneak (default: shift). The object will temporarily turn to stone, " + "indicating that you have it focused as the source for your ability. " + "After you have selected an origin (you no longer need to be sneaking), " + "simply left-click in any direction and you will see your object launch " + "off in that direction, smashing into any creature in its path. If you look " + "towards a creature when you use this ability, it will target that creature. " + "A collision from Earth Blast both knocks the target back and deals some damage. " + "You cannot have multiple of these abilities flying at the same time.");
|
config.addDefault("Abilities.Earth.EarthBlast.Description", "To use, place your cursor over an earthbendable object (dirt, rock, ores, etc) " + "and tap sneak (default: shift). The object will temporarily turn to stone, " + "indicating that you have it focused as the source for your ability. " + "After you have selected an origin (you no longer need to be sneaking), " + "simply left-click in any direction and you will see your object launch " + "off in that direction, smashing into any creature in its path. If you look " + "towards a creature when you use this ability, it will target that creature. " + "A collision from Earth Blast both knocks the target back and deals some damage. " + "You cannot have multiple of these abilities flying at the same time.");
|
||||||
config.addDefault("Abilities.Earth.EarthBlast.DeathMessage", "{victim} was broken apart by {attacker}'s {ability}");
|
config.addDefault("Abilities.Earth.EarthBlast.DeathMessage", "{victim} was broken apart by {attacker}'s {ability}");
|
||||||
config.addDefault("Abilities.Earth.EarthGrab.Description", "To use, simply left-click while targeting a creature within range. " + "This ability will erect a circle of earth to trap the creature in.");
|
config.addDefault("Abilities.Earth.EarthGrab.Description", "To use, simply hold shift and left click while targeting an entity. This ability will erect a circle of earth to trap the entity in. Alternatively, click the block below you to encase yourself.");
|
||||||
config.addDefault("Abilities.Earth.EarthTunnel.Description", "Earth Tunnel is a completely utility ability for earthbenders. To use, simply sneak (default: shift) in the direction you want to tunnel. You will slowly begin tunneling in the direction you're facing for as long as you sneak or if the tunnel has been dug long enough. This ability will be interrupted if it hits a block that cannot be earthbent.");
|
config.addDefault("Abilities.Earth.EarthTunnel.Description", "Earth Tunnel is a completely utility ability for earthbenders. To use, simply sneak (default: shift) in the direction you want to tunnel. You will slowly begin tunneling in the direction you're facing for as long as you sneak or if the tunnel has been dug long enough. This ability will be interrupted if it hits a block that cannot be earthbent.");
|
||||||
config.addDefault("Abilities.Earth.Extraction.Description", "This ability allows metalbenders to extract the minerals from ore blocks. To use, simply tap sneak while looking at an ore block with metal in it (iron, gold, quartz) and the ore will be extracted and drop in front of you. This ability has a small chance of doubling or tripling the loot. This ability has a short cooldown.");
|
config.addDefault("Abilities.Earth.Extraction.Description", "This ability allows metalbenders to extract the minerals from ore blocks. To use, simply tap sneak while looking at an ore block with metal in it (iron, gold, quartz) and the ore will be extracted and drop in front of you. This ability has a small chance of doubling or tripling the loot. This ability has a short cooldown.");
|
||||||
config.addDefault("Abilities.Earth.LavaFlow.Description", "This ability allows an Earthbender to create lava using the Earth around them. To use, simply hold sneak (Default: Shift) to create a lava moat that surrounds you, press sneak again to remove the moat. Left click an Earthbendable block to create a pool of lava after a small delay. Additionally, you can left click at any time to turn lava back into its original state -- Earth.");
|
config.addDefault("Abilities.Earth.LavaFlow.Description", "This ability allows an Earthbender to create lava using the Earth around them. To use, simply hold sneak (Default: Shift) to create a lava moat that surrounds you, press sneak again to remove the moat. Left click an Earthbendable block to create a pool of lava after a small delay. Additionally, you can left click at any time to turn lava back into its original state -- Earth.");
|
||||||
|
@ -845,9 +845,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Earth.EarthBlast.CollisionRadius", 2);
|
config.addDefault("Abilities.Earth.EarthBlast.CollisionRadius", 2);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.EarthGrab.Enabled", true);
|
config.addDefault("Abilities.Earth.EarthGrab.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.EarthGrab.SelectRange", 14);
|
config.addDefault("Abilities.Earth.EarthGrab.SelectRange", 20);
|
||||||
config.addDefault("Abilities.Earth.EarthGrab.Height", 6);
|
config.addDefault("Abilities.Earth.EarthGrab.Height", 6);
|
||||||
config.addDefault("Abilities.Earth.EarthGrab.Cooldown", 500);
|
config.addDefault("Abilities.Earth.EarthGrab.Cooldown", 2000);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.EarthTunnel.Enabled", true);
|
config.addDefault("Abilities.Earth.EarthTunnel.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.EarthTunnel.MaxRadius", 1);
|
config.addDefault("Abilities.Earth.EarthTunnel.MaxRadius", 1);
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
package com.projectkorra.projectkorra.earthbending;
|
package com.projectkorra.projectkorra.earthbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import java.util.ArrayList;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
|
||||||
public class EarthGrab extends EarthAbility {
|
public class EarthGrab extends EarthAbility {
|
||||||
|
|
||||||
|
@ -21,8 +25,14 @@ public class EarthGrab extends EarthAbility {
|
||||||
private Location origin;
|
private Location origin;
|
||||||
private Vector direction;
|
private Vector direction;
|
||||||
private Entity closestEntity;
|
private Entity closestEntity;
|
||||||
|
private Location startLoc;
|
||||||
|
private Location loc;
|
||||||
|
private Vector dir;
|
||||||
|
private Block groundBlock;
|
||||||
|
private Material blockType;
|
||||||
|
private Random random;
|
||||||
|
|
||||||
public EarthGrab(Player player, boolean isOtherEntity) {
|
public EarthGrab(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthGrab.SelectRange");
|
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthGrab.SelectRange");
|
||||||
|
@ -32,32 +42,26 @@ public class EarthGrab extends EarthAbility {
|
||||||
this.direction = origin.getDirection();
|
this.direction = origin.getDirection();
|
||||||
this.lowestDistance = selectRange + 1;
|
this.lowestDistance = selectRange + 1;
|
||||||
this.closestEntity = null;
|
this.closestEntity = null;
|
||||||
|
this.startLoc = player.getLocation();
|
||||||
|
this.loc = player.getLocation();
|
||||||
|
this.dir = player.getLocation().getDirection();
|
||||||
|
this.random = new Random();
|
||||||
|
|
||||||
if (!bPlayer.canBend(this)) {
|
if (!bPlayer.canBend(this)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(player.isSneaking()) {
|
||||||
start();
|
start();
|
||||||
if (isOtherEntity) {
|
}
|
||||||
earthGrabOtherEntity();
|
Location targetLocation = GeneralMethods.getTargetedLocation(player, 1);
|
||||||
} else {
|
Block block = GeneralMethods.getTopBlock(targetLocation, 1);
|
||||||
earthGrabSelf();
|
if(isEarthbendable(block) && block.getLocation().distance(player.getLocation()) <= 2) {
|
||||||
|
earthGrabSelf();
|
||||||
|
remove();
|
||||||
}
|
}
|
||||||
remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void earthGrabOtherEntity() {
|
public void formDome() {
|
||||||
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(origin, selectRange)) {
|
|
||||||
if (GeneralMethods.getDistanceFromLine(direction, origin, entity.getLocation()) <= 3
|
|
||||||
&& (entity instanceof LivingEntity)
|
|
||||||
&& (entity.getEntityId() != player.getEntityId())) {
|
|
||||||
double distance = origin.distance(entity.getLocation());
|
|
||||||
if (distance < lowestDistance) {
|
|
||||||
closestEntity = entity;
|
|
||||||
lowestDistance = distance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (closestEntity != null) {
|
if (closestEntity != null) {
|
||||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||||
|
@ -101,14 +105,16 @@ public class EarthGrab extends EarthAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!blocks.isEmpty()) {
|
bPlayer.addCooldown(this);
|
||||||
bPlayer.addCooldown(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void earthGrabSelf() {
|
public void earthGrabSelf() {
|
||||||
closestEntity = player;
|
closestEntity = player;
|
||||||
|
getGround();
|
||||||
|
ParticleEffect.BLOCK_CRACK.display(
|
||||||
|
(ParticleEffect.ParticleData) new ParticleEffect.BlockData(blockType, (byte) 0), 1F, 1F, 1F,
|
||||||
|
0.1F, 100, player.getLocation(), 500);
|
||||||
if (closestEntity != null) {
|
if (closestEntity != null) {
|
||||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||||
Location location = closestEntity.getLocation();
|
Location location = closestEntity.getLocation();
|
||||||
|
@ -151,9 +157,7 @@ public class EarthGrab extends EarthAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!blocks.isEmpty()) {
|
bPlayer.addCooldown(this);
|
||||||
bPlayer.addCooldown(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +165,65 @@ public class EarthGrab extends EarthAbility {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "EarthGrab";
|
return "EarthGrab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getGround() {
|
||||||
|
for (int i = 0; i <= 5; i++) {
|
||||||
|
Block block = loc.getBlock().getRelative(BlockFace.DOWN, i);
|
||||||
|
if (isEarthbendable(block)) {
|
||||||
|
groundBlock = block;
|
||||||
|
blockType = block.getType();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void progress() {
|
public void progress() {
|
||||||
|
getGround();
|
||||||
|
bPlayer.addCooldown(this);
|
||||||
|
if(groundBlock == null) {
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dir = player.getLocation().getDirection().clone().normalize().multiply(1.5);
|
||||||
|
dir.setY(0);
|
||||||
|
double distance = loc.getY() - (double) groundBlock.getY();
|
||||||
|
double dx = Math.abs(distance - 2.4);
|
||||||
|
if (distance > 1.75) {
|
||||||
|
dir.setY(-.50 * dx * dx);
|
||||||
|
} else if (distance < 1) {
|
||||||
|
dir.setY(.50 * dx * dx);
|
||||||
|
} else {
|
||||||
|
dir.setY(0);
|
||||||
|
}
|
||||||
|
loc.add(dir);
|
||||||
|
ParticleEffect.BLOCK_CRACK.display(
|
||||||
|
(ParticleEffect.ParticleData) new ParticleEffect.BlockData(blockType, (byte) 0), 1F, 0.1F, 1F,
|
||||||
|
0.1F, 100, loc.add(0, -1, 0), 500);
|
||||||
|
if(player.isDead() || !player.isOnline()) {
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!player.isSneaking()) {
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(loc.distance(startLoc) >= selectRange) {
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(Entity e : GeneralMethods.getEntitiesAroundPoint(loc, 2.5)) {
|
||||||
|
if(e.getEntityId() != player.getEntityId() && e instanceof LivingEntity) {
|
||||||
|
closestEntity = e;
|
||||||
|
formDome();
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(random.nextInt(2) == 0) {
|
||||||
|
playEarthbendingSound(loc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue