* Sacrificed a bug of SacrificeAllCost (fixing a problem with Soulblast looping forever).

This commit is contained in:
LevelX2 2018-02-18 23:44:14 +01:00
parent a6644b0eb2
commit 4d4b0d145e
3 changed files with 23 additions and 26 deletions

View file

@ -55,19 +55,19 @@ public class SacrificeAllCost extends CostImpl {
public SacrificeAllCost(final SacrificeAllCost cost) {
super(cost);
for (Permanent permanent: cost.permanents) {
this.permanents.add(permanent.copy());
}
this.permanents.addAll(cost.permanents); // because this are already copied permanents, they can't change, so no copy again is needed
this.filter = cost.filter.copy();
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) {
permanents.add(permanent.copy());
permanent.sacrifice(sourceId, game);
if (permanent.sacrifice(sourceId, game)) {
permanents.add(permanent.copy());
}
}
return true;
paid = true;
return paid;
}
@Override
@ -81,13 +81,13 @@ public class SacrificeAllCost extends CostImpl {
activator = controllerId;
}
}
for (Permanent permanent :game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) {
if(!game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
return false;
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) {
if (!game.getPlayer(activator).canPaySacrificeCost(permanent, sourceId, controllerId, game)) {
return false;
}
}
return true;
}