This commit is contained in:
Sam 2017-05-08 21:09:09 +01:00
parent 5398bf5e81
commit d107c8d6f4
32 changed files with 1442 additions and 186 deletions

View File

@ -17,12 +17,15 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.moba.gold.GoldManager;
import nautilus.game.arcade.game.games.moba.kit.*;
import nautilus.game.arcade.game.games.moba.kit.anath.HeroAnath;
import nautilus.game.arcade.game.games.moba.kit.bob.HeroBob;
import nautilus.game.arcade.game.games.moba.kit.dana.HeroDana;
import nautilus.game.arcade.game.games.moba.kit.devon.HeroDevon;
import nautilus.game.arcade.game.games.moba.kit.hattori.HeroHattori;
import nautilus.game.arcade.game.games.moba.recall.Recall;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePoint;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.modules.compass.CompassModule;
@ -59,6 +62,9 @@ public class Moba extends TeamGame
private final Set<Listener> _listeners = new HashSet<>();
private final MobaShop _shop;
private final GoldManager _goldManager;
public Moba(ArcadeManager manager)
{
super(manager, GameType.MOBA, new Kit[] { new KitPlayer(manager) }, DESCRIPTION);
@ -68,6 +74,7 @@ public class Moba extends TeamGame
new HeroDevon(Manager),
new HeroAnath(Manager),
new HeroDana(Manager),
new HeroBob(Manager)
};
PrepareAutoAnnounce = false;
@ -92,6 +99,14 @@ public class Moba extends TeamGame
Listener recall = new Recall(this);
_listeners.add(recall);
MobaShop shop = new MobaShop(this);
_shop = shop;
_listeners.add(shop);
GoldManager goldManager = new GoldManager(this);
_goldManager = goldManager;
_listeners.add(goldManager);
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
{
@Override
@ -356,7 +371,7 @@ public class Moba extends TeamGame
continue;
}
HeroKit heroKit = getRandomKit(player);
HeroKit heroKit = getFirstKit(player);
MobaPlayer mobaPlayer = getData(player);
mobaPlayer.Role = heroKit.getRole();
@ -543,7 +558,7 @@ public class Moba extends TeamGame
return null;
}
private HeroKit getRandomKit(Player player)
private HeroKit getFirstKit(Player player)
{
MobaPlayer mobaPlayer = getData(player);
@ -551,17 +566,17 @@ public class Moba extends TeamGame
{
MobaRole role = getRandomRole(player);
return getRandomKit(role);
return getFirstKit(role);
}
else if (mobaPlayer.Kit == null)
{
return getRandomKit(mobaPlayer.Role);
return getFirstKit(mobaPlayer.Role);
}
return null;
}
private HeroKit getRandomKit(MobaRole role)
private HeroKit getFirstKit(MobaRole role)
{
for (HeroKit kit : _kits)
{
@ -607,4 +622,19 @@ public class Moba extends TeamGame
return players;
}
public List<CapturePoint> getCapturePoints()
{
return _capturePoints;
}
public MobaShop getShop()
{
return _shop;
}
public GoldManager getGoldManager()
{
return _goldManager;
}
}

View File

@ -0,0 +1,135 @@
package nautilus.game.arcade.game.games.moba.gold;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePoint;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class GoldManager implements Listener
{
private static final int GOLD_PER_5 = 20;
private static final int GOLD_PER_CAPTURE_5 = 5;
private final Moba _host;
private final Map<Player, Integer> _playerGold;
public GoldManager(Moba host)
{
_host = host;
_playerGold = new HashMap<>();
host.registerDebugCommand(new DebugCommand("gold", Rank.ADMIN)
{
@Override
public void Execute(Player caller, String[] args)
{
if (args.length < 1)
{
caller.sendMessage(F.main("Debug", "/gold <amount>"));
return;
}
try
{
int amount = Integer.parseInt(args[0]);
addGold(caller, amount);
caller.sendMessage(F.main("Debug", "Gave yourself " + F.elem(args[0]) + " gold."));
}
catch (NumberFormatException e)
{
caller.sendMessage(F.main("Debug", F.elem(args[0]) + " is not a number."));
}
}
});
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
for (Player player : _host.GetPlayers(true))
{
_playerGold.put(player, 0);
}
}
@EventHandler
public void passiveGain(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC_05 || !_host.IsLive())
{
return;
}
// Every player passive
for (Player player : _host.GetPlayers(true))
{
addGold(player, GOLD_PER_5);
}
// Capture points
for (CapturePoint point : _host.getCapturePoints())
{
GameTeam owner = point.getOwner();
if (owner == null)
{
continue;
}
for (Player player : owner.GetPlayers(true))
{
addGold(player, GOLD_PER_CAPTURE_5);
}
}
}
public void addGold(Player player, int amount)
{
_playerGold.put(player, _playerGold.get(player) + amount);
}
public void removeGold(Player player, int amount)
{
_playerGold.put(player, _playerGold.get(player) - amount);
}
public boolean hasGold(Player player, int amount)
{
return _playerGold.get(player) >= amount;
}
/**
* Returns a map binding the player to the amount of gold they currently have.
*
* @return An unmodifiable version of the internal map used. If you want to edit the player's gold consider using the other methods within this class.
*/
public Map<Player, Integer> getPlayerGoldMap()
{
return Collections.unmodifiableMap(_playerGold);
}
}

View File

@ -0,0 +1,49 @@
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 CooldownCalculateEvent extends PlayerEvent
{
private static final HandlerList _handlers = new HandlerList();
private final long _initialCooldown;
private long _cooldown;
public CooldownCalculateEvent(Player who, long cooldown)
{
super(who);
_initialCooldown = cooldown;
_cooldown = cooldown;
}
public void setCooldown(long cooldown)
{
_cooldown = cooldown;
}
public void decreaseCooldown(double factor)
{
_cooldown = (long) ((double) _initialCooldown * factor);
}
public long getCooldown()
{
return _cooldown;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -2,13 +2,18 @@ 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.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
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.kit.common.SkillBow;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
@ -19,6 +24,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import java.util.List;
public class HeroKit extends Kit
{
@ -140,7 +147,10 @@ public class HeroKit extends Kit
inventory.setItem(AMMO_SLOT, _ammo);
inventory.setItem(RECALL_SLOT, RECALL_ITEM);
for (Perk perk : GetPerks())
Moba host = (Moba) Manager.GetGame();
List<MobaItem> ownedItems = host.getShop().getOwnedItems(player);
perkLoop: for (Perk perk : GetPerks())
{
if (!(perk instanceof HeroSkill))
{
@ -149,7 +159,39 @@ public class HeroKit extends Kit
HeroSkill skill = (HeroSkill) perk;
skill.giveItem(player);
// Sword upgrades
if (skill instanceof SkillSword)
{
for (MobaItem item : ownedItems)
{
if (UtilItem.isSword(item.getItem()))
{
player.getInventory().setItem(skill.getSlot(), item.getItem());
continue perkLoop;
}
}
}
// Bow upgrades
else if (skill instanceof SkillBow)
{
for (MobaItem item : ownedItems)
{
if (item.getItem().getType() == Material.BOW)
{
player.getInventory().setItem(skill.getSlot(), item.getItem());
continue perkLoop;
}
}
}
if (skill.isOnCooldown(player))
{
player.getInventory().setItem(skill.getSlot(), skill.getCooldownItem());
}
else
{
skill.giveItem(player);
}
}
}
}

View File

@ -240,7 +240,11 @@ public class HeroSkill extends Perk
long start = _lastSkill.get(player.getUniqueId());
long cooldown = _cooldown;
//TODO Shop cooldown reduction
// Modify the cooldown with respect to the upgrade items purchased from the shop
CooldownCalculateEvent cooldownEvent = new CooldownCalculateEvent(player, cooldown);
UtilServer.CallEvent(cooldownEvent);
cooldown = cooldownEvent.getCooldown();
boolean done = UtilTime.elapsed(start, cooldown);
@ -338,6 +342,11 @@ public class HeroSkill extends Perk
return _slot;
}
public ItemStack getCooldownItem()
{
return _cooldownItem;
}
public boolean isOnCooldown(Player player)
{
return _lastSkill.containsKey(player.getUniqueId());

View File

@ -41,11 +41,5 @@ public class SkillFlameDash extends DashSkill
Block fBlock = block;
Manager.runSyncLater(() -> Manager.GetBlockRestore().add(fBlock.getRelative(BlockFace.UP), Material.FIRE.getId(), (byte) 0, 5000), 10);
}
@Override
public void postDash(Player player)
{
Manager.GetBlockRestore().restore(player.getLocation().getBlock());
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class HeroBob extends HeroKit
{
private static final String[] DESCRIPTION = {
"Something something"
};
private static final Perk[] PERKS = {
new SkillPaint(0),
new SkillHappyTrees(1),
new SkillBeatTheDevil(2),
new SkillBuildPainting(3)
};
private static final ItemStack IN_HAND = new ItemStack(Material.PAINTING);
private static final ItemStack AMMO = new ItemBuilder(Material.SNOW_BALL)
.setTitle(C.cYellowB + "Paint")
.build();
public HeroBob(ArcadeManager manager)
{
super(manager, "Robert Ross", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
setAmmo(AMMO, 500);
setMaxAmmo(8);
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class SkillBeatTheDevil extends DashSkill
{
private static final String[] DESCRIPTION = {
"Dash along the ground, leaving fire behind you.",
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
public SkillBeatTheDevil(int slot)
{
super("Beat The Devil Out Of It", DESCRIPTION, SKILL_ITEM, slot);
setCooldown(12000);
_collide = false;
_velocityTime = 800;
_velocityStopOnEnd = true;
}
@Override
public void dashTick(Player player)
{
player.getWorld().playSound(player.getLocation(), player.getTicksLived() % 2 == 0 ? Sound.DOOR_OPEN : Sound.DOOR_CLOSE, 1, 0.5F);
for (int i = 0; i < 10; i++)
{
UtilParticle.playColoredParticleToAll(Color.RED, ParticleType.RED_DUST, UtilAlg.getRandomLocation(player.getLocation().add(0, 1, 0), 2), 1, ViewDist.LONG);
}
}
}

View File

@ -0,0 +1,206 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
public class SkillBuildPainting extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final BlockFace[] AXIS = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
private static final byte[][] PAINTING = {
{
3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3
},
{
3, 3, 0, 0, 0, 0, 3, 3, 0, 0, 0, 3, 3, 3, 3
},
{
3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3
},
{
3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 13, 3
},
{
3, 3, 0, 0, 0, 3, 3, 3, 5, 3, 3, 13, 3, 13, 3
},
{
3, 3, 8, 8, 8, 8, 3, 5, 5, 5, 3, 13, 13, 13, 13
},
{
3, 3, 8, 8, 8, 8, 3, 3, 12, 3, 13, 13, 13, 13, 13
},
{
3, 3, 7, 7, 7, 7, 7, 3, 12, 3, 3, 12, 3, 12, 3
},
{
5, 7, 7, 7, 7, 7, 7, 5, 12, 5, 5, 12, 5, 12, 5
}
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
public SkillBuildPainting(int slot)
{
super("The Joy Of Painting", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!Recharge.Instance.use(player, GetName() + " Trigger", 5000, false, false))
{
return;
}
useActiveSkill(player, 4000);
Set<Block> blocks = new HashSet<>();
Vector direction = player.getLocation().getDirection().normalize().setY(0);
Location start = player.getLocation().add(direction);
BlockFace facing = getFace(start.getYaw() + 180F);
Block center = start.getBlock().getRelative(facing).getRelative(BlockFace.UP);
float leftYaw = start.getYaw() - 90;
BlockFace leftSide = getFace(leftYaw);
for (int i = 0; i < 7; i++)
{
center = center.getRelative(leftSide);
}
BlockFace rightSide = leftSide.getOppositeFace();
// Rows
for (int y = 0; y < PAINTING.length; y++)
{
byte[] row = PAINTING[y];
// Column in row
for (int x = 0; x < row.length; x++)
{
Block result = center;
for (int i = 0; i < x; i++)
{
result = result.getRelative(rightSide);
}
result = result.getRelative(0, 8, 0);
for (int i = 0; i < y; i++)
{
result = result.getRelative(BlockFace.DOWN);
}
Block fResult = result;
byte blockData = row[x];
Manager.runSyncLater(() ->
{
blocks.add(fResult);
Manager.GetBlockRestore().add(fResult, Material.WOOL.getId(), blockData, Long.MAX_VALUE);
}, UtilMath.r(40));
}
}
Manager.runSyncLater(() ->
{
for (Block block : blocks)
{
if (Math.random() < 0.2)
{
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 0.5, 0.5), block.getType(), block.getData());
fallingBlock.setVelocity(direction.clone().multiply(1 + (Math.random() * 0.4)));
Manager.GetProjectile().AddThrow(fallingBlock, player, this, 2000, true, true, true, false, 0.5F);
}
Manager.GetBlockRestore().restore(block);
}
}, 80);
}
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
if (event.getEntity().getItemStack().getType() == Material.WOOL)
{
event.setCancelled(true);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
damage(data);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
damage(data);
}
private void damage(ProjectileUser data)
{
Entity entity = data.getThrown();
data.getThrown().getWorld().playEffect(entity.getLocation(), Effect.STEP_SOUND, Material.WOOL, (byte) 0);
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(entity.getLocation(), 3).entrySet())
{
Manager.GetDamage().NewDamageEvent(entry.getKey(), data.getThrower(), null, DamageCause.BLOCK_EXPLOSION, 5, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
data.getThrown().remove();
}
private BlockFace getFace(float yaw)
{
return AXIS[Math.round(yaw / 90F) & 0x3];
}
}

View File

@ -0,0 +1,174 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.*;
import java.util.Map.Entry;
public class SkillHappyTrees extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.SAPLING);
private final Set<HappyTreeData> _data = new HashSet<>();
public SkillHappyTrees(int slot)
{
super("Happy Little Trees", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(15000);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
useSkill(player);
_data.add(new HappyTreeData(player));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
Iterator<HappyTreeData> iterator = _data.iterator();
while (iterator.hasNext())
{
HappyTreeData data = iterator.next();
if (UtilTime.elapsed(data.Start, 9000))
{
iterator.remove();
}
else if (data.Tree1 == null)
{
data.Tree1 = buildTree(data.Center);
}
else if (data.Tree2 == null)
{
data.Tree2 = buildTree(data.Center);
}
if (UtilTime.elapsed(data.Start, 2000))
{
healPlayers(data.Owner, data.Tree1);
healPlayers(data.Owner, data.Tree2);
}
}
}
private Block buildTree(Location center)
{
Location start = UtilAlg.getRandomLocation(center, 5, 0, 5);
Map<Block, Material> blocks = getTree(start);
for (Entry<Block, Material> entry : blocks.entrySet())
{
Manager.runSyncLater(() -> Manager.GetBlockRestore().add(entry.getKey(), entry.getValue().getId(), (byte) 0, (long) (6000 + (Math.random() * 1000))), UtilMath.r(60));
}
return start.getBlock();
}
private Map<Block, Material> getTree(Location start)
{
Block last = start.getBlock().getRelative(BlockFace.DOWN);
Map<Block, Material> blocks = new HashMap<>();
// Trunk
for (int i = 0; i < 5; i++)
{
Block next = last.getRelative(BlockFace.UP);
last = next;
blocks.put(next, Material.LOG);
}
last = last.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN);
// Bottom Leaves
for (Block block : UtilBlock.getInBoundingBox(last.getLocation().add(2, 1, 2), last.getLocation().subtract(2, 0, 2), false))
{
blocks.put(block, Material.LEAVES);
}
last = last.getRelative(BlockFace.UP).getRelative(BlockFace.UP);
// Middle Leaves
for (Block block : UtilBlock.getInBoundingBox(last.getLocation().add(1, 0, 1), last.getLocation().subtract(1, 0, 1), false))
{
blocks.put(block, Material.LEAVES);
}
last = last.getRelative(BlockFace.UP);
// Top Leaves
blocks.put(last.getRelative(BlockFace.NORTH), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.WEST), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.EAST), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.SOUTH), Material.LEAVES);
blocks.put(last.getRelative(BlockFace.UP), Material.LEAVES);
return blocks;
}
private void healPlayers(Player owner, Block block)
{
for (LivingEntity entity : UtilEnt.getInRadius(block.getLocation(), 5).keySet())
{
// Don't heal enemies
if (!isTeamDamage(entity, owner))
{
continue;
}
entity.setHealth(Math.min(entity.getHealth() + 2, entity.getMaxHealth()));
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, entity.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.1F, 4, ViewDist.LONG);
}
}
private class HappyTreeData
{
public Player Owner;
public long Start;
public Location Center;
public Block Tree1;
public Block Tree2;
public HappyTreeData(Player owner)
{
Owner = owner;
Start = System.currentTimeMillis();
Center = owner.getLocation();
}
}
}

