Monster.java

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
Location : getHp
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:damageMonsterLargeAmount()]
replaced float return with 0.0f for g0803/bindingofshiba/model/game/elements/Monster::getHp → KILLED

21

1.1
Location : getDamage
Killed by : none
replaced float return with 0.0f for g0803/bindingofshiba/model/game/elements/Monster::getDamage → NO_COVERAGE

25

1.1
Location : isAlive
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:killMonster()]
changed conditional boundary → KILLED

2.2
Location : isAlive
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:damagingMonsterKeepAlive()]
negated conditional → KILLED

3.3
Location : isAlive
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:killMonster()]
replaced boolean return with true for g0803/bindingofshiba/model/game/elements/Monster::isAlive → KILLED

29

1.1
Location : decreaseHpByAmount
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : decreaseHpByAmount
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:decreaseHpByAmountLargerThanHealth()]
negated conditional → KILLED

31

1.1
Location : decreaseHpByAmount
Killed by : g0803.bindingofshiba.model.game.elements.MonsterTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.elements.MonsterTest]/[method:decreaseHpByAmountLargerThanHealth()]
Replaced float subtraction with addition → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.0