Fixed not giving counter option to non-opponent players that are not the spell's controller

This update brings to code to compliance with LevelX2's reccomendation by using getPlayersInRange(source.getControllerId(), game) and checking manually that the player is not the spell's controller.
This commit is contained in:
ThomasLerner 2017-04-10 04:39:10 -04:00 committed by GitHub
parent 57b50857cc
commit 7a48387635

View file

@ -30,10 +30,8 @@ package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
@ -43,12 +41,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import java.util.UUID;
/**
*
* @author ThomasLerner
@ -98,9 +95,9 @@ class IceCaveEffect extends OneShotEffect {
Player spellController = game.getPlayer(spell.getControllerId());
Cost cost = new ManaCostsImpl(spell.getSpellAbility().getManaCosts().getText());
if(spellController != null) {
for (UUID playerId : game.getOpponents(spell.getControllerId())) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
if(player != null && player != spellController) {
cost.clearPaid();
if(cost.canPay(source, source.getSourceId(), player.getId(), game)
&& player.chooseUse(outcome, "Pay " + cost.getText() + " to counter " + spell.getIdName() + '?', source, game)) {
@ -117,4 +114,3 @@ class IceCaveEffect extends OneShotEffect {
return true;
}
}