mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
PhaseChange done (#665)
* Fix metalclips - Removed a check that was preventing metalclips from progressing past 1 clip on a target. * Fix metalclips - Fixed a bug limiting the metal clip count to one * Improve MetalClips - Fixed bug where shooting at a block spawned two clips - Added ShootCooldown and CrushCooldown - ShootCooldown only applies to shooting clips - Changed how crushing works: --- Removed old style and variables --- When controlling an entity with 4 clips, the controller can click to cause the armor to "crush" and damage the entity. --- Has own cooldown, default of 2000 (2 seconds) - Changed launching --- Works with all clip amounts except 4 --- When the user releases sneak, the entity will be launched at varying power depending on how many clips were attached. - Changed ability cooldown to activate only after the ability is finished. * Add CrushDamage option to MetalClips * New Damage Type, MetalClips changes - Fixed MetalClips bug caused in magnetizing - Added ignoreArmor option to damageEntity method, default true for most abilities. If wanted to be changed, someone needs to go through and add false as a parameter - Changed default config option for MetalClips description * PhaseChange recode * Chris wanted changes * Chris doesn't want bugs * Only you can prevent bugs - Added checks for worlds to prevent errors * Remove unnecessary auto generated comments * Loony didn't like the passive * Added RegionProtection checks * PhaseChange * Revert "PhaseChange" This reverts commit 761c73f5756771674719ffca52413cffa09243a8. * Revert "Added RegionProtection checks" This reverts commit b53a02a74d0276d4d1e773e1c197666cbcfab624. * Revert "Loony didn't like the passive" This reverts commit 6612bb7fa8eea3e26c01d0ef761c658447779e03. * Revert "Remove unnecessary auto generated comments" This reverts commit da9c45106d0b7e256c278e6a84d15f7a7340a140. * Revert "Only you can prevent bugs" This reverts commit 630161659ea89bfb106924c8ab1fbcdb8f6f1310. * Revert "Chris doesn't want bugs" This reverts commit eda2dee6b52dd38c73f35680c5e4484adc5b5b91. * Revert "Chris wanted changes" This reverts commit 30b76c10c4adc63784ea7115eb4f9c636650d6c5. * Revert "PhaseChange recode" This reverts commit f8f290dd8c57a3467a87de7e43b58ce635196c62. * Conflicts * Stupid conflicts * I hope and pray * Revert "Revert "Chris wanted changes"" This reverts commit e612607c8a16a735c92014714c00aa671954b4a5. * Revert "Revert "Chris doesn't want bugs"" This reverts commit bd656b814d7ffa2d9c84fa304d3adb8f1535f782. * Revert "Revert "Only you can prevent bugs"" This reverts commit 7772c95737130cf414ff1af49dcfb48865be5374. * Revert "Revert "Remove unnecessary auto generated comments"" This reverts commit 69315dc7baa6cd237fbd89394e544913596ec6e3. * Revert "Revert "Loony didn't like the passive"" This reverts commit ea397c6323e50d219395d5912850513afd6f2a7b. * Revert "Revert "Added RegionProtection checks"" This reverts commit 8cb41709f65e4322e68b2f0e1792987f7fc214f2. * Revert "Revert "PhaseChange"" This reverts commit da6b0e7071acf74df6447b15daf4ae6e39f057f6. * Working PhaseChange finally * Fix EarthGrab * Air fixes, PhaseChange changes * PhaseChange finalizing. Ready to go!
This commit is contained in:
parent
6b656cc711
commit
45d2230376
3 changed files with 102 additions and 23 deletions
|
@ -257,7 +257,7 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Water.IceSpike.DeathMessage", "{victim} was impaled by {attacker}'s {ability}");
|
||||
config.addDefault("Abilities.Water.OctopusForm.Description", "This ability allows the waterbender to manipulate a large quantity of water into a form resembling that of an octopus. " + "To use, left click to select a water source. Then, hold sneak to channel this ability. " + "While channeling, the water will form itself around you and has a chance to block incoming attacks. " + "Additionally, you can left click while channeling to attack things near you, dealing damage and knocking them back. " + "Releasing sneak at any time will dissipate the form.");
|
||||
config.addDefault("Abilities.Water.OctopusForm.DeathMessage", "{victim} was slapped by {attacker}'s {ability}");
|
||||
config.addDefault("Abilities.Water.PhaseChange.Description", "To use, simply left-click. " + "Any water you are looking at within range will instantly freeze over into solid ice. " + "Provided you stay within range of the ice, " + "that ice will not thaw. If, however, you do either of those the ice will instantly thaw. " + "If you sneak (default: shift), anything around where you are looking at will instantly melt. " + "Since this is a more favorable state for these things, they will never re-freeze unless they " + "would otherwise by nature or some other bending ability." + " Sneaking while running will cause you to skate forwards on ice, and create ice from water under you." + " Having PhaseChange bound while moving removes ice from where you are standing and directly in front of you."/* Additionally, if you tap sneak while " + "targeting water with PhaseChange, it will evaporate water around that block that is above " + "sea level. "*/);
|
||||
config.addDefault("Abilities.Water.PhaseChange.Description", "This ability has 2 functions, Freeze and Melt. \n- Freeze: This function is activated by left clicking. It will freeze any water in a certain radius of where you are looking. \n- Melt: This function is activated by sneaking. It will melt ice in a radius of where you are looking. The melting isn't instant!"/*\n- Skate*/);
|
||||
config.addDefault("Abilities.Water.PlantArmor.Description", "PlantArmor is a defensive ability in the arsenal of the plantbender. Clicking on leaves with this ability will temporarily clad you in strong armor made out of plants! You can use this defensively, but you can also use the armor as a source for other plantbending skills.");
|
||||
config.addDefault("Abilities.Water.Surge.Description", "This ability has two distinct features. If you sneak to select a source block, you can then click in a direction and a large wave will be launched in that direction. If you sneak again while the wave is en route, the wave will freeze the next target it hits. If, instead, you click to select a source block, you can hold sneak to form a wall of water at your cursor location. Click to shift between a water wall and an ice wall. Release sneak to dissipate it.");
|
||||
config.addDefault("Abilities.Water.Torrent.Description", "Torrent is one of the strongest moves in a waterbender's arsenal. To use, first click a source block to select it; then hold shift to begin streaming the water around you. Water flowing around you this way will damage and knock back nearby enemies and projectiles. If you release shift during this, you will create a large wave that expands outwards from you, launching anything in its path back. Instead, if you click you release the water and channel it to flow towards your cursor. Anything caught in the blast will be tossed about violently and take damage. Finally, if you click again when the water is torrenting, it will freeze the area around it when it is obstructed.");
|
||||
|
@ -679,10 +679,10 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Water.PhaseChange.Melt.Delay", 50);
|
||||
config.addDefault("Abilities.Water.PhaseChange.Melt.Radius", 7);
|
||||
config.addDefault("Abilities.Water.PhaseChange.Melt.AllowFlow", true);
|
||||
config.addDefault("Abilities.Water.PhaseChange.Skate.Cooldown", 7000);
|
||||
/*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.PhaseChange.Skate.Speed", 0.335);*/
|
||||
|
||||
config.addDefault("Abilities.Water.PlantArmor.Enabled", true);
|
||||
config.addDefault("Abilities.Water.PlantArmor.Duration", 7500);
|
||||
|
|
|
@ -310,6 +310,13 @@ public class HeatControl extends FireAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
if (TempBlock.isTempBlock(block)) {
|
||||
TempBlock tb = TempBlock.get(block);
|
||||
if (PhaseChange.getFrozenBlocksAsTempBlock().contains(tb)) {
|
||||
PhaseChange.thaw(tb);
|
||||
}
|
||||
}
|
||||
|
||||
WaterSpoutWave.thaw(block);
|
||||
WaterCombo.thaw(block);
|
||||
|
||||
|
@ -317,8 +324,6 @@ public class HeatControl extends FireAbility {
|
|||
if (block.getType() == Material.SNOW) {
|
||||
block.setType(Material.AIR);
|
||||
return;
|
||||
} else if (PhaseChange.getFrozenBlocksAsBlock().contains(block)) {
|
||||
PhaseChange.thaw(block);
|
||||
} else {
|
||||
TempBlock tb = new TempBlock(block, Material.WATER, (byte)0);
|
||||
MELTED_BLOCKS.put(block, tb);
|
||||
|
|
|
@ -5,13 +5,14 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.IceAbility;
|
||||
|
@ -164,7 +165,7 @@ public class PhaseChange extends IceAbility {
|
|||
freezeCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Freeze.Cooldown");
|
||||
freezeRadius = night*getConfig().getInt("Abilities.Water.PhaseChange.Freeze.Radius");
|
||||
|
||||
freezeArea(player.getTargetBlock((Set<Material>)null, sourceRange).getLocation());
|
||||
freezeArea(GeneralMethods.getTargetedLocation(player, sourceRange));
|
||||
} else if (type == PhaseChangeType.MELT) {
|
||||
meltRadius = 1;
|
||||
meltCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Melt.Cooldown");
|
||||
|
@ -208,6 +209,59 @@ public class PhaseChange extends IceAbility {
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList<BlockFace> getBlockFacesTowardsPlayer(Location center) {
|
||||
ArrayList<BlockFace> faces = new ArrayList<>();
|
||||
Vector toPlayer = GeneralMethods.getDirection(center, player.getEyeLocation());
|
||||
double[] vars = {toPlayer.getX(), toPlayer.getY(), toPlayer.getZ()};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (vars[i] != 0) {
|
||||
faces.add(getBlockFaceFromValue(i, vars[i]));
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return faces;
|
||||
}
|
||||
|
||||
private BlockFace getBlockFaceFromValue(int xyz, double value) {
|
||||
switch (xyz) {
|
||||
case 0:
|
||||
if (value > 0) {
|
||||
return BlockFace.EAST;
|
||||
} else if (value < 0) {
|
||||
return BlockFace.WEST;
|
||||
}
|
||||
case 1:
|
||||
if (value > 0) {
|
||||
return BlockFace.UP;
|
||||
} else if (value < 0) {
|
||||
return BlockFace.DOWN;
|
||||
}
|
||||
case 2:
|
||||
if (value > 0) {
|
||||
return BlockFace.SOUTH;
|
||||
} else if (value < 0) {
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Block> getBlocksToFreeze(Location center, int radius) {
|
||||
ArrayList<Block> blocks = new ArrayList<>();
|
||||
for (Location l : GeneralMethods.getCircle(center, radius, depth, false, true, 0)) {
|
||||
Block b = l.getBlock();
|
||||
loop: for (int i = 1; i <= depth; i++) {
|
||||
for (BlockFace face : getBlockFacesTowardsPlayer(center)) {
|
||||
if (b.getRelative(face, i).getType() == Material.AIR) {
|
||||
blocks.add(b);
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
public void freezeArea(Location center, int radius, PhaseChangeType type) {
|
||||
if (type == PhaseChangeType.FREEZE) {
|
||||
if (bPlayer.isOnCooldown("PhaseChangeFreeze")) {
|
||||
|
@ -219,8 +273,9 @@ public class PhaseChange extends IceAbility {
|
|||
center.subtract(0, depth-1, 0);
|
||||
}
|
||||
|
||||
for (Location l : GeneralMethods.getCircle(center, radius, depth, false, false, 0)) {
|
||||
freeze(l.getBlock());
|
||||
ArrayList<Block> toFreeze = getBlocksToFreeze(center, radius);
|
||||
for (Block b : toFreeze) {
|
||||
freeze(b);
|
||||
}
|
||||
|
||||
if (!blocks.isEmpty()) {
|
||||
|
@ -265,13 +320,12 @@ public class PhaseChange extends IceAbility {
|
|||
tb = TempBlock.get(b);
|
||||
if (melted_blocks.contains(tb.getBlock())) {
|
||||
melted_blocks.remove(tb.getBlock());
|
||||
tb.revertBlock();
|
||||
tb.setType(Material.ICE);
|
||||
}
|
||||
tb.revertBlock();
|
||||
}
|
||||
if (tb == null) {
|
||||
tb = new TempBlock(b, Material.ICE, (byte)0);
|
||||
} else {
|
||||
tb.setType(Material.ICE);
|
||||
}
|
||||
blocks.add(tb);
|
||||
PLAYER_BY_BLOCK.put(tb, player);
|
||||
|
@ -284,7 +338,7 @@ public class PhaseChange extends IceAbility {
|
|||
|
||||
List<Block> ice = new ArrayList<Block>();
|
||||
for (Location l : GeneralMethods.getCircle(center, radius, 3, true, true, 0)) {
|
||||
if (isIce(l.getBlock())) {
|
||||
if (isIce(l.getBlock()) || isSnow(l.getBlock())) {
|
||||
ice.add(l.getBlock());
|
||||
}
|
||||
}
|
||||
|
@ -304,30 +358,44 @@ public class PhaseChange extends IceAbility {
|
|||
meltArea(center, meltRadius);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void melt(Block b) {
|
||||
if (b.getWorld() != player.getWorld()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (b.getLocation().distanceSquared(player.getLocation()) > controlRadius*controlRadius) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(player, b.getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SurgeWall.getWallBlocks().containsKey(b)) {
|
||||
return;
|
||||
}
|
||||
if (SurgeWave.isBlockWave(b)) {
|
||||
return;
|
||||
}
|
||||
if (!SurgeWave.canThaw(b)) {
|
||||
SurgeWave.thaw(b);
|
||||
return;
|
||||
}
|
||||
if (!Torrent.canThaw(b)) {
|
||||
Torrent.thaw(b);
|
||||
return;
|
||||
}
|
||||
if (WaterArmsSpear.canThaw(b)) {
|
||||
WaterArmsSpear.thaw(b);
|
||||
return;
|
||||
}
|
||||
if (TempBlock.isTempBlock(b)) {
|
||||
TempBlock tb = TempBlock.get(b);
|
||||
|
||||
if (!isIce(tb.getBlock())) {
|
||||
if (!isIce(tb.getBlock()) && !isSnow(tb.getBlock())) {
|
||||
return;
|
||||
}
|
||||
|
||||
tb.revertBlock();
|
||||
if (blocks.contains(tb)) {
|
||||
blocks.remove(tb);
|
||||
PLAYER_BY_BLOCK.remove(tb);
|
||||
if (PLAYER_BY_BLOCK.containsKey(tb)) {
|
||||
thaw(tb);
|
||||
}
|
||||
} else if (isWater(b)) {
|
||||
//Figure out what to do here also
|
||||
|
@ -335,6 +403,12 @@ public class PhaseChange extends IceAbility {
|
|||
Material m = allowMeltFlow ? Material.WATER : Material.STATIONARY_WATER;
|
||||
b.setType(m);
|
||||
melted_blocks.add(b);
|
||||
} else if (isSnow(b)) {
|
||||
byte data = b.getData();
|
||||
Material m = allowMeltFlow ? Material.WATER : Material.STATIONARY_WATER;
|
||||
b.setType(m);
|
||||
b.setData(data);
|
||||
melted_blocks.add(b);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -356,9 +430,9 @@ public class PhaseChange extends IceAbility {
|
|||
}
|
||||
|
||||
/**
|
||||
* Only works if the block is a {#link TempBlock} and PhaseChange frozen!
|
||||
* Only works if the block is a {@link TempBlock} and PhaseChange frozen!
|
||||
* @param b Block being thawed
|
||||
* @return false if not a {#link TempBlock}
|
||||
* @return false if not a {@link TempBlock}
|
||||
*/
|
||||
public static boolean thaw(Block b) {
|
||||
if (!TempBlock.isTempBlock(b)) {
|
||||
|
|
Loading…
Reference in a new issue