mirror of
https://github.com/correl/mage.git
synced 2025-04-13 17:00:09 -09:00
* Order of Succession - Fixed possible exception error.
This commit is contained in:
parent
423e3847a8
commit
6de177f8ac
1 changed files with 3 additions and 4 deletions
|
@ -58,8 +58,7 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
public class OrderOfSuccession extends CardImpl {
|
public class OrderOfSuccession extends CardImpl {
|
||||||
|
|
||||||
public OrderOfSuccession(UUID ownerId, CardSetInfo setInfo) {
|
public OrderOfSuccession(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||||
|
|
||||||
|
|
||||||
// Choose left or right. Starting with you and proceeding in the chosen direction, each player chooses a creature controlled by the next player in that direction. Each player gains control of the creature he or she chose.
|
// Choose left or right. Starting with you and proceeding in the chosen direction, each player chooses a creature controlled by the next player in that direction. Each player gains control of the creature he or she chose.
|
||||||
this.getSpellAbility().addEffect(new OrderOfSuccessionEffect());
|
this.getSpellAbility().addEffect(new OrderOfSuccessionEffect());
|
||||||
|
@ -98,7 +97,7 @@ class OrderOfSuccessionEffect extends OneShotEffect {
|
||||||
Map<UUID, UUID> playerCreature = new HashMap<>(2);
|
Map<UUID, UUID> playerCreature = new HashMap<>(2);
|
||||||
Choice choice = new ChoiceLeftOrRight();
|
Choice choice = new ChoiceLeftOrRight();
|
||||||
controller.choose(Outcome.Neutral, choice, game);
|
controller.choose(Outcome.Neutral, choice, game);
|
||||||
boolean left = choice.getChoice().equals("Left");
|
boolean left = choice == null || choice.getChoice().equals("Left"); // to prevent npe
|
||||||
PlayerList playerList = game.getState().getPlayerList().copy();
|
PlayerList playerList = game.getState().getPlayerList().copy();
|
||||||
// set playerlist to controller
|
// set playerlist to controller
|
||||||
while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) {
|
while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) {
|
||||||
|
@ -108,7 +107,7 @@ class OrderOfSuccessionEffect extends OneShotEffect {
|
||||||
Player nextPlayer;
|
Player nextPlayer;
|
||||||
UUID firstNextPlayer = null;
|
UUID firstNextPlayer = null;
|
||||||
|
|
||||||
while (!getNextPlayerInDirection(left, playerList, game).equals(firstNextPlayer) && controller.canRespond()){
|
while (!getNextPlayerInDirection(left, playerList, game).equals(firstNextPlayer) && controller.canRespond()) {
|
||||||
nextPlayer = game.getPlayer(playerList.get());
|
nextPlayer = game.getPlayer(playerList.get());
|
||||||
if (nextPlayer == null) {
|
if (nextPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue