- Added 3 kits for DMT

- Added achievement kit for OITQ/Sneaky Assassins/DMT
- Fixed stats/achievements not working (Keen Eye, I See You, Incompetence, DMT Wins)
- Various improvements/fixes for Champions
- Nerfed trollability of Digger kit in DE
This commit is contained in:
Chiss 2014-11-04 19:17:06 +11:00
parent ab62708883
commit f6df7705b1
37 changed files with 1271 additions and 113 deletions

View File

@ -22,6 +22,11 @@ public class UtilAlg
return sortedSet;
}
public static Location getMidpoint(Location a, Location b)
{
return a.add(b.subtract(a).multiply(0.5));
}
public static Vector getTrajectory(Entity from, Entity to)
{
return getTrajectory(from.getLocation().toVector(), to.getLocation().toVector());
@ -179,4 +184,6 @@ public class UtilAlg
{
return cross(vec, getRight(vec));
}
}

View File

@ -172,7 +172,7 @@ public enum Achievement
DRAW_MY_THING_PURE_LUCK("Pure Luck", 800,
new String[]{"Draw My Thing.PureLuck"},
new String[]{"Guess a word in the first 5 seconds"},
new String[]{"Guess a word in the first 8 seconds"},
new int[]{1},
AchievementCategory.DRAW_MY_THING),
@ -492,14 +492,14 @@ public enum Achievement
SNEAK_ASSASSINS_INCOMPETENCE("Incompetence", 600,
new String[]{"Sneaky Assassins.Incompetence"},
new String[]{"Kill 500 NPCs."},
new int[]{500},
new String[]{"Kill 200 NPCs."},
new int[]{200},
AchievementCategory.SNEAKY_ASSASSINS),
SNEAK_ASSASSINS_I_SEE_YOU("I See You", 800,
new String[]{"Sneaky Assassins.ISeeYou"},
new String[]{"Reveal 250 players."},
new int[]{250},
new String[]{"Reveal 50 players."},
new int[]{50},
AchievementCategory.SNEAKY_ASSASSINS),
//Micro Battle

View File

@ -45,7 +45,7 @@ public class AntiHack extends MiniPlugin
public static AntiHack Instance;
private boolean _enabled = true;
private boolean _strict = true;
private boolean _strict = false;
private boolean _kick = true;
public Punish Punish;

View File

@ -0,0 +1,25 @@
package mineplex.core.data;
import org.bukkit.block.Block;
import org.bukkit.Material;
public class BlockData
{
public Block Block;
public Material Material;
public byte Data;
public long Time;
public BlockData(Block block)
{
Block = block;
Material = block.getType();
Data = block.getData();
Time = System.currentTimeMillis();
}
public void restore()
{
Block.setTypeIdAndData(Material.getId(), Data, true);
}
}

View File

@ -3,6 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -10,6 +11,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -18,6 +20,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -128,7 +131,6 @@ public class ArcticArmor extends Skill
continue;
}
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType());
UtilServer.getServer().getPluginManager().callEvent(trigger);
@ -177,6 +179,44 @@ public class ArcticArmor extends Skill
}
}
@EventHandler
public void Damage(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : UtilServer.getPlayers())
{
if (cur.getGameMode() != GameMode.SURVIVAL)
continue;
if (cur.getEyeLocation().getBlock().getType() == Material.ICE)
{
Player damager = null;
double closest = 0;
for (Player player : _active)
{
if (player.equals(cur))
continue;
double dist = UtilMath.offset(player, cur);
if (dist < 5 && (damager == null || dist < closest))
{
damager = player;
closest = dist;
}
}
//Damage Event
Factory.Damage().NewDamageEvent(cur, damager, null,
DamageCause.CUSTOM, 2, false, true, false,
damager == null ? null : damager.getName(), "Arctic Ice");
}
}
}
@EventHandler
public void Slow(UpdateEvent event)
{

View File

@ -13,6 +13,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
@ -28,11 +29,13 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
@ -42,6 +45,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
@ -1567,6 +1571,42 @@ public class Bridge extends TeamGame implements OreObsfucation
{
if (!_bridgesDown)
{
if (!event.getToBlock().getRelative(BlockFace.UP).equals(event.getBlock()))
{
event.setCancelled(true);
}
}
}
// @EventHandler
// public void liquidBlockDeny(BlockBreakEvent event)
// {
// if (_bridgesDown)
// return;
//
// if (!IsAlive(event.getPlayer()))
// return;
//
// if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || event.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP).isLiquid())
// {
// UtilPlayer.message(event.getPlayer(), F.main("Game",
// "Cannot tunnel under liquids."));
//
// event.setCancelled(true);
// }
// }
@EventHandler
public void boatDeny(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOAT))
{
UtilPlayer.message(event.getPlayer(), F.main("Game",
"You cannot place boats."));
event.setCancelled(true);
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
@ -20,7 +21,9 @@ import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsDominate extends Domination
{
@ -60,6 +63,8 @@ public class ChampionsDominate extends Domination
EloRanking = false;
EloStart = 1000;
this.DisableKillCommand = false;
registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination"),
new ElectrocutionStatTracker(this),
@ -94,4 +99,24 @@ public class ChampionsDominate extends Domination
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void InventoryDamageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!IsAlive(player))
return;
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
return;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
player.closeInventory();
}
}

