Fix up Section2
This commit is contained in:
parent
e861e5bca7
commit
b7d80afb91
@ -250,8 +250,6 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
public boolean QuitOut = true;
|
||||
public boolean QuitDropItems = false;
|
||||
|
||||
public boolean IdleKickz = true;
|
||||
|
||||
public boolean CreatureAllow = false;
|
||||
public boolean CreatureAllowOverride = false;
|
||||
|
||||
@ -404,8 +402,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
|
||||
private final Set<QuestTracker<? extends Game>> _questTrackers = new HashSet<>();
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
public WinEffectManager WinEffectManager = new WinEffectManager();
|
||||
public final WinEffectManager WinEffectManager = new WinEffectManager();
|
||||
public boolean WinEffectEnabled = true;
|
||||
|
||||
private Map<Class<? extends Module>, Module> _modules = new HashMap<>();
|
||||
|
||||
@ -1516,7 +1514,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (team != null && !team.GetPlacements(true).isEmpty())
|
||||
if (WinEffectEnabled && team != null && !team.GetPlacements(true).isEmpty())
|
||||
{
|
||||
List<Player> teamList = new ArrayList<>();
|
||||
List<Player> otherList = new ArrayList<>();
|
||||
@ -1624,7 +1622,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
String winnerText = ChatColor.WHITE + "§lNobody won the game...";
|
||||
ChatColor subColor = ChatColor.WHITE;
|
||||
|
||||
if (places != null && !places.isEmpty())
|
||||
if (WinEffectEnabled && places != null && !places.isEmpty())
|
||||
{
|
||||
List<Player> teamList = new ArrayList<>();
|
||||
List<Player> nonTeamList = new ArrayList<>();
|
||||
|
@ -52,6 +52,7 @@ public class ChristmasNew extends ChristmasCommon
|
||||
}, DESCRIPTION);
|
||||
|
||||
WorldTimeSet = 4000;
|
||||
WinEffectEnabled = false;
|
||||
}
|
||||
|
||||
// Take the parse at the purple bridge
|
||||
|
@ -185,7 +185,7 @@ public class Phase1 extends BossPhase
|
||||
return;
|
||||
}
|
||||
|
||||
_section.setObjective("Survive the Pumpkin King's attacks", System.currentTimeMillis() / (double) (_start + DURATION));
|
||||
_section.setObjective("Survive the Pumpkin King's attacks", (double) (System.currentTimeMillis() - _start) / DURATION);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -41,6 +41,9 @@ public class Phase2 extends BossPhase
|
||||
private final Location _podium;
|
||||
private final AttackThrowTNT _tntAttack;
|
||||
|
||||
private boolean _completing;
|
||||
private boolean _complete;
|
||||
|
||||
public Phase2(ChristmasNew host, Section section)
|
||||
{
|
||||
super(host, section);
|
||||
@ -60,7 +63,7 @@ public class Phase2 extends BossPhase
|
||||
@Override
|
||||
public boolean isComplete()
|
||||
{
|
||||
return false;
|
||||
return _complete;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,7 +142,7 @@ public class Phase2 extends BossPhase
|
||||
player.teleport(location);
|
||||
});
|
||||
|
||||
if (++iterations == 20)
|
||||
if (++iterations == 12)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
@ -198,4 +201,20 @@ public class Phase2 extends BossPhase
|
||||
UtilAction.velocity(damager, UtilAlg.getTrajectory(damagee, damager), 0.7, false, 0, 0.4, 0.6, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateEnd(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || !_boss.isDead() || _complete)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_completing)
|
||||
{
|
||||
clearAttacks();
|
||||
_completing = true;
|
||||
_host.sendSantaMessage("At this point Phase 2 should end", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.two;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
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;
|
||||
|
||||
class RockParkour extends SectionChallenge
|
||||
{
|
||||
|
||||
private static final int MAX_MOBS = 25;
|
||||
|
||||
private final List<Location> _mobSpawns;
|
||||
|
||||
private boolean _spawn;
|
||||
|
||||
RockParkour(ChristmasNew host, Location present, Section section)
|
||||
{
|
||||
super(host, present, section);
|
||||
|
||||
_mobSpawns = _worldData.GetDataLocs("YELLOW");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPresentCollect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
_host.getArcadeManager().runSyncLater(() -> _spawn = true, 400);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnregister()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateMobs(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || !_spawn || _entities.size() > MAX_MOBS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Spider spawned = spawn(UtilAlg.Random(_mobSpawns), Spider.class);
|
||||
spawned.setRemoveWhenFarAway(false);
|
||||
|
||||
_entities.forEach(entity ->
|
||||
{
|
||||
if (entity instanceof Spider)
|
||||
{
|
||||
Spider spider = (Spider) entity;
|
||||
|
||||
if (spider.getTarget() == null)
|
||||
{
|
||||
spider.setTarget(UtilPlayer.getClosest(entity.getLocation()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class Section2 extends Section
|
||||
|
||||
registerChallenges(
|
||||
new IceMaze(host, presents[0], this),
|
||||
new SnowTurrets(host, presents[1], this)
|
||||
new RockParkour(host, presents[1], this)
|
||||
);
|
||||
|
||||
setTimeSet(6000);
|
||||
|
@ -1,201 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.christmasnew.section.two;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
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;
|
||||
|
||||
class SnowTurrets extends SectionChallenge
|
||||
{
|
||||
|
||||
private static final FireworkEffect DEATH_EFFECT = FireworkEffect.builder()
|
||||
.with(Type.BALL_LARGE)
|
||||
.withColor(Color.ORANGE, Color.BLACK)
|
||||
.withFade(Color.WHITE)
|
||||
.withFlicker()
|
||||
.build();
|
||||
private static final FireworkEffect BULLET_EFFECT = FireworkEffect.builder()
|
||||
.with(Type.BALL)
|
||||
.withColor(Color.AQUA, Color.BLUE)
|
||||
.withFade(Color.WHITE)
|
||||
.build();
|
||||
private static final int YAW = 160;
|
||||
private static final int MAX_DIST = 40;
|
||||
private static final int HIT_RADIUS = 4;
|
||||
private static final String HIT_CAUSE = "Snow Witch";
|
||||
private static final Vector HIT_VELOCITY = new Vector(0, 0.8, 1.2);
|
||||
private static final Vector HIT_BLOCK_VELOCITY = new Vector(0, 0.6, 0);
|
||||
|
||||
private final List<Location> _turretSpawns;
|
||||
private final Set<FallingBlock> _bullets;
|
||||
|
||||
SnowTurrets(ChristmasNew host, Location present, Section section)
|
||||
{
|
||||
super(host, present, section);
|
||||
|
||||
_turretSpawns = _worldData.GetDataLocs("YELLOW");
|
||||
_bullets = new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPresentCollect()
|
||||
{
|
||||
_entities.forEach(entity ->
|
||||
{
|
||||
UtilFirework.playFirework(entity.getLocation().add(0, 1.8, 0), DEATH_EFFECT);
|
||||
entity.remove();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegister()
|
||||
{
|
||||
_turretSpawns.forEach(location ->
|
||||
{
|
||||
location.setYaw(YAW);
|
||||
|
||||
Witch witch = spawn(location, Witch.class);
|
||||
|
||||
witch.setCustomName(C.cAquaB + HIT_CAUSE);
|
||||
witch.setCustomNameVisible(true);
|
||||
witch.setRemoveWhenFarAway(false);
|
||||
|
||||
UtilEnt.vegetate(witch);
|
||||
UtilEnt.ghost(witch, true, false);
|
||||
UtilEnt.setFakeHead(witch, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnregister()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateShoot(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity entity : _entities)
|
||||
{
|
||||
if (!entity.isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location location = entity.getLocation().add(0, 1, 0);
|
||||
|
||||
UtilPlayer.getInRadius(location, MAX_DIST).forEach((player, scale) ->
|
||||
{
|
||||
if (Math.random() > 0.4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location, Material.SNOW_BLOCK, (byte) 0);
|
||||
fallingBlock.setDropItem(false);
|
||||
|
||||
Vector velocity = UtilAlg.getTrajectory2d(location, player.getLocation());
|
||||
|
||||
velocity.multiply(1.5 * scale);
|
||||
velocity.setY(0.4);
|
||||
|
||||
UtilAction.velocity(fallingBlock, velocity);
|
||||
|
||||
_bullets.add(fallingBlock);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateBullets(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_bullets.removeIf(block ->
|
||||
{
|
||||
if (UtilEnt.isGrounded(block))
|
||||
{
|
||||
Location location = block.getLocation();
|
||||
|
||||
block.remove();
|
||||
MapUtil.QuickChangeBlockAt(location, Material.AIR);
|
||||
explodeBlock(location);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.getTicksLived() % 8 == 0)
|
||||
{
|
||||
UtilFirework.playFirework(block.getLocation(), BULLET_EFFECT);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void explodeBlock(Location location)
|
||||
{
|
||||
location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.8F);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, location, 0, 0, 0, 0.1F, 1, ViewDist.NORMAL);
|
||||
|
||||
DamageManager damageManager = _host.getArcadeManager().GetDamage();
|
||||
|
||||
UtilPlayer.getInRadius(location, HIT_RADIUS).forEach((player, scale) ->
|
||||
{
|
||||
damageManager.NewDamageEvent(player, null, null, DamageCause.CUSTOM, 6, false, true, true, HIT_CAUSE, HIT_CAUSE);
|
||||
UtilAction.velocity(player, HIT_VELOCITY.clone().multiply(scale + 0.3));
|
||||
});
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(location.getBlock(), HIT_RADIUS).keySet())
|
||||
{
|
||||
if (Math.random() > 0.1 || UtilBlock.airFoliage(block) || !UtilBlock.airFoliage(block.getRelative(BlockFace.UP)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 1.5, 0), block.getType(), block.getData());
|
||||
fallingBlock.setDropItem(false);
|
||||
|
||||
UtilAction.velocity(fallingBlock, HIT_BLOCK_VELOCITY.clone().multiply(0.7 + Math.random()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user