Merge branch 'fixes' into 'master'

RestartGame tweak + AI NPE from card changes

See merge request core-developers/forge!6409
This commit is contained in:
Bug Hunter
2022-03-17 13:14:59 +00:00
5 changed files with 12 additions and 12 deletions

View File

@@ -183,7 +183,10 @@ public class CountersPutOrRemoveAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
return doTgt(ai, sa, true);
if (sa.usesTargeting()) {
return doTgt(ai, sa, mandatory);
}
return mandatory;
}
/*

View File

@@ -510,7 +510,7 @@ public class GameAction {
if (mergedCards != null) {
// Move components of merged permanent here
// Also handle 721.3e and 903.9a
// Also handle 723.3e and 903.9a
boolean wasToken = c.isToken();
if (commanderEffect != null) {
for (final ReplacementEffect re : commanderEffect.getReplacementEffects()) {
@@ -524,7 +524,7 @@ public class GameAction {
if (card.isRealCommander()) {
card.setMoveToCommandZone(true);
}
// 721.3e & 903.9a
// 723.3e & 903.9a
if (wasToken && !card.isRealToken() || card.isRealCommander()) {
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(card);
repParams.put(AbilityKey.CardLKI, card);
@@ -1956,7 +1956,7 @@ public class GameAction {
// Where there are none, it should bring up speed controls
game.fireEvent(new GameEventGameStarted(gameType, first, game.getPlayers()));
runPreOpeningHandActions(first);
runPreOpeningHandActions(first);
game.setAge(GameStage.Mulligan);
for (final Player p1 : game.getPlayers()) {
@@ -1997,7 +1997,7 @@ public class GameAction {
p.getController().autoPassCancel();
}
first = game.getPhaseHandler().getPlayerTurn(); // needed only for restart
first = game.getPhaseHandler().getPlayerTurn(); // needed only for restart
} while (game.getAge() == GameStage.RestartedByKarn);
}

View File

@@ -167,8 +167,7 @@ public class PlayEffect extends SpellAbilityEffect {
// so it gets added to stack
card.setCopiedPermanent(card);
card.setToken(true);
tgtCards = new CardCollection();
tgtCards.add(card);
tgtCards = new CardCollection(card);
} else {
tgtCards = new CardCollection();
// filter only cards that didn't changed zones
@@ -217,7 +216,6 @@ public class PlayEffect extends SpellAbilityEffect {
boolean singleOption = tgtCards.size() == 1 && amount == 1 && optional;
Map<String, Object> params = hasTotalCMCLimit ? new HashMap<>() : null;
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, sa.getLastStateBattlefield());
moveParams.put(AbilityKey.LastStateGraveyard, sa.getLastStateGraveyard());
@@ -425,7 +423,6 @@ public class PlayEffect extends SpellAbilityEffect {
}
} // end resolve
protected void addReplaceGraveyardEffect(Card c, SpellAbility sa, String zone, Map<AbilityKey, Object> moveParams) {
final Card hostCard = sa.getHostCard();
final Game game = hostCard.getGame();

View File

@@ -103,8 +103,8 @@ public class RestartGameEffect extends SpellAbilityEffect {
game.resetTurnOrder();
game.setAge(GameStage.RestartedByKarn);
// Do not need this because ability will resolve only during that player's turn
//game.getPhaseHandler().setPlayerTurn(sa.getActivatingPlayer());
// For the rare case that you get to resolve it during another players turn
game.getPhaseHandler().setPlayerTurn(sa.getActivatingPlayer());
// Set turn number?

View File

@@ -134,7 +134,7 @@ public class PhaseHandler implements java.io.Serializable {
public final Player getPlayerTurn() {
return playerTurn;
}
private final void setPlayerTurn(final Player playerTurn0) {
public final void setPlayerTurn(final Player playerTurn0) {
if (playerTurn == playerTurn0) { return; }
playerTurn = playerTurn0;
game.updatePlayerTurnForView();