mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Divine Reckoning - Fixed that only active players in range of controller are asked to choose a creature.
This commit is contained in:
parent
af64575eec
commit
47a442ba28
2 changed files with 34 additions and 17 deletions
|
@ -98,29 +98,33 @@ class DivineReckoningEffect extends OneShotEffect<DivineReckoningEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<Card> chosen = new ArrayList<Card>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
Target target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
target.setRequired(true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
|
||||
player.choose(Outcome.Benefit, target, source.getSourceId(), game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
chosen.add(permanent);
|
||||
Target target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
target.setRequired(true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
|
||||
player.choose(Outcome.Benefit, target, source.getSourceId(), game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
chosen.add(permanent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (!chosen.contains(permanent)) {
|
||||
permanent.destroy(source.getId(), game, false);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (!chosen.contains(permanent)) {
|
||||
permanent.destroy(source.getId(), game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -418,10 +418,23 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
// this.messages.add(message);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns a list of all players of the game ignoring range or
|
||||
* if a player has lost or left the game.
|
||||
*
|
||||
* @return playerList
|
||||
*/
|
||||
public PlayerList getPlayerList() {
|
||||
return playerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all active players of the game, setting the
|
||||
* playerId to the current player of the list.
|
||||
*
|
||||
* @param playerId
|
||||
* @return playerList
|
||||
*/
|
||||
public PlayerList getPlayerList(UUID playerId) {
|
||||
PlayerList newPlayerList = new PlayerList();
|
||||
for (Player player: players.values()) {
|
||||
|
|
Loading…
Reference in a new issue