View File

@ -2,11 +2,14 @@ package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
@ -58,6 +61,8 @@ public class ChampionsTDM extends TeamDeathmatch
InventoryOpenChest = true;
this.DisableKillCommand = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
@ -94,4 +99,24 @@ public class ChampionsTDM extends TeamDeathmatch
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void InventoryDamageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!IsAlive(player))
return;
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
return;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
player.closeInventory();
}
}

View File

@ -22,6 +22,7 @@ import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
public class CapturePoint
@ -87,7 +88,7 @@ public class CapturePoint
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
{
Block block = loc.getBlock().getRelative(x, -1, z);
block.setType(Material.GLASS);
block.setType(Material.STAINED_GLASS);
}
//Iron
@ -164,7 +165,6 @@ public class CapturePoint
return;
}
//Capture
if (teamB == null)
Capture(teamA, playersA.size(), playersA);
@ -193,13 +193,12 @@ public class CapturePoint
_floor.add(block);
block.setData((byte)0);
setWoolColor(block, null, false);
}
//Set Uncaptured
if (_captureAmount == 0)
{
_captured = false;
_owner = null;
//Indicators
@ -225,8 +224,7 @@ public class CapturePoint
_captureFloor.add(block);
if (_owner.GetColor() == ChatColor.RED) block.setData((byte)14);
else block.setData((byte)11);
setWoolColor(block, _owner.GetColor(), false);
}
//Effect
@ -274,8 +272,7 @@ public class CapturePoint
_captureFloor.add(block);
if (team.GetColor() == ChatColor.RED) block.setData((byte)14);
else block.setData((byte)11);
setWoolColor(block, team.GetColor(), false);
}
//Set Fully Captured
@ -284,7 +281,6 @@ public class CapturePoint
_captured = true;
//Firework
Firework(_loc, color, true);
//Indicators
@ -294,6 +290,9 @@ public class CapturePoint
else block.setData((byte)11);
}
//Center
setWoolColor(_loc.getBlock().getRelative(0, -2, 0), _owner.GetColor(), true);
//Reward Gems
if (capturers != null)
{
@ -331,7 +330,7 @@ public class CapturePoint
_floor.add(block);
block.setData((byte)0);
setWoolColor(block, null, false);
}
//Set Uncaptured
@ -340,6 +339,9 @@ public class CapturePoint
_captured = false;
_owner = team;
//Center
setWoolColor(_loc.getBlock().getRelative(0, -2, 0), null, true);
//Indicators
for (Block block : _indicators)
{
@ -364,6 +366,28 @@ public class CapturePoint
}
private void setWoolColor(Block block, ChatColor color, boolean glassOnly)
{
if (color == null)
{
if (!glassOnly)
block.setData((byte)0);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)0, true);
}
else if (color == ChatColor.RED)
{
if (!glassOnly)
block.setData((byte)14);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)14, true);
}
else
{
if (!glassOnly)
block.setData((byte)11);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)11, true);
}
}
public void Firework(Location loc, Color color, boolean major)
{
if (!major)

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.dragonescape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
@ -35,12 +36,14 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -94,6 +97,8 @@ public class DragonEscape extends SoloGame
private double _speedMult = 1;
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
public DragonEscape(ArcadeManager manager)
{
super(manager, GameType.DragonEscape,
@ -103,7 +108,7 @@ public class DragonEscape extends SoloGame
new KitLeaper(manager),
new KitDisruptor(manager),
new KitWarper(manager),
new KitTunneler(manager),
new KitDigger(manager),
},
new String[]
@ -553,6 +558,12 @@ public class DragonEscape extends SoloGame
if (!player.getInventory().contains(Material.DIAMOND_PICKAXE))
return;
if (!UtilTime.elapsed(GetStateTime(), 10000))
{
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
return;
}
if (!Recharge.Instance.use(player, "Tunneler", 100, false, false))
return;
@ -560,7 +571,9 @@ public class DragonEscape extends SoloGame
player.getInventory().addItem(new ItemStack(event.getBlock().getType()));
Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 3000);
_tunneled.put(new BlockData(event.getBlock()), player);
Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 2400);
UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1);
}
@ -573,6 +586,28 @@ public class DragonEscape extends SoloGame
Manager.GetBlockRestore().Add(event.getBlock(),
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 3000);
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
}
@EventHandler
public void TunnelerUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<BlockData> tunnelIterator = _tunneled.keySet().iterator();
while (tunnelIterator.hasNext())
{
BlockData data = tunnelIterator.next();
if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400))
tunnelIterator.remove();
else
for (Player other : UtilServer.getPlayers())
if (!other.equals(_tunneled.get(data)))
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
}
}
}

