Sigils bug fixes

This commit is contained in:
Sam 2017-05-26 18:33:06 +01:00
parent a6c1e6c892
commit 5c8a36b024
14 changed files with 104 additions and 85 deletions

View File

@ -237,7 +237,7 @@ public class Moba extends TeamGame
scoreboard.writeNewLine();
scoreboard.write(C.cYellowB + "Hero");
scoreboard.write(mobaPlayer.getKit() == null ? "Unselected " : mobaPlayer.getKit().GetName() + " (" + mobaPlayer.getRole().getName() + ")");
scoreboard.write((mobaPlayer == null || mobaPlayer.getKit() == null) ? "Unselected " : mobaPlayer.getKit().GetName() + " (" + mobaPlayer.getRole().getName() + ")");
scoreboard.writeNewLine();

View File

@ -65,13 +65,13 @@ public class MobaAI
if (_target != null)
{
_aiMethod.updateMovement(_entity, _target.getLocation(), 2.5F);
_aiMethod.updateMovement(_entity, _target.getLocation(), 5F);
}
}
private void returnToHome()
{
_aiMethod.updateMovement(_entity, _home, 3.5F);
_aiMethod.updateMovement(_entity, _home, 7F);
}
public void setEntity(LivingEntity entity)

View File

@ -15,12 +15,6 @@ public class MobaDirectAIMethod implements MobaAIMethod
public boolean updateMovement(LivingEntity entity, Location goal, float speed)
{
Location entityLocation = entity.getLocation();
if (UtilMath.offsetSquared(entity.getLocation(), goal) < 6)
{
return false;
}
float entityYaw = entityLocation.getYaw();
// Speed is blocks per second
@ -58,7 +52,7 @@ public class MobaDirectAIMethod implements MobaAIMethod
// If reached the goal
else if (UtilMath.offsetSquared(entityLocation, goal) < 0.5)
{
entityLocation = goal;
return false;
}
else
{

View File

@ -89,7 +89,7 @@ public class SkillPulseHeal extends HeroSkill
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !Recharge.Instance.use(player, GetName(), 10000, false, false))
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !Recharge.Instance.use(player, GetName(), 5000, false, false))
{
continue;
}
@ -106,14 +106,14 @@ public class SkillPulseHeal extends HeroSkill
continue;
}
entity.setHealth(Math.min(entity.getHealth() + 2, entity.getMaxHealth()));
entity.setHealth(Math.min(entity.getHealth() + 4, entity.getMaxHealth()));
}
displayPulse(location, false);
}
else
{
player.setHealth(Math.min(player.getHealth() + 2, player.getMaxHealth()));
player.setHealth(Math.min(player.getHealth() + 4, player.getMaxHealth()));
displayPulse(location, true);
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.moba.kit.dana;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -184,6 +185,18 @@ public class SkillRally extends HeroSkill
}
}
@EventHandler
public void velocityChange(EntityVelocityChangeEvent event)
{
for (RallyData data : _data)
{
if (!data.Landed && data.Owner.equals(event.getEntity()))
{
event.setCancelled(true);
}
}
}
private Pattern getPattern(GameTeam team)
{
return team.GetColor() == ChatColor.RED ? new Pattern(DyeColor.WHITE, PatternType.CROSS) : new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE);

View File

@ -36,6 +36,6 @@ public class HeroDevon extends HeroKit
super(manager, "Devon", DESCRIPTION, PERKS, IN_HAND, MobaRole.HUNTER);
setAmmo(AMMO, 3000);
setMaxAmmo(3);
setMaxAmmo(1);
}
}

View File

@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.moba.kit.devon;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
@ -13,7 +12,6 @@ import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
@ -104,15 +102,12 @@ public class SkillInfinity extends HeroSkill
Player player = entry.getValue();
GameTeam team = Manager.GetGame().GetTeam(player);
for (LivingEntity nearby : UtilEnt.getInRadius(entity.getLocation(), 6).keySet())
for (Player nearby : UtilPlayer.getInRadius(entity.getLocation(), 6).keySet())
{
if (nearby instanceof Player)
// If the target is on the same team
if (UtilPlayer.isSpectator(player) || team.equals(Manager.GetGame().GetTeam(nearby)))
{
// If the target is on the same team
if (UtilPlayer.isSpectator(player) || team.equals(Manager.GetGame().GetTeam((Player) nearby)))
{
continue;
}
continue;
}
UtilAction.velocity(entity, UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation().add(0, 1.5, 0)));

