mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Merge pull request #492 from Loonyy/master
New ClickType / Fixes Immobilize bug
This commit is contained in:
commit
e9ee121574
5 changed files with 136 additions and 137 deletions
|
@ -331,13 +331,12 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (bPlayer.getElements().size() > 1) {
|
||||
prefix = Element.AVATAR.getPrefix();
|
||||
} else if (element != null){
|
||||
} else if (element != null) {
|
||||
prefix = element.getPrefix();
|
||||
} else {
|
||||
prefix = ChatColor.WHITE + "[Nonbender] ";
|
||||
prefix = ChatColor.WHITE + "[Nonbender] ";
|
||||
}
|
||||
player.setDisplayName(player.getName());
|
||||
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
|
||||
|
@ -457,7 +456,8 @@ public class PKListener implements Listener {
|
|||
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
||||
}
|
||||
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
|
||||
if (!fc.getAffectedEntities().contains(event.getEntity())) continue;
|
||||
if (!fc.getAffectedEntities().contains(event.getEntity()))
|
||||
continue;
|
||||
List<ItemStack> drops = event.getDrops();
|
||||
List<ItemStack> newDrops = new ArrayList<>();
|
||||
for (int i = 0; i < drops.size(); i++) {
|
||||
|
@ -644,7 +644,7 @@ public class PKListener implements Listener {
|
|||
double maxDamage = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageCap");
|
||||
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
|
||||
if (damage > 0) {
|
||||
if(damage <= maxDamage) {
|
||||
if (damage <= maxDamage) {
|
||||
DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility());
|
||||
} else {
|
||||
DamageHandler.damageEntity((LivingEntity) e.getEntity(), maxDamage, e.getAbility());
|
||||
|
@ -775,7 +775,8 @@ public class PKListener implements Listener {
|
|||
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
||||
double finaldamage = initdamage - newdamage;
|
||||
event.setDamage(finaldamage);
|
||||
if (finaldamage <= 0.4) event.setCancelled(true);
|
||||
if (finaldamage <= 0.4)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (!event.isCancelled() && event.getCause() == DamageCause.FALL) {
|
||||
|
@ -785,9 +786,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (bPlayer.canBendPassive(Element.FIRE)
|
||||
&& bPlayer.hasElement(Element.FIRE)
|
||||
&& (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
||||
if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE) && (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
||||
event.setCancelled(!HeatControlExtinguish.canBurn(player));
|
||||
}
|
||||
|
||||
|
@ -859,8 +858,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
if (e.getCause() == DamageCause.ENTITY_ATTACK && sourceBPlayer.isElementToggled(Element.CHI) == true) {
|
||||
if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
|
||||
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld())
|
||||
&& Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
|
||||
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld()) && Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
|
||||
new Paralyze(sourcePlayer, targetPlayer);
|
||||
}
|
||||
}
|
||||
|
@ -885,9 +883,7 @@ public class PKListener implements Listener {
|
|||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < drops.size(); i++) {
|
||||
Material type = drops.get(i).getType();
|
||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE
|
||||
|| type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS
|
||||
|| type == Material.AIR)) {
|
||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
||||
newDrops.add(drops.get(i));
|
||||
}
|
||||
}
|
||||
|
@ -909,9 +905,7 @@ public class PKListener implements Listener {
|
|||
|
||||
for (int i = 0; i < drops.size(); i++) {
|
||||
Material type = drops.get(i).getType();
|
||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE
|
||||
|| type == Material.LEAVES || type == Material.LEAVES_2
|
||||
|| type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEAVES || type == Material.LEAVES_2 || type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
||||
newDrops.add(drops.get(i));
|
||||
}
|
||||
}
|
||||
|
@ -1070,9 +1064,7 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
else if (CoreAbility.hasAbility(player, WaterSpout.class)
|
||||
|| CoreAbility.hasAbility(player, AirSpout.class)
|
||||
|| CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
Vector vel = new Vector();
|
||||
vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||
vel.setY(event.getTo().getY() - event.getFrom().getY());
|
||||
|
@ -1149,8 +1141,7 @@ public class PKListener implements Listener {
|
|||
if (!Commands.invincible.contains(player.getName())) {
|
||||
Commands.invincible.add(player.getName());
|
||||
}
|
||||
}
|
||||
else if (!(event.getNewGameMode() == GameMode.SPECTATOR) && Commands.invincible.contains(player.getName())) {
|
||||
} else if (!(event.getNewGameMode() == GameMode.SPECTATOR) && Commands.invincible.contains(player.getName())) {
|
||||
Commands.invincible.remove(player.getName());
|
||||
}
|
||||
|
||||
|
@ -1211,11 +1202,8 @@ public class PKListener implements Listener {
|
|||
|
||||
String abilName = bPlayer.getBoundAbilityName();
|
||||
if (Suffocate.isBreathbent(player)) {
|
||||
if (!abilName.equalsIgnoreCase("AirSwipe")
|
||||
|| !abilName.equalsIgnoreCase("FireBlast")
|
||||
|| !abilName.equalsIgnoreCase("EarthBlast")
|
||||
|| !abilName.equalsIgnoreCase("WaterManipulation")) {
|
||||
if(!player.isSneaking()) {
|
||||
if (!abilName.equalsIgnoreCase("AirSwipe") || !abilName.equalsIgnoreCase("FireBlast") || !abilName.equalsIgnoreCase("EarthBlast") || !abilName.equalsIgnoreCase("WaterManipulation")) {
|
||||
if (!player.isSneaking()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -1232,7 +1220,6 @@ public class PKListener implements Listener {
|
|||
|
||||
AirScooter.check(player);
|
||||
|
||||
|
||||
CoreAbility coreAbil = bPlayer.getBoundAbility();
|
||||
String abil = bPlayer.getBoundAbilityName();
|
||||
if (coreAbil == null) {
|
||||
|
@ -1398,7 +1385,7 @@ public class PKListener implements Listener {
|
|||
|
||||
WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class);
|
||||
if (waterArms != null) {
|
||||
waterArms.displayBoundMsg(event.getNewSlot()+1);
|
||||
waterArms.displayBoundMsg(event.getNewSlot() + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1417,7 +1404,13 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
||||
Entity target = GeneralMethods.getTargetedEntity(player, 3);
|
||||
if (target != null && !(target.equals(player)) && target instanceof LivingEntity) {
|
||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY);
|
||||
|
||||
} else {
|
||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
||||
}
|
||||
|
||||
if (Suffocate.isBreathbent(player)) {
|
||||
event.setCancelled(true);
|
||||
|
@ -1428,7 +1421,7 @@ public class PKListener implements Listener {
|
|||
} else if (bPlayer.isChiBlocked()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (GeneralMethods.isInteractable(player.getTargetBlock((Set<Material>)null, 5))) {
|
||||
} else if (GeneralMethods.isInteractable(player.getTargetBlock((Set<Material>) null, 5))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (player.getItemInHand().getType() == Material.FISHING_ROD) {
|
||||
|
@ -1656,11 +1649,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (CoreAbility.hasAbility(player, Tornado.class)
|
||||
|| Bloodbending.isBloodbent(player)
|
||||
|| Suffocate.isBreathbent(player)
|
||||
|| CoreAbility.hasAbility(player, FireJet.class)
|
||||
|| CoreAbility.hasAbility(player, AvatarState.class)) {
|
||||
if (CoreAbility.hasAbility(player, Tornado.class) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player) || CoreAbility.hasAbility(player, FireJet.class) || CoreAbility.hasAbility(player, AvatarState.class)) {
|
||||
event.setCancelled(player.getGameMode() != GameMode.CREATIVE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,10 +157,10 @@ public class ComboManager {
|
|||
|
||||
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.ChiCombo.Immobilize.Enabled")) {
|
||||
ArrayList<AbilityInformation> immobilize = new ArrayList<>();
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK));
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK_ENTITY));
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||
COMBO_ABILITIES.put("Immobilize", new ComboAbilityInfo("Immobilize", immobilize, ChiCombo.class));
|
||||
DESCRIPTIONS.put("Immobilize", ConfigManager.languageConfig.get().getString("Abilities.Chi.Combo.Immobilize.Description"));
|
||||
INSTRUCTIONS.put("Immobilize", "QuickStrike (Left Click) > SwiftKick (Left Click) > QuickStrike (Left Click) > QuickStrike (Left Click)");
|
||||
|
@ -247,11 +247,16 @@ public class ComboManager {
|
|||
|
||||
boolean isValid = true;
|
||||
for (int i = 1; i <= size; i++) {
|
||||
if (!playerCombo.get(playerCombo.size() - i).equalsWithoutTime(abilityCombo.get(abilityCombo.size() - i))) {
|
||||
AbilityInformation playerInfo = playerCombo.get(playerCombo.size() - i);
|
||||
AbilityInformation comboInfo = abilityCombo.get(abilityCombo.size() - i);
|
||||
if (playerInfo.getAbilityName().equals(comboInfo.getAbilityName()) && playerInfo.getClickType() == ClickType.LEFT_CLICK_ENTITY && comboInfo.getClickType() == ClickType.LEFT_CLICK) {
|
||||
continue;
|
||||
} else if (!playerInfo.equalsWithoutTime(comboInfo)) {
|
||||
isValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
return customAbility;
|
||||
}
|
||||
|
@ -345,8 +350,6 @@ public class ComboManager {
|
|||
return INSTRUCTIONS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Contains information on an ability used in a combo.
|
||||
*
|
||||
|
|
|
@ -13,14 +13,15 @@ import java.util.ArrayList;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/*
|
||||
* TODO: Combo classes should eventually be rewritten so that each combo is treated
|
||||
* as an individual ability. In the mean time, we will just place "fake"
|
||||
* TODO: Combo classes should eventually be rewritten so that each combo is
|
||||
* treated as an individual ability. In the mean time, we will just place "fake"
|
||||
* classes so that CoreAbility will register each ability.
|
||||
*/
|
||||
public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||
|
||||
/**
|
||||
* a Map containing every entity which is paralyzed, and the time in milliseconds at which they will be unparalyzed.
|
||||
* a Map containing every entity which is paralyzed, and the time in
|
||||
* milliseconds at which they will be unparalyzed.
|
||||
*/
|
||||
private static final ConcurrentHashMap<Entity, Long> PARALYZED_ENTITIES = new ConcurrentHashMap<>();
|
||||
|
||||
|
@ -40,7 +41,8 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
target = GeneralMethods.getTargetedEntity(player, 5);
|
||||
if (!bPlayer.canBendIgnoreBinds(this)) {
|
||||
return;
|
||||
} if (target == null){
|
||||
}
|
||||
if (target == null) {
|
||||
remove();
|
||||
return;
|
||||
} else {
|
||||
|
@ -52,8 +54,9 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
}
|
||||
|
||||
/**
|
||||
* Paralyzes the target for the given duration. The player will
|
||||
* be unable to move or interact for the duration.
|
||||
* Paralyzes the target for the given duration. The player will be unable to
|
||||
* move or interact for the duration.
|
||||
*
|
||||
* @param target The Entity to be paralyzed
|
||||
* @param duration The time in milliseconds the target will be paralyzed
|
||||
*/
|
||||
|
@ -64,8 +67,8 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convenience method to see if a Player is paralyzed by a ChiCombo.
|
||||
* Calls {@link ChiCombo#isParalyzed(Entity)} with the Player casted to an Entity.
|
||||
* Convenience method to see if a Player is paralyzed by a ChiCombo. Calls
|
||||
* {@link ChiCombo#isParalyzed(Entity)} with the Player casted to an Entity.
|
||||
*
|
||||
* @param player The player to check if they're paralyzed
|
||||
* @return True if the player is paralyzed, false otherwise
|
||||
|
@ -86,9 +89,10 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the status of all paralyzed entities. If their paralysis has expired,
|
||||
* it removes them from {@link ChiCombo#PARALYZED_ENTITIES paralyzedEntities} and
|
||||
* removes the instance of the combo from {@link ChiCombo#instances instances}.
|
||||
* Checks the status of all paralyzed entities. If their paralysis has
|
||||
* expired, it removes them from {@link ChiCombo#PARALYZED_ENTITIES
|
||||
* paralyzedEntities} and removes the instance of the combo from
|
||||
* {@link ChiCombo#instances instances}.
|
||||
*/
|
||||
public static void handleParalysis() {
|
||||
for (Entity entity : PARALYZED_ENTITIES.keySet()) {
|
||||
|
@ -142,7 +146,6 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getInstructions() {
|
||||
return null;
|
||||
|
|
|
@ -28,7 +28,6 @@ public class QuickStrike extends ChiAbility {
|
|||
start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void progress() {
|
||||
if (target == null) {
|
||||
|
|
|
@ -13,7 +13,12 @@ public enum ClickType {
|
|||
*/
|
||||
LEFT_CLICK,
|
||||
/**
|
||||
* For any instance of right clicking that isn't with an entity or a block (Right clicking air will not work).
|
||||
* For any instance of right clicking that isn't with an entity or a block
|
||||
* (Right clicking air will not work).
|
||||
*/
|
||||
LEFT_CLICK_ENTITY,
|
||||
/**
|
||||
* Player has left clicked and hit an entity.
|
||||
*/
|
||||
RIGHT_CLICK,
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue