mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
Fixed getPlayerList references
This commit is contained in:
parent
188db6eedc
commit
502ecd8858
13 changed files with 22 additions and 38 deletions
|
@ -87,7 +87,7 @@ class AllPlayersLostLifeCount implements DynamicValue {
|
|||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
if (watcher != null) {
|
||||
int amountLifeLost = 0;
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
|
||||
amountLifeLost += watcher.getLiveLost(playerId);
|
||||
}
|
||||
return amountLifeLost;
|
||||
|
|
|
@ -80,7 +80,7 @@ class ExtractFromDarknessMillEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCards(player.getLibrary().getTopCards(game, 2), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -147,7 +147,7 @@ class CurseOfEchoesEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
String chooseMessage = "Copy target spell? You may choose new targets for the copy.";
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
if (!playerId.equals(spell.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player.chooseUse(Outcome.Copy, chooseMessage, source, game)) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class CataclysmEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
List<Card> chosen = new ArrayList<>();
|
||||
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
|
||||
|
|
|
@ -44,7 +44,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -90,7 +89,7 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Set<UUID> lands = new HashSet<>();
|
||||
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
for (String landName : new String[]{"Forest", "Island", "Mountain", "Plains", "Swamp"}) {
|
||||
FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control");
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -85,7 +86,8 @@ class ArbiterOfKnollridgeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int maxLife = 0;
|
||||
for (UUID pid : game.getPlayerList()) {
|
||||
PlayerList playerList = game.getState().getPlayersInRange(source.getControllerId(), game);
|
||||
for (UUID pid : playerList) {
|
||||
Player p = game.getPlayer(pid);
|
||||
if (p != null) {
|
||||
if (maxLife < p.getLife()) {
|
||||
|
@ -93,7 +95,7 @@ class ArbiterOfKnollridgeEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (UUID pid : game.getPlayerList()) {
|
||||
for (UUID pid : playerList) {
|
||||
Player p = game.getPlayer(pid);
|
||||
if (p != null) {
|
||||
p.setLife(maxLife, game);
|
||||
|
|
|
@ -89,7 +89,7 @@ class WorldfireEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
permanent.moveToExile(id, "all permanents", id, game);
|
||||
}
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (UUID cid : player.getHand().copy()) {
|
||||
|
|
|
@ -92,7 +92,7 @@ class WordsOfWindEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
game.informPlayers("Each player returns a permanent he or she controls to its owner's hand instead");
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
TargetControlledPermanent target = new TargetControlledPermanent();
|
||||
|
|
|
@ -74,7 +74,7 @@ class SyphonSoulEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damageDealt = 0;
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
if (!playerId.equals(source.getControllerId())) {
|
||||
damageDealt += game.getPlayer(playerId).damage(2, source.getSourceId(), game, false, true);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class PestilenceDemonEffect extends OneShotEffect {
|
|||
p.damage(1, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player p = game.getPlayer(playerId);
|
||||
if (p != null) {
|
||||
p.damage(1, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -108,7 +108,7 @@ class DecreeOfAnnihilationEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
permanent.moveToExile(id, "all artifacts, creatures, and land", id, game);
|
||||
}
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (UUID cid : player.getHand().copy()) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class WhetstoneEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCards(player.getLibrary().getTopCards(game, 2), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -45,7 +45,6 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -115,12 +114,12 @@ class WorldQuellerEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<Card> chosen = new ArrayList<>();
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
if (you != null && sourceCreature != null) {
|
||||
if (player != null && sourceCreature != null) {
|
||||
Choice choiceImpl = new ChoiceImpl();
|
||||
choiceImpl.setChoices(choice);
|
||||
while (you.canRespond() && !you.choose(Outcome.Neutral, choiceImpl, game)) {}
|
||||
while (player.canRespond() && !player.choose(Outcome.Neutral, choiceImpl, game)) {}
|
||||
CardType type = null;
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
|
||||
|
@ -148,26 +147,11 @@ class WorldQuellerEffect extends OneShotEffect {
|
|||
TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
target.setNotTarget(true);
|
||||
|
||||
// you always go first
|
||||
if (target.canChoose(you.getId(), game)) {
|
||||
while (you.canRespond() && !target.isChosen() && target.canChoose(you.getId(), game)) {
|
||||
you.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
chosen.add(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
target.clearChosen();
|
||||
|
||||
// opponents follow
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
if (playerId != you.getId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player2 = game.getPlayer(playerId);
|
||||
if (target.canChoose(playerId, game)) {
|
||||
while (!target.isChosen() && target.canChoose(playerId, game)) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
while (player2.canRespond() && !target.isChosen() && target.canChoose(playerId, game)) {
|
||||
player2.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
|
@ -175,7 +159,6 @@ class WorldQuellerEffect extends OneShotEffect {
|
|||
}
|
||||
target.clearChosen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all chosen permanents are sacrificed together
|
||||
|
|
Loading…
Add table
Reference in a new issue