View File

@ -12,9 +12,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitTunneler extends Kit
public class KitDigger extends Kit
{
public KitTunneler(ArcadeManager manager)
public KitDigger(ArcadeManager manager)
{
super(manager, "Digger", KitAvailability.Achievement, 5000,

View File

@ -1,9 +1,11 @@
package nautilus.game.arcade.game.games.draw;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -16,6 +18,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -25,6 +28,8 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -43,8 +48,10 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.game.games.draw.kits.KitPlayer;
import nautilus.game.arcade.game.games.draw.kits.*;
import nautilus.game.arcade.game.games.draw.tools.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KeenEyeStatTracker;
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
@ -76,6 +83,7 @@ public class Draw extends SoloGame
private Collection<Block> _textBlocks = null;
private HashSet<Tool> _tools;
private String[] _words;
private HashSet<String> _usedWords = new HashSet<String>();
@ -85,7 +93,9 @@ public class Draw extends SoloGame
new Kit[]
{
new KitPlayer(manager),
new KitSlowAndSteady(manager),
new KitSelector(manager),
new KitTools(manager),
},
new String[]
@ -105,6 +115,11 @@ public class Draw extends SoloGame
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Crack", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
};
_tools = new HashSet<Tool>();
_tools.add(new ToolLine(this));
_tools.add(new ToolSquare(this));
_tools.add(new ToolCircle(this));
registerStatTrackers(
new MrSquiggleStatTracker(this),
new KeenEyeStatTracker(this),
@ -193,6 +208,10 @@ public class Draw extends SoloGame
if (event.getType() != UpdateType.FAST)
return;
//Word Selection
if (_round != null && !_round.ChooseWordUpdate())
return;
//End Round
if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true))))
{
@ -223,6 +242,7 @@ public class Draw extends SoloGame
EndCheck();
}
//Reset Round
if ((_round == null && UtilTime.elapsed(_roundTime, 5000) && !_roundPlayer.isEmpty()))
{
Reset();
@ -232,13 +252,8 @@ public class Draw extends SoloGame
_guessers.RemovePlayer(drawer);
_drawers.AddPlayer(drawer, true);
//Get Word
String word = _words[UtilMath.r(_words.length)];
while (!_usedWords.add(word))
word = _words[UtilMath.r(_words.length)];
//Create Round
_round = new DrawRound(this, drawer, word);
_round = new DrawRound(this, drawer);
//Prep Drawer
drawer.teleport(_drawerLocation);
@ -249,15 +264,31 @@ public class Draw extends SoloGame
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush"));
if (GetKit(drawer) instanceof KitTools)
{
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "Line Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
}
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
UtilPlayer.message(drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + _round.Word);
}
}
public String GetWord()
{
//Get Word
String word = _words[UtilMath.r(_words.length)];
while (!_usedWords.add(word))
word = _words[UtilMath.r(_words.length)];
return word;
}
@EventHandler(priority = EventPriority.LOWEST)
public void Guess(AsyncPlayerChatEvent event)
{
@ -267,6 +298,9 @@ public class Draw extends SoloGame
if (_round == null)
return;
if (!_round.IsReady())
return;
Player player = event.getPlayer();
if (event.getMessage().toLowerCase().contains(_round.Word.toLowerCase()))
@ -318,15 +352,21 @@ public class Draw extends SoloGame
if (_round == null)
return;
if (!_round.IsReady())
{
UtilTextBottom.displayProgress(C.Bold + "Word Selection", _round.GetTimePercent(), _round.GetTimeString(), UtilServer.getPlayers());
return;
}
for (Player player : UtilServer.getPlayers())
{
if (_drawers.HasPlayer(player))
{
UtilTextBottom.displayProgress(C.Bold + "Draw " + _round.Word, _round.GetTimePercent(), player);
UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Draw: " + ChatColor.RESET + _round.Word, _round.GetTimePercent(), _round.GetTimeString(), player);
}
else
{
UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Clue " + ChatColor.RESET + C.Bold + _round.GetRevealedWord(), _round.GetTimePercent(), player);
UtilTextBottom.display(_round.GetRevealedWord() + C.cYellow + C.Bold + " HINT " + ChatColor.RESET + _round.GetTimeString(), player);
}
}
}
@ -357,6 +397,29 @@ public class Draw extends SoloGame
}
}
@EventHandler
public void toolStart(PlayerInteractEvent event)
{
if (!IsLive())
return;
for (Tool tool : _tools)
tool.start(event);
}
@EventHandler
public void toolUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (Tool tool : _tools)
tool.update();
}
@EventHandler
public void Paint(UpdateEvent event)
{
@ -368,6 +431,9 @@ public class Draw extends SoloGame
for (Player player : _drawers.GetPlayers(true))
{
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD) && !UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
continue;
if (!player.isBlocking())
{
_brushPrevious = null;
@ -433,7 +499,6 @@ public class Draw extends SoloGame
}
}
@EventHandler
public void PaintReset(PlayerInteractEvent event)
{
@ -582,6 +647,40 @@ public class Draw extends SoloGame
}
}
@Override
public List<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
SortScores();
//Set Places
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
places.add(i, _ranks.get(i).Player);
if (places.isEmpty() || !places.get(0).isOnline())
return Arrays.asList();
else
return Arrays.asList(places.get(0));
}
else
return null;
}
@Override
public List<Player> getLosers()
{
List<Player> losers = getWinners();
if (losers == null)
return null;
losers.remove(0);
return losers;
}
@Override
public void EndCheck()
{
@ -653,4 +752,44 @@ public class Draw extends SoloGame
Scoreboard.Draw();
}
@EventHandler
public void selectionInput(PlayerCommandPreprocessEvent event)
{
if (!event.getMessage().startsWith("/selectword "))
return;
event.setCancelled(true);
if (_round == null)
return;
if (!_round.Drawer.equals(event.getPlayer()))
return;
if (event.getMessage().length() <= 12)
return;
_round.WordClicked(event.getMessage().substring(12));
}
public ArrayList<Block> getCanvas()
{
return _canvas;
}
public boolean isDrawer(Player player)
{
return _drawers.HasPlayer(player);
}
public byte getColor()
{
return _brushColor;
}
public void setLock(boolean b)
{
_lockDrawer = b;
}
}

