| 1 | package com.takenoko.actions.objective; | |
| 2 | ||
| 3 | import com.takenoko.actions.ActionResult; | |
| 4 | import com.takenoko.actions.DefaultAction; | |
| 5 | import com.takenoko.actions.annotations.ActionAnnotation; | |
| 6 | import com.takenoko.actions.annotations.ActionCanBePlayedMultipleTimesPerTurn; | |
| 7 | import com.takenoko.actions.annotations.ActionType; | |
| 8 | import com.takenoko.engine.Board; | |
| 9 | import com.takenoko.engine.BotManager; | |
| 10 | import com.takenoko.engine.BotState; | |
| 11 | import com.takenoko.objective.Objective; | |
| 12 | ||
| 13 | /** This class is an action to redeem an objective. */ | |
| 14 | @ActionAnnotation(ActionType.DEFAULT) | |
| 15 | @ActionCanBePlayedMultipleTimesPerTurn() | |
| 16 | public class RedeemObjectiveAction implements DefaultAction { | |
| 17 | final Objective objective; | |
| 18 | ||
| 19 | public RedeemObjectiveAction(Objective objective) { | |
| 20 | this.objective = objective; | |
| 21 | } | |
| 22 | ||
| 23 | public static boolean canBePlayed(BotState botState) { | |
| 24 |
2
1. canBePlayed : negated conditional → KILLED 2. canBePlayed : replaced boolean return with true for com/takenoko/actions/objective/RedeemObjectiveAction::canBePlayed → KILLED |
return !botState.getAchievedObjectives().isEmpty(); |
| 25 | } | |
| 26 | ||
| 27 | @Override | |
| 28 | public ActionResult execute(Board board, BotManager botManager) { | |
| 29 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
| 30 | botManager.getName() | |
| 31 | + " redeemed objective" | |
| 32 | + objective | |
| 33 | + " and gained " | |
| 34 | + objective.getPoints() | |
| 35 | + "points"); | |
| 36 |
1
1. execute : removed call to com/takenoko/engine/BotManager::redeemObjective → KILLED |
botManager.redeemObjective(objective); |
| 37 |
1
1. execute : removed call to com/takenoko/stats/SingleBotStatistics::updateObjectivesRedeemed → KILLED |
botManager.getSingleBotStatistics().updateObjectivesRedeemed(objective); |
| 38 |
1
1. execute : replaced return value with null for com/takenoko/actions/objective/RedeemObjectiveAction::execute → KILLED |
return new ActionResult(); |
| 39 | } | |
| 40 | } | |
Mutations | ||
| 24 |
1.1 2.2 |
|
| 29 |
1.1 |
|
| 36 |
1.1 |
|
| 37 |
1.1 |
|
| 38 |
1.1 |