Damage per shot bug

This commit is contained in:
Yohann D'ANELLO 2020-02-25 23:38:50 +01:00
parent 3ae852c8f0
commit eda3335501
2 changed files with 3 additions and 11 deletions

View File

@ -123,7 +123,7 @@ public class GameFrame extends JFrame {
for (Tower tower : towers) { for (Tower tower : towers) {
for (Mob mob : tower.filterDetectedMobs(mobs)) for (Mob mob : tower.filterDetectedMobs(mobs))
mob.hit(); mob.hit(tower.getDamagePerShot());
} }
for (Mob mob : new ArrayList<>(mobs)) { 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); 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(); repaint();
} }

View File

@ -59,9 +59,9 @@ public abstract class Mob {
this.hp = hp; this.hp = hp;
} }
public boolean hit() { public boolean hit(int damage) {
if (!isDead()) { if (!isDead()) {
--this.hp; this.hp -= damage;
return true; return true;
} }