mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* 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:
parent
f633d35bfd
commit
bff01090b5
2 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue