Wither and AI base

This commit is contained in:
Sam 2017-05-15 19:32:25 +01:00
parent d510dd9f58
commit a450b23d22
14 changed files with 762 additions and 30 deletions

View File

@ -17,6 +17,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.DebugCommand;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.moba.boss.BossManager;
import nautilus.game.arcade.game.games.moba.fountain.MobaFountain;
import nautilus.game.arcade.game.games.moba.gold.GoldManager;
import nautilus.game.arcade.game.games.moba.kit.*;
@ -34,6 +35,7 @@ import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
@ -110,6 +112,9 @@ public class Moba extends TeamGame
MobaFountain fountain = new MobaFountain(this);
_listeners.add(fountain);
Listener boss = new BossManager(this);
_listeners.add(boss);
new CompassModule()
.setGiveCompass(true)
.setGiveCompassToSpecs(true)
@ -228,21 +233,7 @@ public class Moba extends TeamGame
}
String team = components[1];
String lane = components[2];
int laneInt = 0;
switch (lane)
{
case "A":
laneInt = 0;
break;
case "B":
laneInt = 1;
break;
case "C":
laneInt = 2;
break;
}
MobaLane lane = MobaLane.valueOf(components[2]);
boolean firstTower;
@ -263,7 +254,7 @@ public class Moba extends TeamGame
continue;
}
_towers.add(new Tower(this, location, gameTeam, laneInt, health, firstTower));
_towers.add(new Tower(this, location, gameTeam, lane, health, firstTower));
}
_listeners.forEach(UtilServer::RegisterEvents);
@ -305,19 +296,29 @@ public class Moba extends TeamGame
{
scoreboard.writeNewLine();
// GameTeam team = GetTeam(player);
// boolean blueBottom = team == null || team.GetColor() == ChatColor.BLUE;
//
// // Tower Data
// List<String> lines = new ArrayList<>();
// GameTeam red = GetTeam(ChatColor.RED);
// GameTeam blue = GetTeam(ChatColor.AQUA);
//
// lines.add("");
// Gold
scoreboard.write(C.cGoldB + "Gold");
if (IsAlive(player))
{
int gold = _goldManager.getGold(player);
scoreboard.write(C.cGoldB + "Gold");
scoreboard.write(String.valueOf(gold));
}
else
{
scoreboard.write("You are dead lol");
scoreboard.write("None");
}
scoreboard.writeNewLine();
}
@ -377,6 +378,13 @@ public class Moba extends TeamGame
}
}
@Override
public void RespawnPlayer(Player player)
{
super.RespawnPlayer(player);
player.setGameMode(GameMode.ADVENTURE);
}
@Override
public void disable()
{
@ -680,7 +688,7 @@ public class Moba extends TeamGame
{
for (HeroKit kit : _kits)
{
if (kit.getRole() == role)
if (kit.getRole() == role && kit.isVisible())
{
return kit;
}

View File

@ -0,0 +1,43 @@
package nautilus.game.arcade.game.games.moba;
import nautilus.game.arcade.game.GameTeam;
import org.bukkit.ChatColor;
public enum MobaLane
{
A,
B,
C;
public String getName(GameTeam team)
{
if (this == B)
{
return "Middle";
}
else if (this == A)
{
if (team.GetColor() == ChatColor.AQUA)
{
return "Left";
}
else
{
return "Right";
}
}
else
{
if (team.GetColor() == ChatColor.AQUA)
{
return "Right";
}
else
{
return "Left";
}
}
}
}

View File

@ -0,0 +1,124 @@
package nautilus.game.arcade.game.games.moba.ai;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.Map.Entry;
public class MobaAI
{
public static final int TARGET_RANGE = 11;
public static final int TARGET_RANGE_SQUARED = TARGET_RANGE * TARGET_RANGE;
private final Moba _host;
private final GameTeam _owner;
private LivingEntity _entity;
private LivingEntity _target;
private Location _home;
private MobaAIMethod _aiMethod;
public MobaAI(Moba host, GameTeam owner, LivingEntity entity, Location home, MobaAIMethod aiMethod)
{
_host = host;
_owner = owner;
_entity = entity;
_home = home;
_aiMethod = aiMethod;
}
public void updateTarget()
{
// Entity not spawned
if (_entity == null || !_entity.isValid())
{
return;
}
if (_target == null)
{
_target = getBestEntityTarget();
if (_target == null)
{
returnToHome();
return;
}
}
else
{
double dist = UtilMath.offsetSquared(_home, _target.getLocation());
if (dist > TARGET_RANGE_SQUARED || UtilPlayer.isSpectator(_target))
{
_target = null;
returnToHome();
}
}
if (_target != null)
{
_aiMethod.updateMovement(_entity, _target.getLocation(), 2.5F);
}
}
private void returnToHome()
{
_aiMethod.updateMovement(_entity, _home, 3.5F);
}
private LivingEntity getBestEntityTarget()
{
LivingEntity highest = null;
double bestDist = 0;
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(_home, TARGET_RANGE).entrySet())
{
LivingEntity entity = entry.getKey();
double dist = entry.getValue();
if (_entity.equals(entity))
{
continue;
}
// Make players more desirable
if (entity instanceof Player)
{
if (_owner.equals(_host.GetTeam((Player) entity)))
{
continue;
}
dist += 0.5;
}
if (bestDist < dist)
{
highest = entity;
bestDist = dist;
}
}
return highest;
}
public void setEntity(LivingEntity entity)
{
_entity = entity;
}
public LivingEntity getTarget()
{
return _target;
}
}

View File

@ -0,0 +1,11 @@
package nautilus.game.arcade.game.games.moba.ai.goal;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
public interface MobaAIMethod
{
void updateMovement(LivingEntity entity, Location goal, float speed);
}

View File

@ -0,0 +1,70 @@
package nautilus.game.arcade.game.games.moba.ai.goal;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
public class MobaDirectAIMethod implements MobaAIMethod
{
private static final float YAW_SNAP_LIMIT = 20F;
@Override
public void updateMovement(LivingEntity entity, Location goal, float speed)
{
Location entityLocation = entity.getLocation();
float entityYaw = entityLocation.getYaw();
// Speed is blocks per second
float magnitude = speed / 20F;
// Get the direct vector between the entity and the goal
Vector direction = UtilAlg.getTrajectory(entityLocation, goal);
// From the direction, get the yaw of this direction
float directionYaw = UtilAlg.GetYaw(direction);
// Get the absolute yaw offset from the direction
// This can then be used to see how far the entity is
// looking away from the goal
float yawOffset = Math.abs(directionYaw - entityYaw);
// If the entity is facing too far away from the goal to consider the
// "Head Snapping" of turning the entity too severe
if (yawOffset > YAW_SNAP_LIMIT)
{
// Facing too far right
if (entityYaw > directionYaw)
{
entityYaw -= YAW_SNAP_LIMIT;
}
// Facing too far left
else
{
entityYaw += YAW_SNAP_LIMIT;
}
// Only alter the entity's yaw
entityLocation.setYaw(entityYaw);
}
// If reached the goal
else if (UtilMath.offsetSquared(entityLocation, goal) < 0.5)
{
entityLocation = goal;
}
else
{
// Modify the direction's magnitude to be at the same rate as the speed
direction.multiply(magnitude);
// Add the modified direction to the original entity location
entityLocation.add(direction);
}
// Move the entity to its new location
entity.teleport(entityLocation);
}
}

View File

@ -0,0 +1,15 @@
package nautilus.game.arcade.game.games.moba.ai.goal;
import mineplex.core.common.util.UtilEnt;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
public class MobaEntityAIMethod implements MobaAIMethod
{
@Override
public void updateMovement(LivingEntity entity, Location goal, float speed)
{
UtilEnt.CreatureMoveFast(entity, goal, speed);
}
}

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.game.games.moba.boss;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.HashMap;
import java.util.Map;
public class BossManager implements Listener
{
private final Moba _host;
private Map<GameTeam, WitherBoss> _teamBosses;
public BossManager(Moba host)
{
_host = host;
_teamBosses = new HashMap<>(2);
}
private void spawnBosses()
{
_host.CreatureAllowOverride = true;
WorldData worldData = _host.WorldData;
// Spawn Team Withers
for (GameTeam team : _host.GetTeamList())
{
WitherBoss boss = new WitherBoss(_host, worldData.GetDataLocs(team.GetName().toUpperCase()).get(0), team);
boss.setup();
_teamBosses.put(team, boss);
}
_host.CreatureAllowOverride = false;
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
spawnBosses();
}
@EventHandler
public void cleanup(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End && event.GetState() != GameState.Dead)
{
return;
}
_teamBosses.forEach((team, witherBoss) -> witherBoss.cleanup());
}
public WitherBoss getWitherBoss(GameTeam team)
{
return _teamBosses.get(team);
}
}

View File

@ -0,0 +1,90 @@
package nautilus.game.arcade.game.games.moba.boss;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
public abstract class MobaBoss implements Listener
{
protected final Moba _host;
protected LivingEntity _entity;
protected Location _location;
protected int _respawnTime;
private long _lastDeath;
public MobaBoss(Moba host, Location location)
{
this(host, location, -1);
}
public MobaBoss(Moba host, Location location, int respawnTime)
{
_host = host;
_location = location;
_respawnTime = respawnTime;
_lastDeath = -1;
}
public void setup()
{
_entity = spawnEntity();
UtilServer.RegisterEvents(this);
}
public void cleanup()
{
UtilServer.Unregister(this);
}
@EventHandler
public void updateMovement(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || _entity == null || !_host.IsLive())
{
return;
}
getAi().updateTarget();
}
@EventHandler
public void entityDeath(EntityDeathEvent event)
{
if (_entity != null && _entity.equals(event.getEntity()))
{
_entity = null;
_lastDeath = System.currentTimeMillis();
getAi().setEntity(null);
}
}
@EventHandler
public void updateRespawn(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || _lastDeath == -1 || UtilTime.elapsed(_lastDeath, _respawnTime))
{
return;
}
_lastDeath = -1;
_entity = spawnEntity();
}
public abstract LivingEntity spawnEntity();
public abstract MobaAI getAi();
public LivingEntity getEntity()
{
return _entity;
}
}

