implement [MH3] Nethergoyf, refactor targets usages by game param (#12267)

This commit is contained in:
Susucre 2024-05-21 13:34:38 +02:00 committed by GitHub
parent 88b6f4036f
commit 754b382e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 592 additions and 285 deletions

View file

@ -34,7 +34,6 @@ import mage.target.Targets;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.io.File;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@ -392,7 +391,7 @@ public class ComputerPlayer6 extends ComputerPlayer {
if (effect != null
&& stackObject.getControllerId().equals(playerId)) {
Target target = effect.getTarget();
if (!target.doneChoosing()) {
if (!target.doneChoosing(game)) {
for (UUID targetId : target.possibleTargets(stackObject.getControllerId(), stackObject.getStackAbility(), game)) {
Game sim = game.createSimulationForAI();
StackAbility newAbility = (StackAbility) stackObject.copy();
@ -740,10 +739,10 @@ public class ComputerPlayer6 extends ComputerPlayer {
if (targets.isEmpty()) {
return super.chooseTarget(outcome, cards, target, source, game);
}
if (!target.doneChoosing()) {
if (!target.doneChoosing(game)) {
for (UUID targetId : targets) {
target.addTarget(targetId, source, game);
if (target.doneChoosing()) {
if (target.doneChoosing(game)) {
targets.clear();
return true;
}
@ -758,10 +757,10 @@ public class ComputerPlayer6 extends ComputerPlayer {
if (targets.isEmpty()) {
return super.choose(outcome, cards, target, source, game);
}
if (!target.doneChoosing()) {
if (!target.doneChoosing(game)) {
for (UUID targetId : targets) {
target.add(targetId, game);
if (target.doneChoosing()) {
if (target.doneChoosing(game)) {
targets.clear();
return true;
}

View file

@ -10,7 +10,6 @@ import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.game.Game;
import mage.game.combat.Combat;
import mage.game.events.GameEvent;
@ -149,7 +148,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().isEmpty()) {
if (!newAbility.getTargets().getUnchosen(game).isEmpty()) {
addTargetOptions(options, newAbility, targetNum, game);
}
}