Lots of bug fixes

This commit is contained in:
Sam 2017-06-13 21:49:34 +01:00
parent 3efeb38a01
commit 4978f924a7
25 changed files with 414 additions and 33 deletions

View File

@ -104,7 +104,7 @@ public enum GameDisplay
AlienInvasion("Alien Invasion", Material.ENDER_STONE, (byte) 0, GameCategory.EVENT, 69, false), AlienInvasion("Alien Invasion", Material.ENDER_STONE, (byte) 0, GameCategory.EVENT, 69, false),
MOBA("Heroes of the Craft", Material.SKULL_ITEM, (byte)1, GameCategory.CLASSICS, 70, true), MOBA("Heroes of GWEN", Material.SKULL_ITEM, (byte)1, GameCategory.CLASSICS, 70, true),
GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false), GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false),

View File

@ -44,6 +44,7 @@ public enum GameType
MineWare("MineWare"), MineWare("MineWare"),
MinecraftLeague("MCL"), MinecraftLeague("MCL"),
MilkCow("Milk the Cow"), MilkCow("Milk the Cow"),
HOG("Heroes of GWEN"),
MonsterLeague("MonsterLeague"), MonsterLeague("MonsterLeague"),
MonsterMaze("Monster Maze"), MonsterMaze("Monster Maze"),
Paintball("Super Paintball"), Paintball("Super Paintball"),

View File

@ -10,6 +10,7 @@ import mineplex.minecraft.game.core.combat.DeathMessageType;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.DebugCommand; import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
@ -328,13 +329,16 @@ public class Moba extends TeamGame
scoreboard.write(red.GetColor() + C.Bold + redTitle); scoreboard.write(red.GetColor() + C.Bold + redTitle);
scoreboard.write("Base: " + _tower.getDisplayString(red) + _boss.getWitherDisplayString(red)); scoreboard.write("Base: " + _tower.getDisplayString(red) + _boss.getWitherDisplayString(red));
scoreboard.write("Beacons: " + _capturePoint.getDisplayString(red));
scoreboard.writeNewLine(); scoreboard.writeNewLine();
scoreboard.write(blue.GetColor() + C.Bold + blueTitle); scoreboard.write(blue.GetColor() + C.Bold + blueTitle);
scoreboard.write("Base: " + _tower.getDisplayString(blue) + _boss.getWitherDisplayString(blue)); scoreboard.write("Base: " + _tower.getDisplayString(blue) + _boss.getWitherDisplayString(blue));
scoreboard.write("Beacons: " + _capturePoint.getDisplayString(blue));
scoreboard.writeNewLine();
scoreboard.write(C.cGreenB + "Beacons");
scoreboard.write(_capturePoint.getDisplayString());
scoreboard.writeNewLine(); scoreboard.writeNewLine();
@ -355,8 +359,6 @@ public class Moba extends TeamGame
scoreboard.write(C.cYellowB + "Time"); scoreboard.write(C.cYellowB + "Time");
scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime()));
scoreboard.writeNewLine();
} }
private void writeEnd(Player player, GameScoreboard scoreboard) private void writeEnd(Player player, GameScoreboard scoreboard)
@ -387,6 +389,19 @@ public class Moba extends TeamGame
} }
} }
@EventHandler
public void preventOverfill(PlayerPrepareTeleportEvent event)
{
Player player = event.GetPlayer();
if (GetPlayers(true).size() > 8)
{
SetPlayerState(player, GameTeam.PlayerState.OUT);
Manager.addSpectator(player, true);
player.sendMessage(F.main("Game", "Too many players are in this server. You are now spectating, sorry."));
}
}
@Override @Override
public void EndCheck() public void EndCheck()
{ {

View File

@ -125,7 +125,7 @@ public class PumpkinBoss extends MobaBoss
Block block = entry.getKey(); Block block = entry.getKey();
double setChance = entry.getValue(); double setChance = entry.getValue();
if (block.getType() == Material.AIR || block.getRelative(BlockFace.UP).getType() != Material.AIR || Math.random() > setChance) if (!UtilBlock.solid(block)|| block.getRelative(BlockFace.UP).getType() != Material.AIR || Math.random() > setChance)
{ {
continue; continue;
} }

View File

@ -2,15 +2,24 @@ package nautilus.game.arcade.game.games.moba.buff.buffs;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff; import nautilus.game.arcade.game.games.moba.buff.Buff;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class BuffCripple extends Buff<Player> public class BuffCripple extends Buff<Player>
{ {
private static final ItemStack private static final ItemStack ITEM = new ItemBuilder(Material.IRON_INGOT)
.setTitle(C.cGray + "Crippled")
.build();
public static ItemStack getItemRepresentation()
{
return ITEM;
}
public BuffCripple(Moba host, Player entity, long duration) public BuffCripple(Moba host, Player entity, long duration)
{ {

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.moba.general;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent; import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
@ -10,6 +11,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
public class MobaDamageManager implements Listener public class MobaDamageManager implements Listener
@ -89,4 +91,17 @@ public class MobaDamageManager implements Listener
_host.getScoreboardModule().refresh(); _host.getScoreboardModule().refresh();
} }
@EventHandler(priority = EventPriority.HIGH)
public void unifyKilledWith(CombatDeathEvent event)
{
String word = event.getKilledWord();
String[] split = word.split("-");
if (word.contains("Click") && split.length > 1)
{
word = split[1].trim();
event.setKilledWord(word);
}
}
} }

View File

@ -312,7 +312,8 @@ public class HeroSkill extends Perk
// If the player is crippled say they are // If the player is crippled say they are
if (moba.getBuffManager().hasBuff(player, BuffCripple.class)) if (moba.getBuffManager().hasBuff(player, BuffCripple.class))
{ {
itemStack = player.getInventory().setItem(_slot, BuffCripple.getItemRepresentation());
continue;
} }
if (done) if (done)
@ -385,6 +386,11 @@ public class HeroSkill extends Perk
}, 0, 20); }, 0, 20);
} }
public void resetCooldown(Player player)
{
_lastSkill.put(player.getUniqueId(), 0L);
}
protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager) protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager)
{ {
if (!(damager instanceof Player)) if (!(damager instanceof Player))

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.moba.kit.anath;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill; 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.Material;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -45,7 +46,7 @@ public class SkillFireProjectile extends HeroSkill
Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), _kit.getAmmo()); Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), _kit.getAmmo());
item.setVelocity(direction); item.setVelocity(direction);
Manager.GetFire().Add(item, player, 3, 0, 1, DAMAGE, GetName(), false); Manager.GetFire().Add(item, player, 3, 0, 1, DAMAGE, MobaConstants.BASIC_ATTACK, false);
((Moba) Manager.GetGame()).getTowerManager().addProjectile(player, item, DAMAGE); ((Moba) Manager.GetGame()).getTowerManager().addProjectile(player, item, DAMAGE);
} }
} }

View File

@ -8,6 +8,7 @@ import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
@ -63,6 +64,11 @@ public class SkillMeteor extends HeroSkill implements IThrown
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Recharge.Instance.use(player, GetName() + "Trigger", 2000, false, false))
{
return;
}
for (MeteorShowerData data : _data) for (MeteorShowerData data : _data)
{ {
if (data.Shooter.equals(player)) if (data.Shooter.equals(player))

View File

@ -73,6 +73,7 @@ public class SkillFullMoon extends HeroSkill
wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_GROWL, 1, 1); wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_GROWL, 1, 1);
} }
broadcast(player);
useActiveSkill(() -> useActiveSkill(() ->
{ {
_active.remove(player); _active.remove(player);

View File

@ -4,6 +4,8 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.SpigotUtil; import mineplex.core.common.util.SpigotUtil;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill; import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
@ -93,4 +95,28 @@ public class SkillSummonWolf extends HeroSkill
useSkill(player); useSkill(player);
} }
@EventHandler
public void updateWolfItem(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
HeroBardolf kit = (HeroBardolf) Kit;
for (Player player : Manager.GetGame().GetPlayers(true))
{
WolfData data = kit.getWolfData(player);
ItemStack itemStack = player.getInventory().getItem(getSlot());
if (data == null || itemStack == null || itemStack.getType() != SKILL_ITEM.getType())
{
continue;
}
itemStack.setAmount(data.getWolves().size());
}
}
} }

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.BuffManager; import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffRooting; import nautilus.game.arcade.game.games.moba.buff.buffs.BuffRooting;
@ -138,6 +139,20 @@ public class SkillWarHorse extends HeroSkill
} }
} }
@EventHandler
public void horseDamage(CustomDamageEvent event)
{
for (WarHorseData data : _data)
{
if (data.Horse.equals(event.GetDamageeEntity()))
{
event.SetCancelled("Biff Horse");
return;
}
}
}
private class WarHorseData private class WarHorseData
{ {
public Player Owner; public Player Owner;

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.moba.kit.hp; package nautilus.game.arcade.game.games.moba.kit.hp;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -10,20 +11,27 @@ public class MobaHPRegenEvent extends PlayerEvent implements Cancellable
private static final HandlerList _handlers = new HandlerList(); private static final HandlerList _handlers = new HandlerList();
private final Player _source;
private final double _initialHealth; private final double _initialHealth;
private double _health; private double _health;
private boolean _natural; private boolean _natural;
private boolean _cancel; private boolean _cancel;
public MobaHPRegenEvent(Player who, double health, boolean natural) public MobaHPRegenEvent(Player who, Player source, double health, boolean natural)
{ {
super(who); super(who);
_source = source;
_initialHealth = health; _initialHealth = health;
_health = health; _health = health;
_natural = natural; _natural = natural;
} }
public Player getSource()
{
return _source;
}
public void setHealth(double health) public void setHealth(double health)
{ {
_health = health; _health = health;
@ -31,7 +39,7 @@ public class MobaHPRegenEvent extends PlayerEvent implements Cancellable
public void increaseHealth(double factor) public void increaseHealth(double factor)
{ {
_health = _initialHealth * factor; _health = _initialHealth + (_initialHealth * factor);
} }
public double getHealth() public double getHealth()

View File

@ -11,6 +11,7 @@ import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill; import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager; import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -65,7 +66,7 @@ public class SkillAquaCannon extends HeroSkill
continue; continue;
} }
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), MobaConstants.BASIC_ATTACK);
break; break;
} }
} }

View File

@ -16,7 +16,8 @@ public class HeroRowena extends HeroKit
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new SkillBow(0), new SkillBow(0),
new SkillLightArrows(1), new SkillLightArrows(1),
new SkillCombatDash(2) new SkillCombatDash(2),
new SkillBombardment(3)
}; };
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW) private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)

View File

@ -0,0 +1,219 @@
package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Location;
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.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class SkillBombardment extends HeroSkill
{
private static final String[] DESCRIPTION = {
"Turns into a Diamond Sword that deals extreme",
"damage to any player hit by it."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final int SHOTS = 3;
private static final int MAX_TIME = 10000;
private static final int DAMAGE_INCREASE = 5;
private Set<BombardmentData> _data = new HashSet<>();
public SkillBombardment(int slot)
{
super("Bombardment", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
setCooldown(60000);
setDropItemActivate(true);
}
@Override
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (!isSkillItem(event))
{
return;
}
Player player = event.getPlayer();
for (BombardmentData data : _data)
{
if (data.Shooter.equals(player))
{
return;
}
}
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof SkillLightArrows)
{
SkillLightArrows skill = (SkillLightArrows) perk;
skill.resetCooldown(player);
skill.setPlayerArrows(player, SHOTS);
}
}
broadcast(player);
UtilAction.velocity(player, new Vector(0, 2, 0));
_data.add(new BombardmentData(player));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<BombardmentData> iterator = _data.iterator();
while (iterator.hasNext())
{
BombardmentData data = iterator.next();
Player player = data.Shooter;
if (data.Block == null && player.getVelocity().getY() <= 0)
{
data.Block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
data.Block.setType(Material.BARRIER);
Location playerLocation = player.getLocation();
Location toTeleport = data.Block.getLocation();
toTeleport.setYaw(playerLocation.getYaw());
toTeleport.setPitch(playerLocation.getPitch());
player.getInventory().setHeldItemSlot(0);
}
else if (UtilTime.elapsed(data.Start, MAX_TIME) || data.Shots == 0)
{
useSkill(player);
data.Block.setType(Material.AIR);
iterator.remove();
}
else if (data.Block != null)
{
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, data.Block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.001F, 3, ViewDist.LONG);
}
}
}
@EventHandler
public void shootArrow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
for (BombardmentData data : _data)
{
if (data.Shooter.equals(player))
{
data.Shots--;
return;
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void increaseDamage(CustomDamageEvent event)
{
if (event.isCancelled())
{
return;
}
Player damager = event.GetDamagerPlayer(true);
if (damager == null || event.GetReason() == null || !event.GetReason().contains("Light Arrows"))
{
return;
}
damager.playSound(event.GetDamageeEntity().getLocation(), Sound.EXPLODE, 1, 0.6F);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation().add(0, 1, 0), 0, 0, 0, 0.1F, 1, ViewDist.LONG);
event.AddMod(GetName(), DAMAGE_INCREASE);
}
@EventHandler
public void playerMove(PlayerMoveEvent event)
{
Player player = event.getPlayer();
for (BombardmentData data : _data)
{
if (data.Block != null && data.Shooter.equals(player) && (event.getTo().getX() != event.getFrom().getX() || event.getTo().getZ() != event.getFrom().getZ()))
{
event.setTo(event.getFrom());
}
}
}
@EventHandler
public void playerVelocity(EntityVelocityChangeEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
for (BombardmentData data : _data)
{
if (data.Block != null && data.Shooter.equals(player))
{
event.setCancelled(true);
}
}
}
private class BombardmentData
{
Player Shooter;
int Shots;
Block Block;
long Start;
BombardmentData(Player shooter)
{
Shooter = shooter;
Shots = SHOTS;
Start = System.currentTimeMillis();
}
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.moba.kit.rowena;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle; import mineplex.core.common.util.particles.effects.LineParticle;
@ -11,6 +12,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba; import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill; import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager; import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
import nautilus.game.arcade.game.games.moba.util.MobaUtil; import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Material; import org.bukkit.Material;
@ -129,7 +131,12 @@ public class SkillLightArrows extends HeroSkill
{ {
if (!lineParticle.update()) if (!lineParticle.update())
{ {
towerManager.damageTowerAt(lineParticle.getLastLocation(), player, damage); Tower hitTower = towerManager.damageTowerAt(lineParticle.getLastLocation(), player, damage);
if (hitTower != null && UtilMath.offsetSquared(hitTower.getCrystal(), player) > Tower.TARGET_RANGE_SQUARED)
{
continue;
}
for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 1.5).keySet()) for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 1.5).keySet())
{ {
@ -163,5 +170,10 @@ public class SkillLightArrows extends HeroSkill
_playerArrows.remove(event.getPlayer()); _playerArrows.remove(event.getPlayer());
_arrows.remove(event.getPlayer()); _arrows.remove(event.getPlayer());
} }
void setPlayerArrows(Player player, int amount)
{
_playerArrows.put(player, amount);
}
} }

View File

@ -50,6 +50,10 @@ public abstract class MobaItemEffect
{ {
} }
protected void onHPRegenOthers(MobaHPRegenEvent event)
{
}
protected void onRespawn(PlayerGameRespawnEvent event) protected void onRespawn(PlayerGameRespawnEvent event)
{ {
} }

View File

@ -444,6 +444,30 @@ public class MobaShop implements Listener
} }
} }
@EventHandler
public void hpOther(MobaHPRegenEvent event)
{
if (event.getSource() == null)
{
return;
}
List<MobaItem> items = _upgrades.get(event.getSource());
for (MobaItem item : items)
{
if (item.getEffects() == null)
{
continue;
}
for (MobaItemEffect effect : item.getEffects())
{
effect.onHPRegenOthers(event);
}
}
}
@EventHandler @EventHandler
public void repawn(PlayerGameRespawnEvent event) public void repawn(PlayerGameRespawnEvent event)
{ {

View File

@ -31,7 +31,7 @@ public class MobaAbilityDamageEffect extends MobaItemEffect
} }
@Override @Override
protected void onHPRegen(MobaHPRegenEvent event) protected void onHPRegenOthers(MobaHPRegenEvent event)
{ {
if (event.isNatural()) if (event.isNatural())
{ {

View File

@ -51,6 +51,6 @@ public class MobaHitConditionEffect extends MobaItemEffect
@Override @Override
public String getDescription() public String getDescription()
{ {
return "Hitting a player applies " + F.greenElem(format(_conditionType, _multi)) + " for " + F.time(format(_duration)) + " seconds."; return "Hitting a player gives " + (_applyToDamagee ? "them" : "you") + " " + F.greenElem(format(_conditionType, _multi)) + " for " + F.time(format(_duration)) + " seconds.";
} }
} }

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.moba.shop.effects; package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect; import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
@ -25,6 +26,6 @@ public class MobaMeleeDamageEffect extends MobaItemEffect
@Override @Override
public String getDescription() public String getDescription()
{ {
return "All your melee attacks deal " + F.greenElem("+" + format(_increase)) + "."; return "All your melee attacks deal " + F.greenElem("+" + format(_increase / 2)) + C.cRed + "" + C.cGray + ".";
} }
} }

View File

@ -284,6 +284,11 @@ public class CapturePoint
_center.getBlock().getRelative(BlockFace.DOWN).setData(colour); _center.getBlock().getRelative(BlockFace.DOWN).setData(colour);
} }
public String getName()
{
return _name;
}
public ChatColor getColour() public ChatColor getColour()
{ {
return _colour; return _colour;

View File

@ -5,7 +5,6 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState; 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.Moba;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -77,30 +76,42 @@ public class CapturePointManager implements Listener
} }
} }
public String getDisplayString(GameTeam team) public String getDisplayString()
{ {
StringBuilder out = new StringBuilder(); StringBuilder out = new StringBuilder();
int owned = 0;
for (CapturePoint point : _capturePoints) for (CapturePoint point : _capturePoints)
{ {
if (point.getOwner() == null || !point.getOwner().equals(team)) out.append(point.getOwner() == null ? C.cWhite : point.getOwner().GetColor()).append(point.getName()).append(" ");
{
continue;
}
out.append(point.getColour()).append("");
owned++;
}
while (owned++ < 3)
{
out.append(C.cGray).append("");
} }
return out.toString().trim(); return out.toString().trim();
} }
// public String getDisplayString(GameTeam team)
// {
// StringBuilder out = new StringBuilder();
// int owned = 0;
//
// for (CapturePoint point : _capturePoints)
// {
// if (point.getOwner() == null || !point.getOwner().equals(team))
// {
// continue;
// }
//
// out.append(point.getColour()).append("");
// owned++;
// }
//
// while (owned++ < 3)
// {
// out.append(C.cGray).append("");
// }
//
// return out.toString().trim();
// }
public List<CapturePoint> getCapturePoints() public List<CapturePoint> getCapturePoints()
{ {
return _capturePoints; return _capturePoints;

View File

@ -211,7 +211,7 @@ public class TowerManager implements Listener
GameTeam team = _host.GetTeam(player); GameTeam team = _host.GetTeam(player);
if (UtilPlayer.isSpectator(player) || team == null || !canDamage(tower, team) || shouldCancelDamage(tower, player)) if (UtilPlayer.isSpectator(player) || team == null || !canDamage(tower, team) || shouldCancelDamage(tower, player) || !Recharge.Instance.use(player, "Damage Tower", 200, false, false))
{ {
return; return;
} }