Fix Combos

This commit is contained in:
jedk1 2016-02-17 14:26:34 +00:00
parent a0c13895e3
commit c67f28fbb4
4 changed files with 20 additions and 75 deletions

View file

@ -1134,39 +1134,6 @@ public class PKListener implements Listener {
}
}
}
else {
Location from = event.getFrom();
Location to = event.getTo();
if (from.getBlock() == to.getBlock() && (from.getBlock() != null && to.getBlock() != null)) return;
if (from.getBlockY() < to.getBlockY()) {// Jump
ComboManager.addComboAbility(player, ClickType.JUMP);
return;
}
Vector toRight = GeneralMethods.getDirection(player.getLocation(), GeneralMethods.getRightSide(player.getLocation(), 1));
Vector toLeft = GeneralMethods.getDirection(player.getLocation(), GeneralMethods.getLeftSide(player.getLocation(), 1));
Location loc = player.getLocation();
loc.setYaw(0);
loc.setPitch(0);
Vector forwards = loc.getDirection().normalize();
Vector backwards = forwards.multiply(-1);
Vector current = player.getLocation().toVector().normalize();
if (current.distance(forwards) < 0.5 && current.distance(forwards) > -0.5) {
ComboManager.addComboAbility(player, ClickType.MOVE_FORWARDS);
} else if (current.distance(backwards) < 0.5 && current.distance(backwards) > -0.5) {
ComboManager.addComboAbility(player, ClickType.MOVE_BACKWARDS);
} else if (current.distance(toLeft) < 0.5 && current.distance(toLeft) > -0.5) {
ComboManager.addComboAbility(player, ClickType.MOVE_LEFT);
} else if (current.distance(toRight) < 0.5 && current.distance(toRight) > -0.5) {
ComboManager.addComboAbility(player, ClickType.MOVE_RIGHT);
}
return;
}
}
@EventHandler

View file

@ -319,7 +319,8 @@ public class FireCombo extends FireAbility implements ComboAbility {
ParticleEffect.LARGE_EXPLODE.display(player.getLocation(), spread, spread, spread, 0, 1);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 15, 0F);
}
player.setVelocity(player.getVelocity().normalize().multiply(speed));
FireJet fj = getAbility(player, FireJet.class);
fj.setSpeed(speed);
FireComboStream fs = new FireComboStream(this,
player.getVelocity().clone().multiply(-1), player.getLocation(), 3, 0.5, "JetBlast");
@ -343,7 +344,8 @@ public class FireCombo extends FireAbility implements ComboAbility {
return;
} else if (hasAbility(player, FireJet.class)) {
direction = player.getVelocity().clone().multiply(-1);
player.setVelocity(player.getVelocity().normalize().multiply(speed));
FireJet fj = getAbility(player, FireJet.class);
fj.setSpeed(speed);
FireComboStream fs = new FireComboStream(this, direction, player.getLocation(), 5, 1, "JetBlaze");
fs.setDensity(8);

View file

@ -8,30 +8,10 @@ public enum ClickType {
* Use this to call your own click type.
*/
CUSTOM,
/**
* The player has jumped
*/
JUMP,
/**
* Player has swung their arm.
*/
LEFT_CLICK,
/**
* The player has moved backwards
*/
MOVE_BACKWARDS,
/**
* The player has moved forwards
*/
MOVE_FORWARDS,
/**
* The player has moved left
*/
MOVE_LEFT,
/**
* The player has moved right
*/
MOVE_RIGHT,
/**
* For any instance of right clicking that isn't with an entity or a block (Right clicking air will not work).
*/

View file

@ -1,9 +1,9 @@
package com.projectkorra.projectkorra.waterbending;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location;
import org.bukkit.Material;
@ -15,10 +15,10 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.TempBlock;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
public class WaterSpoutWave extends WaterAbility {
@ -141,7 +141,7 @@ public class WaterSpoutWave extends WaterAbility {
remove();
return;
} else if (player.isSneaking()) {
new WaterSpoutWave(player, AbilityType.SHIFT);
setType(AbilityType.SHIFT);
return;
}
playFocusWaterEffect(origin.getBlock());
@ -158,25 +158,21 @@ public class WaterSpoutWave extends WaterAbility {
charging = true;
animation = AnimateState.RISE;
if(!getType(player, AbilityType.CLICK).isEmpty()) {
WaterSpoutWave clickWave = getType(player, AbilityType.CLICK).get(0);
origin = clickWave.origin.clone();
location = origin.clone();
location = origin.clone();
if (isPlant(origin.getBlock())) {
new PlantRegrowth(player, origin.getBlock());
}
if (isPlant(origin.getBlock())) {
new PlantRegrowth(player, origin.getBlock());
}
}
removeOldType(player, AbilityType.CLICK);
if (!player.isSneaking()) {
if (System.currentTimeMillis() - time > chargeTime) {
WaterSpoutWave wave = new WaterSpoutWave(player, AbilityType.RELEASE);
wave.animation = AnimateState.SHRINK;
wave.direction = direction;
setType(AbilityType.RELEASE);
setAnimation(AnimateState.SHRINK);
} else {
remove();
}
remove();
return;
}