1 | package com.takenoko.actions.improvement; | |
2 | ||
3 | import com.takenoko.actions.Action; | |
4 | import com.takenoko.actions.ActionResult; | |
5 | import com.takenoko.actions.annotations.ActionAnnotation; | |
6 | import com.takenoko.actions.annotations.ActionType; | |
7 | import com.takenoko.engine.Board; | |
8 | import com.takenoko.engine.BotManager; | |
9 | import com.takenoko.layers.tile.ImprovementType; | |
10 | import com.takenoko.vector.PositionVector; | |
11 | import java.util.Objects; | |
12 | ||
13 | /** | |
14 | * Action to draw an improvement from the inventory. Throws an exception if the improvement is not | |
15 | * available. | |
16 | */ | |
17 | @ActionAnnotation(ActionType.FORCED) | |
18 | public class ApplyImprovementAction implements Action { | |
19 | protected final PositionVector positionVector; | |
20 | ||
21 | public ApplyImprovementAction(PositionVector positionVector) { | |
22 | this.positionVector = positionVector; | |
23 | } | |
24 | ||
25 | @Override | |
26 | public ActionResult execute(Board board, BotManager botManager) { | |
27 | ImprovementType improvementType = board.peekImprovement(); | |
28 |
1
1. execute : removed call to com/takenoko/engine/Board::applyImprovement → KILLED |
board.applyImprovement(improvementType, positionVector); |
29 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
30 | botManager.getName() | |
31 | + " applied improvement " | |
32 | + improvementType | |
33 | + " at " | |
34 | + positionVector); | |
35 |
1
1. execute : replaced return value with null for com/takenoko/actions/improvement/ApplyImprovementAction::execute → KILLED |
return new ActionResult(0); |
36 | } | |
37 | ||
38 | @Override | |
39 | public boolean equals(Object o) { | |
40 |
2
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with false for com/takenoko/actions/improvement/ApplyImprovementAction::equals → NO_COVERAGE |
if (this == o) return true; |
41 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE 3. equals : replaced boolean return with true for com/takenoko/actions/improvement/ApplyImprovementAction::equals → NO_COVERAGE |
if (o == null || getClass() != o.getClass()) return false; |
42 | ApplyImprovementAction that = (ApplyImprovementAction) o; | |
43 |
2
1. equals : replaced boolean return with false for com/takenoko/actions/improvement/ApplyImprovementAction::equals → NO_COVERAGE 2. equals : replaced boolean return with true for com/takenoko/actions/improvement/ApplyImprovementAction::equals → NO_COVERAGE |
return Objects.equals(positionVector, that.positionVector); |
44 | } | |
45 | ||
46 | @Override | |
47 | public int hashCode() { | |
48 |
1
1. hashCode : replaced int return with 0 for com/takenoko/actions/improvement/ApplyImprovementAction::hashCode → TIMED_OUT |
return Objects.hash(positionVector); |
49 | } | |
50 | } | |
Mutations | ||
28 |
1.1 |
|
29 |
1.1 |
|
35 |
1.1 |
|
40 |
1.1 2.2 |
|
41 |
1.1 2.2 3.3 |
|
43 |
1.1 2.2 |
|
48 |
1.1 |