Skip to content

Commit

Permalink
tweak wave spawns and make special mobs target someone
Browse files Browse the repository at this point in the history
  • Loading branch information
msudol committed Dec 30, 2019
1 parent 7194807 commit 7ac87b7
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/com/pwn9/PwnRaid/RaidListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public void onRaidStart(RaidTriggerEvent e)
// get some infos
Player p = e.getPlayer();
Raid r = e.getRaid();
World w = e.getWorld();
Location loc = e.getRaid().getLocation();

// set the bad omen level based on the item used to ring the bell and message the server
r.setBadOmenLevel(PwnRaid.currentOmenLevel);
Expand Down Expand Up @@ -131,11 +129,20 @@ public void spawnSuperCreeper(World w, Location loc)
creeper.setCustomName("Raid Bomber");
creeper.setCustomNameVisible(true);

List<Entity> near = creeper.getNearbyEntities(50.0D, 50.0D, 50.0D);
for(Entity entity : near) {
if(entity instanceof Player) {
Player nearPlayer = (Player) entity;
creeper.setTarget(nearPlayer);
return;
}
}

return;
}


// spawn a charged creeper within a random distance from the raid center
// spawn a witherjockey random distance from the raid center
public void spawnWitherJockey(World w, Location loc)
{
Location newLoc = this.getRandomLocNearby(w, loc, 40);
Expand All @@ -147,18 +154,30 @@ public void spawnWitherJockey(World w, Location loc)
ws.setCustomName("Raid Riding Hood");
ws.setCustomNameVisible(true);

// target someone
List<Entity> near = ws.getNearbyEntities(50.0D, 50.0D, 50.0D);
for(Entity entity : near) {
if(entity instanceof Player) {
Player nearPlayer = (Player) entity;
ws.setTarget(nearPlayer);
return;
}
}

return;
}
// spawn a charged creeper within a random distance from the raid center
// spawn a ghast within a random distance from the raid center
public void spawnGhast(World w, Location loc)
{
Location newLoc = this.getRandomLocNearby(w, loc, 40);
newLoc.setY(newLoc.getY() + 20.0D);

// spawn a ghast for kicks
Ghast ghast = (Ghast)w.spawnEntity(newLoc, EntityType.GHAST);
ghast.setCustomName("Raid-A-Ghast");
ghast.setCustomNameVisible(true);

// target someone
List<Entity> near = ghast.getNearbyEntities(50.0D, 50.0D, 50.0D);
for(Entity entity : near) {
if(entity instanceof Player) {
Expand Down Expand Up @@ -194,26 +213,21 @@ public void spawnWaveExtraMobs(World w, Location loc, int wave)
}
else if (wave == 2)
{
this.spawnSuperCreeper(w, loc);
this.spawnGhast(w, loc);
}
else if (wave == 3)
{
this.spawnSuperCreeper(w, loc);
this.spawnSuperCreeper(w, loc);
this.spawnGhast(w, loc);
}
else if (wave == 4)
{
this.spawnSuperCreeper(w, loc);
this.spawnSuperCreeper(w, loc);
this.spawnGhast(w, loc);
this.spawnGhast(w, loc);
this.spawnWitherJockey(w, loc);
}
else if (wave > 4 && wave < 9)
{
this.spawnSuperCreeper(w, loc);
this.spawnSuperCreeper(w, loc);
this.spawnSuperCreeper(w, loc);
this.spawnGhast(w, loc);
Expand All @@ -229,7 +243,6 @@ else if (wave > 8)
this.spawnGhast(w, loc);
this.spawnWitherJockey(w, loc);
this.spawnWitherJockey(w, loc);
this.spawnWitherJockey(w, loc);
}
else {
// wave must be 0
Expand Down

0 comments on commit 7ac87b7

Please sign in to comment.