View File

@ -3,13 +3,23 @@ package nautilus.game.arcade.game.games.draw;
import java.util.ArrayList;
import java.util.HashSet;
import nautilus.game.arcade.game.games.draw.kits.KitSelector;
import nautilus.game.arcade.game.games.draw.kits.KitSlowAndSteady;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
public class DrawRound
@ -21,20 +31,68 @@ public class DrawRound
public int Revealed = 0;
public boolean[] WordReveal;
public long Time;
public double TimeMax = 50;
public double TimeMax;
public double TimeChooseMax = 10;
public HashSet<String> Guessed = new HashSet<String>();
public ArrayList<String> WordChoices;
public DrawRound(Draw draw, Player player, String word)
public DrawRound(Draw draw, Player player)
{
Host = draw;
Drawer = player;
Word = word;
Time = System.currentTimeMillis();
//Kit Modification
Kit kit = draw.GetKit(player);
//Time
if (kit != null && kit instanceof KitSlowAndSteady)
TimeMax = 60;
else
TimeMax = 50;
//Word
if (kit != null && kit instanceof KitSelector)
{
WordChoices = new ArrayList<String>();
while (WordChoices.size() < 3)
WordChoices.add(draw.GetWord());
//Inform
UtilTextMiddle.display("Select Your Word", "Click on a word in Chat", 20, 60, 10, player);
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGreen + C.Bold + "Select Your Word");
for (int i=0 ; i<WordChoices.size() ; i++)
{
ChildJsonMessage message = new JsonMessage("").color("white").extra("").color("white");
message.add("Option " + i + ": ").color("yellow");
message.add(WordChoices.get(i)).color("white").bold().click("run_command", "/selectword " + WordChoices.get(i)).hover("show_text", "Select " + WordChoices.get(i));
message.sendToPlayer(player);
}
Word = null;
}
else
{
SetWord(draw.GetWord());
}
}
public void SetWord(String word)
{
Word = word;
WordReveal = new boolean[word.length()];
for (int i=0 ; i< WordReveal.length ; i++)
WordReveal[i] = false;
Time = System.currentTimeMillis();
UtilPlayer.message(Drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + Word);
}
public boolean Guessed(Player player)
@ -115,7 +173,18 @@ public class DrawRound
public double GetTimePercent()
{
return (TimeMax - (double)(System.currentTimeMillis()-Time)/1000d)/45d;
if (!IsReady())
return (TimeChooseMax - (double)(System.currentTimeMillis()-Time)/1000d)/TimeChooseMax;
return (TimeMax - (double)(System.currentTimeMillis()-Time)/1000d)/TimeMax;
}
public String GetTimeString()
{
if (!IsReady())
return UtilTime.MakeStr((long)(TimeChooseMax*1000 - (double)(System.currentTimeMillis()-Time)));
return UtilTime.MakeStr((long)(TimeMax*1000 - (double)(System.currentTimeMillis()-Time)));
}
public boolean AllGuessed(ArrayList<Player> players)
@ -131,4 +200,37 @@ public class DrawRound
{
return Drawer;
}
public boolean ChooseWordUpdate()
{
if (Word == null && UtilTime.elapsed(Time, (long)(TimeChooseMax*1000)))
{
if (WordChoices.isEmpty())
{
SetWord(Host.GetWord());
}
else
{
SetWord(UtilAlg.Random(WordChoices));
}
}
return IsReady();
}
public boolean IsReady()
{
return Word != null;
}
public void WordClicked(String string)
{
if (IsReady())
return;
if (WordChoices.contains(string))
{
SetWord(string);
}
}
}

