Implement shops for all roles

This commit is contained in:
Sam 2017-05-14 11:41:09 +01:00
parent f23e778d92
commit c3b5b9a8bd
39 changed files with 1209 additions and 99 deletions

View File

@ -33,6 +33,7 @@ import nautilus.game.arcade.game.modules.CustomScoreboardModule;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
@ -118,14 +119,21 @@ public class Moba extends TeamGame
new CustomScoreboardModule()
.setSidebar((player, scoreboard) ->
{
scoreboard.writeNewLine();
GameState state = GetState();
scoreboard.write("Testing");
int gold = _goldManager.getGold(player);
scoreboard.write("Gold " + gold);
scoreboard.writeNewLine();
switch (state)
{
case Prepare:
writePrepare(player, scoreboard);
break;
case Live:
writeLive(player, scoreboard);
break;
case End:
case WinRoom:
writeEnd(player, scoreboard);
break;
}
})
.setPrefix((perspective, subject) ->
{
@ -138,6 +146,34 @@ public class Moba extends TeamGame
return team.GetColor().toString();
})
.setSuffix((perspective, subject) ->
{
if (!IsAlive(subject))
{
return "";
}
GameState state = GetState();
GameTeam perspectiveTeam = GetTeam(perspective);
GameTeam subjectTeam = GetTeam(subject);
MobaPlayer mobaPlayer = getData(subject);
String suffix;
if (state == GameState.Prepare && !perspectiveTeam.equals(subjectTeam))
{
suffix = "Unknown";
}
else if (mobaPlayer.Kit == null)
{
suffix = "Selecting";
}
else
{
suffix = mobaPlayer.Kit.GetName();
}
return C.cYellow + " " + suffix + C.Reset;
})
.register(this);
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
@ -233,68 +269,65 @@ public class Moba extends TeamGame
_listeners.forEach(UtilServer::RegisterEvents);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
private void writePrepare(Player player, GameScoreboard scoreboard)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
MobaPlayer mobaPlayer = getData(player);
GameState state = GetState();
scoreboard.writeNewLine();
switch (state)
{
case Prepare:
writePrepare();
break;
case Live:
writeLive();
break;
case End:
writeEnd();
break;
default:
return;
}
scoreboard.write(C.cYellowB + "Hero Selection");
scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
Scoreboard.draw();
}
scoreboard.writeNewLine();
private void writePrepare()
{
Scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Hero");
scoreboard.write(mobaPlayer.Kit == null ? "Unselected " : mobaPlayer.Kit.GetName() + " (" + mobaPlayer.Role.getName() + ")");
Scoreboard.write(C.cYellowB + "Hero Selection");
Scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
scoreboard.writeNewLine();
Scoreboard.writeNewLine();
Scoreboard.write(C.cYellowB + "Players");
scoreboard.write(C.cYellowB + "Players");
int kits = 0;
for (MobaPlayer player : _playerData)
for (MobaPlayer otherMobaPlayer : _playerData)
{
if (player.Kit != null)
if (otherMobaPlayer.Kit != null)
{
kits++;
}
}
Scoreboard.write(kits + "/" + GetPlayers(true).size());
scoreboard.write(kits + "/" + GetPlayers(true).size());
Scoreboard.writeNewLine();
scoreboard.writeNewLine();
}
private void writeLive()
private void writeLive(Player player, GameScoreboard scoreboard)
{
scoreboard.writeNewLine();
if (IsAlive(player))
{
int gold = _goldManager.getGold(player);
scoreboard.write(C.cGoldB + "Gold");
scoreboard.write(String.valueOf(gold));
}
else
{
scoreboard.write("You are dead lol");
}
scoreboard.writeNewLine();
}
private void writeEnd()
private void writeEnd(Player player, GameScoreboard scoreboard)
{
scoreboard.writeNewLine();
scoreboard.write("Game Over");
scoreboard.writeNewLine();
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -22,7 +22,7 @@ import java.util.Map.Entry;
public class MobaFountain implements Listener
{
private static final int FOUNTAIN_SIZE_SQUARED = 5;
private static final int FOUNTAIN_SIZE_SQUARED = 25;
private final Moba _host;
private final Map<GameTeam, Location> _average;

View File

@ -0,0 +1,54 @@
package nautilus.game.arcade.game.games.moba.kit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class AmmoGiveEvent extends PlayerEvent
{
private static final HandlerList _handlers = new HandlerList();
private int _ammoToGive;
private int _maxAmmo;
public AmmoGiveEvent(Player who, int ammoToGive, int maxAmmo)
{
super(who);
_ammoToGive = ammoToGive;
_maxAmmo = maxAmmo;
}
public void setAmmoToGive(int ammo)
{
_ammoToGive = ammo;
}
public int getAmmoToGive()
{
return _ammoToGive;
}
public void setMaxAmmo(int ammo)
{
_maxAmmo = ammo;
}
public int getMaxAmmo()
{
return _maxAmmo;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -10,16 +10,23 @@ public class CooldownCalculateEvent extends PlayerEvent
private static final HandlerList _handlers = new HandlerList();
private final long _initialCooldown;
private final String _ability;
private long _cooldown;
public CooldownCalculateEvent(Player who, long cooldown)
public CooldownCalculateEvent(Player who, String ability, long cooldown)
{
super(who);
_initialCooldown = cooldown;
_ability = ability;
_cooldown = cooldown;
}
public String getAbility()
{
return _ability;
}
public void setCooldown(long cooldown)
{
_cooldown = cooldown;

View File

@ -1,9 +1,6 @@
package nautilus.game.arcade.game.games.moba.kit;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.*;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -12,6 +9,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
@ -112,32 +110,47 @@ public class HeroKit extends Kit
continue;
}
ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT);
long giveTime = _giveTime;
//TODO shop cooldown reduction
if (!Recharge.Instance.use(player, "Ammo", giveTime, false, false))
if (!Recharge.Instance.usable(player, MobaConstants.AMMO))
{
continue;
}
if (itemStack == null)
{
itemStack = _ammo;
player.getInventory().setItem(AMMO_SLOT, itemStack);
continue;
}
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, MobaConstants.AMMO, giveTime);
UtilServer.CallEvent(cooldownEvent);
if (itemStack.getAmount() >= _maxAmmo)
if (!Recharge.Instance.use(player, MobaConstants.AMMO, cooldownEvent.getCooldown(), false, false))
{
continue;
}
itemStack.setAmount(itemStack.getAmount() + 1);
giveAmmo(player, 1);
}
}
public void giveAmmo(Player player, int amount)
{
ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT);
AmmoGiveEvent event = new AmmoGiveEvent(player, amount, _maxAmmo);
UtilServer.CallEvent(event);
if (itemStack == null)
{
itemStack = _ammo;
player.getInventory().setItem(AMMO_SLOT, itemStack);
return;
}
if (itemStack.getAmount() >= event.getMaxAmmo())
{
return;
}
itemStack.setAmount(itemStack.getAmount() + event.getAmmoToGive());
}
@Override
public void GiveItems(Player player)
{

View File

@ -240,7 +240,7 @@ public class HeroSkill extends Perk
long cooldown = _cooldown;
// Modify the cooldown with respect to the upgrade items purchased from the shop
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, cooldown);
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, GetName(), cooldown);
UtilServer.CallEvent(cooldownEvent);
cooldown = cooldownEvent.getCooldown();
@ -255,7 +255,10 @@ public class HeroSkill extends Perk
else
{
long timeDiff = current - start;
double amount = (int) (cooldown / 1000) - Math.ceil((double) timeDiff / 1000);
// Work out the itemstack amount based on the cooldowns.
// Adding 1 as due to the nature of cooldowns it seems to take much longer to go
// from 2 -> 1 -> 0 as the itemstack doesn't change
double amount = (cooldown / 1000) - Math.ceil((double) timeDiff / 1000) + 1;
if (itemStack == null)
{
@ -316,7 +319,7 @@ public class HeroSkill extends Perk
protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager)
{
if (!(damagee instanceof Player || damager instanceof Player))
if (!(damagee instanceof Player) || !(damager instanceof Player))
{
return false;
}

View File

@ -31,7 +31,7 @@ public class HeroAnath extends HeroKit
public HeroAnath(ArcadeManager manager)
{
super(manager, "Anath the Unsworn", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
super(manager, "Anath", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
setAmmo(AMMO, 1000);
setMaxAmmo(4);

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -81,7 +82,7 @@ public class SkillBurnBeam extends HeroSkill
for (LivingEntity entity : UtilEnt.getInRadius(particle.getLastLocation(), 2).keySet())
{
if (entity.equals(player))
if (entity.equals(player) || !Recharge.Instance.use(player, GetName() + entity.getName() + player.getName(), 2000, false, false))
{
continue;
}

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
@ -44,6 +45,6 @@ public class SkillFireProjectile extends HeroSkill
Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), _kit.getAmmo());
item.setVelocity(direction);
Manager.GetFire().Add(item, player, 3, 0, 1, 5, GetName(), false);
Manager.GetFire().Add(item, player, 3, 0, 1, 5, MobaConstants.BASIC_ATTACK, false);
}
}

View File

@ -62,7 +62,7 @@ public class SkillMeteor extends HeroSkill implements IThrown
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection()), Material.NETHERRACK, (byte) 0);
block.setVelocity(player.getLocation().getDirection());
Manager.GetProjectile().AddThrow(block, player, this, 2000, true, true, true, false, 0.5F);
Manager.GetProjectile().AddThrow(block, player, this, 1000, true, true, true, false, 0.5F);
useActiveSkill(player, 7000);
}
@ -153,6 +153,7 @@ public class SkillMeteor extends HeroSkill implements IThrown
}
startShower(data);
data.getThrown().remove();
}
private void startShower(ProjectileUser data)

View File

@ -26,12 +26,12 @@ public class HeroBob extends HeroKit
private static final ItemStack IN_HAND = new ItemStack(Material.PAINTING);
private static final ItemStack AMMO = new ItemBuilder(Material.SNOW_BALL)
.setTitle(C.cYellowB + "Paint")
.setTitle(C.cYellowB + "Titanium Hwhite")
.build();
public HeroBob(ArcadeManager manager)
{
super(manager, "Robert Ross", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
super(manager, "Bob Ross", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
setAmmo(AMMO, 500);
setMaxAmmo(8);

View File

@ -153,7 +153,7 @@ public class SkillHappyTrees extends HeroSkill
}
entity.setHealth(Math.min(entity.getHealth() + 2, entity.getMaxHealth()));
MobaParticles.healing(entity, 3);
MobaParticles.healing(entity, 1);
}
}

View File

@ -102,7 +102,10 @@ public class SkillRally extends HeroSkill
continue;
}
MobaParticles.healing(nearby, 3);
if (Math.random() > 0.75)
{
MobaParticles.healing(nearby, 1);
}
Manager.GetCondition().Factory().Regen(GetName(), nearby, data.Owner, 3, 1, false, true, false);
}
}

View File

@ -28,6 +28,7 @@ public class HeroDevon extends HeroKit
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)
.setTitle(C.cYellowB + "Hunting Arrow")
.setUnbreakable(true)
.build();
public HeroDevon(ArcadeManager manager)

