| 1 | package com.takenoko.actions; | |
| 2 | ||
| 3 | import com.takenoko.actions.actors.MoveGardenerAction; | |
| 4 | import com.takenoko.actions.actors.MovePandaAction; | |
| 5 | import com.takenoko.actions.improvement.ApplyImprovementFromInventoryAction; | |
| 6 | import com.takenoko.actions.irrigation.DrawIrrigationAction; | |
| 7 | import com.takenoko.actions.irrigation.PlaceIrrigationFromInventoryAction; | |
| 8 | import com.takenoko.actions.objective.DrawObjectiveAction; | |
| 9 | import com.takenoko.actions.objective.RedeemObjectiveAction; | |
| 10 | import com.takenoko.actions.tile.DrawTileAction; | |
| 11 | import com.takenoko.engine.Board; | |
| 12 | import com.takenoko.engine.BotState; | |
| 13 | ||
| 14 | public interface DefaultAction extends Action { | |
| 15 | static boolean canBePlayed( | |
| 16 | Board board, BotState botState, Class<? extends DefaultAction> actionClass) { | |
| 17 |
2
1. canBePlayed : replaced boolean return with false for com/takenoko/actions/DefaultAction::canBePlayed → KILLED 2. canBePlayed : replaced boolean return with true for com/takenoko/actions/DefaultAction::canBePlayed → KILLED |
return switch (actionClass.getSimpleName()) { |
| 18 | case "MovePandaAction" -> MovePandaAction.canBePlayed(board); | |
| 19 | case "MoveGardenerAction" -> MoveGardenerAction.canBePlayed(board); | |
| 20 | case "DrawIrrigationAction" -> DrawIrrigationAction.canBePlayed(board); | |
| 21 | case "DrawObjectiveAction" -> DrawObjectiveAction.canBePlayed(board, botState); | |
| 22 | case "RedeemObjectiveAction" -> RedeemObjectiveAction.canBePlayed(botState); | |
| 23 | case "DrawTileAction" -> DrawTileAction.canBePlayed(board); | |
| 24 | case "ApplyImprovementFromInventoryAction" -> ApplyImprovementFromInventoryAction | |
| 25 | .canBePlayed(board, botState); | |
| 26 | case "PlaceIrrigationFromInventoryAction" -> PlaceIrrigationFromInventoryAction | |
| 27 | .canBePlayed(board, botState); | |
| 28 | default -> throw new IllegalStateException( | |
| 29 | "Unexpected value: " + actionClass.getSimpleName()); | |
| 30 | }; | |
| 31 | } | |
| 32 | } | |
Mutations | ||
| 17 |
1.1 2.2 |