1 | package g0803.bindingofshiba.model.game.elements; | |
2 | ||
3 | import g0803.bindingofshiba.math.Vec2D; | |
4 | ||
5 | public class Monster extends MoveableElement { | |
6 | ||
7 | private float hp; | |
8 | private float damage; | |
9 | ||
10 | public Monster(Vec2D position, float hp, float damage) { | |
11 | super(position); | |
12 | this.hp = hp; | |
13 | this.damage = damage; | |
14 | } | |
15 | ||
16 | public float getHp() { | |
17 |
1
1. getHp : replaced float return with 0.0f for g0803/bindingofshiba/model/game/elements/Monster::getHp → KILLED |
return this.hp; |
18 | } | |
19 | ||
20 | public float getDamage() { | |
21 |
1
1. getDamage : replaced float return with 0.0f for g0803/bindingofshiba/model/game/elements/Monster::getDamage → NO_COVERAGE |
return this.damage; |
22 | } | |
23 | ||
24 | public boolean isAlive() { | |
25 |
3
1. isAlive : changed conditional boundary → KILLED 2. isAlive : negated conditional → KILLED 3. isAlive : replaced boolean return with true for g0803/bindingofshiba/model/game/elements/Monster::isAlive → KILLED |
return this.hp > 0; |
26 | } | |
27 | ||
28 | public void decreaseHpByAmount(float amount) throws IllegalArgumentException { | |
29 |
2
1. decreaseHpByAmount : changed conditional boundary → SURVIVED 2. decreaseHpByAmount : negated conditional → KILLED |
if (amount < 0) throw new IllegalArgumentException("Amount cannot be negative"); |
30 | ||
31 |
1
1. decreaseHpByAmount : Replaced float subtraction with addition → KILLED |
this.hp = Math.max(this.hp - amount, 0); |
32 | } | |
33 | } | |
Mutations | ||
17 |
1.1 |
|
21 |
1.1 |
|
25 |
1.1 2.2 3.3 |
|
29 |
1.1 2.2 |
|
31 |
1.1 |