View File

@ -14,6 +14,7 @@ import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -118,7 +119,7 @@ public class SkillInfinity extends HeroSkill
}
}
UtilAction.velocity(nearby, UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation().add(0, 1.5, 0)));
UtilAction.velocity(entity, UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation().add(0, 1.5, 0)));
}
}
}
@ -126,11 +127,6 @@ public class SkillInfinity extends HeroSkill
@EventHandler
public void arrowDamage(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
{
return;
}
if (_arrows.containsKey(event.GetProjectile()))
{
Bukkit.broadcastMessage("Wither");
@ -141,7 +137,8 @@ public class SkillInfinity extends HeroSkill
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
_arrows.remove(event.getEntity());
// Delay this as the when the CustomDamageEvent is run. The arrow is already removed from the map.
Manager.runSyncLater(() -> _arrows.remove(event.getEntity()), 1);
}
}

View File

@ -75,7 +75,7 @@ public class SkillSnowball extends HeroSkill implements IThrown
if (target != null && !isTeamDamage(target, thrower))
{
thrower.playSound(thrower.getLocation(), Sound.LAVA_POP, 1, 1.3F);
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, 3, true, true, false, UtilEnt.getName(thrower), GetName());
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.CUSTOM, 3, true, true, false, UtilEnt.getName(thrower), GetName());
}
}

View File

@ -96,7 +96,7 @@ public class Recall implements Listener
}
else
{
Location location = player.getLocation().add(0, 0.25, 0);
Location location = session.Location.clone();
double height = (double) (now - session.Start) / (double) RECALL_TIME;
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 10)
@ -104,7 +104,7 @@ public class Recall implements Listener
double x = PARTICLE_RADIUS * Math.sin(theta);
double z = PARTICLE_RADIUS * Math.cos(theta);
for (double y = 0; y < height * PARTICLE_HEIGHT; y += 0.5)
for (double y = 0.25; y < height * PARTICLE_HEIGHT; y += 0.5)
{
location.add(x, y, z);

View File

@ -34,7 +34,7 @@ public class MobaItem
public ItemStack getItem()
{
ItemBuilder builder = new ItemBuilder(_item);
ItemBuilder builder = new ItemBuilder(_item).setUnbreakable(true);
if (getEffects() != null)
{

View File

@ -1,17 +1,47 @@
package nautilus.game.arcade.game.games.moba.shop;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.kit.AmmoGiveEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
public abstract class MobaItemEffect
{
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.#");
protected static String format(double d)
{
return DECIMAL_FORMAT.format(d);
}
protected static String format(ConditionType conditionType, int multi)
{
String condition = conditionType.toString().toLowerCase();
char first = Character.toUpperCase(condition.charAt(0));
condition = first + condition.substring(1);
return condition + (multi == -1 ? "" : " " + (multi + 1));
}
protected void onAmmoGive(AmmoGiveEvent event)
{
}
protected void onCooldownCheck(CooldownCalculateEvent event)
{
}
protected void onDamage(CustomDamageEvent event)
{
}
protected void onDeath(Player killed, Player killer)
{
}
@ -24,6 +54,10 @@ public abstract class MobaItemEffect
{
}
protected void onCondition(ConditionApplyEvent event)
{
}
public abstract String getDescription();
}

View File

@ -5,6 +5,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
@ -13,9 +14,12 @@ import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.MobaPlayer;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.AmmoGiveEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu.MobaCategoryButton;
import nautilus.game.arcade.game.games.moba.shop.assassin.MobaAssassinShop;
import nautilus.game.arcade.game.games.moba.shop.hunter.MobaHunterShop;
import nautilus.game.arcade.game.games.moba.shop.mage.MobaMageShop;
import nautilus.game.arcade.game.games.moba.shop.warrior.MobaWarriorShop;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.Entity;
@ -24,13 +28,14 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Villager.Profession;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class MobaShop implements Listener
@ -50,6 +55,9 @@ public class MobaShop implements Listener
// Create menus
_roleMenus.put(MobaRole.ASSASSIN, new MobaAssassinShop(host, this));
_roleMenus.put(MobaRole.WARRIOR, new MobaWarriorShop(host, this));
_roleMenus.put(MobaRole.HUNTER, new MobaHunterShop(host, this));
_roleMenus.put(MobaRole.MAGE, new MobaMageShop(host, this));
}
@EventHandler
@ -177,8 +185,9 @@ public class MobaShop implements Listener
// The respawn event needs to be called here so that effects like "Total Health Increase" will work straight away, instead of after the next respawn,
if (item.getEffects() != null)
{
// Prevents an infinite speed
// Prevents infinite speed
player.setWalkSpeed(0.2F);
player.setMaxHealth(20);
PlayerGameRespawnEvent fakeEvent = new PlayerGameRespawnEvent(null, player);
@ -239,7 +248,27 @@ public class MobaShop implements Listener
}
@EventHandler
public void hpRegeneration(CooldownCalculateEvent event)
public void ammoGive(AmmoGiveEvent event)
{
Player player = event.getPlayer();
List<MobaItem> items = _upgrades.get(player);
for (MobaItem item : items)
{
if (item.getEffects() == null)
{
continue;
}
for (MobaItemEffect effect : item.getEffects())
{
effect.onAmmoGive(event);
}
}
}
@EventHandler
public void cooldownCheck(CooldownCalculateEvent event)
{
Player player = event.getPlayer();
List<MobaItem> items = _upgrades.get(player);
@ -258,6 +287,34 @@ public class MobaShop implements Listener
}
}
@EventHandler
public void damage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(true);
if (damagee == null || damager == null)
{
return;
}
List<MobaItem> items = _upgrades.get(damager);
for (MobaItem item : items)
{
if (item.getEffects() == null)
{
continue;
}
for (MobaItemEffect effect : item.getEffects())
{
effect.onDamage(event);
}
}
}
@EventHandler
public void combatDeath(CombatDeathEvent event)
{
@ -331,4 +388,32 @@ public class MobaShop implements Listener
}
}
}
@EventHandler
public void conditionApply(ConditionApplyEvent event)
{
LivingEntity entity = event.GetCondition().GetEnt();
if (!(entity instanceof Player))
{
return;
}
Player player = (Player) entity;
List<MobaItem> items = _upgrades.get(player);
for (MobaItem item : items)
{
if (item.getEffects() == null)
{
continue;
}
for (MobaItemEffect effect : item.getEffects())
{
effect.onCondition(event);
}
}
}
}