View File

@ -0,0 +1,162 @@
package nautilus.game.arcade.game.games.moba.boss.wither;
import mineplex.core.common.util.UtilAlg;
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.DisguiseWither;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
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 org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class WitherBoss extends MobaBoss
{
private static final int INITIAL_HEALTH = 1750;
private static final int FIRST_TOWER_HEALTH_REDUCTION = 100;
private static final int SECOND_TOWER_HEALTH_REDUCTION = 250;
private GameTeam _team;
private MobaAI _ai;
public WitherBoss(Moba host, Location location, GameTeam team)
{
super(host, location);
_location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, host.GetSpectatorLocation())));
_team = team;
}
@Override
public LivingEntity spawnEntity()
{
ArmorStand stand = _location.getWorld().spawn(_location, ArmorStand.class);
stand.setMaxHealth(INITIAL_HEALTH);
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);
return stand;
}
@Override
public MobaAI getAi()
{
if (_ai == null)
{
_ai = new MobaAI(_host, _team, _entity, _location, new MobaDirectAIMethod());
}
return _ai;
}
@Override
@EventHandler
public void updateMovement(UpdateEvent event)
{
super.updateMovement(event);
if (event.getType() == UpdateType.SEC && _entity != null && _host.IsLive() && getAi().getTarget() != null)
{
new WitherSkullProjectile(_host, _entity, getAi().getTarget(), _team);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(CustomDamageEvent event)
{
// Not a Wither Boss
if (event.isCancelled() || !(event.GetDamageeEntity().equals(_entity)))
{
return;
}
event.SetCancelled("Wither Boss");
if (event.GetDamagerPlayer(true) == null || event.GetCause() == DamageCause.FIRE || event.GetCause() == DamageCause.FIRE_TICK)
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(true);
GameTeam team = _host.GetTeam(damager);
if (_team.equals(team))
{
return;
}
double newHealth = damagee.getHealth() - event.GetDamage();
// Don't allow the wither to move because of damage
damagee.playEffect(EntityEffect.HURT);
if (newHealth > 0)
{
damagee.setHealth(newHealth);
}
else
{
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _entity.getLocation().add(0, 1.5, 0), 0F, 0F, 0F, 0.1F, 1, ViewDist.LONG);
_entity.remove();
}
}
@EventHandler
public void towerDestroy(TowerDestroyEvent event)
{
Tower tower = event.getTower();
if (!_team.equals(tower.getOwner()))
{
return;
}
if (tower.isFirstTower())
{
_entity.setHealth(_entity.getHealth() - FIRST_TOWER_HEALTH_REDUCTION);
}
else
{
_entity.damage(_entity.getHealth() - SECOND_TOWER_HEALTH_REDUCTION);
}
}
@EventHandler
public void updateTeamDisplay(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || _entity == null)
{
return;
}
double percent = _entity.getHealth() / _entity.getMaxHealth();
for (Player player : _team.GetPlayers(true))
{
UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither");
}
}
}

