Elite monsters move back to their spawn point after killing all targets.

This commit is contained in:
sigonasr2 2016-08-07 21:09:21 -05:00
parent 88988be3dd
commit 6ea02f3d1f
4 changed files with 16 additions and 4 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.8.0
version: 3.8.0r1
commands:
money:
description: Tells the player the amount of money they are holding.

View File

@ -63,6 +63,7 @@ public class EliteMonster {
boolean enraged=false;
boolean storingenergy=false;
Location target_leap_loc = null;
Location myspawn = null;
HashMap<Block,Material> storedblocks = new HashMap<Block,Material>();
List<Player> targetlist = new ArrayList<Player>();
@ -72,6 +73,7 @@ public class EliteMonster {
this.m=m;
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
this.hp_before_burstcheck=m.getHealth();
this.myspawn=m.getLocation();
}
public void runTick() {
@ -80,6 +82,7 @@ public class EliteMonster {
rebuff();
regenerateHealth();
moveFasterToTarget();
resetToSpawn();
if (m.isValid() && targetlist.size()>0) {
weakenTeam();
retargetInAir();
@ -88,6 +91,12 @@ public class EliteMonster {
}
}
private void resetToSpawn() {
if (targetlist.size()==0 && m.getLocation().distanceSquared(myspawn)>81) {
m.teleport(myspawn);
}
}
private void dontDrown() {
m.setRemainingAir(m.getMaximumAir());
}
@ -179,6 +188,7 @@ public class EliteMonster {
m.setTarget(ChooseRandomTarget());
} else {
m.setTarget(null);
resetToSpawn();
}
}
if (!storingenergy) {
@ -205,6 +215,7 @@ public class EliteMonster {
m.setVelocity((m.getLocation().getDirection()).add(new Vector(0,0.2*(l.getLocation().getY()-m.getLocation().getY()),0)));
}
} else {
targetlist.remove(l);
m.setTarget(null);
}
}
@ -342,7 +353,7 @@ public class EliteMonster {
for (int x=-radius;x<radius+1;x++) {
for (int z=-radius;z<radius+1;z++) {
Block b = target.getLocation().add(x,-0.9,z).getBlock();
if (b.getType()!=Material.AIR && aPlugin.API.isDestroyable(b)) {
if (b.getType()!=Material.AIR && aPlugin.API.isDestroyable(b) && GenericFunctions.isSoftBlock(b)) {
storedblocks.put(b, b.getType());
b.setType(Material.STAINED_GLASS);
b.setData((byte)4);

View File

@ -2708,7 +2708,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
for (int i=0;i<elitemonsters.size();i++) {
EliteMonster em = elitemonsters.get(i);
em.getMonster().setTarget(null);
em.targetlist.remove(p);
}
}
@ -3784,6 +3784,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log(ev.getDamage()+"",5);
if (ev.getCause()==DamageCause.FIRE || ev.getCause()==DamageCause.FIRE_TICK ||
ev.getCause()==DamageCause.LAVA || ev.getCause()==DamageCause.SUFFOCATION ||
ev.getCause()==DamageCause.WITHER || ev.getCause()==DamageCause.POISON
|| ev.getCause()==DamageCause.THORNS) {
if (ev.getEntity() instanceof LivingEntity) {