mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Update IceCave.java
I used getOpponents, but that required changing input from source.getControllerId() to spell.getControllerId() so that it would get the opponents of the player who played the spell, rather than the opponents of the player who controls Ice Cave. I also implemented a null check for the spellController as I made it.
This commit is contained in:
parent
d510651bac
commit
57b50857cc
1 changed files with 15 additions and 11 deletions
|
@ -94,17 +94,21 @@ class IceCaveEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
||||||
if(sourcePermanent != null && spell != null) {
|
if(sourcePermanent != null && spell != null && controller != null) {
|
||||||
|
Player spellController = game.getPlayer(spell.getControllerId());
|
||||||
Cost cost = new ManaCostsImpl(spell.getSpellAbility().getManaCosts().getText());
|
Cost cost = new ManaCostsImpl(spell.getSpellAbility().getManaCosts().getText());
|
||||||
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
|
if (spellController != null) {
|
||||||
Player player = game.getPlayer(playerId);
|
for (UUID playerId : game.getOpponents(spell.getControllerId())) {
|
||||||
if(player.getId() != spell.getControllerId()) {
|
Player player = game.getPlayer(playerId);
|
||||||
cost.clearPaid();
|
if (player != null) {
|
||||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
cost.clearPaid();
|
||||||
&& player.chooseUse(outcome, "Pay " + cost.getText() + " to counter " + spell.getIdName() + '?', source, game)) {
|
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||||
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
&& player.chooseUse(outcome, "Pay " + cost.getText() + " to counter " + spell.getIdName() + '?', source, game)) {
|
||||||
game.informPlayers(player.getLogName() + " pays" + cost.getText() + " to counter " + spell.getIdName() + '.');
|
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
game.informPlayers(player.getLogName() + " pays" + cost.getText() + " to counter " + spell.getIdName() + '.');
|
||||||
|
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue