package org.egordorichev.lasttry.entity;

public class Enemy extends Entity {
	protected int currentAi;

	public Enemy(String name, int maxHp, int defense, int damage) {
		super(name, false, maxHp, defense, damage);
	}

	public Enemy(String name) {
		super(name, false);
	}

	@Override
	public void render() {
		this.image.draw(this.rect.x, this.rect.y);
	}

	@Override
	public void update(int dt) {
		super.update(dt);
		this.updateAI();
	}

	public void updateAI() {

	}

	@Override
	public void onSpawn() {

	}

	public static Enemy create(String name) {
		if(name == "Green Slime") {
			return new GreenSlime();
		} else {
			throw new RuntimeException("Entity with name " + name + " is not found.");
		}
	}
}
@@ -96,16 +96,38 @@
 rrentAi;
+%0A%09protected int maxAi;
 %0A%0A%09publi
@@ -230,16 +230,39 @@
 damage);
+%0A%0A%09%09this.currentAi = 0;
 %0A%09%7D%0A%0A%09pu
@@ -308,16 +308,39 @@
  false);
+%0A%0A%09%09this.currentAi = 0;
 %0A%09%7D%0A%0A%09@O
@@ -526,24 +526,108 @@
 pdateAI() %7B%0A
+%09%09this.currentAi++;%0A%0A%09%09if(this.currentAi %3E= this.maxAi) %7B%0A%09%09%09this.currentAi = 0;%0A%09%09%7D
 %0A%09%7D%0A%0A%09@Overr
@@ -858,8 +858,9 @@
 %09%09%7D%0A%09%7D%0A%7D
+%0A

Update Enemy.java