Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/Mineplex
This commit is contained in:
commit
195e555a6e
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
OWNER("OP", ChatColor.DARK_RED),
|
||||
OWNER("Owner", ChatColor.DARK_RED),
|
||||
DEVELOPER("Dev", ChatColor.RED),
|
||||
ADMIN("Admin", ChatColor.RED),
|
||||
MODERATOR("Mod", ChatColor.GOLD),
|
||||
|
@ -72,6 +72,12 @@ public class F
|
||||
return C.mSkill + elem + C.mBody;
|
||||
}
|
||||
|
||||
public static String skill(String a, String b)
|
||||
{
|
||||
|
||||
return C.cYellow + " " + C.cGreen + b + C.mBody;
|
||||
}
|
||||
|
||||
public static String time(String elem)
|
||||
{
|
||||
return C.mTime + elem + C.mBody;
|
||||
|
@ -1,6 +1,8 @@
|
||||
package mineplex.core.shop.item;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
@ -22,7 +23,9 @@ public class BackStab extends Skill
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Attacks from behind opponents",
|
||||
"deals 4 additional damage."
|
||||
"deals 2 additional damage.",
|
||||
"",
|
||||
C.cGold + "+1 damage per Level"
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,15 +54,15 @@ public class FleshHook extends SkillActive implements IThrown
|
||||
"Release Block to release it.",
|
||||
"",
|
||||
"If Flesh Hook hits a player, it",
|
||||
"deals up to 12 damage, and rips them",
|
||||
"towards you with high velocity.",
|
||||
"deals up to #2#2 damage, and rips them",
|
||||
"towards you with #1.2#0.2 velocity.",
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetEnergyString()
|
||||
{
|
||||
return "Energy: 20 + (5 per 20% Strength)";
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -26,7 +27,7 @@ public interface ISkill
|
||||
SkillType GetSkillType();
|
||||
int GetCost();
|
||||
boolean IsFree();
|
||||
String[] GetDesc();
|
||||
String[] GetDesc(int level);
|
||||
void Reset(Player player);
|
||||
|
||||
Set<Player> GetUsers();
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
||||
@ -19,7 +21,7 @@ public abstract class Skill implements ISkill, Listener
|
||||
//Properties
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
private String[] _descFull;
|
||||
private HashMap<Integer, String[]> _descLevels = new HashMap<Integer, String[]>();
|
||||
|
||||
private ClassType _classType;
|
||||
private SkillType _skillType;
|
||||
@ -107,36 +109,85 @@ public abstract class Skill implements ISkill, Listener
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] GetDesc()
|
||||
public String[] GetDesc(int curLevel)
|
||||
{
|
||||
if (_descFull != null)
|
||||
return _descFull;
|
||||
//Desc of this level has already been generated
|
||||
if (_descLevels.containsKey(curLevel))
|
||||
{
|
||||
return _descLevels.get(curLevel);
|
||||
}
|
||||
|
||||
String recharge = GetRechargeString();
|
||||
String energy = GetEnergyString();
|
||||
//Generate DESC
|
||||
|
||||
if (recharge == null && energy == null)
|
||||
_descFull = _desc;
|
||||
|
||||
ArrayList<String> descFull = new ArrayList<String>();
|
||||
ArrayList<String> descOut = new ArrayList<String>();
|
||||
|
||||
//Parse Desc
|
||||
for (String line : _desc)
|
||||
descFull.add(line);
|
||||
{
|
||||
String newLine = "";
|
||||
|
||||
if (energy != null || recharge != null)
|
||||
descFull.add("");
|
||||
//Check for Level Tokens
|
||||
for (String token : line.split(" "))
|
||||
{
|
||||
if (token.length() <= 0)
|
||||
continue;
|
||||
|
||||
if (energy != null)
|
||||
descFull.add(energy);
|
||||
//Parse Level Token
|
||||
if (token.charAt(0) == '#')
|
||||
{
|
||||
String[] numberToks = token.split("#");
|
||||
|
||||
if (recharge != null)
|
||||
descFull.add(recharge);
|
||||
try
|
||||
{
|
||||
double base = Double.parseDouble(numberToks[0]);
|
||||
double bonus = Double.parseDouble(numberToks[1]);
|
||||
|
||||
_descFull = new String[descFull.size()];
|
||||
for (int i=0 ; i<descFull.size() ; i++)
|
||||
_descFull[i] = descFull.get(i);
|
||||
double levelValue = base + ((double)curLevel * bonus);
|
||||
|
||||
return _descFull;
|
||||
char plusMinus = '+';
|
||||
if (bonus < 0)
|
||||
plusMinus = '-';
|
||||
|
||||
token = C.cYellow + levelValue + C.cGray + " (" + C.cGreen + plusMinus + bonus + C.cGray + ")";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
token = C.cRed + token + C.cGray;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newLine += token + " ";
|
||||
}
|
||||
|
||||
//Remove Space
|
||||
if (newLine.length() > 0)
|
||||
newLine = newLine.substring(0, newLine.length()-1);
|
||||
|
||||
descOut.add(newLine);
|
||||
}
|
||||
|
||||
//Append Energy & Recharge
|
||||
if (GetEnergyString() != null || GetRechargeString() != null)
|
||||
descOut.add("");
|
||||
|
||||
if (GetEnergyString() != null)
|
||||
descOut.add(GetEnergyString());
|
||||
|
||||
if (GetRechargeString() != null)
|
||||
descOut.add(GetRechargeString());
|
||||
|
||||
//Return
|
||||
String[] out = new String[descOut.size()];
|
||||
|
||||
for (int i=0 ; i<descOut.size() ; i++)
|
||||
out[i] = descOut.get(i);
|
||||
|
||||
//Store
|
||||
_descLevels.put(curLevel, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
public String GetEnergyString()
|
||||
|
@ -137,7 +137,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
skillLore.add(C.cBlack);
|
||||
}
|
||||
|
||||
skillLore.addAll(Arrays.asList(skill.GetDesc()));
|
||||
skillLore.addAll(java.util.Arrays.asList(skill.GetDesc(0)));
|
||||
|
||||
for (int i = 0; i < skillLore.size(); i++)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ public class SkillSalesPackage extends SalesPackageBase
|
||||
{
|
||||
public SkillSalesPackage(ISkill skill)
|
||||
{
|
||||
super(skill.GetName(), Material.BOOK, skill.GetDesc());
|
||||
super(skill.GetName(), Material.BOOK, skill.GetDesc(0));
|
||||
SalesPackageId = skill.GetSalesPackageId();
|
||||
Free = skill.IsFree();
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
package nautilus.game.arcade.game;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public abstract class AsymTeamGame extends TeamGame
|
||||
{
|
||||
private HashMap<String, ChatColor> _pastTeams = null;
|
||||
|
||||
public AsymTeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc, HashMap<String, ChatColor> pastTeams)
|
||||
{
|
||||
super(manager, gameType, kits, gameDesc);
|
||||
|
||||
_pastTeams = pastTeams;
|
||||
}
|
||||
|
||||
public HashMap<String, ChatColor> GetPastTeams()
|
||||
{
|
||||
return _pastTeams;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (GetPastTeams() != null)
|
||||
{
|
||||
this.SetCountdown(30);
|
||||
this.SetCountdownForce(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameTeam ChooseTeam(Player player)
|
||||
{
|
||||
//Get Past Team
|
||||
ChatColor pastTeam = null;
|
||||
if (_pastTeams != null)
|
||||
pastTeam = _pastTeams.get(player.getName());
|
||||
|
||||
GameTeam newTeam = null;
|
||||
|
||||
for (int i=0 ; i<GetTeamList().size() ; i++)
|
||||
if (newTeam == null || GetTeamList().get(i).GetSize() < newTeam.GetSize())
|
||||
if (pastTeam == null || GetTeamList().get(i).GetColor() != pastTeam)
|
||||
newTeam = GetTeamList().get(i);
|
||||
|
||||
return newTeam;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -50,7 +51,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.AsymTeamGame;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -72,7 +72,7 @@ public class CastleSiege extends TeamGame
|
||||
private Location _kingLoc;
|
||||
private String _kingName;
|
||||
private Player _kingDamager = null;
|
||||
private int _kingHealth = 30;
|
||||
private int _kingHealth = 40;
|
||||
|
||||
private ArrayList<Location> _peasantSpawns;
|
||||
private ArrayList<Location> _horseSpawns;
|
||||
@ -83,10 +83,11 @@ public class CastleSiege extends TeamGame
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
|
||||
new KitHumanKnight(manager),
|
||||
new KitHumanMarksman(manager),
|
||||
new KitHumanBrawler(manager),
|
||||
new KitHumanKnight(manager),
|
||||
//new KitHumanBrawler(manager),
|
||||
//new KitHumanAssassin(manager),
|
||||
new NullKit(manager),
|
||||
new KitHumanPeasant(manager),
|
||||
new NullKit(manager),
|
||||
new KitUndeadGhoul(manager),
|
||||
@ -98,13 +99,25 @@ public class CastleSiege extends TeamGame
|
||||
{
|
||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
|
||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
|
||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.",
|
||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
|
||||
"",
|
||||
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
|
||||
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
|
||||
|
||||
});
|
||||
|
||||
_help = new String[]
|
||||
{
|
||||
"Marksmen are extremely important to defence!",
|
||||
"It's recommended 50%+ of defence are Marksmen.",
|
||||
"Use Barricades to block the Undeads path.",
|
||||
"Use TNT to destroy weak points in walls.",
|
||||
"Weak points are marked by cracked stone brick.",
|
||||
"Undead can break fences with their axes.",
|
||||
"Undead Archers must pick up arrows from the ground.",
|
||||
|
||||
};
|
||||
|
||||
this.HungerSet = 20;
|
||||
this.DeathOut = false;
|
||||
this.WorldTimeSet = 14000; //14000
|
||||
@ -212,6 +225,28 @@ public class CastleSiege extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HorseDamageCancel(CustomDamageEvent event)
|
||||
{
|
||||
if (!(event.GetDamageeEntity() instanceof Horse))
|
||||
return;
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
if (GetTeam(player) == null)
|
||||
return;
|
||||
|
||||
if (GetTeam(player).GetColor() == ChatColor.RED)
|
||||
return;
|
||||
|
||||
event.SetCancelled("Horse Team Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
@ -429,6 +464,9 @@ public class CastleSiege extends TeamGame
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(this.GetStateTime(), 20000))
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(_tntSpawn, 25000))
|
||||
return;
|
||||
|
||||
@ -538,7 +576,7 @@ public class CastleSiege extends TeamGame
|
||||
|
||||
if (dist < 2)
|
||||
{
|
||||
int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d));
|
||||
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
|
||||
@ -564,7 +602,7 @@ public class CastleSiege extends TeamGame
|
||||
Player player = tntIterator.next();
|
||||
FallingBlock block = _tntCarry.get(player);
|
||||
|
||||
if (player.isDead() || !block.isValid() || block.getTicksLived() > 600)
|
||||
if (player.isDead() || !block.isValid() || block.getTicksLived() > 900)
|
||||
{
|
||||
player.eject();
|
||||
block.remove();
|
||||
@ -703,4 +741,25 @@ public class CastleSiege extends TeamGame
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SnowDamage(UpdateEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
if (player.getLocation().getBlock().getTypeId() == 78)
|
||||
{
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.DROWNING, 2, false, true, false,
|
||||
"Snow", "Snow Damage");
|
||||
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
package nautilus.game.arcade.game.games.castlesiege.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||
import nautilus.game.arcade.kit.perks.PerkPowershot;
|
||||
import nautilus.game.arcade.kit.perks.PerkRegeneration;
|
||||
|
||||
public class KitHumanAssassin extends Kit
|
||||
{
|
||||
public KitHumanAssassin(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Castle Assassin", KitAvailability.Blue,
|
||||
new String[]
|
||||
{
|
||||
"Able to kill with a single shot!"
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFletcher(2, 4, false),
|
||||
new PerkLeap("Leap", 1.2, 1, 8000),
|
||||
new PerkPowershot(5, 400),
|
||||
new PerkRegeneration(0),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
new ItemStack(Material.BOW));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
|
||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
|
||||
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS));
|
||||
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ public class KitHumanKnight extends Kit
|
||||
{
|
||||
public KitHumanKnight(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Castle Knight", KitAvailability.Free,
|
||||
super(manager, "Castle Knight", KitAvailability.Green,
|
||||
|
||||
new String[]
|
||||
{
|
||||
@ -31,7 +31,7 @@ public class KitHumanKnight extends Kit
|
||||
new Perk[]
|
||||
{
|
||||
new PerkMammoth(),
|
||||
new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true)
|
||||
new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
|
||||
},
|
||||
|
||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
@ -67,7 +67,8 @@ public class KitHumanKnight extends Kit
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
|
||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
|
||||
|
@ -21,7 +21,7 @@ public class KitHumanMarksman extends Kit
|
||||
{
|
||||
public KitHumanMarksman(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Castle Marksman", KitAvailability.Green,
|
||||
super(manager, "Castle Marksman", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
"Skilled human marksman, can fletch arrows."
|
||||
@ -62,7 +62,6 @@ public class KitHumanMarksman extends Kit
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
|
||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
|
||||
|
@ -61,6 +61,8 @@ public class KitHumanPeasant extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite"));
|
||||
|
||||
player.setHealth(4);
|
||||
|
||||
DisguiseWolf disguise = new DisguiseWolf(player);
|
||||
|
@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000),
|
||||
new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000),
|
||||
new PerkSpeed(0)
|
||||
},
|
||||
EntityType.PIG_ZOMBIE,
|
||||
|
@ -41,8 +41,13 @@ public class KitUndeadZombie extends Kit
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
||||
|
||||
DisguiseZombie disguise = new DisguiseZombie(player);
|
||||
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.SetCustomNameVisible(true);
|
||||
|
||||
if (Manager.GetGame().GetTeam(player) != null)
|
||||
{
|
||||
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.SetCustomNameVisible(true);
|
||||
}
|
||||
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
|
@ -6,13 +6,13 @@ import org.bukkit.ChatColor;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.AsymTeamGame;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.horsecharge.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
|
||||
public class Horse extends AsymTeamGame
|
||||
public class Horse extends TeamGame
|
||||
{
|
||||
public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
|
||||
{
|
||||
@ -34,7 +34,7 @@ public class Horse extends AsymTeamGame
|
||||
"Undead win when all Horsemen are dead.",
|
||||
"",
|
||||
"Teams swap after game is over"
|
||||
}, pastTeams);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,183 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkPowershot extends Perk
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
|
||||
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
|
||||
|
||||
private WeakHashMap<Arrow, Integer> _arrows = new WeakHashMap<Arrow, Integer>();
|
||||
|
||||
private int _max;
|
||||
private long _tick;
|
||||
|
||||
public PerkPowershot(int max, long tick)
|
||||
{
|
||||
super("Power Shot", new String[]
|
||||
{
|
||||
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Power Shot",
|
||||
"Arrows deal up to +15 damage"
|
||||
});
|
||||
|
||||
_max = max;
|
||||
_tick = tick;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DrawBow(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock() != null)
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
//Start Charge
|
||||
_charge.put(player, 0);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChargeBow(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
//Not Charging
|
||||
if (!_charge.containsKey(cur))
|
||||
continue;
|
||||
|
||||
//Max Charge
|
||||
if (_charge.get(cur) >= _max)
|
||||
continue;
|
||||
|
||||
//Charge Interval
|
||||
if (_charge.get(cur) == 0)
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
|
||||
continue;
|
||||
}
|
||||
|
||||
//No Longer Holding Bow
|
||||
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
_chargeLast.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Increase Charge
|
||||
_charge.put(cur, _charge.get(cur) + 1);
|
||||
_chargeLast.put(cur, System.currentTimeMillis());
|
||||
|
||||
//Effect
|
||||
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
|
||||
if (!_charge.containsKey(player))
|
||||
return;
|
||||
|
||||
//Start
|
||||
_arrows.put((Arrow)event.getProjectile(), _charge.remove(player));
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
return;
|
||||
|
||||
if (!(event.GetProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Arrow arrow = (Arrow)event.GetProjectile();
|
||||
|
||||
if (!_arrows.containsKey(arrow))
|
||||
return;
|
||||
|
||||
int charge = _arrows.remove(arrow);
|
||||
|
||||
event.AddMod("Power Shot", "Power Shot", charge * 3, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Clean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Arrow arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_charge.remove(player);
|
||||
_chargeLast.remove(player);
|
||||
}
|
||||
}
|
@ -68,19 +68,19 @@ public class PerkSeismicSlamCS extends Perk
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (!(cur instanceof Player))
|
||||
return;
|
||||
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
|
||||
if (cur instanceof Player)
|
||||
{
|
||||
Player other = (Player)cur;
|
||||
Player other = (Player)cur;
|
||||
|
||||
if (!Manager.GetGame().IsAlive(other))
|
||||
continue;
|
||||
if (!Manager.GetGame().IsAlive(other))
|
||||
continue;
|
||||
|
||||
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
|
||||
continue;
|
||||
}
|
||||
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||
@ -101,10 +101,10 @@ public class PerkSeismicSlamCS extends Perk
|
||||
}
|
||||
|
||||
//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());
|
||||
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()) + "."));
|
||||
|
@ -11,9 +11,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.AsymTeamGame;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -81,20 +79,6 @@ public class GameCreationManager implements Listener
|
||||
//Lobby Display
|
||||
Manager.GetLobby().DisplayLast(Manager.GetGame());
|
||||
|
||||
//Prepare Round 2 - If Applicable
|
||||
if (Manager.GetGame() instanceof AsymTeamGame)
|
||||
{
|
||||
if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null)
|
||||
{
|
||||
_nextGame = Manager.GetGame().GetType();
|
||||
_nextGameTeams = new HashMap<String, ChatColor>();
|
||||
|
||||
for (GameTeam team : Manager.GetGame().GetTeamList())
|
||||
for (Player player : team.GetPlayers(false))
|
||||
_nextGameTeams.put(player.getName(), team.GetColor());
|
||||
}
|
||||
}
|
||||
|
||||
Manager.SetGame(null);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.AsymTeamGame;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -807,13 +806,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
|
||||
DisplayWaiting();
|
||||
|
||||
if (game instanceof AsymTeamGame)
|
||||
{
|
||||
if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)4);
|
||||
else WriteGameLine("Round 2 of 2", 2, 159, (byte)4);
|
||||
}
|
||||
else WriteGameLine(" ", 2, 159, (byte)14);
|
||||
|
||||
CreateKits(game);
|
||||
CreateTeams(game);
|
||||
}
|
||||
|
@ -271,13 +271,6 @@ public class GameManager implements Listener
|
||||
return;
|
||||
|
||||
event.GetGame().DeregisterKits();
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
Manager.Clear(player);
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
|
||||
player.teleport(Manager.GetLobby().GetSpawn());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA
|
||||
@ -528,16 +521,32 @@ public class GameManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerClean(GameStateChangeEvent event)
|
||||
public void PlayerTeleportOut(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Dead)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
final Player[] players = UtilServer.getPlayers();
|
||||
|
||||
//Prepare Players
|
||||
for (int i=0 ; i<players.length ; i++)
|
||||
{
|
||||
Manager.Clear(player);
|
||||
player.eject();
|
||||
player.teleport(Manager.GetLobby().GetSpawn());
|
||||
final Player player = players[i];
|
||||
|
||||
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Manager.Clear(player);
|
||||
UtilInv.Clear(player);
|
||||
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
|
||||
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
player.teleport(Manager.GetLobby().GetSpawn());
|
||||
}
|
||||
}, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user