Gavi, Nest Warden - fixed game error on usage

This commit is contained in:
Oleg Agafonov 2025-05-18 20:44:46 +04:00
parent 5eb4bb0112
commit 655625d695
2 changed files with 11 additions and 5 deletions

View file

@ -93,13 +93,17 @@ class CyclingZeroCostEffect extends CostModificationEffectImpl {
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(outcome, "Pay {0} to cycle this card?", source, game)) {
if (player == null) {
return false;
}
if (game.inCheckPlayableState() || player.chooseUse(outcome, "Pay {0} to cycle this card?", source, game)) {
abilityToModify.clearManaCostsToPay();
abilityToModify.getCosts().removeIf(cost -> !CyclingDiscardCost.class.isInstance(cost));
abilityToModify.addManaCostsToPay(new GenericManaCost(0));
return true;
}
abilityToModify.clearManaCostsToPay();
abilityToModify.getCosts().removeIf(cost -> !CyclingDiscardCost.class.isInstance(cost));
abilityToModify.addManaCostsToPay(new GenericManaCost(0));
return true;
return false;
}
@Override

View file

@ -21,6 +21,8 @@ public interface CostModificationEffect extends ContinuousEffect {
/**
* Called by the {@link ContinuousEffects#costModification(java.util.UUID, mage.abilities.Ability, mage.game.Game) ContinuousEffects.costModification}
* method.
* <p>
* Warning, choose dialogs restricted in plyable calculation, so you must check inCheckPlayableState
*
* @param game The game for which this effect should be applied.
* @param source The source ability of this effect.