The Gitrog Monster - Fixed that it could only be sacrificed if it's still on the battlefield.

This commit is contained in:
LevelX2 2016-10-29 23:58:41 +02:00
parent 70126988c5
commit bec827f96c

View file

@ -5,6 +5,7 @@ import mage.abilities.Mode;
import mage.abilities.costs.Cost;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -38,14 +39,18 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
}
String message = CardUtil.replaceSourceName(sb.toString(), sourcePermanent.getLogName());
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
if (controller.chooseUse(Outcome.Benefit, message, source, game)) {
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(Outcome.Benefit, message, source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
game.informPlayers(controller.getLogName() + " pays " + cost.toString());
return true;
}
}
sourcePermanent.sacrifice(source.getSourceId(), game);
if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId())
&& game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD)) {
sourcePermanent.sacrifice(source.getSourceId(), game);
}
return true;
}
return false;