Implement an OP version of cake wars just for fun
This commit is contained in:
parent
52ffd1cbf0
commit
cad557d1a2
@ -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.buildmavericks.BuildMavericks;
|
||||||
import nautilus.game.arcade.game.games.cakewars.CakeWars;
|
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.CakeWarsDuos;
|
||||||
|
import nautilus.game.arcade.game.games.cakewars.modes.CakeWarsSugarRush;
|
||||||
import nautilus.game.arcade.game.games.cards.Cards;
|
import nautilus.game.arcade.game.games.cards.Cards;
|
||||||
import nautilus.game.arcade.game.games.castleassault.CastleAssault;
|
import nautilus.game.arcade.game.games.castleassault.CastleAssault;
|
||||||
import nautilus.game.arcade.game.games.castleassault.CastleAssaultTDM;
|
import nautilus.game.arcade.game.games.castleassault.CastleAssaultTDM;
|
||||||
@ -251,6 +252,7 @@ public enum GameType
|
|||||||
|
|
||||||
CakeWars4(CakeWars.class, GameDisplay.CakeWars4),
|
CakeWars4(CakeWars.class, GameDisplay.CakeWars4),
|
||||||
CakeWarsDuos(CakeWarsDuos.class, GameDisplay.CakeWarsDuos),
|
CakeWarsDuos(CakeWarsDuos.class, GameDisplay.CakeWarsDuos),
|
||||||
|
CakeWarsOP(CakeWarsSugarRush.class, GameDisplay.CakeWars4),
|
||||||
|
|
||||||
Event(EventGame.class, GameDisplay.Event, new GameType[]{
|
Event(EventGame.class, GameDisplay.Event, new GameType[]{
|
||||||
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
|
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
|
||||||
|
@ -16,6 +16,9 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilMath;
|
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.common.util.UtilPlayer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
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 static final int MIN_BLOCK_PLACE_DIST_SQUARED = 4;
|
||||||
|
|
||||||
|
private int _base, _multiplier;
|
||||||
|
|
||||||
public CakeSpawnerModule(CakeWars game)
|
public CakeSpawnerModule(CakeWars game)
|
||||||
{
|
{
|
||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBase(int base)
|
||||||
|
{
|
||||||
|
_base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplier(int multiplier)
|
||||||
|
{
|
||||||
|
_multiplier = multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void blockPlace(BlockPlaceEvent event)
|
public void blockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
@ -89,6 +104,8 @@ public class CakeSpawnerModule extends CakeModule
|
|||||||
{
|
{
|
||||||
String[] text = new String[resources.length];
|
String[] text = new String[resources.length];
|
||||||
int resourceGenerator = cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE);
|
int resourceGenerator = cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE);
|
||||||
|
resourceGenerator += _base;
|
||||||
|
resourceGenerator *= _multiplier;
|
||||||
|
|
||||||
for (int i = 0; i < resources.length; i++)
|
for (int i = 0; i < resources.length; i++)
|
||||||
{
|
{
|
||||||
@ -142,7 +159,9 @@ public class CakeSpawnerModule extends CakeModule
|
|||||||
|
|
||||||
CakeTeam cakeTeam = _game.getCakeTeamModule().getCakeTeam(team);
|
CakeTeam cakeTeam = _game.getCakeTeamModule().getCakeTeam(team);
|
||||||
|
|
||||||
|
amount += _base;
|
||||||
amount += cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE);
|
amount += cakeTeam.getUpgrades().get(CakeTeamItem.RESOURCE);
|
||||||
|
amount *= _multiplier;
|
||||||
|
|
||||||
ItemStack itemStack = resource.getItemStack().clone();
|
ItemStack itemStack = resource.getItemStack().clone();
|
||||||
itemStack.setAmount(amount);
|
itemStack.setAmount(amount);
|
||||||
@ -151,6 +170,11 @@ public class CakeSpawnerModule extends CakeModule
|
|||||||
List<Player> players = new ArrayList<>();
|
List<Player> players = new ArrayList<>();
|
||||||
Item item = null;
|
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))
|
for (Entity entity : location.getWorld().getNearbyEntities(location, 2, 2, 2))
|
||||||
{
|
{
|
||||||
if (entity instanceof Item)
|
if (entity instanceof Item)
|
||||||
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user