View File

@ -0,0 +1,100 @@
package nautilus.game.arcade.game.games.moba.kit.bob;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Random;
public class SkillPaint extends HeroSkill implements IThrown
{
private static final String[] DESCRIPTION = {
"Bob Ross"
};
private static final byte[] COLOURS = { 14, 1, 4, 5, 3, 11, 0};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.DIAMOND_BARDING);
public SkillPaint(int slot)
{
super("1-Inch Brush", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
if (!_kit.useAmmo(player, 1))
{
return;
}
useSkill(player);
Snowball snowball = player.launchProjectile(Snowball.class);
Manager.GetProjectile().AddThrow(snowball, player, this, -1, true, true, true, false, 0.5F);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Player thrower = (Player) data.getThrower();
Random random = UtilMath.random;
if (target != null)
{
thrower.playSound(thrower.getLocation(), Sound.LAVA_POP, 1, 1.3F);
Manager.GetDamage().NewDamageEvent(target, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, 2, true, true, false, UtilEnt.getName(thrower), GetName());
}
for (Block nearby : UtilBlock.getBlocksInRadius(data.getThrown().getLocation(), 2))
{
if (UtilBlock.airFoliage(nearby))
{
continue;
}
Manager.GetBlockRestore().add(nearby, Material.STAINED_CLAY.getId(), COLOURS[random.nextInt(COLOURS.length)], (long) (3000 + (Math.random() * 500)));
}
for (LivingEntity entity : UtilEnt.getInRadius(data.getThrown().getLocation(), 2).keySet())
{
Manager.GetDamage().NewDamageEvent(entity, thrower, (Projectile) data.getThrown(), DamageCause.PROJECTILE, 2, true, true, false, UtilEnt.getName(thrower), GetName());
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
}

View File

@ -175,8 +175,13 @@ public class DashSkill extends HeroSkill
LivingEntity entity = entry.getKey();
double scale = entry.getValue();
// If player hit themselves or the entity has already been hit
if (player.equals(entity) || !Recharge.Instance.use(player, GetName() + " by " + player.getName(), 500, false, false) && _collideOnce)
// If player hit themselves
if (player.equals(entity))
{
continue;
}
if (!(entity instanceof Player) || !Recharge.Instance.use((Player) entity, GetName() + " by " + player.getName(), 500, false, false) && _collideOnce)
{
continue;
}

View File

@ -4,6 +4,7 @@ import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class SkillSword extends HeroSkill

View File

@ -60,12 +60,12 @@ public class SkillDanaDash extends DashSkill
if (entity instanceof Player)
{
damage = 10;
UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 2, Math.random() / 2 - 0.25));
UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 1, Math.random() / 2 - 0.25));
}
else
{
damage = 6;
UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 1, Math.random() - 0.5));
UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 0.5, Math.random() - 0.5));
}
entity.getWorld().playSound(entity.getLocation(), Sound.IRONGOLEM_HIT, 1, 0.5F);

View File

@ -73,7 +73,7 @@ public class SkillRally extends HeroSkill
@EventHandler
public void updateLand(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
if (event.getType() != UpdateType.TICK)
{
return;
}

View File

@ -66,16 +66,12 @@ public class SkillNinjaBlade extends HeroSkill
Player player = event.GetDamagerPlayer(false);
Player damageePlayer = event.GetDamageePlayer();
if (player != null && damageePlayer != null)
if (player == null || damageePlayer == null || isTeamDamage(damageePlayer, player))
{
Game game = Manager.GetGame();
if (game.GetTeam(player).equals(game.GetTeam(damageePlayer)))
{
return;
}
return;
}
if (player == null || !_active.contains(player.getUniqueId()) || player.getItemInHand() == null || player.getItemInHand().getType() != Material.DIAMOND_SWORD)
if (!_active.contains(player.getUniqueId()) || player.getItemInHand() == null || player.getItemInHand().getType() != Material.DIAMOND_SWORD)
{
return;
}

View File

@ -82,13 +82,11 @@ public class SkillSnowball extends HeroSkill implements IThrown
@Override
public void Idle(ProjectileUser data)
{
data.getThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.getThrown().remove();
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.game.games.moba.shop;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class MobaItem
{
private final ItemStack _item;
private final int _cost;
private List<MobaItemEffect> _effects;
public MobaItem(ItemStack item, int cost)
{
_item = item;
_cost = cost;
}
public MobaItem addEffects(MobaItemEffect... effects)
{
if (_effects == null)
{
_effects = new ArrayList<>(effects.length);
}
for (MobaItemEffect effect : _effects)
{
_effects.add(effect);
}
return this;
}
public ItemStack getItem()
{
return _item;
}
public int getCost()
{
return _cost;
}
public List<MobaItemEffect> getEffects()
{
return _effects;
}
}

View File

@ -0,0 +1,17 @@
package nautilus.game.arcade.game.games.moba.shop;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import org.bukkit.entity.Player;
public class MobaItemEffect
{
public void onCooldownCheck(CooldownCalculateEvent event)
{
}
public void onDeath(Player killed, Player killer)
{
}
}

View File

@ -1,89 +0,0 @@
package nautilus.game.arcade.game.games.moba.shop;
import mineplex.core.common.util.UtilUI;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button;
import mineplex.core.menu.Menu;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.MobaPlayer;
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class MobaMainMenu extends Menu<ArcadeManager>
{
private static final int SLOTS = 27;
private final MobaPlayer _player;
public MobaMainMenu(MobaPlayer player, ArcadeManager plugin)
{
super(player.Kit.GetName() + " Shop", plugin);
_player = player;
}
@Override
protected Button[] setUp(Player player)
{
Button[] buttons = new Button[SLOTS];
HeroKit kit = _player.Kit;
List<HeroSkill> skills = new ArrayList<>(3);
for (Perk perk : kit.GetPerks())
{
if (!(perk instanceof HeroSkill))
{
continue;
}
skills.add((HeroSkill) perk);
}
int slots[] = UtilUI.getIndicesFor(skills.size(), 1, 3);
for (HeroSkill skill : skills)
{
}
return buttons;
}
private ItemStack getMainMenuItem(HeroSkill skill)
{
ItemBuilder builder;
if (skill instanceof SkillSword)
{
builder =
}
}
class MobaMainButton extends Button<ArcadeManager>
{
private MobaPlayer _player;
public MobaMainButton(MobaPlayer player, ArcadeManager plugin)
{
super(item, plugin);
_player = player;
}
@Override
public void onClick(Player player, ClickType clickType)
{
}
}
}

View File

@ -1,10 +1,21 @@
package nautilus.game.arcade.game.games.moba.shop;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
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 nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaPlayer;
import nautilus.game.arcade.game.games.moba.MobaRole;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.assassin.MobaAssassinShop;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -13,22 +24,29 @@ import org.bukkit.entity.Villager.Profession;
import org.bukkit.event.EventHandler;
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.Map.Entry;
public class MobaShop implements Listener
{
private final Moba _host;
private final List<LivingEntity> _entities;
private final Map<Player, Map<MobaUpgradeType, MobaUpgrade>> _upgrades;
private final Map<LivingEntity, Location> _entities;
private final Map<MobaRole, MobaShopMenu> _roleMenus;
private final Map<Player, List<MobaItem>> _upgrades;
public MobaShop(Moba host)
{
_host = host;
_entities = new ArrayList<>(2);
_entities = new HashMap<>(2);
_roleMenus = new HashMap<>(4);
_upgrades = new HashMap<>();
// Create menus
_roleMenus.put(MobaRole.ASSASSIN, new MobaAssassinShop(host, this));
}
@EventHandler
@ -41,6 +59,7 @@ public class MobaShop implements Listener
List<Location> locations = _host.WorldData.GetDataLocs("CYAN");
_host.CreatureAllowOverride = true;
for (Location location : locations)
{
Villager villager = location.getWorld().spawn(location, Villager.class);
@ -48,20 +67,61 @@ public class MobaShop implements Listener
villager.setProfession(Profession.LIBRARIAN);
villager.setAgeLock(true);
villager.setRemoveWhenFarAway(false);
villager.setCustomName(C.cGoldB + "GOLD UPGRADES");
villager.setCustomNameVisible(true);
UtilEnt.vegetate(villager);
UtilEnt.silence(villager, true);
UtilEnt.CreatureForceLook(villager, 0, UtilAlg.GetYaw(UtilAlg.getTrajectory(villager.getLocation(), _host.GetSpectatorLocation())));
_entities.add(villager);
_entities.put(villager, location);
}
}
public void purchaseUpgrade(Player player, MobaUpgrade upgrade)
{
_upgrades.putIfAbsent(player, new HashSet<>(3));
_upgrades.get(player).add(upgrade);
_host.CreatureAllowOverride = false;
}
private void openShop(MobaPlayer player)
{
MobaShopMenu menu = _roleMenus.get(player.Role);
if (menu == null)
{
player.Player.sendMessage(F.main("Game", "There isn't an upgrade shop for that kit yet."));
return;
}
menu.open(player.Player);
}
@EventHandler
public void npcMove(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
for (Entry<LivingEntity, Location> entry : _entities.entrySet())
{
LivingEntity entity = entry.getKey();
Location location = entry.getValue();
((CraftLivingEntity) entity).getHandle().setPosition(location.getX(), location.getY(), location.getZ());
}
}
@EventHandler
public void npcDamage(EntityDamageEvent event)
{
for (Entry<LivingEntity, Location> entry : _entities.entrySet())
{
LivingEntity entity = entry.getKey();
if (entity.equals(event.getEntity()))
{
entity.setFireTicks(0);
event.setCancelled(true);
return;
}
}
}
@EventHandler
@ -83,9 +143,9 @@ public class MobaShop implements Listener
return;
}
Player player = (Player) clicked;
Player player = (Player) clicker;
for (LivingEntity shop : _entities)
for (LivingEntity shop : _entities.keySet())
{
if (clicked.equals(shop))
{
@ -93,6 +153,7 @@ public class MobaShop implements Listener
if (data == null)
{
player.sendMessage(F.main("Game", "You don't appear to have any data?"));
return;
}
@ -101,4 +162,93 @@ public class MobaShop implements Listener
}
}
}
public void purchaseItem(Player player, MobaItem item)
{
player.sendMessage(F.main("Game", "Purchased " + F.greenElem(item.getItem().getItemMeta().getDisplayName()) + "."));
_host.getGoldManager().removeGold(player, item.getCost());
_upgrades.get(player).add(item);
}
public boolean ownsItem(Player player, MobaItem item)
{
return _upgrades.get(player).contains(item);
}
public List<MobaItem> getOwnedItems(Player player)
{
return _upgrades.get(player);
}
/*
Handle MobaItem events
*/
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
for (Player player : _host.GetPlayers(true))
{
_upgrades.put(player, new ArrayList<>());
}
}
@EventHandler
public void cooldownCalculate(CooldownCalculateEvent 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.onCooldownCheck(event);
}
}
}
@EventHandler
public void combatDeath(CombatDeathEvent event)
{
CombatComponent component = event.GetLog().GetKiller();
if (component == null || !component.IsPlayer() || !(event.GetEvent().getEntity() instanceof Player))
{
return;
}
Player killed = (Player) event.GetEvent().getEntity();
Player killer = UtilPlayer.searchExact(component.getUniqueIdOfEntity());
if (killer == null)
{
return;
}
List<MobaItem> items = _upgrades.get(killer);
for (MobaItem item : items)
{
if (item.getEffects() == null)
{
continue;
}
for (MobaItemEffect effect : item.getEffects())
{
effect.onDeath(killed, killer);
}
}
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.moba.shop;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class MobaShopCategory
{
private final String _name;
private final List<MobaItem> _items;
private final ItemStack _menuItem;
private boolean _allowMultiple;
public MobaShopCategory(String name, List<MobaItem> items, ItemStack menuItem)
{
_name = name;
_items = items;
_menuItem = menuItem;
}
public String getName()
{
return _name;
}
public List<MobaItem> getItems()
{
return _items;
}
public ItemStack getMenuItem()
{
return _menuItem;
}
public MobaShopCategory allowMultiple(boolean allow)
{
_allowMultiple = allow;
return this;
}
public boolean isAllowingMultiple()
{
return _allowMultiple;
}
}

View File

@ -0,0 +1,96 @@
package nautilus.game.arcade.game.games.moba.shop;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button;
import mineplex.core.menu.Menu;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
public class MobaShopCategoryMenu extends Menu<ArcadeManager>
{
private static final int SLOTS = 27;
private static final int STARTING_SLOT = 10;
private final Moba _host;
private final MobaShop _shop;
private final MobaShopCategory _category;
public MobaShopCategoryMenu(Moba host, MobaShop shop, MobaShopCategory category, ArcadeManager plugin)
{
super(category.getName() + " Shop", plugin);
_host = host;
_shop = shop;
_category = category;
}
@Override
protected Button[] setUp(Player player)
{
Button[] buttons = new Button[SLOTS];
int slot = STARTING_SLOT;
for (MobaItem item : _category.getItems())
{
ItemBuilder builder = new ItemBuilder(item.getItem());
boolean owns = _shop.ownsItem(player, item);
boolean canPurchase = _host.getGoldManager().hasGold(player, item.getCost());
builder.setTitle((canPurchase ? C.cGreen : C.cRed) + item.getItem().getItemMeta().getDisplayName());
if (owns)
{
builder.addLore(C.cRed + "You already have purchased this upgrade");
}
else
{
builder.addLore("Cost: " + C.cGold + item.getCost());
if (canPurchase)
{
builder.addLore(C.cGreen + "Click to purchase");
}
else
{
builder.addLore(C.cRed + "You cannot afford this item.");
}
}
buttons[slot++] = new MobaPurchaseButton(builder.build(), getPlugin(), item);
}
return buttons;
}
class MobaPurchaseButton extends Button<ArcadeManager>
{
private MobaItem _item;
public MobaPurchaseButton(ItemStack itemStack, ArcadeManager plugin, MobaItem item)
{
super(itemStack, plugin);
_item = item;
}
@Override
public void onClick(Player player, ClickType clickType)
{
boolean owns = _shop.ownsItem(player, _item);
boolean canPurchase = _host.getGoldManager().hasGold(player, _item.getCost());
if (!owns && canPurchase)
{
_shop.purchaseItem(player, _item);
player.closeInventory();
}
}
}
}

View File

@ -0,0 +1,124 @@
package nautilus.game.arcade.game.games.moba.shop;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilUI;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button;
import mineplex.core.menu.Menu;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaRole;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class MobaShopMenu extends Menu<ArcadeManager>
{
private static final int SLOTS = 27;
private final Moba _host;
private final MobaShop _shop;
private final List<MobaShopCategory> _categories;
public MobaShopMenu(Moba host, MobaShop shop, MobaRole role)
{
super(role.getName() + " Upgrade Shop", host.getArcadeManager());
_host = host;
_shop = shop;
_categories = new ArrayList<>();
}
protected void addCategory(MobaShopCategory category)
{
_categories.add(category);
}
@Override
protected Button[] setUp(Player player)
{
Button[] buttons = new Button[SLOTS];
int[] slots = UtilUI.getIndicesFor(_categories.size(), 1);
int slot = 0;
for (MobaShopCategory category : _categories)
{
ItemBuilder builder;
MobaItem owned = null;
for (MobaItem item : category.getItems())
{
if (_shop.ownsItem(player, item))
{
owned = item;
break;
}
}
if (owned == null)
{
builder = new ItemBuilder(category.getMenuItem());
}
else
{
builder = new ItemBuilder(owned.getItem());
}
builder.setTitle(C.cGreen + category.getName());
builder.addLore("", "Not sure what to put here", "");
if (category.isAllowingMultiple())
{
builder.addLore(C.cWhite + "Current Upgrades:");
boolean ownsAtLeastOne = false;
for (MobaItem item : category.getItems())
{
if (_shop.ownsItem(player, item))
{
ownsAtLeastOne = true;
builder.addLore(" - " + item.getItem().getItemMeta().getDisplayName());
}
}
if (!ownsAtLeastOne)
{
builder.addLore(" - None");
}
}
else
{
builder.addLore(C.cWhite + "Current Upgrade: " + (owned == null ? C.cGray + "None" : owned.getItem().getItemMeta().getDisplayName()));
}
builder.addLore("", C.cYellow + "Click to view the upgrades.");
buttons[slots[slot++]] = new MobaCategoryButton(builder.build(), getPlugin(), category);
}
return buttons;
}
class MobaCategoryButton extends Button<ArcadeManager>
{
private MobaShopCategory _category;
public MobaCategoryButton(ItemStack itemStack, ArcadeManager plugin, MobaShopCategory category)
{
super(itemStack, plugin);
_category = category;
}
@Override
public void onClick(Player player, ClickType clickType)
{
new MobaShopCategoryMenu(_host, _shop, _category, getPlugin()).open(player);
}
}
}

View File

@ -1,19 +0,0 @@
package nautilus.game.arcade.game.games.moba.shop;
import org.bukkit.inventory.ItemStack;
public class MobaUpgrade
{
private ItemStack _item;
public MobaUpgrade(ItemStack item)
{
_item = item;
}
public ItemStack getItem()
{
return _item;
}
}

View File

@ -1,13 +0,0 @@
package nautilus.game.arcade.game.games.moba.shop;
public enum MobaUpgradeType
{
SWORD,
BOW,
HELMET,
CHEST,
LEGS,
BOOTS
}

View File

@ -0,0 +1,43 @@
package nautilus.game.arcade.game.games.moba.shop.assassin;
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.MobaKillHealEffect;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
public class MobaAssassinShop extends MobaShopMenu
{
private static final MobaShopCategory SWORD = new MobaShopCategory("Sword", Arrays.asList(
new MobaItem(new ItemBuilder(Material.GOLD_SWORD)
.setTitle(C.cGreenB + "Sword of Time")
.build(), 800)
.addEffects(
new MobaKillHealEffect(3)
),
new MobaItem(new ItemBuilder(Material.IRON_SWORD)
.setTitle(C.cYellowB + "Adventurer's Sword")
.build(), 1000),
new MobaItem(new ItemBuilder(Material.DIAMOND_SWORD)
.setTitle(C.cDRedB + "Pumpkin King's Blade")
.addEnchantment(Enchantment.DAMAGE_ALL, 3)
.build(), 1750)
), new ItemStack(Material.WOOD_SWORD));
public MobaAssassinShop(Moba host, MobaShop shop)
{
super(host, shop, MobaRole.ASSASSIN);
addCategory(SWORD);
}
}

View File

@ -1,22 +0,0 @@
package nautilus.game.arcade.game.games.moba.shop.common;
import nautilus.game.arcade.game.games.moba.shop.MobaUpgrade;
import org.bukkit.inventory.ItemStack;
public class CooldownUpgrade extends MobaUpgrade
{
private double _reductionFactor;
public CooldownUpgrade(ItemStack item, double reductionFactor)
{
super(item);
_reductionFactor = reductionFactor;
}
public double getReductionFactor()
{
return _reductionFactor;
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaCDREffect extends MobaItemEffect
{
private double _factor;
public MobaCDREffect(double factor)
{
_factor = factor;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
event.decreaseCooldown(_factor);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaKillHealEffect extends MobaItemEffect
{
private double _health;
public MobaKillHealEffect(double health)
{
_health = health;
}
@Override
public void onDeath(Player killed, Player killer)
{
killer.setHealth(Math.min(killer.getMaxHealth(), killer.getHealth() + _health));
}
}

View File

@ -168,6 +168,12 @@ public class CapturePoint
private void setOwner(GameTeam team)
{
// Same team
if (_owner != null && _owner.equals(team))
{
return;
}
_owner = team;
setBeaconColour(team);

View File

@ -1,11 +1,8 @@
package nautilus.game.arcade.game.games.moba.structure.point;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import java.util.List;
public class CapturePointCaptureEvent extends Event
{