View File

@ -6,29 +6,32 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class SkillTNTArrows extends HeroSkill implements IThrown
public class SkillTNTArrows extends HeroSkill
{
private static final String[] DESCRIPTION = {
@ -37,7 +40,8 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.TNT);
private final Map<Player, Integer> _arrows = new HashMap<>();
private final Map<Player, Integer> _playerArrows = new HashMap<>();
private final Set<Arrow> _arrows = new HashSet<>();
public SkillTNTArrows(int slot)
{
@ -56,7 +60,7 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
Player player = event.getPlayer();
_arrows.put(player, 3);
_playerArrows.put(player, 3);
player.getItemInHand().addEnchantment(UtilInv.getDullEnchantment(), 1);
player.getItemInHand().setAmount(3);
}
@ -71,87 +75,85 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
Player player = (Player) event.getEntity();
if (!hasPerk(player) || !_arrows.containsKey(player))
if (!hasPerk(player) || !_playerArrows.containsKey(player))
{
return;
}
ItemStack itemStack = player.getInventory().getItem(getSlot());
int arrows = _arrows.get(player);
int arrows = _playerArrows.get(player);
if (arrows == 1)
{
_arrows.remove(player);
_playerArrows.remove(player);
useSkill(player);
}
else
{
arrows--;
_arrows.put(player, arrows);
_playerArrows.put(player, arrows);
itemStack.setAmount(arrows);
}
Manager.GetProjectile().AddThrow(event.getProjectile(), player, this, -1, true, true, true, false, 0);
_arrows.add((Arrow) event.getProjectile());
}
@EventHandler
public void playerDeath(CombatDeathEvent event)
public void projectileHit(ProjectileHitEvent event)
{
_arrows.remove(event.GetEvent().getEntity());
}
ProjectileSource source = event.getEntity().getShooter();
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_arrows.remove(event.getPlayer());
}
if (!(source instanceof Player))
{
return;
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
LivingEntity thrower = data.getThrower();
Location location = data.getThrown().getLocation();
Player player = (Player) source;
Projectile projectile = event.getEntity();
if (!_arrows.contains(projectile))
{
return;
}
_arrows.remove(projectile);
Location location = projectile.getLocation();
location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.9F);
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
double damage = 10;
// Scale damage with the damage on the player's bow
if (thrower instanceof Player)
{
Player throwerPlayer = (Player) thrower;
ItemStack itemStack = throwerPlayer.getInventory().getItem(0);
ItemStack itemStack = player.getInventory().getItem(0);
// Player has a bow
if (itemStack != null && itemStack.getType() == Material.BOW)
{
damage += damage * itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) * 0.25;
}
// Player has a bow
if (itemStack != null && itemStack.getType() == Material.BOW)
{
damage += damage * itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) * 0.25;
}
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(location, 5).entrySet())
{
if (entry.getKey().equals(thrower))
if (entry.getKey().equals(player))
{
continue;
}
Manager.GetDamage().NewDamageEvent(entry.getKey(), thrower, null, DamageCause.BLOCK_EXPLOSION, (entry.getValue() + 0.5) * damage, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
Manager.GetDamage().NewDamageEvent(entry.getKey(), player, null, DamageCause.BLOCK_EXPLOSION, (entry.getValue() + 0.5) * damage, true, true, false, UtilEnt.getName(player), GetName());
}
data.getThrown().remove();
}
@Override
public void Idle(ProjectileUser data)
@EventHandler
public void playerDeath(CombatDeathEvent event)
{
_playerArrows.remove(event.GetEvent().getEntity());
}
@Override
public void Expire(ProjectileUser data)
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerArrows.remove(event.getPlayer());
}
}

View File

@ -17,7 +17,7 @@ public class HeroHattori extends HeroKit
};
private static final Perk[] PERKS = {
new PerkDoubleJump("Double Jump", 1, 1, true),
new PerkDoubleJump("Double Jump", 1, 1, true, 3000, true),
new SkillSnowball(0),
new SkillSword(1),
new SkillNinjaDash(2),

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.moba.minion;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
@ -10,15 +11,19 @@ public class Minion
{
private static final int HEALTH = 10;
private static final int DAMAGE_RATE = 500;
private final LivingEntity _entity;
private Location _target;
private int _targetIndex;
private long _lastDamage;
public Minion(Location spawn, Class<? extends LivingEntity> clazz)
{
_target = spawn;
damage();
LivingEntity entity = spawn.getWorld().spawn(spawn, clazz);
_entity = entity;
@ -69,4 +74,14 @@ public class Minion
{
return _targetIndex;
}
public boolean canDamage()
{
return UtilTime.elapsed(_lastDamage, DAMAGE_RATE);
}
public void damage()
{
_lastDamage = System.currentTimeMillis();
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.moba.minion;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -14,7 +15,6 @@ import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -34,11 +34,11 @@ import java.util.List;
public class MinionWave implements Listener
{
private static final int MAX_MINIONS_PER_WAVE = 1;
private static final int TOO_CLOSE_SQUARED = 12;
private static final int MINION_TOO_CLOSE_SQUARED = 4;
private static final int DAMAGE_RANGE_SQUARED = 15;
private static final int DAMAGE_AMOUNT = 4;
private static final int MAX_MINIONS_PER_WAVE = 6;
private static final int TOO_CLOSE_SQUARED = 9;
private static final int MINION_TOO_CLOSE_SQUARED = 16;
private static final int DAMAGE_RANGE_SQUARED = 16;
private static final double DAMAGE_AMOUNT = 0.2;
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
private final Moba _host;
@ -73,7 +73,7 @@ public class MinionWave implements Listener
cancel();
}
}
}, 20, 20);
}, 15, 15);
}
private boolean spawn()
@ -119,10 +119,10 @@ public class MinionWave implements Listener
minion.setTarget(target);
// Too close
if (UtilMath.offsetSquared(entity.getLocation(), target) < MINION_TOO_CLOSE_SQUARED)
if (UtilMath.offsetSquared(entity.getLocation(), target) < MINION_TOO_CLOSE_SQUARED && minionTarget.canDamage())
{
Bukkit.broadcastMessage("Attack");
_host.getArcadeManager().GetDamage().NewDamageEvent(minion.getEntity(), minionTarget.getEntity(), null, DamageCause.CUSTOM, DAMAGE_AMOUNT, false, false, false, UtilEnt.getName(minion.getEntity()), "Minion");
minionTarget.damage();
_host.getArcadeManager().GetDamage().NewDamageEvent(minion.getEntity(), minionTarget.getEntity(), null, DamageCause.CUSTOM, DAMAGE_AMOUNT, false, true, false, UtilEnt.getName(minion.getEntity()), "Minion");
continue;
}
}
@ -138,7 +138,7 @@ public class MinionWave implements Listener
// Too close
if (UtilMath.offsetSquared(entity.getLocation(), target) < TOO_CLOSE_SQUARED)
{
Bukkit.broadcastMessage("Too close");
//Bukkit.broadcastMessage("Too close");
continue;
}
}
@ -149,13 +149,13 @@ public class MinionWave implements Listener
if (newTarget == _path.size())
{
Bukkit.broadcastMessage("Done");
//Bukkit.broadcastMessage("Done");
continue;
}
minion.setTargetIndex(newTarget);
minion.setTarget(_path.get(newTarget));
Bukkit.broadcastMessage("Advance target " + newTarget);
//Bukkit.broadcastMessage("Advance target " + newTarget);
}
}

View File

@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
public class PrepareInformation implements Listener
{
private static final long MESSAGE_TIME = TimeUnit.SECONDS.toMillis(5);
private static final long MESSAGE_TIME = TimeUnit.SECONDS.toMillis(3);
private static final int MESSAGE_TIME_TICKS = (int) (MESSAGE_TIME / 50D + 5);
private final Moba _host;
@ -46,7 +46,7 @@ public class PrepareInformation implements Listener
}
// Modify the prepare time
_host.PrepareTime = longestDescription * 1000 + 1000;
_host.PrepareTime = longestDescription * MESSAGE_TIME + 1000;
UtilServer.RegisterEvents(this);
}

View File

@ -46,7 +46,7 @@ public class CapturePointManager implements Listener
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.SEC || !_host.IsLive())
{
return;
}

View File

@ -31,8 +31,8 @@ import java.util.Map.Entry;
public class TowerManager implements Listener
{
private static final int FIRST_TOWER_HEALTH = 250;
private static final int SECOND_TOWER_HEALTH = 500;
private static final int FIRST_TOWER_HEALTH = 500;
private static final int SECOND_TOWER_HEALTH = 1000;
private final Moba _host;