LightningOrb now strikes all living entities instead of just players.

This commit is contained in:
Jonathan Williams 2014-12-27 03:25:54 -05:00
parent d83a63ef57
commit 2480361421

View File

@ -19,10 +19,12 @@ import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.event.player.*;
public class LightningOrb extends SkillActive implements IThrown
@ -42,16 +44,16 @@ public class LightningOrb extends SkillActive implements IThrown
return getHandlerList();
}
private final List<Player> _struck;
private final List<LivingEntity> _struck;
public LightningOrbEvent(Player who, List<Player> struck)
public LightningOrbEvent(Player who, List<LivingEntity> struck)
{
super(who);
_struck = struck;
}
public List<Player> getStruck()
public List<LivingEntity> getStruck()
{
return _struck;
}
@ -143,33 +145,36 @@ public class LightningOrb extends SkillActive implements IThrown
if (level == 0) return;
HashMap<Player, Double> hit = UtilPlayer.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level);
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level);
//Lightning Condition
for (Player cur : hit.keySet())
for (LivingEntity cur : hit.keySet())
{
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
}
List<Player> struck = new ArrayList<>();
List<LivingEntity> struck = new ArrayList<>();
//Lightning
for (Player cur : hit.keySet())
for (LivingEntity cur : hit.keySet())
{
if (cur.equals(player))
continue;
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
if (cur instanceof Player)
{
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
}
//Lightning
cur.getWorld().strikeLightning(cur.getLocation());
struck.add(cur);
}
//Apply Conditions
for (Player cur : hit.keySet())
for (LivingEntity cur : hit.keySet())
{
if (cur.equals(player))
continue;