mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
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:
parent
57b50857cc
commit
7a48387635
1 changed files with 7 additions and 11 deletions
|
@ -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
|
||||
|
@ -97,14 +94,14 @@ class IceCaveEffect extends OneShotEffect {
|
|||
if(sourcePermanent != null && spell != null && controller != null) {
|
||||
Player spellController = game.getPlayer(spell.getControllerId());
|
||||
Cost cost = new ManaCostsImpl(spell.getSpellAbility().getManaCosts().getText());
|
||||
if (spellController != null) {
|
||||
for (UUID playerId : game.getOpponents(spell.getControllerId())) {
|
||||
if(spellController != null) {
|
||||
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)
|
||||
if(cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay " + cost.getText() + " to counter " + spell.getIdName() + '?', source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||
if(cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays" + cost.getText() + " to counter " + spell.getIdName() + '.');
|
||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||
return true;
|
||||
|
@ -117,4 +114,3 @@ class IceCaveEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue