Fixed range fro SacrificeAllEffect and Burning Inquiry

This commit is contained in:
North 2012-06-20 00:15:13 +03:00
parent 239a4fb100
commit a6a333422b
2 changed files with 123 additions and 109 deletions

View file

@ -84,7 +84,12 @@ class BurningInquiryEffect extends OneShotEffect<BurningInquiryEffect> {
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getPlayerList()) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (int i = 0; i < 3; i++) {

View file

@ -74,8 +74,15 @@ public class SacrificeAllEffect extends OneShotEffect<SacrificeAllEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
List<UUID> perms = new ArrayList<UUID>();
for (Player player: game.getPlayers().values()) {
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
int numTargets = Math.min(amount, game.getBattlefield().countAll(filter, player.getId(), game));
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
if (target.canChoose(player.getId(), game)) {
@ -85,11 +92,13 @@ public class SacrificeAllEffect extends OneShotEffect<SacrificeAllEffect> {
perms.addAll(target.getTargets());
}
}
for (UUID permID: perms) {
}
for (UUID permID : perms) {
Permanent permanent = game.getPermanent(permID);
if (permanent != null)
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
}
return true;
}