mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
* Sacrificed a bug of SacrificeAllCost (fixing a problem with Soulblast looping forever).
This commit is contained in:
parent
a6644b0eb2
commit
4d4b0d145e
3 changed files with 23 additions and 26 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue