diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 3cfbb5831..2ded2cc65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -25,6 +25,7 @@ import nautilus.game.arcade.game.games.build.modes.TeamBuild; import nautilus.game.arcade.game.games.buildmavericks.BuildMavericks; import nautilus.game.arcade.game.games.cakewars.CakeWars; import nautilus.game.arcade.game.games.cakewars.modes.CakeWarsDuos; +import nautilus.game.arcade.game.games.cakewars.modes.CakeWarsSugarRush; import nautilus.game.arcade.game.games.cards.Cards; import nautilus.game.arcade.game.games.castleassault.CastleAssault; import nautilus.game.arcade.game.games.castleassault.CastleAssaultTDM; @@ -251,6 +252,7 @@ public enum GameType CakeWars4(CakeWars.class, GameDisplay.CakeWars4), CakeWarsDuos(CakeWarsDuos.class, GameDisplay.CakeWarsDuos), + CakeWarsOP(CakeWarsSugarRush.class, GameDisplay.CakeWars4), Event(EventGame.class, GameDisplay.Event, new GameType[]{ GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java index e358d3a08..7702c1982 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java @@ -16,6 +16,9 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; 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.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -33,11 +36,23 @@ public class CakeSpawnerModule extends CakeModule private static final int MIN_BLOCK_PLACE_DIST_SQUARED = 4; + private int _base, _multiplier; + public CakeSpawnerModule(CakeWars game) { super(game); } + public void setBase(int base) + { + _base = base; + } + + public void setMultiplier(int multiplier) + { + _multiplier = multiplier; + } + @EventHandler public void blockPlace(BlockPlaceEvent event) { @@ -89,6 +104,8 @@ public class CakeSpawnerModule extends CakeModule { String[] text = new String[resources.length]; int resourceGenerator = cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE); + resourceGenerator += _base; + resourceGenerator *= _multiplier; for (int i = 0; i < resources.length; i++) { @@ -142,7 +159,9 @@ public class CakeSpawnerModule extends CakeModule CakeTeam cakeTeam = _game.getCakeTeamModule().getCakeTeam(team); + amount += _base; amount += cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE); + amount *= _multiplier; ItemStack itemStack = resource.getItemStack().clone(); itemStack.setAmount(amount); @@ -151,6 +170,11 @@ public class CakeSpawnerModule extends CakeModule List players = new ArrayList<>(); Item item = null; + if (_multiplier > 0) + { + UtilParticle.PlayParticleToAll(ParticleType.LAVA, location.clone().add(0, 1, 0), 0.3F, 0.3F, 0.3F, 0, 1, ViewDist.NORMAL); + } + for (Entity entity : location.getWorld().getNearbyEntities(location, 2, 2, 2)) { if (entity instanceof Item) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/modes/CakeWarsSugarRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/modes/CakeWarsSugarRush.java new file mode 100644 index 000000000..21c9e8274 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/modes/CakeWarsSugarRush.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.game.games.cakewars.modes; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.cakewars.CakeWars; + +public class CakeWarsSugarRush extends CakeWars +{ + + private static final PotionEffect SPEED = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0, false, false); + + public CakeWarsSugarRush(ArcadeManager manager) + { + super(manager, GameType.CakeWarsOP); + + getCakeSpawnerModule().setBase(1); + getCakeSpawnerModule().setMultiplier(2); + } + + @EventHandler + public void prepare(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + Manager.runSyncLater(() -> + { + GetTeamList().forEach(team -> + { + String title = team.GetColor() + C.Bold + "Cake " + C.cWhiteB + "Wars", subtitle = team.GetColor() + "★ Sugar Rush ★"; + + team.GetPlayers(false).forEach(player -> + { + UtilTextMiddle.display(title, subtitle, 10, 60, 10, player); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0.8F); + }); + }); + }, 60); + } + + @EventHandler + public void updateSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || !InProgress()) + { + return; + } + + for (Player player : GetPlayers(true)) + { + if (!player.hasPotionEffect(PotionEffectType.SPEED)) + { + player.addPotionEffect(SPEED); + } + } + } + + @Override + public String GetMode() + { + return "Sugar Rush"; + } +}