PlaceTileWithImprovementAction.java

1
package com.takenoko.actions.tile;
2
3
import com.takenoko.actions.ActionResult;
4
import com.takenoko.actions.annotations.ActionAnnotation;
5
import com.takenoko.actions.annotations.ActionType;
6
import com.takenoko.engine.Board;
7
import com.takenoko.engine.BotManager;
8
import com.takenoko.layers.tile.ImprovementType;
9
import com.takenoko.layers.tile.Tile;
10
import com.takenoko.vector.PositionVector;
11
12
/**
13
 * This class represents the action of placing a tile on the board with an improvement from the
14
 * inventory.
15
 */
16
@ActionAnnotation(ActionType.FORCED)
17
public class PlaceTileWithImprovementAction extends PlaceTileAction {
18
19
    public PlaceTileWithImprovementAction(
20
            Tile tile, PositionVector positionVector, ImprovementType improvementType) {
21
        super(tile, positionVector);
22 1 1. <init> : removed call to com/takenoko/layers/tile/Tile::setImprovement → KILLED
        tile.setImprovement(improvementType);
23
    }
24
25
    /**
26
     * Apply the improvement on tile then place the tile on the board and display a message.
27
     *
28
     * @param board the board
29
     * @param botManager the bot manager
30
     * @return the action result
31
     */
32
    @Override
33
    public ActionResult execute(Board board, BotManager botManager) {
34 1 1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT
        botManager.displayMessage(
35
                botManager.getName()
36
                        + " applied improvement "
37
                        + tile.getImprovement().orElseThrow()
38
                        + " on tile to place");
39 1 1. execute : removed call to com/takenoko/inventory/Inventory::useImprovement → KILLED
        botManager.getInventory().useImprovement(tile.getImprovement().orElseThrow());
40 1 1. execute : replaced return value with null for com/takenoko/actions/tile/PlaceTileWithImprovementAction::execute → TIMED_OUT
        return super.execute(board, botManager);
41
    }
42
}

Mutations

22

1.1
Location : <init>
Killed by : com.takenoko.actions.tile.PlaceTileWithImprovementActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.tile.PlaceTileWithImprovementActionTest]/[nested-class:TestExecute]/[method:shouldAddImprovementToTile()]
removed call to com/takenoko/layers/tile/Tile::setImprovement → KILLED

34

1.1
Location : execute
Killed by : none
removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT

39

1.1
Location : execute
Killed by : com.takenoko.actions.tile.PlaceTileWithImprovementActionTest.[engine:junit-jupiter]/[class:com.takenoko.actions.tile.PlaceTileWithImprovementActionTest]/[nested-class:TestExecute]/[method:shouldAddImprovementToTile()]
removed call to com/takenoko/inventory/Inventory::useImprovement → KILLED

40

1.1
Location : execute
Killed by : none
replaced return value with null for com/takenoko/actions/tile/PlaceTileWithImprovementAction::execute → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.8.0