diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 23d876bfb..43338451f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -853,6 +853,12 @@ public enum Achievement new int[]{50}, AchievementCategory.BACON_BRAWL), + BACON_BRAWL_KILLS_IN_GAME("Pigs In Blankets", 800, + new String[]{"Bacon Brawl.KillsInGame"}, + new String[]{"Kill 6 players in one game."}, + new int[]{1}, + AchievementCategory.BACON_BRAWL), + //Sneaky Assassins SNEAKY_ASSASSINS_WINS("So So Sneaky", 600, new String[]{"Sneaky Assassins.Wins"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 11754062c..fb261b841 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -200,9 +200,17 @@ public enum AchievementCategory new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()), - BACON_BRAWL("Bacon Brawl", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.PORK, 0, GameCategory.ARCADE, null, false, GameDisplay.BaconBrawl.getGameId()), + BACON_BRAWL( + "Bacon Brawl", + null, + new StatDisplay[] + { + StatDisplay.WINS, + StatDisplay.GAMES_PLAYED, + StatDisplay.KILLS, + StatDisplay.DEATHS, + StatDisplay.GEMS_EARNED + }, Material.PORK, 0, GameCategory.ARCADE, "Chris P Bacon", false, GameDisplay.BaconBrawl.getGameId()), MICRO_BATTLE("Micro Battle", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java b/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java index e14e3fbc5..edac7d52e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java @@ -174,6 +174,34 @@ public enum GameKit } }, + BACON_BRAWL_CHRIS_P_BACON + ( + 3, + GameDisplay.BaconBrawl, + "Chris P Bacon", + null, + new String[] + { + "Guess he burnt the bacon", + C.blankLine, + click(false, "Axe to launch " + C.cGreen + "Crispy Bacon"), + "Players on fire take " + C.cGreen + "+30%" + C.cGray + "knockback." + }, + new KitEntityData<> + ( + Pig.class, + new ItemStack(Material.GRILLED_PORK) + ), + getAchievementsFor(AchievementCategory.BACON_BRAWL) + ) + { + @Override + protected void onEntitySpawn(LivingEntity entity) + { + entity.setFireTicks(Integer.MAX_VALUE); + } + }, + // Barbarians BARBARIANS_BRUTE diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index 906ccdcd5..51b8d3cb7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -4,9 +4,9 @@ import java.util.concurrent.TimeUnit; import org.bukkit.GameMode; import org.bukkit.Sound; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.C; @@ -21,11 +21,13 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.baconbrawl.kits.KitChrisPBacon; import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.stats.KillsWithinGameStatTracker; public class BaconBrawl extends SoloGame { @@ -46,7 +48,8 @@ public class BaconBrawl extends SoloGame { new KitPig(manager), new KitMamaPig(manager), - new KitSheepPig(manager) + new KitSheepPig(manager), + new KitChrisPBacon(manager) }, DESCRIPTION); DamageTeamSelf = true; @@ -64,6 +67,10 @@ public class BaconBrawl extends SoloGame DamageTaken ); + registerStatTrackers( + new KillsWithinGameStatTracker(this, 6, "KillsInGame") + ); + new CompassModule() .register(this); } @@ -124,21 +131,23 @@ public class BaconBrawl extends SoloGame } } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void knockback(CustomDamageEvent event) { - if (!IsLive()) + if (!IsLive() || event.GetDamageePlayer() == null) { return; } DamageCause cause = event.GetCause(); - if (cause == DamageCause.ENTITY_ATTACK || cause == DamageCause.CUSTOM || cause == DamageCause.PROJECTILE) + if (cause == DamageCause.FIRE_TICK) { - LivingEntity entity = event.GetDamageeEntity(); - - entity.setHealth(entity.getMaxHealth()); + event.SetCancelled("Fire Damage"); + } + else if (cause == DamageCause.ENTITY_ATTACK || cause == DamageCause.CUSTOM || cause == DamageCause.PROJECTILE) + { + UtilPlayer.health(event.GetDamageePlayer(), event.GetDamage()); event.AddKnockback("Pig Wrestle", _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitChrisPBacon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitChrisPBacon.java new file mode 100644 index 000000000..3dfa305cf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitChrisPBacon.java @@ -0,0 +1,39 @@ +package nautilus.game.arcade.game.games.baconbrawl.kits; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguisePig; +import mineplex.core.game.kit.GameKit; +import mineplex.core.itemstack.ItemStackFactory; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.baconbrawl.kits.perks.PerkCrispyBacon; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; + +public class KitChrisPBacon extends Kit +{ + + private static final Perk[] PERKS = + { + new PerkCrispyBacon() + }; + + public KitChrisPBacon(ArcadeManager manager) + { + super(manager, GameKit.BACON_BRAWL_CHRIS_P_BACON, PERKS); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + DisguisePig disguise = new DisguisePig(player); + disguise.setName(C.cYellow + player.getName()); + disguise.setCustomNameVisible(false); + Manager.GetDisguise().disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java new file mode 100644 index 000000000..419073a1c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java @@ -0,0 +1,84 @@ +package nautilus.game.arcade.game.games.baconbrawl.kits.perks; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.kit.Perk; + +public class PerkCrispyBacon extends Perk +{ + + private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(5); + + public PerkCrispyBacon() + { + super("Crispy Bacon"); + } + + @EventHandler + public void playerInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (!UtilItem.isAxe(itemStack) || !Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + Location location = player.getLocation().add(0, 1.5, 0); + location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.2F); + UtilParticle.PlayParticleToAll(ParticleType.LAVA, location, 0.5F, 0.5F, 0.5F, 0, 4, ViewDist.NORMAL); + + for (int i = 0; i < 3; i++) + { + Item item = player.getWorld().dropItem(location, new ItemBuilder(Material.GRILLED_PORK) + .setTitle(String.valueOf(UtilMath.r(1000))) + .build()); + item.setVelocity(new Vector((Math.random() - 0.5) * 0.3, 0.4, (Math.random() - 0.5) * 0.3)); + Manager.GetFire().Add(item, player, 10, 1, 5, 2, GetName(), false); + } + } + + @EventHandler + public void knockbackIncrease(CustomDamageEvent event) + { + Player damgee = event.GetDamageePlayer(); + Player damager = event.GetDamagerPlayer(true); + + if (damgee == null || damager == null) + { + return; + } + + if (hasPerk(damager) && damgee.getFireTicks() > 0) + { + event.AddKnockback(GetName(), 1.3); + } + } +}