Allow flat health values for bosses.
This commit is contained in:
@@ -233,7 +233,23 @@ public class WaveParser
|
|||||||
// Grab the boss health
|
// Grab the boss health
|
||||||
String hlth = config.getString("health");
|
String hlth = config.getString("health");
|
||||||
BossHealth health = BossHealth.fromString(hlth);
|
BossHealth health = BossHealth.fromString(hlth);
|
||||||
|
if (health != null) {
|
||||||
result.setHealth(health);
|
result.setHealth(health);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
int flatHealth;
|
||||||
|
if (hlth != null) {
|
||||||
|
flatHealth = Integer.parseInt(hlth);
|
||||||
|
} else {
|
||||||
|
flatHealth = config.getInt("health");
|
||||||
|
}
|
||||||
|
result.setFlatHealth(flatHealth);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String warning = "Unable to parse health of boss '%s' in arena '%s'. Defaulting to medium. Value was '%s'";
|
||||||
|
Messenger.warning(String.format(warning, name, arena.configName(), hlth));
|
||||||
|
result.setHealth(BossHealth.MEDIUM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// And the abilities.
|
// And the abilities.
|
||||||
String ablts = config.getString("abilities");
|
String ablts = config.getString("abilities");
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ public enum BossHealth
|
|||||||
return (playerCount + 1) * 20 * multiplier;
|
return (playerCount + 1) * 20 * multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMultiplier() {
|
||||||
|
return multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
public static BossHealth fromString(String string) {
|
public static BossHealth fromString(String string) {
|
||||||
return WaveUtils.getEnumFromString(BossHealth.class, string, MEDIUM);
|
return WaveUtils.getEnumFromString(BossHealth.class, string, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,10 @@ public class BossWave extends AbstractWave
|
|||||||
{
|
{
|
||||||
private MACreature monster;
|
private MACreature monster;
|
||||||
private Set<MABoss> bosses;
|
private Set<MABoss> bosses;
|
||||||
private BossHealth health;
|
|
||||||
|
private boolean useHealthMultiplier;
|
||||||
|
private int healthMultiplier;
|
||||||
|
private int flatHealth;
|
||||||
|
|
||||||
private List<Ability> abilities;
|
private List<Ability> abilities;
|
||||||
private boolean activated, abilityAnnounce;
|
private boolean activated, abilityAnnounce;
|
||||||
@@ -36,6 +39,10 @@ public class BossWave extends AbstractWave
|
|||||||
this.activated = false;
|
this.activated = false;
|
||||||
this.abilityAnnounce = false;
|
this.abilityAnnounce = false;
|
||||||
this.setType(WaveType.BOSS);
|
this.setType(WaveType.BOSS);
|
||||||
|
|
||||||
|
this.useHealthMultiplier = true;
|
||||||
|
this.healthMultiplier = 0;
|
||||||
|
this.flatHealth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,11 +53,20 @@ public class BossWave extends AbstractWave
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxHealth(int playerCount) {
|
public int getMaxHealth(int playerCount) {
|
||||||
return health.getMax(playerCount);
|
if (useHealthMultiplier) {
|
||||||
|
return (playerCount + 1) * 20 * healthMultiplier;
|
||||||
|
}
|
||||||
|
return flatHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHealth(BossHealth health) {
|
public void setHealth(BossHealth health) {
|
||||||
this.health = health;
|
this.healthMultiplier = health.getMultiplier();
|
||||||
|
this.useHealthMultiplier = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlatHealth(int flatHealth) {
|
||||||
|
this.flatHealth = flatHealth;
|
||||||
|
this.useHealthMultiplier = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMABoss(MABoss boss) {
|
public void addMABoss(MABoss boss) {
|
||||||
|
|||||||
Reference in New Issue
Block a user