diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 5a67a956f..7c7fbfbd8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -19,15 +20,18 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -53,6 +57,8 @@ public class Halloween extends SoloGame private int _maxMobs = 80; private ArrayList _mobs = new ArrayList(); + private HashMap _damageTime = new HashMap(); + private HashSet _soundOff = new HashSet(); public long total = 0; @@ -110,7 +116,7 @@ public class Halloween extends SoloGame this.PrepareFreeze = false; - this.HungerSet = 20; + //this.HungerSet = 20; this.WorldBoundaryKill = false; } @@ -558,4 +564,82 @@ public class Halloween extends SoloGame ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); } } + + private int hungerTick = 0; + @EventHandler + public void Hunger(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + if (_mobs.size() < 30) + { + for (Player player : GetPlayers(true)) + UtilPlayer.hunger(player, 1); + return; + } + + int rate = 4; + if (_mobs.size() > 60) + rate = 3; + if (_mobs.size() > 70) + rate = 2; + if (_mobs.size() >= 80) + rate = 1; + + hungerTick = (hungerTick + 1)%rate; + + for (Player player : GetPlayers(true)) + { + if (_damageTime.containsKey(player)) + { + if (!UtilTime.elapsed(_damageTime.get(player), 2000)) + continue; + } + + player.setSaturation(3f); + player.setExhaustion(0f); + + if (player.getFoodLevel() <= 2) + { + if (Recharge.Instance.use(player, "Food Message", 4000, false, false)) + UtilPlayer.message(player, F.main("Game", "Attack monsters players to restore hunger!")); + } + + if (hungerTick == 0) + { + if (player.getFoodLevel() > 2) + { + UtilPlayer.hunger(player, -1); + } + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void HungerRestore(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetDamagerPlayer(true) == null) + return; + + if (event.GetDamage() <= 1) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + return; + + if (!Recharge.Instance.use(damager, "Hunger Restore", 100, false, false)) + return; + + _damageTime.put(damager, System.currentTimeMillis()); + + UtilPlayer.hunger(damager, 4); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobGhast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobGhast.java index a2adf2c42..25b74f7fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobGhast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobGhast.java @@ -21,8 +21,8 @@ public class MobGhast extends CreatureBase @Override public void SpawnCustom(Ghast ent) { - ent.setMaxHealth(80); - ent.setHealth(80); + ent.setMaxHealth(55); + ent.setHealth(55); ent.setCustomName("Ghast"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java index 3d08eff13..e3baf43d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java @@ -66,6 +66,12 @@ public class PerkFlameSlam extends Perk if (!Kit.HasKit(player)) return; + if (!UtilEnt.isGrounded(player)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne.")); + return; + } + if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) return;