View File

@ -1,6 +1,5 @@
package nautilus.game.arcade.game.games.moba.shop;
import javafx.scene.shape.Arc;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button;
@ -28,7 +27,7 @@ public class MobaShopCategoryMenu extends Menu<ArcadeManager>
public MobaShopCategoryMenu(Moba host, MobaShop shop, MobaShopCategory category, ArcadeManager plugin)
{
super(category.getName() + " Shop", plugin);
super(category.getName() + " Category", plugin);
_host = host;
_shop = shop;
@ -73,6 +72,12 @@ public class MobaShopCategoryMenu extends Menu<ArcadeManager>
}
buttons[slot++] = new MobaPurchaseButton(builder.build(), getPlugin(), item);
// Reached the end of the row, wrap it to keep it neat.
if (slot == 17)
{
slot = 19;
}
}
return buttons;

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class MobaAbilityDamageEffect extends MobaItemEffect
{
private String _reason;
private double _factor;
public MobaAbilityDamageEffect(String reason, double factor)
{
_reason = reason;
_factor = factor;
}
@Override
protected void onDamage(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.CUSTOM || event.GetReason().contains(MobaConstants.BASIC_ATTACK))
{
return;
}
event.AddMod(_reason, event.GetDamage() * _factor);
}
@Override
public String getDescription()
{
return "Increases ability damage by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -0,0 +1,28 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import nautilus.game.arcade.game.games.moba.kit.AmmoGiveEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
public class MobaAmmoIncreaseEffect extends MobaItemEffect
{
private int _maxAmmoIncrease;
public MobaAmmoIncreaseEffect(int maxAmmoIncrease)
{
_maxAmmoIncrease = maxAmmoIncrease;
}
@Override
protected void onAmmoGive(AmmoGiveEvent event)
{
event.setMaxAmmo(event.getMaxAmmo() + _maxAmmoIncrease);
}
@Override
public String getDescription()
{
return "Increases max ammo by " + F.greenElem(format(_maxAmmoIncrease)) + ".";
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
public class MobaBasicAttackDamageEffect extends MobaItemEffect
{
private String _reason;
private double _factor;
public MobaBasicAttackDamageEffect(String reason, double factor)
{
_reason = reason;
_factor = factor;
}
@Override
protected void onDamage(CustomDamageEvent event)
{
if (!event.GetReason().contains(MobaConstants.BASIC_ATTACK))
{
return;
}
event.AddMod(_reason, event.GetDamage() * _factor);
}
@Override
public String getDescription()
{
return "Increases basic attack damage by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
public class MobaCDRAmmoEffect extends MobaItemEffect
{
private double _factor;
public MobaCDRAmmoEffect(double factor)
{
_factor = factor;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
if (!event.getAbility().equals(MobaConstants.AMMO))
{
return;
}
event.decreaseCooldown(_factor);
}
@Override
public String getDescription()
{
return "Decreases ammo reload time by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
public class MobaCDREffect extends MobaItemEffect
{
@ -17,12 +18,17 @@ public class MobaCDREffect extends MobaItemEffect
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
if (event.getAbility().equals(MobaConstants.AMMO))
{
return;
}
event.decreaseCooldown(_factor);
}
@Override
public String getDescription()
{
return "Decreases ability cooldowns by " + F.greenElem(String.valueOf(_factor * 100)) + "%.";
return "Decreases ability cooldowns by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
public class MobaConditionImmunityEffect extends MobaItemEffect
{
private ConditionType _conditionType;
public MobaConditionImmunityEffect(ConditionType conditionType)
{
_conditionType = conditionType;
}
@Override
protected void onCondition(ConditionApplyEvent event)
{
if (event.GetCondition().GetType() == _conditionType)
{
event.setCancelled(true);
}
}
@Override
public String getDescription()
{
return "Grants immunity to " + F.greenElem(format(_conditionType, -1)) + " effects.";
}
}

View File

@ -23,6 +23,6 @@ public class MobaHPRegenEffect extends MobaItemEffect
@Override
public String getDescription()
{
return "Increases HP regeneration by " + F.greenElem(String.valueOf(_factor * 100)) + "%.";
return "Increases HP regeneration by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.Managers;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
public class MobaHitArrowAmmoEffect extends MobaItemEffect
{
@Override
protected void onDamage(CustomDamageEvent event)
{
if (!(event.GetProjectile() instanceof Arrow))
{
return;
}
Player damager = event.GetDamagerPlayer(true);
Moba host = (Moba) Managers.get(ArcadeManager.class).GetGame();
HeroKit kit = host.getData(damager).Kit;
kit.giveAmmo(damager, 1);
}
@Override
public String getDescription()
{
return "Hitting a player with an arrow gives you a new arrow.";
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
public class MobaHitArrowHealEffect extends MobaItemEffect
{
private double _factor;
public MobaHitArrowHealEffect(double factor)
{
_factor = factor;
}
@Override
protected void onDamage(CustomDamageEvent event)
{
if (!(event.GetProjectile() instanceof Arrow))
{
return;
}
Player damager = event.GetDamagerPlayer(true);
damager.setHealth(Math.min(damager.getMaxHealth(), damager.getHealth() + (event.GetDamage() * _factor)));
}
@Override
public String getDescription()
{
return "Hitting a player with an arrow heals for " + F.greenElem(format(_factor * 100)) + "% of the damage.";
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.Managers;
import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class MobaHitConditionEffect extends MobaItemEffect
{
private String _reason;
private ConditionType _conditionType;
private double _duration;
private int _multi;
private boolean _applyToDamagee;
public MobaHitConditionEffect(String reason, ConditionType conditionType, double duration, int multi, boolean applyToDamagee)
{
_reason = reason;
_conditionType = conditionType;
_duration = duration;
_multi = multi;
_applyToDamagee = applyToDamagee;
}
@Override
protected void onDamage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(true);
if (!_applyToDamagee)
{
// Swap damagee and damager
Player temp = damagee;
damagee = damager;
damager = temp;
}
ConditionManager conditionManager = Managers.get(ArcadeManager.class).GetCondition();
conditionManager.AddCondition(new Condition(conditionManager, _reason, damagee, damager, _conditionType, _multi, (int) (_duration * 20), false, Material.WEB, (byte) 0, true, false));
}
@Override
public String getDescription()
{
return "Hitting a player applies " + F.greenElem(format(_conditionType, _multi)) + " for " + F.time(format(_duration)) + " seconds.";
}
}

View File

@ -27,6 +27,6 @@ public class MobaKillHealEffect extends MobaItemEffect
@Override
public String getDescription()
{
return "Killing a player heals you for " + F.greenElem(String.valueOf(_health / 2)) + C.cRed + "" + C.cGray + ".";
return "Killing a player heals for " + F.greenElem(format(_health / 2)) + C.cRed + "" + C.cGray + ".";
}
}

View File

@ -28,6 +28,6 @@ public class MobaSpeedEffect extends MobaItemEffect
@Override
public String getDescription()
{
return "Increases your movement speed by " + F.greenElem(String.valueOf(_factor * 100)) + "%.";
return "Increases movement speed by " + F.greenElem(format(_factor * 100)) + "%.";
}
}

View File

@ -28,6 +28,6 @@ public class MobaTotalHealthEffect extends MobaItemEffect
@Override
public String getDescription()
{
return "Increases your total hearts by " + F.greenElem(String.valueOf(_health / 2)) + C.cRed + "" + C.cGray + ".";
return "Increases total hearts by " + F.greenElem(format(_health / 2)) + C.cRed + "" + C.cGray + ".";
}
}

View File

@ -0,0 +1,207 @@
package nautilus.game.arcade.game.games.moba.shop.hunter;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.shop.MobaShopCategory;
import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu;
import nautilus.game.arcade.game.games.moba.shop.effects.*;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
public class MobaHunterShop extends MobaShopMenu
{
private static final MobaShopCategory BOW = new MobaShopCategory("Bow", Arrays.asList(
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cGreenB + "Hunter's Bow")
.addEnchantment(Enchantment.ARROW_DAMAGE, 1)
.build(), 500),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cGreenB + "Elven Bow")
.addEnchantment(Enchantment.ARROW_DAMAGE, 2)
.build(), 750),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cGreenB + "Eagle's Bow")
.addEnchantment(Enchantment.ARROW_DAMAGE, 3)
.build(), 1000),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cYellowB + "Bow of Pursuit")
.addEnchantment(Enchantment.ARROW_DAMAGE, 2)
.build(), 1200)
.addEffects(
new MobaHitConditionEffect("Bow of Pursuit", ConditionType.SPEED, 2, 0, false)
),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cYellowB + "Vampiric Bow")
.addEnchantment(Enchantment.ARROW_DAMAGE, 1)
.build(), 1500)
.addEffects(
new MobaHitArrowHealEffect(0.25)
),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cYellowB + "Bow of Renewal")
.addEnchantment(Enchantment.ARROW_DAMAGE, 1)
.build(), 1750)
.addEffects(
new MobaHitArrowAmmoEffect()
),
new MobaItem(new ItemBuilder(Material.BOW)
.setTitle(C.cYellowB + "Specialist's Bow")
.build(), 1000)
.addEffects(
new MobaCDREffect(0.1),
new MobaAbilityDamageEffect("Specialist's Bow", 0.2)
)
), new ItemStack(Material.BOW));
private static final MobaShopCategory HELMET = new MobaShopCategory("Helmet", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Leather Helmet")
.build(), 200),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Leather Cap of Holding")
.build(), 400)
.addEffects(
new MobaAmmoIncreaseEffect(1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Leather Cap of Nimble Fingers")
.build(), 400)
.addEffects(
new MobaCDRAmmoEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Focused Cap")
.build(), 500)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Vampiric Helmet")
.build(), 500)
.addEffects(
new MobaHitArrowHealEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_HELMET)
.setTitle(C.cGreen + "Chainmail Helmet")
.build(), 500)
), new ItemStack(Material.LEATHER_HELMET));
private static final MobaShopCategory CHESTPLATE = new MobaShopCategory("Chestplate", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Leather Chestplate")
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Leather Chestplate of Nimble Fingers")
.build(), 750)
.addEffects(
new MobaCDRAmmoEffect(0.15)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Focused Chestplate")
.build(), 750)
.addEffects(
new MobaCDREffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Vampiric Chestplate")
.build(), 750)
.addEffects(
new MobaHitArrowHealEffect(0.15)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE)
.setTitle(C.cGreen + "Chainmail Chestplate")
.build(), 500)
), new ItemStack(Material.LEATHER_CHESTPLATE));
private static final MobaShopCategory LEGGINGS = new MobaShopCategory("Leggings", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Leather Leggings")
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Leather Leggings of Nimble Fingers")
.build(), 750)
.addEffects(
new MobaCDRAmmoEffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Focused Leggings")
.build(), 750)
.addEffects(
new MobaCDREffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Vampiric Leggings")
.build(), 700)
.addEffects(
new MobaHitArrowHealEffect(0.1)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_LEGGINGS)
.setTitle(C.cGreen + "Chainmail Leggings")
.build(), 500)
), new ItemStack(Material.LEATHER_LEGGINGS));
private static final MobaShopCategory BOOTS = new MobaShopCategory("Boots", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Leather Boots")
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Leather Boots of Nimble Fingers")
.build(), 400)
.addEffects(
new MobaCDRAmmoEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Focused Boots")
.build(), 600)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Vampiric Boots")
.build(), 500)
.addEffects(
new MobaHitArrowHealEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Leather Hiking Boots")
.build(), 300)
.addEffects(
new MobaSpeedEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_BOOTS)
.setTitle(C.cGreen + "Leather Moccasins")
.build(), 500)
.addEffects(
new MobaSpeedEffect(0.1)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_BOOTS)
.setTitle(C.cGreen + "Leather Crosstrainers")
.build(), 800)
.addEffects(
new MobaSpeedEffect(0.15)
),
new MobaItem(new ItemBuilder(Material.CHAINMAIL_BOOTS)
.setTitle(C.cGreen + "Chainmail Boots")
.build(), 500)
), new ItemStack(Material.LEATHER_BOOTS));
public MobaHunterShop(Moba host, MobaShop shop)
{
super(host, shop, MobaRole.HUNTER);
addCategory(BOW);
addCategory(HELMET);
addCategory(CHESTPLATE);
addCategory(LEGGINGS);
addCategory(BOOTS);
}
}

