mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Fixed some possible exceptions.
This commit is contained in:
parent
8bdb6665d9
commit
0051f70b8a
6 changed files with 30 additions and 30 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -492,18 +491,22 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
PlayerList players = game.getState().getPlayerList(playerId);
|
||||
for (int i = 0; i < range.getRange(); i++) {
|
||||
Player player = players.getNext(game);
|
||||
while (player.hasLeft()) {
|
||||
player = players.getNext(game);
|
||||
if (player != null) {
|
||||
while (player.hasLeft()) {
|
||||
player = players.getNext(game);
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
players = game.getState().getPlayerList(playerId);
|
||||
for (int i = 0; i < range.getRange(); i++) {
|
||||
Player player = players.getPrevious(game);
|
||||
while (player.hasLeft()) {
|
||||
player = players.getPrevious(game);
|
||||
if (player != null) {
|
||||
while (player.hasLeft()) {
|
||||
player = players.getPrevious(game);
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
inRange.add(player.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,19 @@
|
|||
|
||||
|
||||
package mage.target;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class TargetObject extends TargetImpl {
|
||||
|
||||
protected TargetObject() {}
|
||||
protected TargetObject() {
|
||||
}
|
||||
|
||||
public TargetObject(Zone zone) {
|
||||
this(1, 1, zone, false);
|
||||
|
|
@ -40,7 +38,7 @@ public abstract class TargetObject extends TargetImpl {
|
|||
@Override
|
||||
public String getTargetedName(Game game) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UUID targetId: getTargets()) {
|
||||
for (UUID targetId : getTargets()) {
|
||||
MageObject object = game.getObject(targetId);
|
||||
if (object != null) {
|
||||
sb.append(object.getLogName()).append(' ');
|
||||
|
|
@ -52,7 +50,9 @@ public abstract class TargetObject extends TargetImpl {
|
|||
@Override
|
||||
public boolean canTarget(UUID id, Game game) {
|
||||
MageObject object = game.getObject(id);
|
||||
return object != null && game.getState().getZone(id).match(zone) && getFilter().match(object, game);
|
||||
return object != null
|
||||
&& zone != null && zone.match(game.getState().getZone(id))
|
||||
&& getFilter() != null && getFilter().match(object, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue