Add boss abilities with `all` modifiers.

Introduces four "new" boss abilities that work like their pre-existing counterparts, but affect all players in the arena. This makes the four _ability sets_ a bit more complete, as it were, in that it is now possible to choose between single targets, nearby, distant, or _all_ players for the given abilities.

Closes #434
This commit is contained in:
Griffin 2021-08-30 12:02:30 -05:00 committed by GitHub
parent c9766dee97
commit caee8be6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 117 additions and 0 deletions

View File

@ -15,6 +15,7 @@ These changes will (most likely) be included in the next version.
- New monster variant `angry-bees` can be used to spawn angry bees.
- Pet names are now per-class configurable via the optional `pet-name` property, which defaults to `<display-name>'s pet` (the `<player-name>` variable is also supported).
- New per-arena setting `auto-leave-on-end` can be used to automatically "kick" spectators when the current session ends.
- Added boss abilities `disorient-all`, `fetch-all`, `pull-all`, and `throw-all`. These abilities work like their target-specific and distance-based counterparts, but affect all players in the arena.
- (API) MobArena's internal command handler now supports registering pre-instantiated subcommand instances. This should make it easier for extensions to avoid the Singleton anti-pattern for command dependencies.
- (API) MobArena now fires MobArenaPreReloadEvent and MobArenaReloadEvent before and after, respectively, reloading its config-file. This should allow extensions and other plugins to better respond to configuration changes.

View File

@ -1,9 +1,11 @@
package com.garbagemule.MobArena.waves.ability;
import com.garbagemule.MobArena.waves.ability.core.ChainLightning;
import com.garbagemule.MobArena.waves.ability.core.DisorientAll;
import com.garbagemule.MobArena.waves.ability.core.DisorientDistant;
import com.garbagemule.MobArena.waves.ability.core.DisorientNearby;
import com.garbagemule.MobArena.waves.ability.core.DisorientTarget;
import com.garbagemule.MobArena.waves.ability.core.FetchAll;
import com.garbagemule.MobArena.waves.ability.core.FetchDistant;
import com.garbagemule.MobArena.waves.ability.core.FetchNearby;
import com.garbagemule.MobArena.waves.ability.core.FetchTarget;
@ -12,6 +14,7 @@ import com.garbagemule.MobArena.waves.ability.core.Flood;
import com.garbagemule.MobArena.waves.ability.core.LightningAura;
import com.garbagemule.MobArena.waves.ability.core.LivingBomb;
import com.garbagemule.MobArena.waves.ability.core.ObsidianBomb;
import com.garbagemule.MobArena.waves.ability.core.PullAll;
import com.garbagemule.MobArena.waves.ability.core.PullDistant;
import com.garbagemule.MobArena.waves.ability.core.PullNearby;
import com.garbagemule.MobArena.waves.ability.core.PullTarget;
@ -19,6 +22,7 @@ import com.garbagemule.MobArena.waves.ability.core.RootTarget;
import com.garbagemule.MobArena.waves.ability.core.ShootArrow;
import com.garbagemule.MobArena.waves.ability.core.ShootFireball;
import com.garbagemule.MobArena.waves.ability.core.ShufflePositions;
import com.garbagemule.MobArena.waves.ability.core.ThrowAll;
import com.garbagemule.MobArena.waves.ability.core.ThrowDistant;
import com.garbagemule.MobArena.waves.ability.core.ThrowNearby;
import com.garbagemule.MobArena.waves.ability.core.ThrowTarget;
@ -67,9 +71,11 @@ public class AbilityManager
if (abilities == null) abilities = new HashMap<>();
register(ChainLightning.class);
register(DisorientAll.class);
register(DisorientDistant.class);
register(DisorientNearby.class);
register(DisorientTarget.class);
register(FetchAll.class);
register(FetchDistant.class);
register(FetchNearby.class);
register(FetchTarget.class);
@ -78,6 +84,7 @@ public class AbilityManager
register(LightningAura.class);
register(LivingBomb.class);
register(ObsidianBomb.class);
register(PullAll.class);
register(PullDistant.class);
register(PullNearby.class);
register(PullTarget.class);
@ -85,6 +92,7 @@ public class AbilityManager
register(ShootArrow.class);
register(ShootFireball.class);
register(ShufflePositions.class);
register(ThrowAll.class);
register(ThrowDistant.class);
register(ThrowNearby.class);
register(ThrowTarget.class);

View File

@ -0,0 +1,25 @@
package com.garbagemule.MobArena.waves.ability.core;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.MABoss;
import com.garbagemule.MobArena.waves.ability.Ability;
import com.garbagemule.MobArena.waves.ability.AbilityInfo;
import com.garbagemule.MobArena.waves.ability.AbilityUtils;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@AbilityInfo(
name = "Disorient All",
aliases = {"disorientall"}
)
public class DisorientAll implements Ability
{
@Override
public void execute(Arena arena, MABoss boss) {
for (Player p : arena.getPlayersInArena()) {
Location loc = p.getLocation();
loc.setYaw(loc.getYaw() + 45 + AbilityUtils.random.nextInt(270));
p.teleport(loc);
}
}
}

View File

@ -0,0 +1,24 @@
package com.garbagemule.MobArena.waves.ability.core;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.MABoss;
import com.garbagemule.MobArena.waves.ability.Ability;
import com.garbagemule.MobArena.waves.ability.AbilityInfo;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@AbilityInfo(
name = "Fetch All",
aliases = {"fetchall"}
)
public class FetchAll implements Ability
{
@Override
public void execute(Arena arena, MABoss boss) {
Location bLoc = boss.getEntity().getLocation();
for (Player p : arena.getPlayersInArena()) {
p.teleport(bLoc);
}
}
}

View File

@ -0,0 +1,32 @@
package com.garbagemule.MobArena.waves.ability.core;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.MABoss;
import com.garbagemule.MobArena.waves.ability.Ability;
import com.garbagemule.MobArena.waves.ability.AbilityInfo;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@AbilityInfo(
name = "Pull All",
aliases = {"pullall"}
)
public class PullAll implements Ability
{
@Override
public void execute(Arena arena, MABoss boss) {
Location bLoc = boss.getEntity().getLocation();
for (Player p : arena.getPlayersInArena()) {
Location loc = p.getLocation();
Vector v = new Vector(bLoc.getX() - loc.getX(), 0, bLoc.getZ() - loc.getZ());
double a = Math.abs(bLoc.getX() - loc.getX());
double b = Math.abs(bLoc.getZ() - loc.getZ());
double c = Math.sqrt((a*a + b*b));
p.setVelocity(v.normalize().multiply(c*0.3).setY(0.8));
}
}
}

View File

@ -0,0 +1,27 @@
package com.garbagemule.MobArena.waves.ability.core;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.MABoss;
import com.garbagemule.MobArena.waves.ability.Ability;
import com.garbagemule.MobArena.waves.ability.AbilityInfo;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@AbilityInfo(
name = "Throw All",
aliases = {"throwall"}
)
public class ThrowAll implements Ability
{
@Override
public void execute(Arena arena, MABoss boss) {
Location bLoc = boss.getEntity().getLocation();
for (Player p : arena.getPlayersInArena()) {
Location loc = p.getLocation();
Vector v = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ());
p.setVelocity(v.normalize().setY(0.8));
}
}
}