Merge branch 'controllers' into 'master'

getAllPossibleAbilities: Restore old controllers

Closes #1806

See merge request core-developers/forge!4646
This commit is contained in:
Michael Kamensky
2021-05-04 18:17:41 +00:00

View File

@@ -6476,6 +6476,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
final Collection<SpellAbility> toRemove = Lists.newArrayListWithCapacity(abilities.size()); final Collection<SpellAbility> toRemove = Lists.newArrayListWithCapacity(abilities.size());
for (final SpellAbility sa : abilities) { for (final SpellAbility sa : abilities) {
Player oldController = sa.getActivatingPlayer();
sa.setActivatingPlayer(player); sa.setActivatingPlayer(player);
// fix things like retrace // fix things like retrace
// check only if SA can't be cast normally // check only if SA can't be cast normally
@@ -6483,6 +6484,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
continue; continue;
} }
if ((removeUnplayable && !sa.canPlay()) || !sa.isPossible()) { if ((removeUnplayable && !sa.canPlay()) || !sa.isPossible()) {
if (oldController != null) {
// in case the ability is on the stack this should not change
sa.setActivatingPlayer(oldController);
}
toRemove.add(sa); toRemove.add(sa);
} }
} }