* Cumulative Upkeep - Fixed that a permanent with CU was wrongly sacrificed if the control of the permanent has changed since CU begin of upkeep trigger was put on the stack. Added tests for CU.

This commit is contained in:
LevelX2 2020-12-21 14:36:22 +01:00
parent 94f6cfc03f
commit 29184316f2
2 changed files with 113 additions and 1 deletions

View file

@ -89,7 +89,9 @@ class CumulativeUpkeepEffect extends OneShotEffect {
}
}
game.fireEvent(new GameEvent(GameEvent.EventType.DIDNT_PAY_CUMULATIVE_UPKEEP, permanent.getId(), source, player.getId(), ageCounter, false));
permanent.sacrifice(source, game);
if (source.getControllerId().equals(permanent.getControllerId())) { // Permanent can only be sacrificed if you still control it
permanent.sacrifice(source, game);
}
return true;
} else {
CostsImpl<Cost> totalCost = new CostsImpl<>();