mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
use for instead of while loop
This commit is contained in:
parent
0ab9abd524
commit
00e51189e3
1 changed files with 4 additions and 7 deletions
|
|
@ -71,7 +71,7 @@ class GrenzosRebuttalEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
UUID controllerId = source.getControllerId();
|
UUID controllerId = source.getControllerId();
|
||||||
Player controller = game.getPlayer(controllerId);
|
Player controller = game.getPlayer(controllerId);
|
||||||
if (controller == null || !controller.canRespond()) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Permanent> chosenPermanents = new ArrayList<>();
|
List<Permanent> chosenPermanents = new ArrayList<>();
|
||||||
|
|
@ -79,13 +79,9 @@ class GrenzosRebuttalEffect extends OneShotEffect {
|
||||||
PlayerList playerList = game.getState().getPlayersInRange(controllerId, game, true);
|
PlayerList playerList = game.getState().getPlayersInRange(controllerId, game, true);
|
||||||
|
|
||||||
Player currentPlayer = game.getPlayer(playerList.get());
|
Player currentPlayer = game.getPlayer(playerList.get());
|
||||||
Player nextPlayer = null;
|
boolean firstIteration = true;
|
||||||
|
|
||||||
while (!playerList.get().equals(controllerId) || nextPlayer == null) {
|
for (Player nextPlayer = game.getPlayer(playerList.getNext()); !currentPlayer.getId().equals(controllerId) || firstIteration; nextPlayer = game.getPlayer(playerList.getNext())) {
|
||||||
nextPlayer = game.getPlayer(playerList.getNext());
|
|
||||||
if (nextPlayer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPlayer != null) {
|
if (currentPlayer != null) {
|
||||||
for (CardType cardType : cardTypes) {
|
for (CardType cardType : cardTypes) {
|
||||||
|
|
@ -108,6 +104,7 @@ class GrenzosRebuttalEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
firstIteration = false;
|
||||||
currentPlayer = nextPlayer;
|
currentPlayer = nextPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue