Sneaky Assassins changes :)

This commit is contained in:
Chiss 2014-07-31 12:58:33 +10:00
parent fb0469adfa
commit a4d579789c
7 changed files with 62 additions and 60 deletions

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits;
import nautilus.game.arcade.*; import nautilus.game.arcade.*;
import nautilus.game.arcade.kit.*; import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.inventory.*; import org.bukkit.inventory.*;
@ -11,7 +12,16 @@ public class KitAssassin extends SneakyAssassinKit
{ {
public KitAssassin(ArcadeManager manager) public KitAssassin(ArcadeManager manager)
{ {
super(manager, "Assassin", KitAvailability.Free, new String[]{""}, new Perk[]{new PerkSmokebomb(Material.INK_SACK, 5, true)}, new ItemStack(Material.BOW)); super(manager, "Ranged Assassin", KitAvailability.Free,
new String[]
{
"Skilled at ranged assassination!"
},
new Perk[]
{
new PerkSmokebomb(Material.INK_SACK, 5, true)
},
new ItemStack(Material.BOW));
} }
@Override @Override

View File

@ -11,7 +11,16 @@ public class KitEscapeArtist extends SneakyAssassinKit
{ {
public KitEscapeArtist(ArcadeManager manager) public KitEscapeArtist(ArcadeManager manager)
{ {
super(manager, "Escape Artist", KitAvailability.Free, new String[]{""}, new Perk[]{new PerkSmokebomb(Material.INK_SACK, 5, true)}, new ItemStack(Material.INK_SACK)); super(manager, "Escape Artist", KitAvailability.Free,
new String[]
{
"Carries two extra Smokebombs!"
},
new Perk[]
{
new PerkSmokebomb(Material.INK_SACK, 5, true)
},
new ItemStack(Material.INK_SACK));
} }
@Override @Override

View File

@ -5,6 +5,7 @@ import mineplex.core.itemstack.*;
import nautilus.game.arcade.*; import nautilus.game.arcade.*;
import nautilus.game.arcade.kit.*; import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.inventory.*; import org.bukkit.inventory.*;
@ -13,7 +14,17 @@ public class KitRevealer extends SneakyAssassinKit
{ {
public KitRevealer(ArcadeManager manager) public KitRevealer(ArcadeManager manager)
{ {
super(manager, "Revealer", KitAvailability.Free, new String[]{""}, new Perk[]{new PerkSmokebomb(Material.INK_SACK, 5, true), new PerkRevealer()}, new ItemStack(Material.EMERALD)); super(manager, "Revealer", KitAvailability.Free,
new String[]
{
"Carries two extra Smokebombs!"
},
new Perk[]
{
new PerkSmokebomb(Material.INK_SACK, 5, true),
new PerkRevealer()
},
new ItemStack(Material.INK_SACK));
} }
@Override @Override

View File

@ -32,9 +32,9 @@ public abstract class SneakyAssassinKit extends Kit
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb",
new String[] new String[]
{ {
ChatColor.RESET + "Throw a smoke bomb.", ChatColor.RESET + "Throw a Smoke Bomb.",
ChatColor.RESET + "Everyone within 5 blocks", ChatColor.RESET + "Everyone within 6 blocks",
ChatColor.RESET + "gets blindness for 5 seconds.", ChatColor.RESET + "gets Blindness for 6 seconds.",
})); }));
} }

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.sneakyassassins.npc; package nautilus.game.arcade.game.games.sneakyassassins.npc;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.*; import mineplex.core.updater.*;
import mineplex.core.updater.event.*; import mineplex.core.updater.event.*;
import nautilus.game.arcade.game.*; import nautilus.game.arcade.game.*;
@ -53,21 +54,7 @@ public class NpcManager implements Listener
public Location getNpcSpawn() public Location getNpcSpawn()
{ {
Location best = null; return UtilAlg.Random(getGame().GetTeamList().get(0).GetSpawns());
double farthest = Double.NaN;
for (Location spawn : getGame().GetTeamList().get(0).GetSpawns())
{
double distance = getNearestVillagerDistanceSquared(spawn);
if (Double.isNaN(farthest) || distance > farthest)
{
best = spawn;
farthest = distance;
}
}
return best;
} }
@EventHandler @EventHandler
@ -84,6 +71,8 @@ public class NpcManager implements Listener
@EventHandler @EventHandler
public void onEntityDeath(EntityDeathEvent event) public void onEntityDeath(EntityDeathEvent event)
{
try
{ {
if (event.getEntity().getWorld() == getGame().WorldData.World) if (event.getEntity().getWorld() == getGame().WorldData.World)
{ {
@ -91,6 +80,11 @@ public class NpcManager implements Listener
event.getDrops().clear(); event.getDrops().clear();
} }
} }
catch (Exception e)
{
e.printStackTrace();
}
}
public void bustle() public void bustle()
{ {
@ -103,34 +97,11 @@ public class NpcManager implements Listener
if (loc.getWorld().getHighestBlockYAt(loc) > 0) if (loc.getWorld().getHighestBlockYAt(loc) > 0)
{ {
UtilEnt.CreatureMove(npc, loc, 0.8f); UtilEnt.CreatureMove(npc, loc, 0.8f);
npc.teleport(npc.getLocation().add(0, 1.2, 0));
} }
} }
} }
} }
private double getNearestVillagerDistanceSquared(Location location)
{
double nearest = Double.NaN;
for (Entity entity : getGame().GetPlayers(true))
{
double distance = entity.getLocation().distanceSquared(location);
nearest = Double.isNaN(nearest) ? distance : Math.min(nearest, distance);
}
for (Entity entity : getNpcs())
{
double distance = entity.getLocation().distanceSquared(location);
nearest = Double.isNaN(nearest) ? distance : Math.min(nearest, distance);
}
return nearest;
}
public Random getRandom() public Random getRandom()
{ {
return _random; return _random;

View File

@ -33,7 +33,7 @@ public class PerkRevealer extends Perk implements IThrown
public PerkRevealer() public PerkRevealer()
{ {
super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Emerald to " + C.cGreen + "throw Revealer"}); super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Emerald to " + C.cGreen + "Throw Revealer"});
} }
@EventHandler @EventHandler

View File

@ -26,25 +26,25 @@ import java.util.*;
public class PerkSmokebomb extends Perk public class PerkSmokebomb extends Perk
{ {
private final Set<Material> activatorTypes; private final Set<Material> activatorTypes;
private final int blindnessDuration; private final int effectDuration;
private final boolean itemConsumed; private final boolean itemConsumed;
public PerkSmokebomb(Material activatorType, int blindnessDuration, boolean itemConsumed) public PerkSmokebomb(Material activatorType, int effectDuration, boolean itemConsumed)
{ {
this(activatorType, blindnessDuration, itemConsumed, C.cYellow + "Right-Click" + C.cGray + " to " + C.cGreen + "Smoke Bomb"); this(activatorType, effectDuration, itemConsumed, C.cYellow + "Right-Click" + C.cGray + " to " + C.cGreen + "Smoke Bomb");
} }
public PerkSmokebomb(Material activatorType, int blindnessDuration, boolean itemConsumed, String... description) public PerkSmokebomb(Material activatorType, int effectDuration, boolean itemConsumed, String... description)
{ {
this(EnumSet.of(activatorType), blindnessDuration, itemConsumed, description); this(EnumSet.of(activatorType), effectDuration, itemConsumed, description);
} }
public PerkSmokebomb(Set<Material> activatorTypes, int blindnessDuration, boolean itemConsumed, String... description) public PerkSmokebomb(Set<Material> activatorTypes, int effectDuration, boolean itemConsumed, String... description)
{ {
super("Smoke Bomb", description); super("Smoke Bomb", description);
this.activatorTypes = activatorTypes; this.activatorTypes = activatorTypes;
this.blindnessDuration = blindnessDuration; this.effectDuration = effectDuration;
this.itemConsumed = itemConsumed; this.itemConsumed = itemConsumed;
} }
@ -53,9 +53,9 @@ public class PerkSmokebomb extends Perk
return activatorTypes; return activatorTypes;
} }
public int getBlindnessDuration() public int geteffectDuration()
{ {
return blindnessDuration; return effectDuration;
} }
public boolean isItemConsumed() public boolean isItemConsumed()
@ -90,7 +90,7 @@ public class PerkSmokebomb extends Perk
} }
//Action //Action
Manager.GetCondition().Factory().Cloak(GetName(), player, player, 8, false, false); //Manager.GetCondition().Factory().Cloak(GetName(), player, player, 8, false, false);
//Manager.GetCondition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, false, true); //Manager.GetCondition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, false, true);
//Blind //Blind
@ -99,7 +99,8 @@ public class PerkSmokebomb extends Perk
if (other.equals(player)) if (other.equals(player))
continue; continue;
Manager.GetCondition().Factory().Blind(GetName(), other, player, getBlindnessDuration(), 0, false, false, true); Manager.GetCondition().Factory().Blind(GetName(), other, player, geteffectDuration(), 0, false, false, true);
Manager.GetCondition().Factory().Slow(GetName(), other, player, geteffectDuration(), 1, false, false, true, false);
} }
//Effects //Effects