Fixed Anowon, the Ruin Sage

This commit is contained in:
magenoxx 2011-09-17 00:48:35 +04:00
parent 6316580aa7
commit f5164fa526
2 changed files with 5 additions and 3 deletions

View file

@ -77,7 +77,7 @@ public class SacrificeAllEffect extends OneShotEffect<SacrificeAllEffect> {
for (Player player: game.getPlayers().values()) { for (Player player: game.getPlayers().values()) {
int numTargets = Math.min(amount, game.getBattlefield().countAll(filter, player.getId())); int numTargets = Math.min(amount, game.getBattlefield().countAll(filter, player.getId()));
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false); TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
if (target.canChoose(source.getControllerId(), game)) { if (target.canChoose(player.getId(), game)) {
while (!target.isChosen()) { while (!target.isChosen()) {
player.choose(Outcome.Sacrifice, target, game); player.choose(Outcome.Sacrifice, target, game);
} }

View file

@ -136,8 +136,10 @@ public class TargetPermanent<T extends TargetPermanent<T>> extends TargetObject<
@Override @Override
public boolean canChoose(UUID sourceControllerId, Game game) { public boolean canChoose(UUID sourceControllerId, Game game) {
int remainingTargets = this.minNumberOfTargets - targets.size(); int remainingTargets = this.minNumberOfTargets - targets.size();
if (remainingTargets == 0) if (remainingTargets == 0) {
return true; // if we return true, then AnowonTheRuinSage will hang for AI when no targets in play
return false;
}
int count = 0; int count = 0;
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, game)) { for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, game)) {
if (!targets.containsKey(permanent.getId())) { if (!targets.containsKey(permanent.getId())) {