View File

@ -0,0 +1,82 @@
package nautilus.game.arcade.game.games.moba.boss.wither;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class WitherSkullProjectile implements IThrown
{
private static final int DAMAGE = 10;
private final Moba _host;
private final ArcadeManager _manager;
private final GameTeam _owner;
public WitherSkullProjectile(Moba host, LivingEntity shooter, LivingEntity target, GameTeam owner)
{
_host = host;
_manager = host.getArcadeManager();
_owner = owner;
WitherSkull skull = shooter.launchProjectile(WitherSkull.class);
skull.setYield(0);
skull.setVelocity(skull.getVelocity().add(UtilAlg.getTrajectory(shooter, target)).normalize().multiply(3));
_manager.GetProjectile().AddThrow(skull, shooter, this, 2000, true, true, true, false, 0.5F);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target == null)
{
Expire(data);
return;
}
if (target instanceof Player)
{
Player targetPlayer = (Player) target;
GameTeam targetTeam = _host.GetTeam(targetPlayer);
// Not team damage
if (!_owner.equals(targetTeam))
{
_manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), "Wither Skull");
}
Expire(data);
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
Entity thrown = data.getThrown();
thrown.getWorld().playSound(thrown.getLocation(), Sound.EXPLODE, 1, 1.6F);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, thrown.getLocation(), 0, 0, 0, 0.1F, 1, ViewDist.LONG);
thrown.remove();
}
}

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.games.moba.kit.common;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
@ -16,7 +18,10 @@ public class SkillBow extends HeroSkill
"Please work"
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BOW);
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.BOW)
.setTitle(C.cGreenB + "Bow")
.setUnbreakable(true)
.build();
public SkillBow(int slot)
{

View File

@ -5,16 +5,13 @@ import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -23,7 +20,6 @@ import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.HashSet;
@ -129,7 +125,6 @@ public class SkillInfinity extends HeroSkill
{
if (_arrows.containsKey(event.GetProjectile()))
{
Bukkit.broadcastMessage("Wither");
Manager.GetCondition().Factory().Wither(GetName(), event.GetDamageeEntity(), event.GetDamagerEntity(true), 3, 0, false, true, false);
}
}

View File

@ -91,6 +91,11 @@ public class MobaShop implements Listener
public void openShop(MobaPlayer player)
{
if (UtilPlayer.isSpectator(player.Player) || _host.GetState() != GameState.Live)
{
return;
}
MobaShopMenu menu = _roleMenus.get(player.Role);
if (menu == null)

View File

@ -3,9 +3,9 @@ package nautilus.game.arcade.game.games.moba.structure.tower;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.utils.UtilVariant;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.MobaLane;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Guardian;
@ -16,14 +16,14 @@ public class Tower
private final Moba _host;
private final Location _location;
private final GameTeam _team;
private int _lane;
private MobaLane _lane;
private double _health;
private int _maxHealth;
private boolean _firstTower;
private Guardian _guardian;
private boolean _dead;
public Tower(Moba host, Location location, GameTeam team, int lane, int health, boolean firstTower)
public Tower(Moba host, Location location, GameTeam team, MobaLane lane, int health, boolean firstTower)
{
_host = host;
_location = location;
@ -79,7 +79,7 @@ public class Tower
{
float percentage = (float) _health / (float) _maxHealth;
_guardian.setCustomName(UtilTextMiddle.progress(percentage));
_guardian.setCustomName(getHealthBar(40));
}
private void explode()
@ -93,4 +93,54 @@ public class Tower
{
return _dead;
}
private String getHealthBar(int bars)
{
String out = "";
String colour;
double health = _guardian.getHealth() / _guardian.getMaxHealth();
if (health < 0.25)
{
colour = C.cRedB;
}
else if (health < 0.5)
{
colour = C.cGoldB;
}
else if (health < 0.75)
{
colour = C.cYellowB;
}
else
{
colour = C.cGreenB;
}
for (int i = 0; i < bars; i++)
{
double cur = i * (1D / (double) bars);
if (cur < health)
{
out += colour + "|";
}
else
{
out += C.cGrayB + "|";
}
}
return out;
}
public GameTeam getOwner()
{
return _team;
}
public boolean isFirstTower()
{
return _firstTower;
}
}