* Fixed a bug of each player sacrifice a creature/permanent effect, that permanent with shroud could not be sacrificed - locking the game.

This commit is contained in:
LevelX2 2014-08-16 22:39:56 +02:00
parent f633d35bfd
commit bff01090b5
2 changed files with 4 additions and 5 deletions

View file

@ -35,7 +35,6 @@ import mage.abilities.costs.CostImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
/**
*
@ -43,8 +42,8 @@ import mage.target.common.TargetControlledPermanent;
*/
public class SacrificeAllCost extends CostImpl {
private FilterPermanent filter;
private List<Permanent> permanents = new ArrayList<Permanent>();
private final FilterPermanent filter;
private final List<Permanent> permanents = new ArrayList<>();
public SacrificeAllCost(FilterPermanent filter) {
this.filter = filter;

View file

@ -85,12 +85,12 @@ public class SacrificeAllEffect extends OneShotEffect {
return false;
}
List<UUID> perms = new ArrayList<UUID>();
List<UUID> perms = new ArrayList<>();
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game));
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, true);
if (target.canChoose(player.getId(), game)) {
while (!target.isChosen() && player.isInGame()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);