From eda3335501efb2a5d06ced28dc9637ce338090f1 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 25 Feb 2020 23:38:50 +0100 Subject: [PATCH] Damage per shot bug --- .../java/fr/ynerant/leveleditor/game/GameFrame.java | 10 +--------- src/main/java/fr/ynerant/leveleditor/game/Mob.java | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java b/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java index fc78c0d..1de9d2d 100644 --- a/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java +++ b/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java @@ -123,7 +123,7 @@ public class GameFrame extends JFrame { for (Tower tower : towers) { for (Mob mob : tower.filterDetectedMobs(mobs)) - mob.hit(); + mob.hit(tower.getDamagePerShot()); } for (Mob mob : new ArrayList<>(mobs)) { @@ -192,14 +192,6 @@ public class GameFrame extends JFrame { g.drawImage(s.getImage(), SPRITE_SIZE * tower.getX(), SPRITE_SIZE * tower.getY(), SPRITE_SIZE, SPRITE_SIZE, null, null); } - for (RawCase c : getMap().getCases()) { - if (c.getCollision() == Collision.ANY) - continue; - - g.setColor(new Color(0x10000000)); - g.fillRect(SPRITE_SIZE * c.getPosX(), SPRITE_SIZE * c.getPosY(), SPRITE_SIZE, SPRITE_SIZE); - } - repaint(); } diff --git a/src/main/java/fr/ynerant/leveleditor/game/Mob.java b/src/main/java/fr/ynerant/leveleditor/game/Mob.java index 34c810c..3b5e859 100644 --- a/src/main/java/fr/ynerant/leveleditor/game/Mob.java +++ b/src/main/java/fr/ynerant/leveleditor/game/Mob.java @@ -59,9 +59,9 @@ public abstract class Mob { this.hp = hp; } - public boolean hit() { + public boolean hit(int damage) { if (!isDead()) { - --this.hp; + this.hp -= damage; return true; }