Merge branch '2112-problem-with-some-ltb-trigger' into 'master'

Resolve "Problem with some LTB trigger"

Closes #2112

See merge request core-developers/forge!6347
This commit is contained in:
Hans Mackowiak
2022-03-05 21:42:28 +00:00
3 changed files with 10 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ package forge.game.cost;
import java.util.Map; import java.util.Map;
import forge.game.Game;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.player.Player; import forge.game.player.Player;
@@ -97,9 +98,10 @@ public class CostDraw extends CostPart {
*/ */
@Override @Override
public final boolean payAsDecided(final Player ai, final PaymentDecision decision, SpellAbility ability, final boolean effect) { public final boolean payAsDecided(final Player ai, final PaymentDecision decision, SpellAbility ability, final boolean effect) {
final Game game = ai.getGame();
Map<AbilityKey, Object> moveParams = AbilityKey.newMap(); Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, ability.getLastStateBattlefield()); moveParams.put(AbilityKey.LastStateBattlefield, game.getLastStateBattlefield());
moveParams.put(AbilityKey.LastStateGraveyard, ability.getLastStateGraveyard()); moveParams.put(AbilityKey.LastStateGraveyard, game.getLastStateGraveyard());
for (final Player p : decision.players) { for (final Player p : decision.players) {
p.drawCards(decision.c, ability, moveParams); p.drawCards(decision.c, ability, moveParams);
} }

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import forge.game.Game;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardCollectionView; import forge.game.card.CardCollectionView;
@@ -135,11 +136,12 @@ public class CostSacrifice extends CostPartWithList {
@Override @Override
protected Card doPayment(SpellAbility ability, Card targetCard, final boolean effect) { protected Card doPayment(SpellAbility ability, Card targetCard, final boolean effect) {
final Game game = targetCard.getGame();
// no table there, it is already handled by CostPartWithList // no table there, it is already handled by CostPartWithList
Map<AbilityKey, Object> moveParams = AbilityKey.newMap(); Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, ability.getLastStateBattlefield()); moveParams.put(AbilityKey.LastStateBattlefield, game.getLastStateBattlefield());
moveParams.put(AbilityKey.LastStateGraveyard, ability.getLastStateGraveyard()); moveParams.put(AbilityKey.LastStateGraveyard, game.getLastStateGraveyard());
return targetCard.getGame().getAction().sacrifice(targetCard, ability, effect, null, moveParams); return game.getAction().sacrifice(targetCard, ability, effect, null, moveParams);
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -1066,6 +1066,7 @@ public class PhaseHandler implements java.io.Serializable {
} }
} }
game.copyLastState();
loopCount++; loopCount++;
} while (loopCount < 999 || !pPlayerPriority.getController().isAI()); } while (loopCount < 999 || !pPlayerPriority.getController().isAI());