Make the wither display its health

This commit is contained in:
Sam 2017-05-16 11:58:00 +01:00
parent 119b041ec1
commit 0874458754
1 changed files with 15 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -16,6 +17,7 @@ import nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerDestroyEvent;
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
@ -35,6 +37,8 @@ public class WitherBoss extends MobaBoss
private GameTeam _team;
private MobaAI _ai;
private DisguiseWither _disguise;
public WitherBoss(Moba host, Location location, GameTeam team)
{
super(host, location);
@ -52,10 +56,10 @@ public class WitherBoss extends MobaBoss
stand.setHealth(INITIAL_HEALTH);
stand.setGravity(false);
DisguiseWither disguiseWither = new DisguiseWither(stand);
disguiseWither.setName(_team.GetColor() + _team.GetName() + "\'s Wither");
disguiseWither.setCustomNameVisible(true);
_host.getArcadeManager().GetDisguise().disguise(disguiseWither);
_disguise = new DisguiseWither(stand);
_disguise.setName(_team.GetColor() + _team.GetName() + "\'s Wither");
_disguise.setCustomNameVisible(true);
_host.getArcadeManager().GetDisguise().disguise(_disguise);
return stand;
}
@ -116,6 +120,7 @@ public class WitherBoss extends MobaBoss
if (newHealth > 0)
{
damagee.setHealth(newHealth);
updateDisplay();
}
else
{
@ -140,7 +145,7 @@ public class WitherBoss extends MobaBoss
}
else
{
_entity.damage(_entity.getHealth() - SECOND_TOWER_HEALTH_REDUCTION);
_entity.setHealth(_entity.getHealth() - SECOND_TOWER_HEALTH_REDUCTION);
}
}
@ -159,4 +164,9 @@ public class WitherBoss extends MobaBoss
UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither");
}
}
private void updateDisplay()
{
_disguise.setName(MobaUtil.getHealthBar(_entity, 40));
}
}