mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
PhaseChange changes (#695)
This commit is contained in:
parent
edfd032724
commit
4b8d9783d2
2 changed files with 14 additions and 66 deletions
|
@ -809,15 +809,6 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.PhaseChange.Melt.Delay", 50);
|
config.addDefault("Abilities.Water.PhaseChange.Melt.Delay", 50);
|
||||||
config.addDefault("Abilities.Water.PhaseChange.Melt.Radius", 7);
|
config.addDefault("Abilities.Water.PhaseChange.Melt.Radius", 7);
|
||||||
config.addDefault("Abilities.Water.PhaseChange.Melt.AllowFlow", true);
|
config.addDefault("Abilities.Water.PhaseChange.Melt.AllowFlow", true);
|
||||||
/*
|
|
||||||
* config.addDefault("Abilities.Water.PhaseChange.Skate.Cooldown",
|
|
||||||
* 7000);
|
|
||||||
* config.addDefault("Abilities.Water.PhaseChange.Skate.Duration",
|
|
||||||
* 7000);
|
|
||||||
* config.addDefault("Abilities.Water.PhaseChange.Skate.Radius", 1);
|
|
||||||
* config.addDefault("Abilities.Water.PhaseChange.Skate.Speed",
|
|
||||||
* 0.335);
|
|
||||||
*/
|
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.PlantArmor.Enabled", true);
|
config.addDefault("Abilities.Water.PlantArmor.Enabled", true);
|
||||||
config.addDefault("Abilities.Water.PlantArmor.Duration", 7500);
|
config.addDefault("Abilities.Water.PlantArmor.Duration", 7500);
|
||||||
|
|
|
@ -20,12 +20,13 @@ import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.Torrent;
|
import com.projectkorra.projectkorra.waterbending.Torrent;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear;
|
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear;
|
||||||
|
|
||||||
public class PhaseChange extends IceAbility {
|
public class PhaseChange extends IceAbility {
|
||||||
|
|
||||||
public static enum PhaseChangeType {
|
public static enum PhaseChangeType {
|
||||||
FREEZE, MELT, SKATE;
|
FREEZE, MELT;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -33,8 +34,6 @@ public class PhaseChange extends IceAbility {
|
||||||
return "Freeze";
|
return "Freeze";
|
||||||
} else if (this == MELT) {
|
} else if (this == MELT) {
|
||||||
return "Melt";
|
return "Melt";
|
||||||
} else if (this == SKATE) {
|
|
||||||
return "Skate";
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -63,13 +62,6 @@ public class PhaseChange extends IceAbility {
|
||||||
private long lastBlockTime = 0;
|
private long lastBlockTime = 0;
|
||||||
private CopyOnWriteArrayList<Block> melted_blocks = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Block> melted_blocks = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
/*Skate Variables
|
|
||||||
private long skateCooldown = 7000;
|
|
||||||
private int skateRadius = 1;
|
|
||||||
private long duration = 7000;
|
|
||||||
private double speed = 0.335;
|
|
||||||
*/
|
|
||||||
|
|
||||||
public PhaseChange(Player player, PhaseChangeType type) {
|
public PhaseChange(Player player, PhaseChangeType type) {
|
||||||
super(player);
|
super(player);
|
||||||
startNewType(type);
|
startNewType(type);
|
||||||
|
@ -103,13 +95,10 @@ public class PhaseChange extends IceAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_types.contains(PhaseChangeType.MELT)) {
|
if (active_types.contains(PhaseChangeType.MELT)) {
|
||||||
if (active_types.contains(PhaseChangeType.SKATE)) {
|
|
||||||
active_types.remove(PhaseChangeType.MELT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
active_types.remove(PhaseChangeType.MELT);
|
active_types.remove(PhaseChangeType.MELT);
|
||||||
bPlayer.addCooldown("PhaseChangeMelt", meltCooldown);
|
bPlayer.addCooldown("PhaseChangeMelt", meltCooldown);
|
||||||
|
meltRadius = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (meltRadius >= meltMaxRadius) {
|
if (meltRadius >= meltMaxRadius) {
|
||||||
|
@ -119,27 +108,8 @@ public class PhaseChange extends IceAbility {
|
||||||
Location l = GeneralMethods.getTargetedLocation(player, sourceRange);
|
Location l = GeneralMethods.getTargetedLocation(player, sourceRange);
|
||||||
resetMeltLocation(l);
|
resetMeltLocation(l);
|
||||||
meltArea(l, meltRadius);
|
meltArea(l, meltRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (active_types.contains(PhaseChangeType.SKATE)) {
|
|
||||||
if (!player.isSprinting()) {
|
|
||||||
active_types.remove(PhaseChangeType.SKATE);
|
|
||||||
bPlayer.addCooldown("PhaseChangeSkate", skateCooldown);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() > getStartTime() + duration) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Location center = player.getLocation().clone().subtract(0, 1, 0);
|
|
||||||
if (isWater(center.getBlock()) || isIce(center.getBlock())) {
|
|
||||||
freezeArea(center, skateRadius, PhaseChangeType.SKATE);
|
|
||||||
Vector v = new Vector(player.getLocation().getDirection().getX(), 0, player.getLocation().getDirection().getZ());
|
|
||||||
player.setVelocity(v.normalize().multiply(speed));
|
|
||||||
displaySkateParticles();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (active_types.isEmpty()) {
|
if (active_types.isEmpty()) {
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
@ -176,27 +146,9 @@ public class PhaseChange extends IceAbility {
|
||||||
meltDelay = getConfig().getInt("Abilities.Water.PhaseChange.Melt.Delay")/night;
|
meltDelay = getConfig().getInt("Abilities.Water.PhaseChange.Melt.Delay")/night;
|
||||||
meltMaxRadius = night*getConfig().getInt("Abilities.Water.PhaseChange.Melt.Radius");
|
meltMaxRadius = night*getConfig().getInt("Abilities.Water.PhaseChange.Melt.Radius");
|
||||||
allowMeltFlow = getConfig().getBoolean("Abilities.Water.PhaseChange.Melt.AllowFlow");
|
allowMeltFlow = getConfig().getBoolean("Abilities.Water.PhaseChange.Melt.AllowFlow");
|
||||||
/*} else if (type == PhaseChangeType.SKATE) {
|
|
||||||
if (bPlayer.isOnCooldown("PhaseChangeSkate")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
duration = night*getConfig().getLong("Abilities.Water.PhaseChange.Skate.Duration");
|
|
||||||
speed = night*getConfig().getDouble("Abilities.Water.PhaseChange.Skate.Speed");
|
|
||||||
skateCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Skate.Cooldown");
|
|
||||||
skateRadius = night*getConfig().getInt("Abilities.Water.PhaseChange.Skate.Radius");
|
|
||||||
|
|
||||||
freezeArea(player.getLocation().clone().subtract(0, 1, 0), skateRadius, PhaseChangeType.SKATE);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void displaySkateParticles() {
|
|
||||||
Location right = GeneralMethods.getRightSide(player.getLocation(), 0.3);
|
|
||||||
Location left = GeneralMethods.getLeftSide(player.getLocation(), 0.3);
|
|
||||||
|
|
||||||
ParticleEffect.SNOW_SHOVEL.display(right, 0, 0, 0, 0.00012F, 1);
|
|
||||||
ParticleEffect.SNOW_SHOVEL.display(left, 0, 0, 0, 0.00012F, 1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void resetMeltLocation(Location loc) {
|
public void resetMeltLocation(Location loc) {
|
||||||
if (meltLoc == null) {
|
if (meltLoc == null) {
|
||||||
meltLoc = loc;
|
meltLoc = loc;
|
||||||
|
@ -266,6 +218,7 @@ public class PhaseChange extends IceAbility {
|
||||||
}
|
}
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void freezeArea(Location center, int radius, PhaseChangeType type) {
|
public void freezeArea(Location center, int radius, PhaseChangeType type) {
|
||||||
if (type == PhaseChangeType.FREEZE) {
|
if (type == PhaseChangeType.FREEZE) {
|
||||||
if (bPlayer.isOnCooldown("PhaseChangeFreeze")) {
|
if (bPlayer.isOnCooldown("PhaseChangeFreeze")) {
|
||||||
|
@ -333,6 +286,7 @@ public class PhaseChange extends IceAbility {
|
||||||
}
|
}
|
||||||
blocks.add(tb);
|
blocks.add(tb);
|
||||||
PLAYER_BY_BLOCK.put(tb, player);
|
PLAYER_BY_BLOCK.put(tb, player);
|
||||||
|
playIcebendingSound(b.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void meltArea(Location center, int radius) {
|
public void meltArea(Location center, int radius) {
|
||||||
|
@ -355,7 +309,6 @@ public class PhaseChange extends IceAbility {
|
||||||
|
|
||||||
Block b = ice.get(r.nextInt(ice.size()));
|
Block b = ice.get(r.nextInt(ice.size()));
|
||||||
melt(b);
|
melt(b);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void meltArea(Location center) {
|
public void meltArea(Location center) {
|
||||||
|
@ -390,6 +343,10 @@ public class PhaseChange extends IceAbility {
|
||||||
WaterArmsSpear.thaw(b);
|
WaterArmsSpear.thaw(b);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (WaterSpoutWave.canThaw(b)) {
|
||||||
|
WaterSpoutWave.thaw(b);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (TempBlock.isTempBlock(b)) {
|
if (TempBlock.isTempBlock(b)) {
|
||||||
TempBlock tb = TempBlock.get(b);
|
TempBlock tb = TempBlock.get(b);
|
||||||
|
|
||||||
|
@ -410,6 +367,7 @@ public class PhaseChange extends IceAbility {
|
||||||
new TempBlock(b, Material.AIR, (byte)0);
|
new TempBlock(b, Material.AIR, (byte)0);
|
||||||
melted_blocks.add(b);
|
melted_blocks.add(b);
|
||||||
}
|
}
|
||||||
|
playWaterbendingSound(b.getLocation());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Only works with PhaseChange frozen blocks!
|
* Only works with PhaseChange frozen blocks!
|
||||||
|
@ -422,6 +380,9 @@ public class PhaseChange extends IceAbility {
|
||||||
} else {
|
} else {
|
||||||
Player p = PLAYER_BY_BLOCK.get(tb);
|
Player p = PLAYER_BY_BLOCK.get(tb);
|
||||||
PhaseChange pc = getAbility(p, PhaseChange.class);
|
PhaseChange pc = getAbility(p, PhaseChange.class);
|
||||||
|
if (pc == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
PLAYER_BY_BLOCK.remove(tb);
|
PLAYER_BY_BLOCK.remove(tb);
|
||||||
if (pc.getFrozenBlocks() != null) {
|
if (pc.getFrozenBlocks() != null) {
|
||||||
pc.getFrozenBlocks().remove(tb);
|
pc.getFrozenBlocks().remove(tb);
|
||||||
|
@ -543,10 +504,6 @@ public class PhaseChange extends IceAbility {
|
||||||
return meltRadius;
|
return meltRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public int getSkateFreezeRadius() {
|
|
||||||
return skateRadius;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void setFreezeControlRadius(int value) {
|
public void setFreezeControlRadius(int value) {
|
||||||
controlRadius = value;
|
controlRadius = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue