Reimplement wave AI, split out some UI code into a ui module, update TODO

This commit is contained in:
2022-05-10 05:28:01 +02:00
parent 2f63695ee9
commit 75debe1905
15 changed files with 588 additions and 248 deletions

View File

@@ -6,6 +6,9 @@ import gg.malloc.defense.model.Spawner;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Mob;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.Attribute;
import java.util.HashMap;
@@ -55,6 +58,8 @@ public class ScaledWaves implements Game {
@Override
public void spawnBatch(Spawner spawner, int batch) {
double healthScale = -0.5;
AttributeModifier modifier = new AttributeModifier("Scaled Health", healthScale, AttributeModifier.Operation.MULTIPLY_SCALAR_1);
assert(m_mobsPerBatch > 0);
for(int i = 0; i < m_mobsPerBatch; i++) {
EntityType selectedType = null;
@@ -67,8 +72,9 @@ public class ScaledWaves implements Game {
}
}
assert(selectedType != null);
Entity newMob = spawner.spawnMob(selectedType);
Mob newMob = (Mob)spawner.spawnBombCarrier(selectedType);
newMob.setCustomName("Mob " + i + "/" + m_mobsPerBatch);
newMob.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(modifier);
}
if (m_hasRavager) {
Entity newMob = spawner.spawnMob(EntityType.RAVAGER);