mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
* Fixed that the cascade converted mana costs comparison did not work correctly with split spells.
This commit is contained in:
parent
227143aacf
commit
0dacf2a6fa
3 changed files with 68 additions and 18 deletions
|
|
@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -120,14 +121,13 @@ class CascadeEffect extends OneShotEffect {
|
|||
break;
|
||||
}
|
||||
controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName());
|
||||
} while (controller.isInGame() && card.getCardType().contains(CardType.LAND) || card.getConvertedManaCost() >= sourceCost);
|
||||
} while (controller.isInGame() && (card.getCardType().contains(CardType.LAND) || !cardThatCostsLess(sourceCost, card, game)));
|
||||
|
||||
controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw
|
||||
|
||||
if (card != null) {
|
||||
if (controller.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + "?", source, game)) {
|
||||
if (controller.cast(card.getSpellAbility(), game, true)) {
|
||||
exile.remove(card.getId());
|
||||
}
|
||||
controller.cast(card.getSpellAbility(), game, true);
|
||||
}
|
||||
}
|
||||
// Move the remaining cards to the buttom of the library in a random order
|
||||
|
|
@ -148,4 +148,12 @@ class CascadeEffect extends OneShotEffect {
|
|||
return new CascadeEffect(this);
|
||||
}
|
||||
|
||||
private boolean cardThatCostsLess(int value, Card card, Game game) {
|
||||
if (card instanceof SplitCard) {
|
||||
return ((SplitCard) card).getLeftHalfCard().getConvertedManaCost() < value
|
||||
|| ((SplitCard) card).getRightHalfCard().getConvertedManaCost() < value;
|
||||
} else {
|
||||
return card.getConvertedManaCost() < value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue