This commit is contained in:
Chiss 2013-11-23 09:28:27 +11:00
parent a5a80378f7
commit 42cab3a39c
2 changed files with 28 additions and 35 deletions

View File

@ -1131,17 +1131,4 @@ public class HungerGames extends SoloGame
{
event.SetDamageToLevel(false);
}
@EventHandler
public void Firework(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL).trail(false).build();
UtilFirework.playFirework(GetSpectatorLocation(), effect);
}
}

View File

@ -34,6 +34,7 @@ public class PerkSkeletons extends Perk
private HashMap<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
private boolean _name;
private int _maxDist = 8;
public PerkSkeletons(boolean name)
{
@ -68,7 +69,7 @@ public class PerkSkeletons extends Perk
Manager.GetGame().CreatureAllowOverride = false;
UtilEnt.removeGoalSelectors(skel);
skel.setMaxHealth(30);
skel.setHealth(skel.getMaxHealth());
@ -83,7 +84,7 @@ public class PerkSkeletons extends Perk
event.GetEvent().getDrops().remove(killed.getInventory().getChestplate());
event.GetEvent().getDrops().remove(killed.getInventory().getLeggings());
event.GetEvent().getDrops().remove(killed.getInventory().getBoots());
skel.getEquipment().setItemInHandDropChance(1f);
skel.getEquipment().setHelmetDropChance(1f);
skel.getEquipment().setChestplateDropChance(1f);
@ -112,6 +113,20 @@ public class PerkSkeletons extends Perk
if (_minions.get(event.getTarget()).contains(event.getEntity()))
event.setCancelled(true);
for (Player player : _minions.keySet())
{
for (Skeleton skel : _minions.get(player))
{
if (event.getEntity().equals(skel))
{
if (UtilMath.offset(skel, player) > _maxDist)
{
}
}
}
}
}
@EventHandler
@ -137,19 +152,11 @@ public class PerkSkeletons extends Perk
//Return to Owner
double range = 4;
if (skel.getTarget() != null)
if (skel.getTarget() != null || ((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
{
range = 8;
System.out.println("A: " + UtilEnt.getName(skel.getTarget()));
range = _maxDist;
}
if (((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
{
range = 8;
System.out.println("B: " + ((CraftSkeleton)skel).getHandle().getGoalTarget());
}
if (UtilMath.offset(skel, player) > range)
{
float speed = 1f;
@ -157,15 +164,14 @@ public class PerkSkeletons extends Perk
speed = 1.4f;
//Move
Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3));
EntityCreature ec = ((CraftCreature)skel).getHandle();
Navigation nav = ec.getNavigation();
Location target = player.getLocation().add(UtilAlg.getTrajectory(player, skel));
nav.a(target.getX(), target.getY(), target.getZ(), speed);
skel.setTarget(null);
((CraftSkeleton)skel).getHandle().setGoalTarget(null);
System.out.println("OUT OF RANGE! RETURN HOME MY FRIEND");
}
}
}
@ -215,32 +221,32 @@ public class PerkSkeletons extends Perk
{
if (event.GetDamagerEntity(true) == null)
return;
if (!IsMinion(event.GetDamagerEntity(true)))
return;
double damage = 4;
if (event.GetDamagerEntity(true) instanceof Skeleton)
{
Skeleton skel = (Skeleton)event.GetDamagerEntity(true);
if (skel.getEquipment().getItemInHand() != null)
{
if (skel.getEquipment().getItemInHand().getType() == Material.STONE_SWORD) damage = 5;
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_SWORD) damage = 6;
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_SWORD) damage = 6;
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_SWORD) damage = 7;
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_AXE) damage = 5;
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_AXE) damage = 5;
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_AXE) damage = 6;
}
}
if (event.GetProjectile() != null)
damage = 6;
event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Skeleton Minion", "Damage", damage, false);
}