View File

@ -0,0 +1,152 @@
package nautilus.game.arcade.game.games.moba.shop.mage;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.shop.MobaShopCategory;
import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu;
import nautilus.game.arcade.game.games.moba.shop.effects.MobaAbilityDamageEffect;
import nautilus.game.arcade.game.games.moba.shop.effects.MobaBasicAttackDamageEffect;
import nautilus.game.arcade.game.games.moba.shop.effects.MobaCDREffect;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
public class MobaMageShop extends MobaShopMenu
{
private static final MobaShopCategory HELMET = new MobaShopCategory("Helmet", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Leather Cap")
.build(), 200),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Adept's Cap")
.setColor(Color.BLACK)
.build(), 500)
.addEffects(
new MobaAbilityDamageEffect("Adept's Cap", 0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Helm of Focus")
.setColor(Color.PURPLE)
.build(), 500)
.addEffects(
new MobaCDREffect(0.03)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Battle Mage Cap")
.setColor(Color.YELLOW)
.build(), 500)
.addEffects(
new MobaBasicAttackDamageEffect("Battle Mage Cap", 0.03)
),
new MobaItem(new ItemBuilder(Material.GOLD_HELMET)
.setTitle(C.cYellow + "Golden Helmet")
.build(), 750)
), new ItemStack(Material.LEATHER_HELMET));
private static final MobaShopCategory CHESTPLATE = new MobaShopCategory("Chestplate", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Leather Chestplate")
.build(), 400),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Adept's Chestplate")
.setColor(Color.BLACK)
.build(), 1250)
.addEffects(
new MobaAbilityDamageEffect("Adept's Chestplate", 0.15)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Chestplate of Focus")
.setColor(Color.PURPLE)
.build(), 1000)
.addEffects(
new MobaCDREffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Battle Mage Chestplate")
.setColor(Color.YELLOW)
.build(), 1000)
.addEffects(
new MobaBasicAttackDamageEffect("Battle Mage Chestplate", 0.1)
),
new MobaItem(new ItemBuilder(Material.GOLD_CHESTPLATE)
.setTitle(C.cYellow + "Golden Chestplate")
.build(), 1000)
), new ItemStack(Material.LEATHER_CHESTPLATE));
private static final MobaShopCategory LEGGINGS = new MobaShopCategory("Leggings", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Leather Leggings")
.build(), 400),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Adept's Leggings")
.setColor(Color.BLACK)
.build(), 750)
.addEffects(
new MobaAbilityDamageEffect("Adept's Leggings", 0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Leggings of Focus")
.setColor(Color.PURPLE)
.build(), 750)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Battle Mage Leggings")
.setColor(Color.YELLOW)
.build(), 750)
.addEffects(
new MobaBasicAttackDamageEffect("Battle Mage Leggings", 0.05)
),
new MobaItem(new ItemBuilder(Material.GOLD_LEGGINGS)
.setTitle(C.cYellow + "Golden Leggings")
.build(), 1000)
), new ItemStack(Material.LEATHER_LEGGINGS));
private static final MobaShopCategory BOOTS = new MobaShopCategory("Boots", Arrays.asList(
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Leather Boots")
.build(), 200),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Adept's Boots")
.setColor(Color.BLACK)
.build(), 500)
.addEffects(
new MobaAbilityDamageEffect("Adept's Boots", 0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Boots of Focus")
.setColor(Color.PURPLE)
.build(), 500)
.addEffects(
new MobaCDREffect(0.03)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Battle Mage Boots")
.setColor(Color.YELLOW)
.build(), 500)
.addEffects(
new MobaBasicAttackDamageEffect("Battle Mage Boots", 0.03)
),
new MobaItem(new ItemBuilder(Material.GOLD_BOOTS)
.setTitle(C.cYellow + "Golden Boots")
.build(), 750)
), new ItemStack(Material.LEATHER_BOOTS));
public MobaMageShop(Moba host, MobaShop shop)
{
super(host, shop, MobaRole.MAGE);
addCategory(HELMET);
addCategory(CHESTPLATE);
addCategory(LEGGINGS);
addCategory(BOOTS);
}
}

