package gg.malloc.defense.games; import gg.malloc.defense.model.Wave; import gg.malloc.defense.model.Game; import gg.malloc.defense.model.Spawner; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; public class LinearGame implements Game { private class ZombieWave implements Wave { int m_batches; int m_zombiesPerBatch; public ZombieWave(int zombiesPerBatch, int batches) { m_batches = batches; m_zombiesPerBatch = zombiesPerBatch; } @Override public int totalMobCount() { int ret = 0; for(int i = 1; i <= m_batches; i++) { ret += i * m_zombiesPerBatch; } return ret; } @Override public int batchCount() { return m_batches; } @Override public void spawnBatch(Spawner spawner, int batch) { int zombiesToSpawn = batch * m_zombiesPerBatch; for(int i = 0; i < zombiesToSpawn; i++) { Entity newMob = spawner.spawnMob(EntityType.ZOMBIE); newMob.setCustomName("Zombie " + i + "/" + zombiesToSpawn); } } } @Override public int getWaveCount() { return 10; } @Override public Wave getWave(int waveNumber) { return new ZombieWave(waveNumber, 2); } }