mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-16 20:41:56 +01:00
Added two new boss abilities
This commit is contained in:
parent
04fdbf9031
commit
5534b87c9e
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1065,6 +1065,11 @@ public class Arena
|
||||
return spawnThread.getPlayerCount();
|
||||
}
|
||||
|
||||
public void addBlock(Block b)
|
||||
{
|
||||
blocks.add(b);
|
||||
}
|
||||
|
||||
public void addMonster(LivingEntity e)
|
||||
{
|
||||
monsters.add(e);
|
||||
@ -1091,6 +1096,11 @@ public class Arena
|
||||
return result;
|
||||
}
|
||||
|
||||
public Set<Player> getArenaPlayers()
|
||||
{
|
||||
return arenaPlayers;
|
||||
}
|
||||
|
||||
public List<Player> getNonreadyPlayers()
|
||||
{
|
||||
List<Player> result = new LinkedList<Player>();
|
||||
|
@ -535,12 +535,18 @@ public class MAUtils
|
||||
if (stacks == null)
|
||||
return;
|
||||
|
||||
// If the player isn't online, write directly to their data file.
|
||||
if (!p.isOnline())
|
||||
{
|
||||
ItemStack[] items = readInventoryData(p);
|
||||
int currentSlot = 0;
|
||||
for (ItemStack stack : stacks)
|
||||
{
|
||||
// Skip money rewards for now. TODO: Make this work as well
|
||||
if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID)
|
||||
continue;
|
||||
|
||||
// Find the first available slot
|
||||
while (currentSlot < items.length && items[currentSlot] != null)
|
||||
currentSlot++;
|
||||
|
||||
@ -550,10 +556,12 @@ public class MAUtils
|
||||
items[currentSlot] = stack;
|
||||
}
|
||||
|
||||
// Write the data
|
||||
writeInventoryData(p, items);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, give the player some items!
|
||||
PlayerInventory inv = p.getInventory();
|
||||
for (ItemStack stack : stacks)
|
||||
{
|
||||
@ -572,7 +580,6 @@ public class MAUtils
|
||||
// If these are rewards, don't tamper with them.
|
||||
if (rewards)
|
||||
{
|
||||
//inv.addItem(stack);
|
||||
giveItem(inv, stack);
|
||||
continue;
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.garbagemule.MobArena.waves;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Fireball;
|
||||
@ -14,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.garbagemule.MobArena.Arena;
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import com.garbagemule.MobArena.util.WaveUtils;
|
||||
|
||||
|
||||
@ -60,46 +63,6 @@ public enum BossAbility
|
||||
arena.getWorld().strikeLightning(sw);
|
||||
}
|
||||
},
|
||||
DISORIENTTARGET("Disorient Target")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
{
|
||||
LivingEntity target = getTarget(boss);
|
||||
if (target == null) return;
|
||||
|
||||
Location loc = target.getLocation();
|
||||
loc.setYaw(target.getLocation().getYaw() + 45 + (new Random()).nextInt(270));
|
||||
target.teleport(loc);
|
||||
}
|
||||
},
|
||||
ROOTTARGET("Root Target")
|
||||
{
|
||||
public void run(final Arena arena, LivingEntity boss)
|
||||
{
|
||||
final LivingEntity target = getTarget(boss);
|
||||
if (target == null) return;
|
||||
|
||||
final Location loc = target.getLocation();
|
||||
final int freezeTaskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(arena.getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (arena.getLivingPlayers().contains(target))
|
||||
target.teleport(loc);
|
||||
}
|
||||
}, 3, 3);
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(arena.getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Bukkit.getServer().getScheduler().cancelTask(freezeTaskId);
|
||||
}
|
||||
}, 45);
|
||||
}
|
||||
},
|
||||
LIVINGBOMB("Living Bomb")
|
||||
{
|
||||
public void run(final Arena arena, LivingEntity boss)
|
||||
@ -163,6 +126,46 @@ public enum BossAbility
|
||||
}, 8);
|
||||
}
|
||||
},
|
||||
DISORIENTTARGET("Disorient Target")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
{
|
||||
LivingEntity target = getTarget(boss);
|
||||
if (target == null) return;
|
||||
|
||||
Location loc = target.getLocation();
|
||||
loc.setYaw(target.getLocation().getYaw() + 45 + MobArena.random.nextInt(270));
|
||||
target.teleport(loc);
|
||||
}
|
||||
},
|
||||
ROOTTARGET("Root Target")
|
||||
{
|
||||
public void run(final Arena arena, LivingEntity boss)
|
||||
{
|
||||
final LivingEntity target = getTarget(boss);
|
||||
if (target == null) return;
|
||||
|
||||
final Location loc = target.getLocation();
|
||||
final int freezeTaskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(arena.getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (arena.getLivingPlayers().contains(target))
|
||||
target.teleport(loc);
|
||||
}
|
||||
}, 3, 3);
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(arena.getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Bukkit.getServer().getScheduler().cancelTask(freezeTaskId);
|
||||
}
|
||||
}, 45);
|
||||
}
|
||||
},
|
||||
WARPTOPLAYER("Warp")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
@ -171,6 +174,38 @@ public enum BossAbility
|
||||
boss.teleport(list.get((new Random()).nextInt(list.size())));
|
||||
}
|
||||
},
|
||||
SHUFFLEPOSITIONS("Shuffle Positions")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
{
|
||||
// Grab the players and add the boss
|
||||
List<LivingEntity> entities = new LinkedList<LivingEntity>(arena.getArenaPlayers());
|
||||
entities.add(boss);
|
||||
|
||||
// Grab the locations
|
||||
List<Location> locations = new LinkedList<Location>();
|
||||
for (LivingEntity e : entities)
|
||||
locations.add(e.getLocation());
|
||||
|
||||
// Shuffle the entities, and then begin warping.
|
||||
Collections.shuffle(entities);
|
||||
while (!entities.isEmpty() && !locations.isEmpty())
|
||||
entities.remove(0).teleport(locations.remove(0));
|
||||
}
|
||||
},
|
||||
FLOOD("Flood")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
{
|
||||
List<Player> players = arena.getLivingPlayers();
|
||||
Block block = players.get(MobArena.random.nextInt(players.size())).getLocation().getBlock();
|
||||
if (block.getTypeId() == 0)
|
||||
{
|
||||
block.setTypeId(8);
|
||||
arena.addBlock(block);
|
||||
}
|
||||
}
|
||||
},
|
||||
THROWTARGET("Throw Target")
|
||||
{
|
||||
public void run(Arena arena, LivingEntity boss)
|
||||
|
@ -76,35 +76,35 @@ public class BOSE6 implements Method {
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return (double) this.BOSEconomy.getPlayerMoneyDouble(this.name);
|
||||
return (double) this.BOSEconomy.getPlayerMoney(this.name);
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (double) IntAmount, false);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, (double) IntAmount, false);
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (double) (balance - IntAmount), false);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (double) (balance * IntAmount), false);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (double) (balance / IntAmount), false);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
@ -146,36 +146,36 @@ public class BOSE6 implements Method {
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return (double) this.BOSEconomy.getBankMoneyDouble(bank);
|
||||
return (double) this.BOSEconomy.getBankMoney(bank);
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setBankMoney(bank, (double) IntAmount, true);
|
||||
return this.BOSEconomy.setBankMoney(bank, IntAmount, true);
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (double) (balance + IntAmount), false);
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance + IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (double) (balance - IntAmount), false);
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance - IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (double) (balance * IntAmount), false);
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance * IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (double) (balance / IntAmount), false);
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance / IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
|
Loading…
Reference in New Issue
Block a user