Prevent snowman smash from affecting self, and give 3 snowmen

This commit is contained in:
xGamingDudex 2016-10-22 21:28:11 +02:00
parent 295f1f255f
commit 2d0d78e1b7
2 changed files with 37 additions and 4 deletions

View File

@ -403,7 +403,12 @@ public abstract class SuperSmash extends Game
private void giveSmashItem(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash"));
int amount = 1;
if(GetKit(player) instanceof KitSnowman)
{
amount = 3;
}
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, amount, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash"));
Manager.GetGame().Announce(C.Bold + player.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
}

View File

@ -16,6 +16,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
@ -25,10 +27,12 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
@ -53,7 +57,10 @@ public class SmashSnowman extends SmashUltimate
@Override
public void activate(Player player)
{
super.activate(player);
// super.activate(player);
player.sendMessage(F.main("Game", "Activated " + F.skill(GetName()) + "."));
Game game = Manager.GetGame();
@ -75,8 +82,12 @@ public class SmashSnowman extends SmashUltimate
@Override
public void cancel(Player player)
{
super.cancel(player);
// super.cancel(player);
player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + "."));
/*
Iterator<Snowman> iterator = _turret.keySet().iterator();
while (iterator.hasNext())
@ -91,6 +102,7 @@ public class SmashSnowman extends SmashUltimate
return;
}
}
*/
}
@EventHandler
@ -106,6 +118,21 @@ public class SmashSnowman extends SmashUltimate
while (turretIter.hasNext())
{
Snowman snowman = turretIter.next();
if(snowman.getTicksLived() >= (DURATION/50.0))
{
UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
snowman.remove();
turretIter.remove();
continue;
}
else
{
double amount = 1 - snowman.getTicksLived() / (DURATION/50.0);
snowman.setCustomName(UtilText.getProgress(C.cGreen, amount, C.cRed, false));
snowman.setCustomNameVisible(true);
}
Player player = _turret.get(snowman);
Player target = UtilPlayer.getClosest(snowman.getLocation(), TeamSuperSmash.getTeam(Manager, player, true));
@ -168,7 +195,7 @@ public class SmashSnowman extends SmashUltimate
event.SetCancelled("Turret");
if(TeamSuperSmash.getTeam(Manager, damager, false).contains(damagee))
if(TeamSuperSmash.getTeam(Manager, damager, true).contains(damagee))
{
return;
}
@ -214,4 +241,5 @@ public class SmashSnowman extends SmashUltimate
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}