Various fixes (read desc.)

Removes Auto/Dynamic capabilities from various moves (shouldnt have had
them)
Fixes metalbending
Fixes Dynamic Toggles not working correctly
This commit is contained in:
OmniCypher 2015-12-26 16:33:33 -08:00
parent 4e23e4b7fd
commit d89e177737
16 changed files with 59 additions and 81 deletions

View file

@ -359,9 +359,6 @@ public class ConfigManager {
config.addDefault("Abilities.Water.IceSpike.Projectile.Range", 20);
config.addDefault("Abilities.Water.IceSpike.Projectile.Damage", 1);
config.addDefault("Abilities.Water.IceSpike.SelectRange", 12);
config.addDefault("Abilities.Water.IceSpike.AutoSourcing.Enabled", true);
config.addDefault("Abilities.Water.IceSpike.AutoSourcing.Cooldown", 2000);
config.addDefault("Abilities.Water.IceSpike.AutoSourcing.SelectRange", 5);
config.addDefault("Abilities.Water.IceSpike.DynamicSourcing.Enabled", true);
config.addDefault("Abilities.Water.OctopusForm.Enabled", true);
@ -476,8 +473,6 @@ public class ConfigManager {
config.addDefault("Abilities.Water.WaterArms.Spear.NightAugments.Duration.Normal", 7000);
config.addDefault("Abilities.Water.WaterArms.Spear.NightAugments.Duration.FullMoon", 12000);
config.addDefault("Abilities.Water.WaterArms.AutoSourcing.Enabled", false);
config.addDefault("Abilities.Water.WaterBubble.Enabled", true);
config.addDefault("Abilities.Water.WaterBubble.Description", "To use, the bender must hold down sneak. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
config.addDefault("Abilities.Water.WaterBubble.Radius", 7);
@ -510,7 +505,6 @@ public class ConfigManager {
config.addDefault("Abilities.Water.WaterSpout.Wave.AutoSourcing.Enabled", true);
config.addDefault("Abilities.Water.WaterSpout.Wave.AutoSourcing.Cooldown", 1500);
config.addDefault("Abilities.Water.WaterSpout.Wave.AutoSourcing.SelectRange", 5);
config.addDefault("Abilities.Water.WaterSpout.Wave.DynamicSourcing.Enabled", true);
config.addDefault("Abilities.Water.WaterCombo.Enabled", true);
config.addDefault("Abilities.Water.WaterCombo.IceWave.Damage", 4);
@ -522,8 +516,6 @@ public class ConfigManager {
config.addDefault("Abilities.Water.WaterCombo.IceBullet.AnimationSpeed", 1);
config.addDefault("Abilities.Water.WaterCombo.IceBullet.ShootTime", 10000);
config.addDefault("Abilities.Water.WaterCombo.IceBullet.Cooldown", 10000);
config.addDefault("Abilities.Water.WaterCombo.IceBullet.AutoSourcing.Enabled", true);
config.addDefault("Abilities.Water.WaterCombo.IceBullet.DynamicSourcing.Enabled", true);
config.addDefault("Abilities.Earth.Passive.Duration", 2500);
config.addDefault("Properties.Earth.Passive.SandRunPower", 1);

View file

@ -34,7 +34,7 @@ public class Collapse {
return;
this.player = player;
Block sblock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, false, dynamic, true, EarthMethods.canSandbend(player), false);
Block sblock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
Location location;
if (sblock == null) {
location = player.getTargetBlock(EarthMethods.getTransparentEarthbending(), selectRange).getLocation();

View file

@ -41,7 +41,7 @@ public class CompactColumn {
if (bPlayer.isOnCooldown("Collapse"))
return;
block = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, false, dynamic, true, EarthMethods.canSandbend(player), false);
block = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
if (block == null)
return;
origin = block.getLocation();

View file

@ -59,7 +59,7 @@ public class EarthArmor {
return;
this.player = player;
headblock = BlockSource.getEarthSourceBlock(player, autoSelectRange, selectRange, ClickType.LEFT_CLICK, false, auto, false, true, EarthMethods.canSandbend(player), false);
headblock = BlockSource.getEarthSourceBlock(player, autoSelectRange, selectRange, ClickType.LEFT_CLICK, auto, false, true, EarthMethods.canSandbend(player), false);
if (BlockSource.isAuto(headblock)) {
bPlayer.addCooldown("EarthArmor", autocooldown);
} else {

View file

@ -83,8 +83,8 @@ public class EarthBlast {
public boolean prepare() {
cancelPrevious();
Block block = BlockSource.getEarthSourceBlock(player, autoSelectRange, selectRange, ClickType.SHIFT_DOWN, dynamic, auto,
dynamic, true, EarthMethods.canSandbend(player), false);
Block block = BlockSource.getEarthSourceBlock(player, autoSelectRange, selectRange, ClickType.SHIFT_DOWN, auto,
dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
block(player);
if (block != null) {
if (block.getLocation().distance(player.getLocation()) > selectRange) {

View file

@ -49,7 +49,7 @@ public class EarthColumn {
if (AvatarState.isAvatarState(player)) {
height = (int) (2. / 5. * (double) AvatarState.getValue(height));
}
block = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, false, dynamic, true, EarthMethods.canSandbend(player), false);
block = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
if (block == null)
return;
origin = block.getLocation();

View file

@ -45,7 +45,7 @@ public class EarthWall {
Vector orth = new Vector(ox, oy, oz);
orth = orth.normalize();
Block sblock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, false, dynamic, true, EarthMethods.canSandbend(player), false);
Block sblock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
if (sblock != null) {
Location origin = sblock.getLocation();
World world = origin.getWorld();

View file

@ -168,7 +168,7 @@ public class LavaFlow {
}
instances.add(this);
} else if (type == AbilityType.CLICK) {
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.SHIFT_DOWN, false, false, dynamic, true, EarthMethods.canSandbend(player));
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
if (sourceBlock == null) {
remove();
return;

View file

@ -102,7 +102,7 @@ public class LavaSurge {
public boolean prepare()
{
Block targetBlock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, false, dynamic, true, EarthMethods.canSandbend(player), false);
Block targetBlock = BlockSource.getEarthSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
if(targetBlock == null ||
!(targetBlock.getRelative(BlockFace.UP).getType() == Material.AIR) &&

View file

@ -68,7 +68,7 @@ public class LavaWall {
public boolean prepare() {
cancelPrevious();
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, false, dynamic, true, EarthMethods.canSandbend(player));
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player));
if (block != null) {
sourceblock = block;
focusBlock();

View file

@ -67,7 +67,7 @@ public class LavaWave {
public boolean prepare() {
cancelPrevious();
// Block block = player.getTargetBlock(null, (int) range);
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, false, dynamic, true, EarthMethods.canSandbend(player));
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
if (block != null) {
sourceblock = block;
focusBlock();

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -147,7 +148,7 @@ public class BlockSource {
public static Block getDynamicEarthSourceBlock(Player player, int autoRange, int selectRange, BlockSourceType sourceType, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand, boolean metal) {
update(player, selectRange, clickType);
BlockSourceInformation info = getValidBlockSourceInformation(player, selectRange, sourceType, clickType);
if (info != null && dynamic) {
if (info != null) {
Block tempBlock = info.getBlock();
if (EarthMethods.isEarthbendable(tempBlock.getType()) && earth) {
return tempBlock;
@ -159,11 +160,10 @@ public class BlockSource {
return tempBlock;
}
}
if (auto) {
return EarthMethods.getRandomEarthBlock(player, player.getLocation(), autoRange, earth, sand, metal);
} else {
return EarthMethods.getEarthSourceBlock(player, selectRange, earth, sand, metal);
if (info == null && dynamic) {
return null;
}
return EarthMethods.getEarthSourceBlock(player, selectRange, earth, sand, metal);
}
/**
@ -189,11 +189,12 @@ public class BlockSource {
return info.getBlock();
}
}
if (auto) {
return WaterMethods.getRandomWaterBlock(player, player.getLocation(), autoRange, water, ice, plant);
} else {
return WaterMethods.getWaterSourceBlock(player, selectRange, water, ice, plant);
if (info == null && dynamic) {
Bukkit.broadcastMessage("2");
return null;
}
Bukkit.broadcastMessage("1");
return WaterMethods.getWaterSourceBlock(player, selectRange, water, ice, plant);
}
/**
@ -212,13 +213,20 @@ public class BlockSource {
* @return a valid Water bendable block, or null if none was found.
*/
public static Block getWaterSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean bottles, boolean water, boolean ice, boolean plant) {
Block sourceBlock = BlockSource.getDynamicWaterSourceBlock(player, autoRange, selectRange, BlockSourceType.WATER, clickType, auto, dynamic, water, ice, plant);
Block sourceBlock = null;
if(dynamic)
sourceBlock = BlockSource.getDynamicWaterSourceBlock(player, autoRange, selectRange, BlockSourceType.WATER, clickType, auto, dynamic, water, ice, plant);
else
sourceBlock = WaterMethods.getWaterSourceBlock(player, selectRange, water, ice, plant);
if (bottles && sourceBlock == null) {
if(bottles) {
// Check the block in front of the player's eyes, it may have been created by a
// WaterBottle.
sourceBlock = WaterMethods.getWaterSourceBlock(player, selectRange, water, ice, plant);
if (sourceBlock == null || sourceBlock.getLocation().distance(player.getEyeLocation()) > 3) {
sourceBlock = null;
}
if (auto && (sourceBlock == null || sourceBlock.getLocation().distance(player.getEyeLocation()) > 3)) {
Bukkit.broadcastMessage("3");
sourceBlock = WaterMethods.getRandomWaterBlock(player, player.getLocation(), autoRange, water, ice, plant);
}
}
return sourceBlock;
@ -237,11 +245,15 @@ public class BlockSource {
* block.
* @return a valid Earth bendable block, or null if none was found.
*/
public static Block getEarthSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean nearby, boolean auto, boolean dynamic, boolean earth, boolean sand, boolean metal) {
Block sourceBlock = getDynamicEarthSourceBlock(player, autoRange, selectRange, BlockSourceType.EARTH, clickType, auto, dynamic, earth, sand, metal);
if (!auto && nearby && sourceBlock == null) {
public static Block getEarthSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand, boolean metal) {
Block sourceBlock = null;
if(dynamic)
sourceBlock = getDynamicEarthSourceBlock(player, autoRange, selectRange, BlockSourceType.EARTH, clickType, auto, dynamic, earth, sand, metal);
else
sourceBlock = EarthMethods.getEarthSourceBlock(player, selectRange, earth, sand, metal);
if (sourceBlock == null) {
BlockSourceInformation blockInfo = getBlockSourceInformation(player, BlockSourceType.EARTH, clickType);
if (dynamic) {
if (blockInfo == null) {
return null;
}
@ -252,8 +264,9 @@ public class BlockSource {
Location loc = tempBlock.getLocation();
sourceBlock = EarthMethods.getNearbyEarthBlock(loc, autoRange, autoRange, earth, sand, metal);
if (sourceBlock == null || !sourceBlock.getLocation().getWorld().equals(player.getWorld()) || Math.abs(sourceBlock.getLocation().distance(player.getEyeLocation())) > autoRange) {
return null;
}
if (auto && (sourceBlock == null || !sourceBlock.getLocation().getWorld().equals(player.getWorld()) || Math.abs(sourceBlock.getLocation().distance(player.getEyeLocation())) > selectRange)) {
return EarthMethods.getRandomEarthBlock(player, player.getLocation(), autoRange, earth, sand, metal);
}
}
return sourceBlock;
@ -269,13 +282,13 @@ public class BlockSource {
* either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK.
* @return a valid Earth or Lava bendable block, or null if none was found.
*/
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean nearby, boolean auto, boolean dynamic, boolean earth, boolean sand) {
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand) {
/*
* When Lava is selected as a source it automatically overrides the
* previous Earth based source. Only one of these types can exist, so if
* Lava exists then we know Earth is null.
*/
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, nearby, auto, dynamic, earth, sand, false);
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, auto, dynamic, earth, sand, false);
BlockSourceInformation lavaBlockInfo = getValidBlockSourceInformation(player, selectRange, BlockSourceType.LAVA, clickType);
if (earthBlock != null) {
return earthBlock;

View file

@ -34,9 +34,6 @@ public class IceSpike2 {
static long slowCooldown = 5000;
private static int selectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.IceSpike.Projectile.SelectRange");
private static int autoSelectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.IceSpike.Projectile.AutoSourcing.SelectRange");
private static boolean auto = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.IceSpike.Projectile.AutoSourcing.Enabled");
private static long autocooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Water.IceSpike.Projectile.AutoSourcing.Cooldown");
private static boolean dynamic = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.IceSpike.Projectile.DynamicSourcing.Enabled");
private static final long interval = 20;
@ -59,20 +56,13 @@ public class IceSpike2 {
private double defaultrange = RANGE;
private double defaultdamage = DAMAGE;
private boolean isAuto;
public IceSpike2(Player player) {
if (!WaterMethods.canIcebend(player))
return;
block(player);
this.player = player;
Block sourceblock = BlockSource.getWaterSourceBlock(player, autoSelectRange, selectRange, ClickType.SHIFT_DOWN, auto, dynamic, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
if (BlockSource.isAuto(sourceblock)) {
isAuto = true;
} else {
isAuto = false;
}
Block sourceblock = BlockSource.getWaterSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
if (sourceblock == null) {
new SpikeField(player);
} else {
@ -410,11 +400,7 @@ public class IceSpike2 {
progressing = false;
}
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
if (isAuto) {
bPlayer.addCooldown("IceSpike", autocooldown);
} else {
bPlayer.addCooldown("IceSpike", GeneralMethods.getGlobalCooldown());
}
instances.remove(id);
}

View file

@ -57,10 +57,6 @@ public class WaterCombo {
public static long ICE_BULLET_SHOOT_TIME = ProjectKorra.plugin.getConfig().getLong(
"Abilities.Water.WaterCombo.IceBullet.ShootTime");
private static int icebullet_selectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterCombo.IceBullet.SelectRange");
private static int icebullet_autoSelectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterCombo.IceBullet.AutoSourcing.SelectRange");
private static boolean icebullet_auto = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterCombo.IceBullet.AutoSourcing.Enabled");
private static long icebullet_autocooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Water.WaterCombo.IceBullet.AutoSourcing.Cooldown");
private static boolean icebullet_dynamic = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.IceBlast.DynamicSourcing.Enabled");
private boolean IceBulletisAuto;
@ -273,25 +269,17 @@ public class WaterCombo {
remove();
return;
}
Block waterBlock = BlockSource.getWaterSourceBlock(player, icebullet_autoSelectRange, icebullet_selectRange, ClickType.SHIFT_DOWN, icebullet_auto, icebullet_dynamic, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
Block waterBlock = BlockSource.getWaterSourceBlock(player, icebullet_selectRange, icebullet_selectRange, ClickType.SHIFT_DOWN, false, false, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
if (waterBlock == null) {
remove();
return;
}
if (BlockSource.isAuto(waterBlock)) {
IceBulletisAuto = true;
} else {
IceBulletisAuto = false;
}
this.time = 0;
origin = waterBlock.getLocation();
currentLoc = origin.clone();
state = AbilityState.ICE_BULLET_FORMING;
if (IceBulletisAuto) {
bplayer.addCooldown("IceBullet", icebullet_autocooldown);
} else {
bplayer.addCooldown("IceBullet", cooldown);
}
direction = new Vector(1, 0, 1);
waterGrabber = new WaterSourceGrabber(player, origin.clone());
} else if (waterGrabber.getState() == WaterSourceGrabber.AnimationState.FAILED) {

View file

@ -301,7 +301,7 @@ public class WaterMethods {
}
public static boolean isIcebendable(Block block) {
if (block.getType() == Material.ICE)
if (block.getType() == Material.ICE || block.getType() == Material.SNOW)
return true;
if (block.getType() == Material.PACKED_ICE && plugin.getConfig().getBoolean("Properties.Water.CanBendPackedIce"))
return true;

View file

@ -49,7 +49,6 @@ public class WaterWave {
private static int autoSelectRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterSpout.Wave.AutoSourcing.SelectRange");
private static boolean auto = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterSpout.Wave.AutoSourcing.Enabled");
private static long autocooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Water.WaterSpout.Wave.AutoSourcing.Cooldown");
private static boolean dynamic = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterSpout.Wave.DynamicSourcing.Enabled");
private boolean isAuto;
@ -112,7 +111,7 @@ public class WaterWave {
if (origin == null) {
removeType(player, AbilityType.CLICK);
Block block = BlockSource.getWaterSourceBlock(player, autoSelectRange, selectRange, ClickType.SHIFT_DOWN, auto, dynamic, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
Block block = BlockSource.getWaterSourceBlock(player, autoSelectRange, selectRange, ClickType.SHIFT_DOWN, auto, false, true, true, WaterMethods.canIcebend(player), WaterMethods.canPlantbend(player));
if (block == null) {
if(instances.contains(this)) {
remove();