View File

@ -8,15 +8,15 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitPlayer extends Kit
public class KitSelector extends Kit
{
public KitPlayer(ArcadeManager manager)
public KitSelector(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
super(manager, "Selector", KitAvailability.Gem, 4000,
new String[]
{
""
"Choose from one of three words to draw!"
},
new Perk[]

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.draw.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitSlowAndSteady extends Kit
{
public KitSlowAndSteady(ArcadeManager manager)
{
super(manager, "Extra Time", KitAvailability.Free,
new String[]
{
"Receive +10 Seconds to draw!"
},
new Perk[]
{
},
EntityType.SKELETON,
new ItemStack(Material.WATCH));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.game.games.draw.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import mineplex.core.achievement.Achievement;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitTools extends Kit
{
public KitTools(ArcadeManager manager)
{
super(manager, "Tools", KitAvailability.Achievement,
new String[]
{
"Can draw lines, circles and squares!"
},
new Perk[]
{
},
EntityType.SKELETON,
null);
this.setAchievementRequirements(new Achievement[]
{
Achievement.DRAW_MY_THING_KEEN_EYE,
Achievement.DRAW_MY_THING_MR_SQUIGGLE,
Achievement.DRAW_MY_THING_PURE_LUCK,
Achievement.DRAW_MY_THING_WINS,
});
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.game.games.draw.tools;
import java.util.HashMap;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;
public abstract class Tool
{
protected Draw Host;
protected Player _drawer;
protected Block _start;
protected Material _material;
protected HashMap<Block, Byte> _past = new HashMap<Block, Byte>();
protected HashMap<Block, Byte> _new = new HashMap<Block, Byte>();
public Tool(Draw host, Material mat)
{
Host = host;
_material = mat;
}
public void start(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
Block block = event.getPlayer().getTargetBlock(null, 60);
if (block == null)
return;
if (!Host.getCanvas().contains(block))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), _material))
return;
_drawer = event.getPlayer();
_start = block;
Host.setLock(false);
}
public void update()
{
if (_start == null || _drawer == null)
return;
if (!_drawer.isOnline() || !Host.isDrawer(_drawer) || !_drawer.isBlocking())
{
_drawer = null;
_start = null;
_past.clear();
return;
}
_new = new HashMap<Block, Byte>();
//Calculate New
Block end = _drawer.getTargetBlock(null, 64);
if (end != null && Host.getCanvas().contains(end))
{
customDraw(end);
}
//Remove Old
for (Block block : _past.keySet())
{
if (!_new.containsKey(block))
block.setData(_past.get(block));
}
_past = _new;
_new = null;
for (Player other : UtilServer.getPlayers())
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
}
public abstract void customDraw(Block end);
}

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolCircle extends Tool
{
public ToolCircle(Draw host)
{
super(host, Material.DIAMOND_SWORD);
}
public void customDraw(Block end)
{
Location mid = UtilAlg.getMidpoint(_start.getLocation().add(0.5, 0.5, 0.5), end.getLocation().add(0.5, 0.5, 0.5));
double height = Math.max(_start.getY(), end.getY()) - mid.getY();
boolean planeIsZ = _start.getZ() == end.getZ();
double width = Math.max(_start.getX(), end.getX()) - mid.getX();
if (!planeIsZ)
width = Math.max(_start.getZ(), end.getZ()) - mid.getZ();
for (double i=0 ; i<Math.PI*2 ; i += 0.05)
{
double horizontal = Math.sin(i) * width;
double vertical = Math.cos(i) * height + 0.4;
color(mid.clone().add(planeIsZ ? horizontal : 0, vertical, planeIsZ ? 0 : horizontal));
}
}
public void color(Location loc)
{
Block block = loc.getBlock();
if (_new.containsKey(block))
return;
if (!Host.getCanvas().contains(block))
return;
byte color = block.getData();
if (_past.containsKey(block))
color = _past.get(block);
_new.put(block, color);
block.setData(Host.getColor());
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolLine extends Tool
{
public ToolLine(Draw host)
{
super(host, Material.STONE_SWORD);
}
public void customDraw(Block end)
{
Location loc = _start.getLocation().add(0.5, 0.5, 0.5);
while (UtilMath.offset(loc, end.getLocation().add(0.5, 0.5, 0.5)) > 0.5)
{
loc.add(UtilAlg.getTrajectory(loc, end.getLocation().add(0.5, 0.5, 0.5)).multiply(0.5));
Block lineBlock = loc.getBlock();
if (_new.containsKey(lineBlock))
continue;
if (!Host.getCanvas().contains(lineBlock))
continue;
byte color = lineBlock.getData();
if (_past.containsKey(lineBlock))
color = _past.get(lineBlock);
_new.put(lineBlock, color);
lineBlock.setData(Host.getColor());
}
}
}

View File

@ -0,0 +1,82 @@
package nautilus.game.arcade.game.games.draw.tools;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolSquare extends Tool
{
public ToolSquare(Draw host)
{
super(host, Material.GOLD_SWORD);
}
public void customDraw(Block end)
{
Location upper = new Location(end.getWorld(), Math.max(_start.getX(), end.getX()), Math.max(_start.getY(), end.getY()), Math.max(_start.getZ(), end.getZ()));
upper.add(0.5, 0.5, 0.5);
Location lower = new Location(end.getWorld(), Math.min(_start.getX(), end.getX()), Math.min(_start.getY(), end.getY()), Math.min(_start.getZ(), end.getZ()));
lower.add(0.5, 0.5, 0.5);
Location cur = upper.clone();
//Decrease
while (cur.getX() > lower.getX())
{
cur.setX(cur.getX() - 1);
color(cur);
}
while (cur.getY() > lower.getY())
{
cur.setY(cur.getY() - 1);
color(cur);
}
while (cur.getZ() > lower.getZ())
{
cur.setZ(cur.getZ() - 1);
color(cur);
}
//Increase
while (cur.getX() < upper.getX())
{
cur.setX(cur.getX() + 1);
color(cur);
}
while (cur.getY() < upper.getY())
{
cur.setY(cur.getY() + 1);
color(cur);
}
while (cur.getZ() < upper.getZ())
{
cur.setZ(cur.getZ() + 1);
color(cur);
}
}
public void color(Location loc)
{
Block block = loc.getBlock();
if (_new.containsKey(block))
return;
if (!Host.getCanvas().contains(block))
return;
byte color = block.getData();
if (_past.containsKey(block))
color = _past.get(block);
_new.put(block, color);
block.setData(Host.getColor());
}
}

View File

@ -25,6 +25,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -53,7 +54,8 @@ public class Quiver extends SoloGame
{
new KitLeaper(manager),
new KitBrawler(manager),
new KitElementalist(manager),
new KitEnchanter(manager),
new KitSlamShot(manager)
},
new String[]
@ -148,8 +150,20 @@ public class Quiver extends SoloGame
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null) return;
int amount = 1;
if (GetKit(player) instanceof KitSlamShot)
{
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null))
{
amount = 2;
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 3f, 0.75f);
}
}
//New Arrow
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
//Score

View File

@ -16,9 +16,9 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitElementalist extends Kit
public class KitEnchanter extends Kit
{
public KitElementalist(ArcadeManager manager)
public KitEnchanter(ArcadeManager manager)
{
super(manager, "Enchanter", KitAvailability.Gem, 5000,

View File

@ -29,7 +29,7 @@ public class KitLeaper extends Kit
new Perk[]
{
new PerkDoubleJump("Double Jump", 0.9, 0.9, true)
new PerkSeismicSlam()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
@ -39,7 +39,7 @@ public class KitLeaper extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.quiver.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitSlamShot extends Kit
{
public KitSlamShot(ArcadeManager manager)
{
super(manager, "Slam Shooter", KitAvailability.Achievement,
new String[]
{
"Gets 2 arrows for killing slammed players!"
},
new Perk[]
{
new PerkSeismicSlamOITQ()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SPADE));
this.setAchievementRequirements(new Achievement[]
{
Achievement.OITQ_PERFECTIONIST,
Achievement.OITQ_SHARPSHOOTER,
Achievement.OITQ_WHATS_A_BOW,
Achievement.OITQ_WINS,
});
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
}
}

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.game.games.sneakyassassins;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.*;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import mineplex.minecraft.game.core.combat.event.*;
@ -54,7 +56,8 @@ public class SneakyAssassins extends SoloGame
new Kit[]{
new KitEscapeArtist(manager, EntityType.VILLAGER),
new KitAssassin(manager, EntityType.VILLAGER),
new KitRevealer(manager, EntityType.VILLAGER)
new KitRevealer(manager, EntityType.VILLAGER),
new KitBriber(manager, EntityType.VILLAGER),
},
new String[]
{
@ -286,7 +289,25 @@ public class SneakyAssassins extends SoloGame
public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() instanceof Villager)
{
event.setCancelled(true);
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.EMERALD))
{
if (!Recharge.Instance.use(event.getPlayer(), "Bribe Villager", 4000, true, true))
return;
_npcManager.setBribed(event.getRightClicked(), event.getPlayer());
UtilInv.remove(event.getPlayer(), Material.EMERALD, (byte)0, 1);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You used " + F.elem("Bribe Villager") + "."));
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.VILLAGER_YES, 1f, 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, event.getRightClicked().getLocation().add(0, 1, 0), 0.3f, 0.5f, 0.3f, 0, 10);
}
}
}
@EventHandler(ignoreCancelled = true)

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.sneakyassassins.kits;
import mineplex.core.common.util.*;
import mineplex.core.itemstack.*;
import nautilus.game.arcade.*;
import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.inventory.*;
public class KitBriber extends SneakyAssassinKit
{
public KitBriber(ArcadeManager manager, EntityType disguiseType)
{
super(manager, "Briber", KitAvailability.Achievement,
new String[]
{
"Pay Villagers to attack other players!"
},
new Perk[]
{
new PerkSmokebomb(Material.INK_SACK, 3, true),
//new PerkBriber(),
},
new ItemStack(Material.EMERALD),
disguiseType);
}
@Override
public void GiveItems(Player player)
{
super.GiveItems(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 4,
C.cYellow + C.Bold + "Right-Click Villager" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bribe Villager",
new String[]
{
ChatColor.RESET + "Pay a villager to help you.",
ChatColor.RESET + "It will attack the nearest",
ChatColor.RESET + "enemy for 15 seconds.",
}));
}
}

View File

@ -33,7 +33,7 @@ public class KitRevealer extends SneakyAssassinKit
{
super.GiveItems(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 3,
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 3,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reveal Assassins",
new String[]
{

View File

@ -0,0 +1,16 @@
package nautilus.game.arcade.game.games.sneakyassassins.npc;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class BribedData
{
public Player Player;
public Location LastLocation;
public long LastTime;
public BribedData(Player player)
{
Player = player;
}
}

View File

@ -12,6 +12,7 @@ import org.bukkit.block.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.plugin.*;
import java.util.*;
@ -22,6 +23,8 @@ public class NpcManager implements Listener
private final Random _random;
private EntityType _disguiseType = EntityType.VILLAGER;
private NautHashMap<Entity, BribedData> _bribed = new NautHashMap<Entity, BribedData>();
public NpcManager(SneakyAssassins sneakyAssassins, Random random)
{
_sneakyAssassins = sneakyAssassins;
@ -66,7 +69,7 @@ public class NpcManager implements Listener
return;
if (getGame().GetState() == Game.GameState.Live || getGame().GetState() == Game.GameState.Prepare)
bustle();
move();
}
@EventHandler
@ -91,12 +94,20 @@ public class NpcManager implements Listener
{
event.setDroppedExp(0);
event.getDrops().clear();
_bribed.remove(event.getEntity());
}
public void bustle()
public void move()
{
for (Entity npc : getNpcs())
{
if (_bribed.containsKey(npc))
{
if (bribedLogic(npc))
continue;
}
if (getRandom().nextInt(40) == 0)
{
List<Location> nearby = new ArrayList<>();
@ -136,6 +147,68 @@ public class NpcManager implements Listener
}
}
private boolean bribedLogic(Entity npc)
{
if (!(npc instanceof LivingEntity))
return false;
BribedData data = _bribed.get(npc);
if (data == null)
return false;
Player bestTarget = null;
double bestDist = 0;
for (Player other : _sneakyAssassins.GetPlayers(true))
{
if (data.Player.equals(other))
continue;
double dist = UtilMath.offset(npc, other);
if (bestTarget == null || dist < bestDist)
{
bestTarget = other;
bestDist = dist;
}
}
if (bestTarget == null)
return false;
//Move
UtilEnt.CreatureMove(npc, bestTarget.getLocation().add(UtilAlg.getTrajectory(bestTarget, npc)), 0.8f);
//Stuck
if (data.LastLocation == null)
data.LastLocation = npc.getLocation();
if (UtilMath.offset(npc.getLocation(), data.LastLocation) > 1.5)
{
data.LastLocation = npc.getLocation();
data.LastTime = System.currentTimeMillis();
}
else
{
if (UtilTime.elapsed(data.LastTime, 800))
{
UtilAction.velocity(npc, 0.3, 0.3, 0.7, true);
}
}
if (UtilMath.offset(npc, bestTarget) < 1.5)
{
//Damage Event
_sneakyAssassins.Manager.GetDamage().NewDamageEvent(bestTarget, (LivingEntity)npc, null,
DamageCause.CUSTOM, 2, true, false, false,
data.Player.getName(), data.Player.getName() + "'s Bribed Villager");
npc.getWorld().playSound(npc.getLocation(), Sound.VILLAGER_NO, 1f, 1f);
}
return true;
}
public Random getRandom()
{
return _random;
@ -155,4 +228,9 @@ public class NpcManager implements Listener
{
_disguiseType = disguiseType;
}
public void setBribed(Entity ent, Player player)
{
_bribed.put(ent, new BribedData(player));
}
}

View File

@ -26,7 +26,6 @@ public class KitSmasher extends Kit
new Perk[]
{
new PerkMammoth(),
new PerkSeismicSlamHG()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));

View File

@ -74,12 +74,6 @@ public class PerkLazer extends Perk
if (!Kit.HasKit(player))
return;
if (!UtilEnt.isGrounded(player))
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne."));
return;
}
if (!Recharge.Instance.use(player, GetName(), _recharge, true, true))
return;

View File

@ -52,7 +52,7 @@ public class PerkRevealer extends Perk implements IThrown
private static final FireworkEffect REVEALER_FIREWORK_EFFECT = FireworkEffect
.builder()
.flicker(false)
.withColor(Color.GREEN)
.withColor(Color.AQUA)
.with(FireworkEffect.Type.BALL_LARGE)
.trail(false)
.build();
@ -72,7 +72,7 @@ public class PerkRevealer extends Perk implements IThrown
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 Diamond to " + C.cGreen + "Throw Revealer"});
}
@EventHandler
@ -84,7 +84,7 @@ public class PerkRevealer extends Perk implements IThrown
if (event.getPlayer().getItemInHand() == null)
return;
if (event.getPlayer().getItemInHand().getType() != Material.EMERALD)
if (event.getPlayer().getItemInHand().getType() != Material.DIAMOND)
return;
Player player = event.getPlayer();
@ -94,10 +94,10 @@ public class PerkRevealer extends Perk implements IThrown
event.setCancelled(true);
UtilInv.remove(player, Material.EMERALD, (byte) 0, 1);
UtilInv.remove(player, Material.DIAMOND, (byte) 0, 1);
UtilInv.Update(player);
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.EMERALD));
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.DIAMOND));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
}

