Bug fixes, AvatarState config options (#689)

* Fixes EarthSmash and LavaFlow not working

EarthSmash and LavaFlow wasn’t being activated when the player sneaked,
it’s now fixed.

* Fix WaterArms not working

Cod wasn’t being called because of a misplaced bracket

* Adds some more AvatarState config options
This commit is contained in:
Loony 2017-01-08 00:48:11 +00:00 committed by Christopher Martin
parent 6885e0b4ba
commit 3aa804d44f
15 changed files with 109 additions and 44 deletions

View file

@ -15,8 +15,10 @@
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;ProjectKorra&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/ProjectKorra/test/server/spigot-1.8.8.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.bukkit.craftbukkit.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ProjectKorra"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:ProjectKorra}/test/server/"/>
</launchConfiguration>

View file

@ -1361,6 +1361,10 @@ public class PKListener implements Listener {
bPlayer.toggleTremorSense();
} else if (abil.equalsIgnoreCase("Extraction")) {
new Extraction(player);
} else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
} else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.SHIFT_DOWN);
} else if (abil.equalsIgnoreCase("MetalClips")) {
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
if (clips != null) {
@ -1375,11 +1379,7 @@ public class PKListener implements Listener {
}
}
else if (abil.equalsIgnoreCase("LavaFlow")) {
new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
} else if (abil.equalsIgnoreCase("EarthSmash")) {
new EarthSmash(player, ClickType.SHIFT_DOWN);
}
}
if (coreAbil instanceof FireAbility && bPlayer.isElementToggled(Element.FIRE) == true) {
@ -1630,12 +1630,12 @@ public class PKListener implements Listener {
new AvatarState(player);
}
}
}
if (MultiAbilityManager.hasMultiAbilityBound(player)) {
abil = MultiAbilityManager.getBoundMultiAbility(player);
if (abil.equalsIgnoreCase("WaterArms")) {
new WaterArms(player);
}
}
}
}

View file

