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 name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.8.0 version: 3.8.0r1
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -63,6 +63,7 @@ public class EliteMonster {
boolean enraged=false; boolean enraged=false;
boolean storingenergy=false; boolean storingenergy=false;
Location target_leap_loc = null; Location target_leap_loc = null;
Location myspawn = null;
HashMap<Block,Material> storedblocks = new HashMap<Block,Material>(); HashMap<Block,Material> storedblocks = new HashMap<Block,Material>();
List<Player> targetlist = new ArrayList<Player>(); List<Player> targetlist = new ArrayList<Player>();
@ -72,6 +73,7 @@ public class EliteMonster {
this.m=m; this.m=m;
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD); m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
this.hp_before_burstcheck=m.getHealth(); this.hp_before_burstcheck=m.getHealth();
this.myspawn=m.getLocation();
} }
public void runTick() { public void runTick() {
@ -80,6 +82,7 @@ public class EliteMonster {
rebuff(); rebuff();
regenerateHealth(); regenerateHealth();
moveFasterToTarget(); moveFasterToTarget();
resetToSpawn();
if (m.isValid() && targetlist.size()>0) { if (m.isValid() && targetlist.size()>0) {
weakenTeam(); weakenTeam();
retargetInAir(); 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() { private void dontDrown() {
m.setRemainingAir(m.getMaximumAir()); m.setRemainingAir(m.getMaximumAir());
} }
@ -179,6 +188,7 @@ public class EliteMonster {
m.setTarget(ChooseRandomTarget()); m.setTarget(ChooseRandomTarget());
} else { } else {
m.setTarget(null); m.setTarget(null);
resetToSpawn();
} }
} }
if (!storingenergy) { 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))); m.setVelocity((m.getLocation().getDirection()).add(new Vector(0,0.2*(l.getLocation().getY()-m.getLocation().getY()),0)));
} }
} else { } else {
targetlist.remove(l);
m.setTarget(null); m.setTarget(null);
} }
} }
@ -342,7 +353,7 @@ public class EliteMonster {
for (int x=-radius;x<radius+1;x++) { for (int x=-radius;x<radius+1;x++) {
for (int z=-radius;z<radius+1;z++) { for (int z=-radius;z<radius+1;z++) {
Block b = target.getLocation().add(x,-0.9,z).getBlock(); 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()); storedblocks.put(b, b.getType());
b.setType(Material.STAINED_GLASS); b.setType(Material.STAINED_GLASS);
b.setData((byte)4); 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++) { for (int i=0;i<elitemonsters.size();i++) {
EliteMonster em = elitemonsters.get(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); log(ev.getDamage()+"",5);
if (ev.getCause()==DamageCause.FIRE || ev.getCause()==DamageCause.FIRE_TICK || 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.WITHER || ev.getCause()==DamageCause.POISON
|| ev.getCause()==DamageCause.THORNS) { || ev.getCause()==DamageCause.THORNS) {
if (ev.getEntity() instanceof LivingEntity) { if (ev.getEntity() instanceof LivingEntity) {