Apply smoother knockback on volley pig

This commit is contained in:
Thanos Paravantis 2016-06-28 18:41:50 +03:00
parent c5367d4510
commit eea980b354

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.games.mineware.challenge.type;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.Color;
import org.bukkit.Location;
@ -18,10 +17,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
@ -181,7 +177,7 @@ public class ChallengeVolleyPig extends TeamChallenge
if (event.GetCause() == DamageCause.FALL)
return;
event.AddMult("No Damage", null, 0.001, false);
event.AddMult("Push", null, 0.001, false);
_pig.setHealth(_pig.getMaxHealth());
}
@ -250,11 +246,16 @@ public class ChallengeVolleyPig extends TeamChallenge
private void knockback(Player player)
{
ArrayList<Location> center = new ArrayList<Location>(Arrays.asList(getTeamCenter(player)));
Vector bump = UtilAlg.getAverageBump(player.getLocation(), center);
UtilAction.velocity(player, bump, 0.8, false, 0, 0.4, 10, true);
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
UtilAction.velocity(
player,
UtilAlg.getTrajectory2d(player.getLocation(), getTeamCenter(player)),
-UtilAlg.calculateVelocity(player.getLocation().toVector(), getTeamCenter(player).toVector(), 0).length() + 0.2,
false,
0,
0,
0,
false
);
if (Recharge.Instance.use(player, "Knockback Message", 1000, false, false))
{