Finalisation of update

This commit is contained in:
Sam 2016-07-07 23:03:23 +01:00
parent c0680b3511
commit da9ad913b2
18 changed files with 1105 additions and 438 deletions

View File

@ -1,16 +1,18 @@
package mineplex.core.progression; package mineplex.core.progression;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.progression.data.KitAbilityDetail; import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.math.Calculations; import mineplex.core.progression.math.Calculations;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.UUID;
/** /**
* The API class all kits with the new system must use * The API class all kits with the new system must use
@ -53,7 +55,7 @@ public interface ProgressiveKit
* *
* @return The map of upgrades and their details * @return The map of upgrades and their details
*/ */
List<KitAbilityDetail> getAbilityDetails(); HashMap<Integer, ArrayList<KitAbilityDetail>> getAbilityDetails();
/** /**
* Retrieve the current level of this kit * Retrieve the current level of this kit

View File

@ -17,7 +17,6 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker; import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
import nautilus.game.arcade.stats.SkywarsTNTStatTracker; import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
@ -29,6 +28,7 @@ public class SoloSkywars extends Skywars
private GameTeam _players; private GameTeam _players;
@SuppressWarnings("unchecked")
public SoloSkywars(ArcadeManager manager) public SoloSkywars(ArcadeManager manager)
{ {
this(manager, GameType.Skywars); this(manager, GameType.Skywars);
@ -51,6 +51,7 @@ public class SoloSkywars extends Skywars
); );
} }
@SuppressWarnings("unchecked")
public SoloSkywars(ArcadeManager manager, GameType type) public SoloSkywars(ArcadeManager manager, GameType type)
{ {
super(manager, type, super(manager, type,

View File

@ -1,47 +0,0 @@
package nautilus.game.arcade.game.games.skywars.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkChicken;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitChicken extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"BAWK BAWK. Eggs!",
"",
"Get a chicken that follows you around",
"And lays eggs every " + C.cGreen + 8 + C.cWhite + " seconds!"
};
private static final Perk[] PERKS = {
new PerkChicken()
};
private static final ItemStack IN_HAND = new ItemStack(Material.EGG);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
};
public KitChicken(ArcadeManager manager)
{
super(manager, "Chicken Farmer", "skywarschickenfarmer", KitAvailability.Free, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
((PerkChicken) PERKS[0]).spawnChicken(player, player.getLocation());
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,58 +0,0 @@
package nautilus.game.arcade.game.games.skywars.kits;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDestructor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitDestructor extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Your Ender Pearls make the world crumble!",
"",
receiveItem("Seismic Charge", 1, 40, 2),
C.cYellow + "Right-Click" + C.cWhite + " with Seismic Charge to " + C.cGreen + "Throw Seismic Charge",
};
private static final Perk[] PERKS = {
new PerkDestructor(40, 2, 2500, true)
};
private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
};
private static final Achievement[] ACHIEVEMENTS = {
Achievement.SKYWARS_BOMBER,
Achievement.SKYWARS_NOARMOR,
Achievement.SKYWARS_NOCHEST,
Achievement.SKYWARS_PLAYER_KILLS,
Achievement.SKYWARS_TNT,
Achievement.SKYWARS_WINS,
Achievement.SKYWARS_ZOMBIE_KILLS
};
public KitDestructor(ArcadeManager manager)
{
super(manager, "Destructor", "skywarsdestructor", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
this.setAchievementRequirements(ACHIEVEMENTS);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,80 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkArmorUpgrade;
public class KitDevourer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "25 Cobblestone",
"",
"Each kill upgrades your lowest armor piece by 1 tier"
};
private static final Perk[] PERKS = {
new PerkArmorUpgrade()
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.COBBLESTONE, 25)
};
private static final ItemStack IN_HAND = new ItemStack(Material.OBSIDIAN);
public KitDevourer(ArcadeManager manager)
{
super(manager, "Devourer", "skywarsdevourer", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
setPerks(PERKS);
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
switch (level)
{
case 0:
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD));
break;
case 1:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
break;
case 2:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
break;
case 3:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
break;
case 4:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
player.getInventory().addItem(new ItemStack(Material.GOLD_LEGGINGS));
break;
case 5:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
player.getInventory().addItem(new ItemStack(Material.GOLD_LEGGINGS));
player.getInventory().addItem(new ItemStack(Material.GOLD_CHESTPLATE));
break;
}
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,97 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkIncreaseOre;
public class KitGatherer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Each ore mined drops double"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_SWORD)
};
private static final Material[] TYPES = {
Material.COAL_ORE,
Material.GOLD_ORE,
Material.IRON_ORE,
};
private static final Material[] TYPES_5 = {
Material.COAL_ORE,
Material.GOLD_ORE,
Material.IRON_ORE,
Material.DIAMOND_ORE,
};
private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_PICKAXE);
public KitGatherer(ArcadeManager manager)
{
super(manager, "Gatherer", "skywarsgartherer", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkIncreaseOre(1, TYPES) }, EntityType.ZOMBIE, IN_HAND);
for (int i = 0; i < 5; i++)
{
setPerks(i, new Perk[] { new PerkIncreaseOre(1, TYPES) });
}
setPerks(5, new Perk[] { new PerkIncreaseOre(1, TYPES_5) });
setOtherPerks(2, "Gain Haste I");
setOtherPerks(3, "Gain Haste I");
setOtherPerks(4, "Gain Haste II");
setOtherPerks(5, "Gain Haste III", "Diamond ore drops double");
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
player.getInventory().addItem(PLAYER_ITEMS);
switch (level)
{
case 0:
player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE));
break;
case 1:
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
break;
case 2:
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 0));
break;
case 3:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 0));
break;
case 4:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 1));
break;
case 5:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 2));
break;
default:
break;
}
}
}

View File

@ -1,45 +0,0 @@
package nautilus.game.arcade.game.games.skywars.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkMadScientist;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitMadScientist extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Spawn crazy animals to fight for you!",
"",
receiveItem("Egg", 1, 90, 3),
"Eggs spawn a loyal minion to fight for you",
};
private static final Perk[] PERKS = {
new PerkMadScientist()
};
private static final ItemStack IN_HAND = new ItemStack(Material.MONSTER_EGG);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
};
public KitMadScientist(ArcadeManager manager)
{
super(manager, "Mad Scientist", "skywarsmadscientist", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,45 +0,0 @@
package nautilus.game.arcade.game.games.skywars.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDigger;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitMiner extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with better tools!",
"",
"Receive " + C.cGreen + "Haste II" + C.cWhite + " the entire game"
};
private static final Perk[] PERKS = {
new PerkDigger(),
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_PICKAXE);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.STONE_AXE),
ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE)
};
public KitMiner(ArcadeManager manager)
{
super(manager, "Miner", "skywarsminer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkThorns;
public class KitPricklyPete extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Each armor piece reflects 0.5 damage per hit every 10 seconds"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.WOOD_SWORD)
};
private static final ItemStack IN_HAND = new ItemStack(Material.CACTUS);
public KitPricklyPete(ArcadeManager manager)
{
super(manager, "Prickly Pete", "skywarspricklypete", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkThorns(0.5, 10) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkThorns(1, 10) });
setPerks(2, new Perk[] { new PerkThorns(1, 9) });
setPerks(3, new Perk[] { new PerkThorns(1.5, 9) });
setPerks(4, new Perk[] { new PerkThorns(1.5, 8) });
setPerks(5, new Perk[] { new PerkThorns(2, 8) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
public class KitRock extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Take 0.1 less damage from all attacks"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.WOOD_SWORD)
};
private static final ItemStack IN_HAND = new ItemStack(Material.STONE);
public KitRock(ArcadeManager manager)
{
super(manager, "The Rock", "skywarsrock", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkIronSkin(0.1) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkIronSkin(0.15) });
setPerks(2, new Perk[] { new PerkIronSkin(0.2) });
setPerks(3, new Perk[] { new PerkIronSkin(0.25) });
setPerks(4, new Perk[] { new PerkIronSkin(0.3) });
setPerks(5, new Perk[] { new PerkIronSkin(0.35) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitSharpshooter extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Bow",
"",
receiveArrowString(1, 12, 64)
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.BOW)
};
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
public KitSharpshooter(ArcadeManager manager)
{
super(manager, "Sharpshooter", "skywarssharpshooter", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkFletcher(12, 64, true, false) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkFletcher(11, 64, true, false) });
setPerks(2, new Perk[] { new PerkFletcher(10, 64, true, false) });
setPerks(3, new Perk[] { new PerkFletcher(9, 64, true, false) });
setPerks(4, new Perk[] { new PerkFletcher(8, 64, true, false) });
setPerks(5, new Perk[] { new PerkFletcher(7, 64, true, false) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,6 +1,29 @@
package nautilus.game.arcade.kit; package nautilus.game.arcade.kit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -22,27 +45,13 @@ import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_8_R3.EntityFireworks; import net.minecraft.server.v1_8_R3.EntityFireworks;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_8_R3.World;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* Kit wrapper for all new kits * Kit wrapper for all new kits
*/ */
public abstract class ProgressingKit extends Kit implements ProgressiveKit public abstract class ProgressingKit extends Kit implements ProgressiveKit
{ {
private static final FireworkEffect EFFECT = FireworkEffect.builder() private static final FireworkEffect EFFECT = FireworkEffect.builder()
.withColor(Color.AQUA) .withColor(Color.AQUA)
.with(Type.BALL) .with(Type.BALL)
@ -50,18 +59,23 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
private String _internalName; private String _internalName;
private PlayerKitDataManager _dataManager; private PlayerKitDataManager _dataManager;
private List<KitAbilityDetail> _kitAbilityDetails; private HashMap<Integer, ArrayList<KitAbilityDetail>> _kitAbilityDetails;
private Perk[][] _perks;
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{ {
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName; _internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager(); _dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Lists.newArrayList(); _kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks) for (Perk perk : kitPerks)
{ {
_kitAbilityDetails.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc())); details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
} }
_kitAbilityDetails.put(0, details);
} }
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
@ -69,11 +83,15 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName; _internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager(); _dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Lists.newArrayList(); _kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks) for (Perk perk : kitPerks)
{ {
_kitAbilityDetails.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc())); details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
} }
_kitAbilityDetails.put(0, details);
} }
@ -102,7 +120,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
} }
@Override @Override
public List<KitAbilityDetail> getAbilityDetails() public HashMap<Integer, ArrayList<KitAbilityDetail>> getAbilityDetails()
{ {
return _kitAbilityDetails; return _kitAbilityDetails;
} }
@ -320,6 +338,39 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
} }
return false; return false;
} }
public void setPerks(int level, Perk[] perks)
{
_perks[level] = perks;
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : perks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
perk.SetHost(this);
}
_kitAbilityDetails.put(level, details);
}
public void setPerks(Perk[] perks)
{
for (int i = 1; i <= 5; i++)
{
setPerks(i, perks);
}
}
public void setOtherPerks(int level, String... detail)
{
ArrayList<KitAbilityDetail> details = _kitAbilityDetails.get(level);
//details.add(new KitAbilityDetail(getIcon(), KitMenu.OTHER_PERK_META, detail));
_kitAbilityDetails.put(level, details);
}
public Perk[][] getPerks()
{
return _perks;
}
public static String leap() public static String leap()
{ {

View File

@ -0,0 +1,100 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilItem.ArmorMaterial;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkArmorUpgrade extends Perk
{
private static final ArmorMaterial[] ARMOR_PRIORTY = new ArmorMaterial[] {
ArmorMaterial.LEATHER,
ArmorMaterial.GOLD,
ArmorMaterial.CHAINMAIL,
ArmorMaterial.IRON,
ArmorMaterial.DIAMOND
};
public PerkArmorUpgrade()
{
super("Armor Upgrade", new String[] { "Every time you kill a player your weakest piece of armor is upgrade by 1 tier" });
}
@EventHandler(priority = EventPriority.LOWEST)
public void onDeath(CombatDeathEvent event)
{
LivingEntity player = event.GetEvent().getEntity().getKiller();
if (!(player instanceof Player))
{
return;
}
if (!Kit.HasKit((Player) player))
{
return;
}
ItemStack[] armorContents = player.getEquipment().getArmorContents();
ItemStack worstItem = null;
int worst = ARMOR_PRIORTY.length - 1;
int index = 0;
for (int i = 0; i < armorContents.length; i++)
{
ItemStack itemStack = armorContents[i];
if (!UtilItem.isArmor(itemStack))
{
continue;
}
int cur = getIndex(ArmorMaterial.of(itemStack.getType()));
if (cur <= worst)
{
worstItem = itemStack;
worst = cur;
index = i;
}
}
if (worst == ARMOR_PRIORTY.length - 1)
{
return;
}
String worstItemPart = worstItem.getType().name().split("_")[1];
String worstItemTier = ARMOR_PRIORTY[worst].name();
String newItemTier = ARMOR_PRIORTY[worst + 1].name();
worstItem = new ItemStack(Material.valueOf(newItemTier + "_" + worstItemPart));
armorContents[index] = worstItem;
player.getEquipment().setArmorContents(armorContents);
player.sendMessage(F.main("Skill", "Your " + C.mSkill + formatItem(worstItemTier, worstItemPart) + C.cGray + " just upgraded to " + C.mSkill + formatItem(newItemTier, worstItemPart) + C.cGray + " by " + C.mSkill + "Armor Upgrade" + C.cGray + "."));
}
private int getIndex(ArmorMaterial armorMaterial)
{
for (int i = 0; i < ARMOR_PRIORTY.length; i++)
{
ArmorMaterial armorMaterial2 = ARMOR_PRIORTY[i];
if (armorMaterial == armorMaterial2)
return i;
}
return 0;
}
private String formatItem(String tier, String part)
{
return Character.toUpperCase(tier.charAt(0)) + tier.substring(1).toLowerCase() + " " + Character.toUpperCase(part.charAt(0)) + part.substring(1).toLowerCase();
}
}

View File

@ -3,12 +3,12 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -37,23 +37,35 @@ public class PerkFletcher extends Perk
private int _time = 0; private int _time = 0;
private boolean _remove; private boolean _remove;
private int _slot; private int _slot;
private boolean _instant = true;
public PerkFletcher(int time, int max, boolean remove) public PerkFletcher(int time, int max, boolean remove)
{ {
this(time, max, remove, -1); this(time, max, remove, -1);
} }
public PerkFletcher(int time, int max, boolean remove, boolean instant)
{
this(time, max, remove, -1, instant);
}
public PerkFletcher(int time, int max, boolean remove, int slot) public PerkFletcher(int time, int max, boolean remove, int slot)
{
this(time, max, remove, slot, true);
}
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant)
{ {
super("Fletcher", new String[] super("Fletcher", new String[]
{ {
C.cGray + "Receive 1 Arrow every " + time + " seconds. Maximum of " + max + ".", "Receive 1 Arrow every " + time + " seconds. Maximum of " + max + ".",
}); });
_time = time; _time = time;
_max = max; _max = max;
_remove = remove; _remove = remove;
_slot = slot; _slot = slot;
_instant = instant;
} }
public boolean isFletchedArrow(ItemStack stack) public boolean isFletchedArrow(ItemStack stack)
@ -106,7 +118,12 @@ public class PerkFletcher extends Perk
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
if (!UtilTime.elapsed(Manager.GetGame().getGameLiveTime(), _time * 1000) && !_instant)
{
return;
}
for (Player cur : UtilServer.getPlayers()) for (Player cur : UtilServer.getPlayers())
{ {
if (Manager.isSpectator(cur)) if (Manager.isSpectator(cur))

View File

@ -0,0 +1,60 @@
package nautilus.game.arcade.kit.perks;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
public class PerkIncreaseOre extends Perk
{
private int extra;
private Material[] type;
public PerkIncreaseOre(int extra, Material[] type)
{
super("Lucky Miner", new String[] { "Every ore you mine drops another " + extra + " extra" });
this.extra = extra;
this.type = type;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent event)
{
if (!Kit.HasKit(event.getPlayer()))
{
return;
}
Block block = event.getBlock();
boolean contains = false;
for (Material type : this.type)
{
if (block.getType() == type)
{
contains = true;
break;
}
}
if (!contains)
{
return;
}
String type = block.getType() == Material.DIAMOND_ORE || block.getType() == Material.COAL_ORE ? block.getType().name().split("_")[0] : block.getType().name().split("_")[0] + "_INGOT";
for (int i = 0; i < extra; i++)
{
event.getBlock().getWorld().dropItem(block.getLocation(), new ItemStack(Material.valueOf(type)));
}
}
}

View File

@ -5,7 +5,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -17,7 +16,7 @@ public class PerkIronSkin extends Perk
{ {
super("Iron Skin", new String[] super("Iron Skin", new String[]
{ {
C.cGray + "You take " + d + " less damage from attacks", "You take " + d + " less damage from attacks",
}); });
_reduction = d; _reduction = d;

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkThorns extends Perk
{
private double _damage;
private double _cooldown;
public PerkThorns(double damage, double cooldown)
{
super("Thorns", new String[] { "For each piece of armor you equip you reflect " + damage, "Cooldown of " + cooldown + " seconds" });
this._damage = damage;
this._cooldown = cooldown;
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (!Kit.HasKit(event.GetDamageePlayer()))
{
return;
}
if (event.GetCause() == DamageCause.FALL || event.GetCause() == DamageCause.PROJECTILE)
{
return;
}
if(!Recharge.Instance.use(event.GetDamageePlayer(), "Thorns", (long) _cooldown * 1000, false, false))
return;
double totalDamage = 0;
for (ItemStack itemStack : event.GetDamageeEntity().getEquipment().getArmorContents())
{
if (itemStack == null || itemStack.getType() == Material.AIR)
{
continue;
}
totalDamage += _damage;
}
if (totalDamage == 0)
{
return;
}
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), event.GetDamageeEntity(), event.GetProjectile(), DamageCause.THORNS, totalDamage * 2, false, true, true, event.GetDamageeEntity().getName(), "Thorns");
event.GetDamagerPlayer(false).sendMessage(F.main("Skill", C.cYellow + event.GetDamageeEntity().getName() + C.cGray + " used" + C.mSkill + " Thorns" + C.cGray + "."));
event.GetDamageePlayer().sendMessage(F.main("Skill", "You used" + C.mSkill + " Thorns" + C.cGray + " on " + C.cYellow + event.GetDamagerEntity(false).getName() + C.cGray + "."));
}
}