More progress on the Boss
This commit is contained in:
parent
782f0c5699
commit
cc8d1ca6c4
@ -34,6 +34,8 @@ public class Sleigh
|
||||
|
||||
private Entity Santa;
|
||||
|
||||
private boolean _loaded;
|
||||
|
||||
public void setupSleigh(ChristmasCommon host, Location loc)
|
||||
{
|
||||
Host = host;
|
||||
@ -133,6 +135,8 @@ public class Sleigh
|
||||
{
|
||||
horse.spawnHorse();
|
||||
}
|
||||
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
public Location GetLocation()
|
||||
@ -147,6 +151,11 @@ public class Sleigh
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!_loaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bump();
|
||||
|
||||
if (Target == null)
|
||||
@ -238,6 +247,7 @@ public class Sleigh
|
||||
PresentSlots.forEach(part -> part.Ent.remove());
|
||||
Santa.remove();
|
||||
CentralEntity.remove();
|
||||
_loaded = false;
|
||||
}
|
||||
|
||||
public boolean HasPresent(Location loc)
|
||||
|
@ -97,8 +97,6 @@ class SwitchParkour extends SectionChallenge
|
||||
{
|
||||
_black.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||
}
|
||||
|
||||
_removeTick = !_removeTick;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,29 +1,43 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.six;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.utils.UtilVariant;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.SectionChallenge;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.six.phase.BossPhase;
|
||||
|
||||
class BossFight extends SectionChallenge
|
||||
{
|
||||
|
||||
private final Location _bossSpawn;
|
||||
private final List<Location> _lightning;
|
||||
private final List<Location> _playerSpawns;
|
||||
private final List<Location> _innerGate;
|
||||
|
||||
private final List<BossPhase> _phases;
|
||||
private BossPhase _currentPhase;
|
||||
|
||||
private long _start;
|
||||
private int _phase ;
|
||||
private ArmorStand _boss;
|
||||
private boolean _enabled;
|
||||
|
||||
private Skeleton _boss;
|
||||
|
||||
BossFight(ChristmasNew host, Location present, Section section)
|
||||
{
|
||||
@ -32,6 +46,14 @@ class BossFight extends SectionChallenge
|
||||
_worldData.GetCustomLocs(String.valueOf(Material.IRON_ORE.getId())).forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.BARRIER));
|
||||
_bossSpawn = _worldData.GetCustomLocs("BOSS SPAWN").get(0);
|
||||
_bossSpawn.setYaw(180);
|
||||
|
||||
_lightning = _worldData.GetCustomLocs("LIGHTNING");
|
||||
_playerSpawns = _worldData.GetCustomLocs("PLAYER SPAWN");
|
||||
_innerGate = _worldData.GetCustomLocs(String.valueOf(Material.IRON_ORE.getId()));
|
||||
|
||||
_phases = Arrays.asList(
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,25 +75,73 @@ class BossFight extends SectionChallenge
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateText(UpdateEvent event)
|
||||
public void updatePhase(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST || !_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentPhase == null || _currentPhase.isComplete())
|
||||
{
|
||||
if (_currentPhase != null)
|
||||
{
|
||||
_currentPhase.onUnregister();
|
||||
_currentPhase.deactivate();
|
||||
}
|
||||
|
||||
if (_phases.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_currentPhase = _phases.remove(0);
|
||||
_currentPhase.setBoss(_boss);
|
||||
_currentPhase.activate();
|
||||
_currentPhase.onRegister();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateStart(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_start, 5000))
|
||||
if (UtilTime.elapsed(_start, 30000))
|
||||
{
|
||||
_host.sendSantaMessage("Starting", null);
|
||||
_host.getSleigh().unloadSleigh();
|
||||
_host.WorldChunkUnload = true;
|
||||
spawnBoss();
|
||||
_phase++;
|
||||
_enabled = true;
|
||||
|
||||
int spawnIndex = 0;
|
||||
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
player.teleport(_playerSpawns.get(spawnIndex));
|
||||
|
||||
if (++spawnIndex == _playerSpawns.size())
|
||||
{
|
||||
spawnIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_innerGate.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.NETHER_FENCE));
|
||||
}
|
||||
else if (Math.random() < 0.1)
|
||||
{
|
||||
Location location = UtilAlg.Random(_lightning);
|
||||
location.getWorld().strikeLightningEffect(location);
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnBoss()
|
||||
{
|
||||
_boss = spawn(_bossSpawn, ArmorStand.class);
|
||||
_boss = UtilVariant.spawnWitherSkeleton(_bossSpawn);
|
||||
_boss.setCustomName(C.cGoldB + "Pumpkin King");
|
||||
_boss.setCustomNameVisible(true);
|
||||
|
||||
@ -79,5 +149,7 @@ class BossFight extends SectionChallenge
|
||||
UtilEnt.setFakeHead(_boss, true);
|
||||
|
||||
_entities.add(_boss);
|
||||
|
||||
_boss.getWorld().strikeLightningEffect(_bossSpawn);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
public class Section6 extends Section
|
||||
{
|
||||
|
||||
private static final int GATE_OPEN_DELAY = 250;
|
||||
private static final int GATE_OPEN_DELAY = 350;
|
||||
|
||||
private final List<Location> _gate;
|
||||
|
||||
@ -28,8 +28,6 @@ public class Section6 extends Section
|
||||
_gate.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.NETHER_FENCE));
|
||||
|
||||
setTimeSet(18000);
|
||||
_host.WorldWeatherEnabled = true;
|
||||
_worldData.World.setStorm(true);
|
||||
|
||||
registerChallenges(
|
||||
new BossFight(host, presents[0], this)
|
||||
@ -39,6 +37,9 @@ public class Section6 extends Section
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
_host.WorldWeatherEnabled = true;
|
||||
_worldData.World.setStorm(true);
|
||||
|
||||
AtomicInteger lowestY = new AtomicInteger(Integer.MAX_VALUE);
|
||||
|
||||
for (Location location : _gate)
|
||||
@ -78,9 +79,7 @@ public class Section6 extends Section
|
||||
location.getWorld().playSound(location, Sound.PISTON_RETRACT, 1.5F, 0.8F);
|
||||
}
|
||||
}
|
||||
}, GATE_OPEN_DELAY, 4);
|
||||
|
||||
_host.WorldChunkUnload = true;
|
||||
}, GATE_OPEN_DELAY, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,4 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.six.phases;
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.six.phase;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
@ -7,6 +9,8 @@ import nautilus.game.arcade.game.games.christmasnew.section.SectionChallenge;
|
||||
public abstract class BossPhase extends SectionChallenge
|
||||
{
|
||||
|
||||
protected LivingEntity _boss;
|
||||
|
||||
public BossPhase(ChristmasNew host, Section section)
|
||||
{
|
||||
super(host, null, section);
|
||||
@ -17,6 +21,10 @@ public abstract class BossPhase extends SectionChallenge
|
||||
@Override
|
||||
public void onPresentCollect()
|
||||
{
|
||||
// Unneeded
|
||||
}
|
||||
|
||||
public void setBoss(LivingEntity boss)
|
||||
{
|
||||
_boss = boss;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.six.phase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
|
||||
public class Phase1 extends BossPhase
|
||||
{
|
||||
|
||||
private static final ItemStack HELMET = new ItemStack(Material.OBSIDIAN);
|
||||
private static final int SHIELD_STANDS = 16;
|
||||
private static final double DELTA_THETA = Math.PI / 40;
|
||||
|
||||
private final List<ArmorStand> _shield;
|
||||
|
||||
public Phase1(ChristmasNew host, Section section)
|
||||
{
|
||||
super(host, section);
|
||||
|
||||
_shield = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
Location location = _boss.getLocation();
|
||||
|
||||
for (int i = 0; i < SHIELD_STANDS; i++)
|
||||
{
|
||||
ArmorStand stand = spawn(location, ArmorStand.class);
|
||||
|
||||
stand.setVisible(false);
|
||||
stand.setGravity(false);
|
||||
stand.setHelmet(HELMET);
|
||||
|
||||
UtilEnt.vegetate(stand);
|
||||
|
||||
_shield.add(stand);
|
||||
}
|
||||
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += DELTA_THETA)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnregister()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.six.phases;
|
||||
|
||||
public class Phase1
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user