View File

@ -0,0 +1,201 @@
package nautilus.game.arcade.game.games.moba.shop.warrior;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.shop.MobaShopCategory;
import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu;
import nautilus.game.arcade.game.games.moba.shop.effects.*;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
public class MobaWarriorShop extends MobaShopMenu
{
private static final MobaShopCategory SWORD = new MobaShopCategory("Sword", Arrays.asList(
new MobaItem(new ItemBuilder(Material.STONE_SWORD)
.setTitle(C.cGreenB + "Stone Sword")
.build(), 500),
new MobaItem(new ItemBuilder(Material.GOLD_SWORD)
.setTitle(C.cYellowB + "Frostbound Sword")
.build(), 750)
.addEffects(
new MobaHitConditionEffect("Frostbound Sword", ConditionType.SLOW, 3, 0, true)
),
new MobaItem(new ItemBuilder(Material.GOLD_SWORD)
.setTitle(C.cYellowB + "Swift Blade")
.build(), 750)
.addEffects(
new MobaConditionImmunityEffect(ConditionType.SLOW)
),
new MobaItem(new ItemBuilder(Material.IRON_SWORD)
.setTitle(C.cDRedB + "Knight's Blade")
.build(), 1250)
), new ItemStack(Material.WOOD_SWORD));
private static final MobaShopCategory HELMET = new MobaShopCategory("Helmet", Arrays.asList(
new MobaItem(new ItemBuilder(Material.IRON_HELMET)
.setTitle(C.cGreenB + "Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 1)
.build(), 400)
.addEffects(
new MobaHPRegenEffect(0.03)
),
new MobaItem(new ItemBuilder(Material.IRON_HELMET)
.setTitle(C.cYellowB + "Superior Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
.build(), 750)
.addEffects(
new MobaHPRegenEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.IRON_HELMET)
.setTitle(C.cGreenB + "Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1)
.build(), 400)
.addEffects(
new MobaHPRegenEffect(0.03)
),
new MobaItem(new ItemBuilder(Material.IRON_HELMET)
.setTitle(C.cYellowB + "Superior Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.build(), 750)
.addEffects(
new MobaHPRegenEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.DIAMOND_HELMET)
.setTitle(C.cDRedB + "Prince's Plate")
.build(), 2000)
.addEffects(
new MobaHPRegenEffect(0.15)
)
), new ItemStack(Material.IRON_HELMET));
private static final MobaShopCategory CHESTPLATE = new MobaShopCategory("Chestplate", Arrays.asList(
new MobaItem(new ItemBuilder(Material.IRON_CHESTPLATE)
.setTitle(C.cGreenB + "Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 1)
.build(), 600)
.addEffects(
new MobaTotalHealthEffect(2)
),
new MobaItem(new ItemBuilder(Material.IRON_CHESTPLATE)
.setTitle(C.cYellowB + "Superior Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
.build(), 1000)
.addEffects(
new MobaTotalHealthEffect(4)
),
new MobaItem(new ItemBuilder(Material.IRON_CHESTPLATE)
.setTitle(C.cGreenB + "Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1)
.build(), 600)
.addEffects(
new MobaTotalHealthEffect(2)
),
new MobaItem(new ItemBuilder(Material.IRON_CHESTPLATE)
.setTitle(C.cYellowB + "Superior Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.build(), 1000)
.addEffects(
new MobaTotalHealthEffect(4)
),
new MobaItem(new ItemBuilder(Material.DIAMOND_CHESTPLATE)
.setTitle(C.cDRedB + "Prince's Plate")
.build(), 2500)
.addEffects(
new MobaTotalHealthEffect(4)
)
), new ItemStack(Material.IRON_CHESTPLATE));
private static final MobaShopCategory LEGGINGS = new MobaShopCategory("Leggings", Arrays.asList(
new MobaItem(new ItemBuilder(Material.IRON_LEGGINGS)
.setTitle(C.cGreenB + "Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 1)
.build(), 600)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.IRON_LEGGINGS)
.setTitle(C.cYellowB + "Superior Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
.build(), 1000)
.addEffects(
new MobaCDREffect(0.07)
),
new MobaItem(new ItemBuilder(Material.IRON_LEGGINGS)
.setTitle(C.cGreenB + "Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1)
.build(), 600)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.IRON_LEGGINGS)
.setTitle(C.cYellowB + "Superior Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.build(), 1000)
.addEffects(
new MobaCDREffect(0.07)
),
new MobaItem(new ItemBuilder(Material.DIAMOND_LEGGINGS)
.setTitle(C.cDRedB + "Prince's Plate")
.build(), 2500)
.addEffects(
new MobaCDREffect(0.1)
)
), new ItemStack(Material.IRON_LEGGINGS));
private static final MobaShopCategory BOOTS = new MobaShopCategory("Boots", Arrays.asList(
new MobaItem(new ItemBuilder(Material.IRON_BOOTS)
.setTitle(C.cGreenB + "Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 1)
.build(), 400)
.addEffects(
new MobaSpeedEffect(0.04)
),
new MobaItem(new ItemBuilder(Material.IRON_BOOTS)
.setTitle(C.cYellowB + "Superior Archer's Bane")
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
.build(), 750)
.addEffects(
new MobaSpeedEffect(0.06)
),
new MobaItem(new ItemBuilder(Material.IRON_BOOTS)
.setTitle(C.cGreenB + "Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1)
.build(), 400)
.addEffects(
new MobaSpeedEffect(0.04)
),
new MobaItem(new ItemBuilder(Material.IRON_BOOTS)
.setTitle(C.cYellowB + "Superior Brawler's Plate")
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.build(), 750)
.addEffects(
new MobaSpeedEffect(0.06)
),
new MobaItem(new ItemBuilder(Material.DIAMOND_BOOTS)
.setTitle(C.cDRedB + "Prince's Plate")
.build(), 2000)
.addEffects(
new MobaSpeedEffect(0.1)
)
), new ItemStack(Material.IRON_BOOTS));
public MobaWarriorShop(Moba host, MobaShop shop)
{
super(host, shop, MobaRole.WARRIOR);
addCategory(SWORD);
addCategory(HELMET);
addCategory(CHESTPLATE);
addCategory(LEGGINGS);
addCategory(BOOTS);
}
}

View File

@ -0,0 +1,10 @@
package nautilus.game.arcade.game.games.moba.util;
public class MobaConstants
{
// String constants
public static final String BASIC_ATTACK = "Basic Attack";
public static final String AMMO = "Ammo";
}

View File

@ -10,7 +10,7 @@ public class MobaParticles
public static void healing(LivingEntity entity, int amount)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, entity.getEyeLocation(), 0.5F, 0.5F, 0.5F, 0.1F, amount, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.HEART, entity.getLocation().add(0, 1.3, 0), 0.5F, 0.5F, 0.5F, 0.1F, amount, ViewDist.LONG);
}
}