Fixed a rare issue where killing Sam as a response to his response to Frodo dying causing the game to fail to detect the Ring-bearer had died. (If for example the new Terrible as the Dawn errata kills Sam as he responds)

This commit is contained in:
Christian 'ketura' McCarty
2024-12-11 21:14:18 -06:00
parent 7def1402f4
commit 1c3a07557c
3 changed files with 17 additions and 0 deletions

View File

@@ -171,8 +171,20 @@ public class TurnProcedure {
for (EffectResult effectResult : _effectResults) {
if (effectResult.getType() == EffectResult.Type.ANY_NUMBER_KILLED) {
KilledResult killResult = (KilledResult) effectResult;
if (Filters.acceptsAny(_game, killResult.getKilledCards(), Filters.ringBearer))
return true;
//TODO: Make a better filter that keys off of "can become ring-bearer" rather than
// assuming that will always be Sam.
//If Sam is killed as a response to triggering *his* response, then the game flounders
// and never properly evaluates the ring-bearer as dying. So as a hack, we will check
// for *Sam's* death and see if the Ring-bearer is dead at that time as well.
if (Filters.acceptsAny(_game, killResult.getKilledCards(), Filters.sam)) {
var ringBearer = _game.getGameState().getRingBearer( _game.getGameState().getCurrentPlayerId());
if (ringBearer.getZone() == null || !ringBearer.getZone().isInPlay())
return true;
}
}
if (effectResult.getType() == EffectResult.Type.FOR_EACH_RETURNED_TO_HAND) {
ReturnCardsToHandResult returnResult = (ReturnCardsToHandResult) effectResult;

View File

@@ -1104,6 +1104,10 @@ public class GenericCardTestHelper extends AbstractAtTest {
playerDecided(playerID, option);
}
public boolean GameIsFinished() {
return _game.isFinished();
}
public void FreepsResolveRuleFirst() throws DecisionResultInvalidException { FreepsResolveActionOrder(null); }
public void FreepsResolveActionOrder(String option) throws DecisionResultInvalidException { ChooseAction(P1, "actionText", option); }

View File

@@ -165,5 +165,6 @@ public class Card_01_311_ErrataTests
assertTrue(scn.FreepsHasOptionalTriggerAvailable());
scn.FreepsAcceptOptionalTrigger();
assertSame(scn.GetRingBearer(), sam);
assertFalse(scn.GameIsFinished());
}
}