Finish up the wonder that is Christmas Chaos II
This commit is contained in:
parent
5c98456995
commit
d8aa718488
@ -245,6 +245,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
|
||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticlePumpkinShield;
|
||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticleWingsChristmas;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||
@ -655,6 +656,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new ParticleWingsChristmas(this));
|
||||
addGadget(new ParticleBlizzard(this));
|
||||
addGadget(new ParticleFidgetSpinner(this));
|
||||
addGadget(new ParticlePumpkinShield(this));
|
||||
|
||||
// Arrow Trails
|
||||
addGadget(new ArrowTrailFrostLord(this));
|
||||
|
@ -0,0 +1,208 @@
|
||||
package mineplex.core.gadget.gadgets.particle.christmas;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.arcadeevents.CoreGameStartEvent;
|
||||
import mineplex.core.arcadeevents.CoreGameStopEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
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.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ParticlePumpkinShield extends ParticleGadget
|
||||
{
|
||||
|
||||
private static final ItemStack HELMET = new ItemStack(Material.JACK_O_LANTERN);
|
||||
private static final int SHIELD_STANDS = 3;
|
||||
private static final double INITIAL_THETA = 2 * Math.PI / 16;
|
||||
private static final double DELTA_THETA = Math.PI / 40;
|
||||
private static final double DELTA_THETA_Y = Math.PI / 35;
|
||||
private static final int RADIUS = 2;
|
||||
|
||||
private final Map<Player, List<ArmorStand>> _shield;
|
||||
private double _theta;
|
||||
private double _thetaY;
|
||||
private boolean _inGame;
|
||||
|
||||
public ParticlePumpkinShield(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Pumpkin Shield",
|
||||
UtilText.splitLinesToArray(new String[]
|
||||
{
|
||||
C.cGray + "You exert a eerie aura around you...",
|
||||
C.blankLine,
|
||||
C.cBlue + "Earned by defeating the Pumpkin King",
|
||||
C.cBlue + "in the 2017 Christmas Chaos II."
|
||||
}, LineFormat.LORE),
|
||||
CostConstants.NO_LORE, Material.JACK_O_LANTERN, (byte) 0);
|
||||
|
||||
_shield = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
super.enableCustom(player, message);
|
||||
|
||||
spawnArmourStands(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
super.disableCustom(player, message);
|
||||
|
||||
removeArmourStands(player);
|
||||
}
|
||||
|
||||
private void spawnArmourStands(Player player)
|
||||
{
|
||||
if (!isActive(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
List<ArmorStand> stands = new ArrayList<>(SHIELD_STANDS);
|
||||
|
||||
for (int i = 0; i < SHIELD_STANDS; i++)
|
||||
{
|
||||
ArmorStand stand = location.getWorld().spawn(location, ArmorStand.class);
|
||||
|
||||
stand.setVisible(false);
|
||||
stand.setGravity(false);
|
||||
stand.setHelmet(HELMET);
|
||||
stand.setRemoveWhenFarAway(false);
|
||||
|
||||
UtilEnt.vegetate(stand);
|
||||
|
||||
stands.add(stand);
|
||||
}
|
||||
|
||||
_shield.put(player, stands);
|
||||
}
|
||||
|
||||
private void removeArmourStands(Player player)
|
||||
{
|
||||
List<ArmorStand> stands = _shield.remove(player);
|
||||
|
||||
if (stands != null)
|
||||
{
|
||||
stands.forEach(Entity::remove);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playParticle(Player player, UpdateEvent event)
|
||||
{
|
||||
if (_inGame)
|
||||
{
|
||||
Location location = player.getLocation().add(0, 1, 0);
|
||||
|
||||
if (Manager.isMoving(player))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0.2F, 0, 0, 2, ViewDist.NORMAL);
|
||||
}
|
||||
else if (Math.random() < 0.3)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, location, 1, 0.8F, 1F, 0, 1, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void Caller(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
super.Caller(event);
|
||||
|
||||
_shield.forEach((player, stands) ->
|
||||
{
|
||||
Location base = player.getLocation();
|
||||
int index = 0;
|
||||
|
||||
for (ArmorStand stand : stands)
|
||||
{
|
||||
double theta = index++ * INITIAL_THETA + _theta;
|
||||
double x = RADIUS * Math.cos(theta);
|
||||
double y = Math.sin(theta + _thetaY) * 0.7;
|
||||
double z = RADIUS * Math.sin(theta);
|
||||
|
||||
base.add(x, y, z);
|
||||
base.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory2d(player.getLocation(), base)));
|
||||
|
||||
stand.teleport(base);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, base.clone().add(0, 1.7, 0), 0.2F, 0.2F, 0.2F, 0, 1, ViewDist.LONG);
|
||||
|
||||
base.subtract(x, y, z);
|
||||
}
|
||||
});
|
||||
|
||||
_theta += DELTA_THETA;
|
||||
_thetaY += DELTA_THETA_Y;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gameStart(CoreGameStartEvent event)
|
||||
{
|
||||
_inGame = true;
|
||||
_active.forEach(this::removeArmourStands);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gameStop(CoreGameStopEvent event)
|
||||
{
|
||||
_inGame = false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void playerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
if (event.isCancelled() || _inGame)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!isActive(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.runSyncLater(() ->
|
||||
{
|
||||
if (isActive(player))
|
||||
{
|
||||
spawnArmourStands(player);
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
}
|
@ -23,6 +23,8 @@ import mineplex.core.titles.commands.GiveTrackCommand;
|
||||
import mineplex.core.titles.tracks.award.AlienInvasionTrack;
|
||||
import mineplex.core.titles.tracks.award.AprilFools2017Track;
|
||||
import mineplex.core.titles.tracks.award.Bridges2017Track;
|
||||
import mineplex.core.titles.tracks.award.CCIIPublicTrack;
|
||||
import mineplex.core.titles.tracks.award.CCIITrack;
|
||||
import mineplex.core.titles.tracks.award.CastleSiegeTesterTrack;
|
||||
import mineplex.core.titles.tracks.award.ClansRaidTrack;
|
||||
import mineplex.core.titles.tracks.award.Minestrike2017Track;
|
||||
@ -121,6 +123,8 @@ public class TrackManager extends MiniPlugin
|
||||
registerTrack(new ClansRaidTrack());
|
||||
registerTrack(new CastleSiegeTesterTrack());
|
||||
registerTrack(new Minestrike2017Track());
|
||||
registerTrack(new CCIITrack());
|
||||
registerTrack(new CCIIPublicTrack());
|
||||
|
||||
// Staff tracks
|
||||
registerTrack(new BuilderTrack());
|
||||
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.titles.tracks.award;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.titles.tracks.ItemizedTrack;
|
||||
import mineplex.core.titles.tracks.TrackFormat;
|
||||
import mineplex.core.titles.tracks.TrackTier;
|
||||
|
||||
public class CCIIPublicTrack extends ItemizedTrack
|
||||
{
|
||||
|
||||
public CCIIPublicTrack()
|
||||
{
|
||||
super(
|
||||
"christmas-chaos",
|
||||
ChatColor.RED,
|
||||
"Santa's Helper",
|
||||
"Santa's Helper",
|
||||
"This track is awarded to players who won the Christmas Chaos II.",
|
||||
true);
|
||||
|
||||
special();
|
||||
|
||||
getRequirements()
|
||||
.addTier(new TrackTier(
|
||||
C.cWhiteB + "Santa's Helper",
|
||||
null,
|
||||
this::owns,
|
||||
new TrackFormat(ChatColor.WHITE, ChatColor.RED)
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package mineplex.core.titles.tracks.award;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.core.titles.tracks.Track;
|
||||
import mineplex.core.titles.tracks.TrackFormat;
|
||||
import mineplex.core.titles.tracks.TrackTier;
|
||||
import mineplex.core.titles.tracks.custom.ScrollAnimation;
|
||||
|
||||
public class CCIITrack extends Track
|
||||
{
|
||||
|
||||
private static final String TITLE = "❄ Christmas Tester ❄";
|
||||
|
||||
private static String[] buildAnimation()
|
||||
{
|
||||
return new ScrollAnimation(TITLE)
|
||||
.withPrimaryColour(ChatColor.AQUA)
|
||||
.withSecondaryColour(ChatColor.WHITE)
|
||||
.withTertiaryColour(ChatColor.BLUE)
|
||||
.bold()
|
||||
.build();
|
||||
}
|
||||
|
||||
private static final Set<String> OWNERS = Sets.newHashSet(
|
||||
"ca871a3f-349c-474c-9c45-c36f2e679ab3", // Moppletop
|
||||
"852a8acf-7337-40d7-99ec-b08fd99650b5", // KingCrazy_
|
||||
"eee121e6-2453-4801-8f44-d406e6f521f0", // DeanTM
|
||||
"e873e1c7-8e7d-4489-84e1-74b86e1b4ba7", // Dutty
|
||||
"c76f8ca3-21a2-4c0c-9217-4ded7ddd798f", // Intoxicating
|
||||
"b59ed7e5-9305-41c6-a0bd-3362ea643ac5" // SimplyBrandon1
|
||||
);
|
||||
|
||||
public CCIITrack()
|
||||
{
|
||||
super(
|
||||
"cc2-tester",
|
||||
ChatColor.GREEN,
|
||||
"CC2 Tester",
|
||||
"Christmas Tester",
|
||||
"This track is awarded to the players who helped with Christmas Chaos II :)",
|
||||
true);
|
||||
|
||||
special();
|
||||
getRequirements()
|
||||
.addTier(new TrackTier(
|
||||
TITLE,
|
||||
null,
|
||||
player -> OWNERS.contains(player.getUniqueId().toString()),
|
||||
new TrackFormat(ChatColor.AQUA)
|
||||
.animated(2, buildAnimation())
|
||||
));
|
||||
}
|
||||
}
|
@ -148,7 +148,10 @@ public enum GameType
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip")
|
||||
}, true),
|
||||
ChristmasNew(ChristmasNew.class, GameDisplay.ChristmasNew),
|
||||
ChristmasNew(ChristmasNew.class, GameDisplay.ChristmasNew, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://moppletop.github.io/mineplex/ResChristmas2.zip")
|
||||
}, false),
|
||||
DeathTag(DeathTag.class, GameDisplay.DeathTag),
|
||||
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
|
||||
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
|
||||
|
@ -276,6 +276,11 @@ public class ChristmasCommon extends SoloGame
|
||||
_currentSection.start();
|
||||
_currentSection.setObjective("Follow Santa");
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Location target = _currentSection.getSleighTarget();
|
||||
|
||||
if (_forceSkipTeleport)
|
||||
@ -558,8 +563,18 @@ public class ChristmasCommon extends SoloGame
|
||||
{
|
||||
if (victory)
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
WorldTimeSet = 18000;
|
||||
Manager.runSyncLater(() -> sendSantaMessage("You did it! I can’t believe it! You saved Christmas!", null), 80);
|
||||
Manager.runSyncLater(() -> sendSantaMessage("You did it! I can’t believe it! You saved Christmas!", ChristmasNewAudio.SANTA_YOU_DID_IT), 80);
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 20, "Defeating the Pumpkin King", false, false);
|
||||
}
|
||||
|
||||
SetCustomWinLine(customLine);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@ -12,12 +13,18 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlockText;
|
||||
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticlePumpkinShield;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.titles.tracks.Track;
|
||||
import mineplex.core.titles.tracks.award.CCIIPublicTrack;
|
||||
import mineplex.core.treasure.types.TreasureType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -32,6 +39,7 @@ import nautilus.game.arcade.game.games.christmasnew.section.one.Section1;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.Section6;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.three.Section3;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.two.Section2;
|
||||
import nautilus.game.arcade.game.modules.gamesummary.GameSummaryModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class ChristmasNew extends ChristmasCommon
|
||||
@ -50,6 +58,10 @@ public class ChristmasNew extends ChristmasCommon
|
||||
.withFlicker()
|
||||
.build();
|
||||
|
||||
private final Gadget _gadgetReward;
|
||||
private final Track _titleReward;
|
||||
private final List<Player> _playersToReward;
|
||||
|
||||
private final Comparator<Location> _locationComparator = (o1, o2) ->
|
||||
{
|
||||
double o1Dist = UtilMath.offsetSquared(o1, _sleighSpawn);
|
||||
@ -76,6 +88,13 @@ public class ChristmasNew extends ChristmasCommon
|
||||
StrictAntiHack = true;
|
||||
WorldTimeSet = 4000;
|
||||
WinEffectEnabled = false;
|
||||
|
||||
_gadgetReward = manager.getCosmeticManager().getGadgetManager().getGadget(ParticlePumpkinShield.class);
|
||||
_titleReward = manager.getTrackManager().getTrack(CCIIPublicTrack.class);
|
||||
_playersToReward = new ArrayList<>();
|
||||
|
||||
getModule(GameSummaryModule.class)
|
||||
.addComponent(new ChristmasSummaryComponent(_playersToReward::contains));
|
||||
}
|
||||
|
||||
// Take the parse at the purple bridge
|
||||
@ -158,4 +177,23 @@ public class ChristmasNew extends ChristmasCommon
|
||||
|
||||
UtilFirework.playFirework(UtilAlg.getRandomLocation(_winText, 20, 1, 20), FIREWORK_EFFECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endGame(boolean victory, String customLine)
|
||||
{
|
||||
if (victory)
|
||||
{
|
||||
_playersToReward.addAll(GetPlayers(true));
|
||||
_playersToReward.removeIf(_gadgetReward::ownsGadget);
|
||||
|
||||
_playersToReward.forEach(player ->
|
||||
{
|
||||
Manager.GetDonation().purchaseUnknownSalesPackage(player, _gadgetReward.getName(), GlobalCurrency.GEM, 0, true, null);
|
||||
Manager.getTrackManager().unlockTrack(player, _titleReward);
|
||||
Manager.getInventoryManager().addItemToInventory(player, TreasureType.GINGERBREAD.getItemName(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
super.endGame(victory, customLine);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,11 @@ import mineplex.core.common.util.UtilPlayer.CustomSound;
|
||||
public enum ChristmasNewAudio implements CustomSound
|
||||
{
|
||||
|
||||
PK_LAUGH("pk_hahaha_I_have_been_expecting_you_santa_claus"),
|
||||
PK_DEFEATED("pk_defeated"),
|
||||
PK_LAUGH("pk_expecting_santa"),
|
||||
PK_FALSE_BAN("pk_false_ban"),
|
||||
PK_LEARNED("pk_learned_tricks"),
|
||||
PK_ANGRY("pk_now_done_it"),
|
||||
PK_IT_WAS_ME("pk_yes_it_was_me_nothing_you_can_do_too_late"),
|
||||
|
||||
SANTA_ALMOST_THERE("santa_almost_there"),
|
||||
@ -13,20 +17,29 @@ public enum ChristmasNewAudio implements CustomSound
|
||||
SANTA_CLEAR_PATH("santa_clear_path_through_rocks"),
|
||||
SANTA_FOLLOW_ME("santa_follow_me"),
|
||||
SANTA_FOLLOW_ME_2("santa_follow_me_find_out_who_behind_this"),
|
||||
SANTA_GEN_DESTROYED("santa_generator_destroyed"),
|
||||
SANTA_GOOD_JOB("santa_good_job"),
|
||||
SANTA_LONGER("santa_great_job_just_a_little_bit_longer"),
|
||||
SANTA_LONGER("santa_great_job_monsters_coming"),
|
||||
SANTA_GWEN("santa_gwen_is_you"),
|
||||
SANTA_SHIELD("santa_he_has_shield"),
|
||||
SANTA_PUMPKIN_CASTLE("santa_jeepers_creepers_pumpkin_kings_castle"),
|
||||
SANTA_LETS_GO("santa_lets_go"),
|
||||
SANTA_GHASTS("santa_look_ghasts_ghouls"),
|
||||
SANTA_TWO_MORE_PRESENTS("santa_look_two_more_presents"),
|
||||
SANTA_FAIRIES("santa_move_flame_fairies"),
|
||||
SANTA_BRIDGE_OFF("santa_oh_no_magical_bridge_turned_off_defend_generators"),
|
||||
SANTA_WITCHES("santa_oh_no_those_witches_look_particularly_nasty"),
|
||||
SANTA_SPIDERS("santa_spiders_nasty"),
|
||||
SANTA_STORM("santa_storm_coming"),
|
||||
SANTA_TREES("santa_see_one_in_trees_follow_ornaments"),
|
||||
SANTA_STOLE_PRESENTS("santa_so_it_was_you_who_stole_all_of_the_christmas_presents"),
|
||||
SANTA_INTRO("santa_thanks_for_coming"),
|
||||
SANTA_ICE_MAZE("santa_theres_another_present_hidden_ice_maze"),
|
||||
SANTA_VULNERABLE("santa_vulnerable_to_attacks"),
|
||||
SANTA_ITS_A_TRAP("santa_watch_out_its_a_trap"),
|
||||
SANTA_PURPLE("santa_watch_out_purple_aura"),
|
||||
SANTA_PREPARE_FOR_BATTLE("santa_we_will_see_about_that_prepare_for_battle"),
|
||||
SANTA_WELL_DONE("santa_well_done"),
|
||||
SANTA_YOU_DID_IT("santa_you_did_it"),
|
||||
SANTA_BRIDGE_ON("santa_you_did_it_magical_bridge_turned_on")
|
||||
|
||||
;
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.treasure.types.TreasureType;
|
||||
|
||||
import nautilus.game.arcade.game.modules.gamesummary.GameSummaryComponent;
|
||||
import nautilus.game.arcade.game.modules.gamesummary.GameSummaryComponentType;
|
||||
|
||||
public class ChristmasSummaryComponent extends GameSummaryComponent<Boolean>
|
||||
{
|
||||
|
||||
private static final List<String> HOVER_TEXT = Arrays.asList(
|
||||
C.cGray + "- " + C.cGold + "Pumpkin Shield Particle Effect",
|
||||
C.cGray + "- " + C.cRed + "Santa's Helper Title",
|
||||
C.cGray + "- " + C.cYellow + "1 " + TreasureType.GINGERBREAD.getName()
|
||||
|
||||
);
|
||||
|
||||
ChristmasSummaryComponent(Function<Player, Boolean> getFunction)
|
||||
{
|
||||
super(GameSummaryComponentType.CUSTOM_REWARD, getFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMainText(Boolean data)
|
||||
{
|
||||
return data ? C.cAquaB + "UNLOCKED CHRISTMAS REWARDS" : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHoverText(Boolean data)
|
||||
{
|
||||
return HOVER_TEXT;
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.present;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
@ -19,15 +22,15 @@ public class Present implements Component
|
||||
private static final int ROTATION_ITERATIONS = 20;
|
||||
private static final double ROTATION_DELTA_Y = 1D / ROTATION_ITERATIONS;
|
||||
private static final float ROTATION_DELTA_YAW = 360F / ROTATION_ITERATIONS;
|
||||
private static final int TO_COLLECT = 2;
|
||||
|
||||
private final Location _location;
|
||||
private final ArmorStand _stand;
|
||||
private final List<Player> _players;
|
||||
|
||||
private int _iterations;
|
||||
private boolean _down;
|
||||
|
||||
private boolean _collected;
|
||||
|
||||
public Present(Location location)
|
||||
{
|
||||
_location = location.clone();
|
||||
@ -38,6 +41,7 @@ public class Present implements Component
|
||||
_stand.setHelmet(PRESENT);
|
||||
_stand.setRemoveWhenFarAway(false);
|
||||
UtilEnt.setTickWhenFarAway(_stand, true);
|
||||
_players = new ArrayList<>(TO_COLLECT);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(_location, Material.SNOW_BLOCK);
|
||||
}
|
||||
@ -51,11 +55,8 @@ public class Present implements Component
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
if (!isCollected())
|
||||
{
|
||||
_stand.remove();
|
||||
MapUtil.QuickChangeBlockAt(_location.clone().subtract(0, 1, 0), Material.COAL_BLOCK);
|
||||
}
|
||||
_stand.remove();
|
||||
MapUtil.QuickChangeBlockAt(_location.clone().subtract(0, 1, 0), Material.COAL_BLOCK);
|
||||
}
|
||||
|
||||
public void updateRotation()
|
||||
@ -84,19 +85,23 @@ public class Present implements Component
|
||||
return _location;
|
||||
}
|
||||
|
||||
public boolean isColliding(Player player)
|
||||
public boolean isColliding(Player player, boolean containsCheck)
|
||||
{
|
||||
return UtilMath.offsetSquared(player, _stand) < 4;
|
||||
return (!containsCheck || !_players.contains(player)) && UtilMath.offsetSquared(player, _stand) < 4;
|
||||
}
|
||||
|
||||
public void setCollected()
|
||||
public void setCollected(Player player)
|
||||
{
|
||||
deactivate();
|
||||
_collected = true;
|
||||
_players.add(player);
|
||||
}
|
||||
|
||||
public int getLeft()
|
||||
{
|
||||
return TO_COLLECT - _players.size();
|
||||
}
|
||||
|
||||
public boolean isCollected()
|
||||
{
|
||||
return _collected;
|
||||
return _players.size() == TO_COLLECT;
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,11 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio
|
||||
|
||||
public void onPresentCollect(Player player, Present present)
|
||||
{
|
||||
_host.AddGems(player, 1, "Presents Collected", true, true);
|
||||
present.setCollected(player);
|
||||
|
||||
Location location = present.getLocation();
|
||||
|
||||
int left = 0;
|
||||
|
||||
for (SectionChallenge challenge : _challenges)
|
||||
@ -107,18 +112,14 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio
|
||||
continue;
|
||||
}
|
||||
|
||||
if (present.equals(otherPresent))
|
||||
if (present.equals(otherPresent) && present.isCollected())
|
||||
{
|
||||
present.deactivate();
|
||||
challenge.onPresentCollect();
|
||||
}
|
||||
else if (!otherPresent.isCollected())
|
||||
{
|
||||
left++;
|
||||
}
|
||||
}
|
||||
|
||||
present.setCollected();
|
||||
Location location = present.getLocation();
|
||||
left += otherPresent.getLeft();
|
||||
}
|
||||
|
||||
_host.sendSantaMessage("Well done " + player.getName() + " you found a present!" + (left > 0 ? " Only " + left + " to go!" : ""), null);
|
||||
|
||||
|
@ -95,9 +95,12 @@ public abstract class SectionChallenge extends ListenerComponent implements Sect
|
||||
}
|
||||
else if (event.getType() == UpdateType.FAST && !_present.isCollected())
|
||||
{
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
List<Player> alive = _host.GetPlayers(true);
|
||||
boolean containsCheck = alive.size() > 1;
|
||||
|
||||
for (Player player : alive)
|
||||
{
|
||||
if (_present.isColliding(player))
|
||||
if (_present.isColliding(player, containsCheck))
|
||||
{
|
||||
_section.onPresentCollect(player, _present);
|
||||
return;
|
||||
|
@ -40,7 +40,6 @@ class SnowmenKong extends SectionChallenge
|
||||
|
||||
private final List<SnowmanWave> _waves;
|
||||
|
||||
private long _lastWave;
|
||||
private boolean _spawn;
|
||||
|
||||
SnowmenKong(ChristmasNew host, Location present, Section section)
|
||||
@ -103,13 +102,11 @@ class SnowmenKong extends SectionChallenge
|
||||
@EventHandler
|
||||
public void updateWaveSpawn(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST || !_spawn || _entities.size() > MAX_MOBS || !UtilTime.elapsed(_lastWave, WAVE_FREQUENCY))
|
||||
if (event.getType() != UpdateType.SLOW || !_spawn || _entities.size() > MAX_MOBS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_lastWave = System.currentTimeMillis();
|
||||
|
||||
for (SnowmanWave wave : _waves)
|
||||
{
|
||||
int index = UtilMath.r(wave.Spawns.size() - 1) + 1;
|
||||
|
@ -37,7 +37,9 @@ import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.SectionChallenge;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
|
||||
@ -180,9 +182,9 @@ class MobDefense extends SectionChallenge
|
||||
creatureLocation.getWorld().playEffect(creatureLocation.add(0, 1.3, 0), Effect.STEP_SOUND, Material.QUARTZ_BLOCK);
|
||||
}
|
||||
|
||||
if (_generatorHealth == 0)
|
||||
if (_generatorHealth <= 0)
|
||||
{
|
||||
_host.sendSantaMessage("Oh no one of the generators has been destroyed! If we lose both we'll never save Christmas in time!", null);
|
||||
_host.sendSantaMessage("Oh no one of the generators has been destroyed! If we lose both we'll never save Christmas in time!", ChristmasNewAudio.SANTA_GEN_DESTROYED);
|
||||
_healthHolograms.forEach(Hologram::stop);
|
||||
_generator.getWorld().createExplosion(_generator.clone().add(0, 2.5, 0), 6);
|
||||
}
|
||||
@ -209,6 +211,8 @@ class MobDefense extends SectionChallenge
|
||||
eFireball.dirX = direction.getX();
|
||||
eFireball.dirY = direction.getY() - 0.005;
|
||||
eFireball.dirZ = direction.getZ();
|
||||
|
||||
UtilEnt.CreatureMoveFast(_ghast, _ghastSpawn, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -257,7 +261,7 @@ class MobDefense extends SectionChallenge
|
||||
{
|
||||
_ghast = spawn(_ghastSpawn, Ghast.class);
|
||||
|
||||
int health = players * 15;
|
||||
int health = players * 10;
|
||||
_ghast.setMaxHealth(health);
|
||||
_ghast.setHealth(_ghast.getMaxHealth());
|
||||
UtilEnt.vegetate(_ghast);
|
||||
@ -270,6 +274,6 @@ class MobDefense extends SectionChallenge
|
||||
|
||||
public boolean isDead()
|
||||
{
|
||||
return _generatorHealth == 0;
|
||||
return _generatorHealth <= 0;
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class Section4 extends Section
|
||||
switch (_wave)
|
||||
{
|
||||
case 2:
|
||||
_host.sendSantaMessage("Ahh! Look it's some ghasts and ghouls!", null);
|
||||
_host.sendSantaMessage("Ahh! Look it's some ghasts and ghouls!", ChristmasNewAudio.SANTA_GHASTS);
|
||||
|
||||
int players = _host.GetPlayers(true).size();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class BossFight extends SectionChallenge
|
||||
{
|
||||
|
||||
private static final ItemStack HELMET = new ItemStack(Material.PUMPKIN);
|
||||
private static final int TIME_OF_DAY = 12000;
|
||||
private static final int TIME_OF_DAY = 1200;
|
||||
|
||||
private final Location _bossSpawn;
|
||||
private final List<Location> _lightning;
|
||||
@ -128,7 +128,7 @@ class BossFight extends SectionChallenge
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_start, 50000))
|
||||
if (UtilTime.elapsed(_start, 58000))
|
||||
{
|
||||
_host.sendSantaMessage("We’ll see about that. Prepare for battle!", ChristmasNewAudio.SANTA_PREPARE_FOR_BATTLE);
|
||||
_host.getSleigh().unloadSleigh();
|
||||
@ -155,17 +155,17 @@ class BossFight extends SectionChallenge
|
||||
|
||||
_innerGate.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.NETHER_FENCE));
|
||||
}
|
||||
else if (!_dialogueC && UtilTime.elapsed(_start, 44000))
|
||||
else if (!_dialogueC && UtilTime.elapsed(_start, 50000))
|
||||
{
|
||||
_dialogueC = true;
|
||||
_host.sendBossMessage("Yes it was me! There is nothing you and your friends can do now, you are too late!", ChristmasNewAudio.PK_IT_WAS_ME);
|
||||
}
|
||||
else if (!_dialogueB && UtilTime.elapsed(_start, 40000))
|
||||
else if (!_dialogueB && UtilTime.elapsed(_start, 43000))
|
||||
{
|
||||
_dialogueB = true;
|
||||
_host.sendSantaMessage("So it was you who stole all of the presents.", ChristmasNewAudio.SANTA_STOLE_PRESENTS);
|
||||
}
|
||||
else if (!_dialogueA && UtilTime.elapsed(_start, 35000))
|
||||
else if (!_dialogueA && UtilTime.elapsed(_start, 36000))
|
||||
{
|
||||
_dialogueA = true;
|
||||
spawnBoss();
|
||||
|
@ -38,6 +38,8 @@ public class Section6 extends Section
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
_host.sendSantaMessage("Oh dear, a storm is coming. Stay close everyone!", ChristmasNewAudio.SANTA_STORM);
|
||||
|
||||
_host.WorldWeatherEnabled = true;
|
||||
_worldData.World.setStorm(true);
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class AttackFire extends BossAttack
|
||||
|
||||
UtilPlayer.getInRadius(location, _radius + 3).forEach((player, scale) ->
|
||||
{
|
||||
manager.GetDamage().NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 20 * (scale + 0.3), false, true, true, _boss.getCustomName(), "Lightning Strike");
|
||||
manager.GetDamage().NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 20 * (scale + 0.3), false, true, true, _boss.getCustomName(), "Fire");
|
||||
});
|
||||
|
||||
}, TICKS_BEFORE_STRIKE);
|
||||
|
@ -18,6 +18,7 @@ import mineplex.core.particleeffects.Effect;
|
||||
import mineplex.core.particleeffects.ObjectiveEffect;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.phase.BossPhase;
|
||||
|
||||
public class AttackFlame extends BossAttack
|
||||
@ -43,7 +44,7 @@ public class AttackFlame extends BossAttack
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
_phase.getHost().sendSantaMessage("Move, quick! Dodge those flame fairies.", null);
|
||||
_phase.getHost().sendSantaMessage("Move, quick! Dodge those flame fairies.", ChristmasNewAudio.SANTA_FAIRIES);
|
||||
|
||||
DamageManager manager = _phase.getHost().getArcadeManager().GetDamage();
|
||||
Location location = _boss.getEyeLocation();
|
||||
|
@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.phase.BossPhase;
|
||||
|
||||
public class AttackSeismicWave extends BossAttack
|
||||
@ -50,7 +51,7 @@ public class AttackSeismicWave extends BossAttack
|
||||
{
|
||||
ArcadeManager manager = _phase.getHost().getArcadeManager();
|
||||
|
||||
_phase.getHost().sendSantaMessage("Watch out for that magic aura. Jump over the purple waves!", null);
|
||||
_phase.getHost().sendSantaMessage("Watch out for that magic aura. Jump over the purple waves!", ChristmasNewAudio.SANTA_PURPLE);
|
||||
|
||||
manager.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.GWENAnimation;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.attack.AttackFire;
|
||||
@ -104,8 +105,8 @@ public class Phase1 extends BossPhase
|
||||
_shield.add(stand);
|
||||
}
|
||||
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendSantaMessage("He has a shield that’s protecting him from your attacks. Just try and survive while I think of a way to destroy it.", null), 80);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendBossMessage("That’s right! I’ve learned about all your tricks that you’ve used before. I won’t be falling for them again!", null), 240);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendSantaMessage("He has a shield that’s protecting him from your attacks. Just try and survive while I think of a way to destroy it.", ChristmasNewAudio.SANTA_SHIELD), 80);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendBossMessage("That’s right! I’ve learned about all your tricks that you’ve used before. I won’t be falling for them again!", ChristmasNewAudio.PK_LEARNED), 240);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -208,8 +209,8 @@ public class Phase1 extends BossPhase
|
||||
_animation = new GWENAnimation(_host.getArcadeManager(), _boss.getLocation(), 4, (int) GWEN_DURATION);
|
||||
_host.CreatureAllowOverride = false;
|
||||
_completing = true;
|
||||
_host.sendSantaMessage("GWEN? Is that you?", null);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendBossMessage("That’s right! I’ve learned about all your tricks that you’ve used before. I won’t be falling for them again!", null), 60);
|
||||
_host.sendSantaMessage("GWEN? Is that you?", ChristmasNewAudio.SANTA_GWEN);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendBossMessage("No! This is a false ban!", ChristmasNewAudio.PK_FALSE_BAN), 80);
|
||||
}
|
||||
|
||||
if (_animation.update())
|
||||
|
@ -31,6 +31,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.attack.AttackArmouredMobs;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.attack.AttackFire;
|
||||
@ -48,7 +49,6 @@ public class Phase2 extends BossPhase
|
||||
private final AttackThrowTNT _tntAttack;
|
||||
|
||||
private boolean _completing;
|
||||
private boolean _complete;
|
||||
|
||||
public Phase2(ChristmasNew host, Section section)
|
||||
{
|
||||
@ -69,7 +69,7 @@ public class Phase2 extends BossPhase
|
||||
@Override
|
||||
public boolean isComplete()
|
||||
{
|
||||
return _complete;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,8 +116,8 @@ public class Phase2 extends BossPhase
|
||||
|
||||
onAttack(null);
|
||||
|
||||
_host.sendBossMessage("Now you've really done it!", null);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendSantaMessage("Great! He’s now vulnerable to your attacks.", null), 50);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendBossMessage("Now you've really done it!", ChristmasNewAudio.PK_ANGRY), 180);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendSantaMessage("Great! He’s now vulnerable to your attacks.", ChristmasNewAudio.SANTA_VULNERABLE), 280);
|
||||
|
||||
Map<Player, Location> lastLocation = new HashMap<>();
|
||||
|
||||
@ -195,7 +195,7 @@ public class Phase2 extends BossPhase
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectile instanceof Arrow && UtilMath.offset2dSquared(_boss, projectile) < 4)
|
||||
if (projectile instanceof Arrow && UtilMath.offset2dSquared(_boss, projectile) < 25)
|
||||
{
|
||||
Player player = (Player) projectile.getShooter();
|
||||
|
||||
@ -206,6 +206,11 @@ public class Phase2 extends BossPhase
|
||||
@EventHandler
|
||||
public void bossDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
|
||||
if (!damagee.equals(_boss))
|
||||
@ -227,7 +232,9 @@ public class Phase2 extends BossPhase
|
||||
else if (Math.random() < 0.4 && Recharge.Instance.use(damager, "Fire Attack", 1000, false, false))
|
||||
{
|
||||
AttackFire attackFire = new AttackFire(this, 3, damager.getLocation());
|
||||
attackFire.onRegister();
|
||||
attackFire.start();
|
||||
|
||||
_host.getArcadeManager().runSyncLater(attackFire::stop, 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,7 +242,7 @@ public class Phase2 extends BossPhase
|
||||
@EventHandler
|
||||
public void updateEnd(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC || !_boss.isDead() || _complete)
|
||||
if (event.getType() != UpdateType.TWOSEC || !_boss.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -244,7 +251,7 @@ public class Phase2 extends BossPhase
|
||||
{
|
||||
clearAttacks();
|
||||
_completing = true;
|
||||
_host.sendBossMessage("No!!!!!! I can't believe you defeated me!", null);
|
||||
_host.sendBossMessage("No!!!!!! I can't believe you defeated me!", ChristmasNewAudio.PK_DEFEATED);
|
||||
_host.endGame(true, "The Pumpkin King was Defeated!");
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Section2 extends Section
|
||||
@Override
|
||||
public void onSantaTarget()
|
||||
{
|
||||
_host.sendSantaMessage("Oh no! Those spiders looks particularly nasty.", ChristmasNewAudio.SANTA_WITCHES);
|
||||
_host.sendSantaMessage("Oh no! Those spiders looks particularly nasty.", ChristmasNewAudio.SANTA_SPIDERS);
|
||||
_host.getArcadeManager().runSyncLater(() -> _host.sendSantaMessage("There’s another present hidden within that ice maze.", ChristmasNewAudio.SANTA_ICE_MAZE), 150);
|
||||
}
|
||||
}
|
||||
|
@ -13,5 +13,6 @@ public enum GameSummaryComponentType
|
||||
|
||||
// Custom
|
||||
WIN_STREAK,
|
||||
EV_KIT
|
||||
EV_KIT,
|
||||
CUSTOM_REWARD
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user