mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-12 01:48:31 +00:00
HealingWaters
Waterbending finished ^^
This commit is contained in:
parent
c1e71c8723
commit
87032ad4f7
4 changed files with 118 additions and 2 deletions
src
com/projectkorra/ProjectKorra
config.yml
|
@ -38,6 +38,7 @@ import com.projectkorra.ProjectKorra.firebending.Fireball;
|
|||
import com.projectkorra.ProjectKorra.firebending.Illumination;
|
||||
import com.projectkorra.ProjectKorra.waterbending.Bloodbending;
|
||||
import com.projectkorra.ProjectKorra.waterbending.FreezeMelt;
|
||||
import com.projectkorra.ProjectKorra.waterbending.HealingWaters;
|
||||
import com.projectkorra.ProjectKorra.waterbending.IceSpike;
|
||||
import com.projectkorra.ProjectKorra.waterbending.IceSpike2;
|
||||
import com.projectkorra.ProjectKorra.waterbending.OctopusForm;
|
||||
|
@ -103,6 +104,7 @@ public class BendingManager implements Runnable {
|
|||
FireBlast.progressAll();
|
||||
AirSuction.progressAll();
|
||||
Fireball.progressAll();
|
||||
HealingWaters.heal(Bukkit.getServer());
|
||||
for (int ID: AirSwipe.instances.keySet()) {
|
||||
AirSwipe.progress(ID);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Air.AirSwipe.Push", 1);
|
||||
config.addDefault("Abilities.Air.AirSwipe.Arc", 20);
|
||||
config.addDefault("Abilities.Air.AirSwipe.Speed", 25);
|
||||
|
||||
|
||||
config.addDefault("Abilities.Air.Tornado.Radius", 10);
|
||||
config.addDefault("Abilities.Air.Tornado.Height", 25);
|
||||
config.addDefault("Abilities.Air.Tornado.Range", 25);
|
||||
|
@ -155,6 +155,16 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Water.Bloodbending.ThrowFactor", 2);
|
||||
config.addDefault("Abilities.Water.Bloodbending.Range", 10);
|
||||
|
||||
config.addDefault("Abilities.Water.HealingWaters.Enabled", true);
|
||||
config.addDefault("Abilities.Water.HealingWaters.Description", "To use, the bender must be at least partially submerged in water. "
|
||||
+ "If the user is not sneaking, this ability will automatically begin "
|
||||
+ "working provided the user has it selected. If the user is sneaking, "
|
||||
+ "he/she is channeling the healing to their target in front of them. "
|
||||
+ "In order for this channel to be successful, the user and the target must "
|
||||
+ "be at least partially submerged in water.");
|
||||
config.addDefault("Abilities.Water.HealingWaters.Radius", 5);
|
||||
config.addDefault("Abilities.Water.HealingWaters.Interval", 750);
|
||||
|
||||
config.addDefault("Abilities.Water.IceSpike.Enabled", true);
|
||||
config.addDefault("Abilities.Water.IceSpike.Description", "This ability has many functions. Clicking while targetting ice, or an entity over some ice, "
|
||||
+ "will raise a spike of ice up, damaging and slowing the target. Tapping sneak (shift) while"
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package com.projectkorra.ProjectKorra.waterbending;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.projectkorra.ProjectKorra.Methods;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
import com.projectkorra.ProjectKorra.TempBlock;
|
||||
|
||||
public class HealingWaters {
|
||||
|
||||
private static final double range = ProjectKorra.plugin.getConfig().getDouble("Abilities.Water.HealingWaters.Radius");
|
||||
private static final long interval = ProjectKorra.plugin.getConfig().getLong("Abilities.Water.HealingWaters.Interval");
|
||||
|
||||
private static long time = 0;
|
||||
|
||||
public static void heal(Server server) {
|
||||
if (System.currentTimeMillis() - time >= interval) {
|
||||
time = System.currentTimeMillis();
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
if (Methods.getBoundAbility(player) != null) {
|
||||
if (Methods.getBoundAbility(player).equalsIgnoreCase("HealingWaters") && Methods.canBend(player.getName(),"HealingWaters")) {
|
||||
heal(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void heal(Player player) {
|
||||
if (inWater(player)) {
|
||||
if (player.isSneaking()) {
|
||||
Entity entity = Methods.getTargetedEntity(player, range, new ArrayList<Entity>());
|
||||
if (entity instanceof LivingEntity && inWater(entity)) {
|
||||
giveHPToEntity((LivingEntity) entity);
|
||||
}
|
||||
} else {
|
||||
giveHP(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void giveHPToEntity(LivingEntity le) {
|
||||
if (!le.isDead() && le.getHealth() < le.getMaxHealth()) {
|
||||
applyHealingToEntity(le);
|
||||
}
|
||||
}
|
||||
|
||||
private static void giveHP(Player player) {
|
||||
if (!player.isDead() && player.getHealth() < 20) {
|
||||
// int hp = player.getHealth();
|
||||
// if (hp < 20) {
|
||||
// hp++;
|
||||
// }
|
||||
// player.setHealth(hp);
|
||||
applyHealing(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static boolean inWater(Entity entity) {
|
||||
Block block = entity.getLocation().getBlock();
|
||||
if (Methods.isWater(block) && !TempBlock.isTempBlock(block))
|
||||
return true;
|
||||
// if (entity.getLocation().getBlock().getType() == Material.WATER
|
||||
// || entity.getLocation().getBlock().getType() ==
|
||||
// Material.STATIONARY_WATER) &&
|
||||
// return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void applyHealing(Player player) {
|
||||
// if (!Methods.isRegionProtectedFromBuild(player, Abilities.HealingWaters,
|
||||
// player.getLocation()))
|
||||
player.addPotionEffect(new PotionEffect(
|
||||
PotionEffectType.REGENERATION, 70, 1));
|
||||
}
|
||||
|
||||
private static void applyHealingToEntity(LivingEntity le) {
|
||||
le.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 70, 1));
|
||||
}
|
||||
|
||||
public static String getDescription() {
|
||||
return "To use, the bender must be at least partially submerged in water. "
|
||||
+ "If the user is not sneaking, this ability will automatically begin "
|
||||
+ "working provided the user has it selected. If the user is sneaking, "
|
||||
+ "he/she is channeling the healing to their target in front of them. "
|
||||
+ "In order for this channel to be successful, the user and the target must "
|
||||
+ "be at least partially submerged in water.";
|
||||
}
|
||||
}
|
|
@ -99,9 +99,14 @@ Abilities:
|
|||
SwimSpeedFactor: 0.7
|
||||
Bloodbending:
|
||||
Enabled: true
|
||||
Description: "This ability was made illegal for a reason. With this ability selected, sneak while targeting something and you will bloodbend that target. Bloodbent targets cannot move, bend, or attack. You are free to control their actions by looking elsewhere - they will be forced to move in that direciton. Additionally, clicking while bloodbending will launch that target off in the direction you're looking. People who are capable of bloodbending are immune to technique, and you are immune to theirs."
|
||||
Description: "This ability was made illegal for a reason. With this ability selected, sneak while targeting something and you will bloodbend that target. Bloodbent targets cannot move, bend, or attack. You are free to control their actions by looking elsewhere - they will be forced to move in that direction. Additionally, clicking while bloodbending will launch that target off in the direction you're looking. People who are capable of bloodbending are immune to technique, and you are immune to theirs."
|
||||
ThrowFactor: 2
|
||||
Range: 10
|
||||
HealingWaters:
|
||||
Enabled: true
|
||||
Description: "To use, the bender must be at least partially submerged in water. If the user is not sneaking, this ability will automatically begin working provided the user has it selected. If the user is sneaking, he/she is channeling the healing to their target in front of them. In order for this channel to be successful, the user and the target must be at least partially submerged in water."
|
||||
Radius: 5
|
||||
Interval: 750
|
||||
IceSpike:
|
||||
Enabled: true
|
||||
Description: "This ability has many functions. Clicking while targetting ice, or an entity over some ice, will raise a spike of ice up, damaging and slowing the target. Tapping sneak (default: shift) while selecting a water source will select that source that can be fired with a click. Firing this will launch a spike of ice at your target, dealing a bit of damage and slowing the target. If you sneak (shift) will not selecting a source, many ice spikes will erupt from around you, damaging and slowing those targets."
|
||||
|
|
Loading…
Reference in a new issue