View File

@ -29,12 +29,12 @@ public class PerkSeismicSlamHG extends Perk
{
super("Ground Pound", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Ground Pound"
C.cYellow + "Right-Click" + C.cGray + " with " + "Sword/Axe" + " to " + C.cGreen + "Ground Pound"
});
}
@EventHandler
public void Leap(PlayerInteractEvent event)
public void skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
@ -48,7 +48,7 @@ public class PerkSeismicSlamHG extends Perk
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE") && !event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD") && !event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();

View File

@ -0,0 +1,96 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlamOITQ extends Perk
{
public PerkSeismicSlamOITQ()
{
super("Ground Pound", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound"
});
}
@EventHandler
public void skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
return;
//Action
double range = 8;
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
continue;
cur.playEffect(EntityEffect.HURT);
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
0.8 * targets.get(cur), true, 0, 0.8 + 1.0 * targets.get(cur), 1.8, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
//Inform
if (cur instanceof Player)
UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + "."));
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -22,6 +22,16 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != Game.GameState.Prepare)
return;
for (Player player : event.GetGame().GetPlayers(true))
_guessAll.add(player);
}
@EventHandler
public void onDrawRoundEnd(DrawRoundEndEvent event)
{

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class KillEntityStatTracker extends StatTracker<Game>
@ -24,23 +25,19 @@ public class KillEntityStatTracker extends StatTracker<Game>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event)
public void onKillingBlow(CustomDamageEvent event)
{
if (event.getEntity().getType() != getEntityType())
if (event.GetDamageeEntity().getType() != getEntityType())
return;
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
if (!event.GetDamageeEntity().isDead())
return;
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) event.getEntity();
Player damager = null;
if (edbee.getDamager() instanceof Player)
damager = (Player) edbee.getDamager();
else if (edbee.getDamager() instanceof Projectile && ((Projectile) edbee.getDamager()).getShooter() instanceof Player)
damager = (Player) ((Projectile) edbee.getDamager()).getShooter();
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (damager != null)
addStat(damager, getStatName(), 1, false, false);
addStat(player, getStatName(), 1, false, false);
}
public String getStatName()

View File

@ -20,7 +20,7 @@ public class PureLuckStatTracker extends StatTracker<Draw>
if (getGame().GetState() != Game.GameState.Live)
return;
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
if (System.currentTimeMillis() - event.getDrawRound().Time < 8000)
addStat(event.getPlayer(), "PureLuck", 1, true, false);
}
}