@ -27,7 +27,6 @@ import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -111,6 +110,13 @@ public class AirBlast extends AirAbility {
this.canOpenDoors = false;
this.canPressButtons = false;
this.canFlickLevers = false;
if (bPlayer.isAvatarState()) {
this.pushFactor = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Entities");
this.pushFactorForOthers = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Self");
}
start();
}
@ -195,11 +201,7 @@ public class AirBlast extends AirAbility {
double max = speed / speedFactor;
double factor = pushFactor;
if (bPlayer.isAvatarState()) {
max = AvatarState.getValue(max);
factor = AvatarState.getValue(factor);
}
Vector push = direction.clone();
if (Math.abs(push.getY()) > max && !isUser) {
if (push.getY() < 0) {

View file

@ -50,6 +50,11 @@ public class AirSpout extends AirAbility {
}
new Flight(player);
if (bPlayer.isAvatarState()) {
this.height = getConfig().getDouble("Abilities.Avatar.AvatarState.AirSpout.Height");
}
start();
bPlayer.addCooldown(this);
}

View file

@ -15,7 +15,6 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.Flight;
@ -78,6 +77,9 @@ public class AirSuction extends AirAbility {
}
bPlayer.addCooldown(this);
if (bPlayer.isAvatarState()) {
this.pushFactor = getConfig().getDouble("Abilities.Avatar.AvatarState.AirSuction.Push");
}
start();
}
@ -165,10 +167,6 @@ public class AirSuction extends AirAbility {
Vector velocity = entity.getVelocity();
double max = speed;
double factor = pushFactor;
if (bPlayer.isAvatarState()) {
max = AvatarState.getValue(max);
factor = AvatarState.getValue(factor);
}
Vector push = direction.clone();
if (Math.abs(push.getY()) > max && entity.getEntityId() != player.getEntityId()) {

View file

@ -22,7 +22,6 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.firebending.Illumination;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -98,6 +97,13 @@ public class AirSwipe extends AirAbility {
if (!charging) {
launch();
}
if (bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Air.AirSwipe.Cooldown");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage");
this.pushFactor = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirSwipe.Push");
}
start();
}
@ -201,12 +207,9 @@ public class AirSwipe extends AirAbility {
}
}
if (entities.size() < MAX_AFFECTABLE_ENTITIES) {
if (bPlayer.isAvatarState()) {
GeneralMethods.setVelocity(entity,
fDirection.multiply(AvatarState.getValue(pushFactor)));
} else {
GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor));
}
GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor));
}
if (entity instanceof LivingEntity && !affectedEntities.contains(entity)) {
if (damage != 0) {
@ -222,11 +225,9 @@ public class AirSwipe extends AirAbility {
elements.remove(fDirection);
}
} else if (entity.getEntityId() != player.getEntityId() && !(entity instanceof LivingEntity)) {
if (bPlayer.isAvatarState()) {
GeneralMethods.setVelocity(entity, fDirection.multiply(AvatarState.getValue(pushFactor)));
} else {
GeneralMethods.setVelocity(entity, fDirection.multiply(pushFactor));
}
}
}
}.runTaskLater(ProjectKorra.plugin, i / MAX_AFFECTABLE_ENTITIES);
@ -285,9 +286,7 @@ public class AirSwipe extends AirAbility {
double factor = 1;
if (System.currentTimeMillis() >= getStartTime() + maxChargeTime) {
factor = maxChargeFactor;
} else if (bPlayer.isAvatarState()) {
factor = AvatarState.getValue(factor);
} else {
} else {
factor = maxChargeFactor * (double) (System.currentTimeMillis() - getStartTime())
/ (double) maxChargeTime;
}

View file

@ -533,6 +533,13 @@ public class ConfigManager {
config.addDefault("Abilities.Avatar.AvatarState.PotionEffects.FireResistance.Enabled", true);
config.addDefault("Abilities.Avatar.AvatarState.PotionEffects.FireResistance.Power", 3);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Entities", 4.5);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Self", 4.0);
config.addDefault("Abilities.Avatar.AvatarState.AirSpout.Height", 26);
config.addDefault("Abilities.Avatar.AvatarState.AirSuction.Push", 3.5);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Cooldown", 1000);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage", 4.5);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Push", 1.0);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.ChargeTime", 1000);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.Damage", 3);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle", true);
@ -541,7 +548,9 @@ public class ConfigManager {
config.addDefault("Abilities.Avatar.AvatarState.Air.Suffocate.Damage", 3);
config.addDefault("Abilities.Avatar.AvatarState.Air.Suffocate.Range", 16);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Catapult.Length", 10);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Catapult.Push", 8);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown", 0);
config.addDefault("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftCooldown", 1500);
config.addDefault("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLavaCooldown", 1500);
config.addDefault("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLandCooldown", 1500);
@ -553,11 +562,30 @@ public class ConfigManager {
config.addDefault("Abilities.Avatar.AvatarState.Earth.MetalClips.CrushDamage", 3);
config.addDefault("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Height", 20);
config.addDefault("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Column.Width", 16);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Collapse.Column.Height", 20);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Collapse.Wall.Height", 20);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthArmor.Cooldown", 2000);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthArmor.GoldHearts", 6);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthBlast.Cooldown", 500);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthBlast.Damage", 5);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthGrab.Cooldown", 0);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthGrab.Height", 10);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Shockwave.Range", 20);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Shockwave.Cooldown", 0);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Shockwave.ChargeTime", 1500);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Shockwave.Damage", 5);
config.addDefault("Abilities.Avatar.AvatarState.Earth.Shockwave.Knockback", 2);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.SelectRange", 16);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.GrabRange", 16);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.ChargeTime", 1500);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.Cooldown", 0);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.Damage", 7);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.Knockback", 4.5);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.FlightSpeed", 1.0);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.FlightTimer", 10000);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthSmash.ShootRange", 30);
config.addDefault("Abilities.Avatar.AvatarState.Earth.EarthTunnel.Radius", 0.05);
config.addDefault("Abilities.Avatar.AvatarState.Fire.Blaze.Ring.Range", 14);
config.addDefault("Abilities.Avatar.AvatarState.Fire.FireJet.IsAvatarStateToggle", true);

View file

@ -57,6 +57,13 @@ public class Catapult extends EarthAbility {
}
moving = true;
if (bPlayer.isAvatarState()) {
this.length = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Catapult.Length");
this.push = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Catapult.Push");
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown");
}
start();
bPlayer.addCooldown(this);
}

View file

@ -46,6 +46,9 @@ public class Collapse extends EarthAbility {
this.distance = getEarthbendableBlocksLength(block, direction.clone().multiply(-1), height);
loadAffectedBlocks();
if (bPlayer.isAvatarState()) {
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Collapse.Column.Height");
}
if (distance != 0) {
start();
bPlayer.addCooldown("CollapsePillar", cooldown);

View file

@ -38,6 +38,9 @@ public class CollapseWall extends EarthAbility {
this.blocks = new ConcurrentHashMap<>();
this.baseBlocks = new ConcurrentHashMap<>();
if (bPlayer.isAvatarState()) {
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Collapse.Wall.Height");
}
Block sblock = BlockSource.getEarthSourceBlock(player, selectRange, ClickType.SHIFT_DOWN);
if (sblock == null) {
location = getTargetEarthBlock(selectRange).getLocation();

View file

@ -53,6 +53,11 @@ public class EarthArmor extends EarthAbility {
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthArmor.SelectRange");
this.maxGoldHearts = getConfig().getInt("Abilities.Earth.EarthArmor.GoldHearts");
if (bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthArmor.Cooldown");
this.maxGoldHearts = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.EarthArmor.GoldHearts");
}
headBlock = getTargetEarthBlock((int) selectRange);
if (!GeneralMethods.isRegionProtectedFromBuild(this, headBlock.getLocation())
&& getEarthbendableBlocksLength(headBlock, new Vector(0, -1, 0), 2) >= 2) {

View file

@ -60,6 +60,12 @@ public class EarthBlast extends EarthAbility {
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthBlast.SelectRange");
this.time = System.currentTimeMillis();
this.interval = (long) (1000.0 / speed);
if (bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthBlast.Cooldown");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthBlast.Damage");
}
if (prepare()) {
start();

View file

@ -52,6 +52,12 @@ public class EarthGrab extends EarthAbility {
return;
}
if (bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthGrab.Cooldown");
this.height = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthGrab.Height");
}
if (player.isSneaking()) {
start();
} else {

View file

@ -15,7 +15,6 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
@ -90,16 +89,15 @@ public class EarthSmash extends EarthAbility {
if (type == ClickType.SHIFT_DOWN || type == ClickType.SHIFT_UP && !player.isSneaking()) {
if (bPlayer.isAvatarState()) {
selectRange = AvatarState.getValue(selectRange);
grabRange = AvatarState.getValue(grabRange);
chargeTime = 0;
cooldown = 0;
damage = AvatarState.getValue(damage);
knockback = AvatarState.getValue(knockback);
knockup = AvatarState.getValue(knockup);
flightSpeed = AvatarState.getValue(flightSpeed);
flightRemoveTimer = Integer.MAX_VALUE;
shootRange = AvatarState.getValue(shootRange);
this.selectRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.SelectRange");
this.grabRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.GrabRange");
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.ChargeTime");
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.Cooldown");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Damage");
this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Knockback");
this.flightSpeed = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.FlightSpeed");
this.flightRemoveTimer = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.FlightTimer");
this.shootRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.ShootRange");
}
EarthSmash flySmash = flyingInSmashCheck(player);

View file

@ -60,6 +60,9 @@ public class EarthTunnel extends EarthAbility {
if (!bPlayer.canBend(this)) {
return;
}
if (bPlayer.isAvatarState()) {
this.radius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthTunnel.Radius");
}
start();
}