mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
other: reworked target selection: (#13638)
- WIP: AI and multi targets, human and X=0 use cases, human and impossible targets use cases;
- improved stability and shared logic (related to #13606, #11134, #11666, continue from a53eb66b58, close #13617, close #13613);
- improved test logs and debug info to show more target info on errors;
- improved test framework to support multiple addTarget calls;
- improved test framework to find bad commands order for targets (related to #11666);
- fixed game freezes on auto-choice usages with disconnected or under control players (related to #11285);
- gui, game: fixed that player doesn't mark avatar as selected/green in "up to" targeting;
- gui, game: fixed small font in some popup messages on big screens (related to #969);
- gui, game: added min targets info for target selection dialog;
- for devs: added new cheat option to call and test any game dialog (define own dialogs, targets, etc in HumanDialogsTester);
- for devs: now tests require complete an any or up to target selection by addTarget + TestPlayer.TARGET_SKIP or setChoice + TestPlayer.CHOICE_SKIP (if not all max/possible targets used);
- for devs: added detail targets info for activate/trigger/cast, can be useful to debug unit tests, auto-choose or AI (see DebugUtil.GAME_SHOW_CHOOSE_TARGET_LOGS)
This commit is contained in:
parent
80d62727e1
commit
133e4fe425
84 changed files with 2737 additions and 743 deletions
|
|
@ -399,7 +399,7 @@ public class ComputerPlayer6 extends ComputerPlayer {
|
|||
if (effect != null
|
||||
&& stackObject.getControllerId().equals(playerId)) {
|
||||
Target target = effect.getTarget();
|
||||
if (!target.doneChoosing(game)) {
|
||||
if (!target.isChoiceCompleted(game)) {
|
||||
for (UUID targetId : target.possibleTargets(stackObject.getControllerId(), stackObject.getStackAbility(), game)) {
|
||||
Game sim = game.createSimulationForAI();
|
||||
StackAbility newAbility = (StackAbility) stackObject.copy();
|
||||
|
|
@ -848,10 +848,10 @@ public class ComputerPlayer6 extends ComputerPlayer {
|
|||
if (targets.isEmpty()) {
|
||||
return super.chooseTarget(outcome, cards, target, source, game);
|
||||
}
|
||||
if (!target.doneChoosing(game)) {
|
||||
if (!target.isChoiceCompleted(game)) {
|
||||
for (UUID targetId : targets) {
|
||||
target.addTarget(targetId, source, game);
|
||||
if (target.doneChoosing(game)) {
|
||||
if (target.isChoiceCompleted(game)) {
|
||||
targets.clear();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -866,10 +866,10 @@ public class ComputerPlayer6 extends ComputerPlayer {
|
|||
if (targets.isEmpty()) {
|
||||
return super.choose(outcome, cards, target, source, game);
|
||||
}
|
||||
if (!target.doneChoosing(game)) {
|
||||
if (!target.isChoiceCompleted(game)) {
|
||||
for (UUID targetId : targets) {
|
||||
target.add(targetId, game);
|
||||
if (target.doneChoosing(game)) {
|
||||
if (target.isChoiceCompleted(game)) {
|
||||
targets.clear();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public final class SimulatedPlayer2 extends ComputerPlayer {
|
|||
}
|
||||
newAbility.adjustTargets(game);
|
||||
// add the different possible target option for the specific X value
|
||||
if (!newAbility.getTargets().getUnchosen(game).isEmpty()) {
|
||||
if (newAbility.getTargets().getNextUnchosen(game) != null) {
|
||||
addTargetOptions(options, newAbility, targetNum, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue