mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
* Possibility Storm - Fixed a bug that it was not correctly checked if the player was able to cast modal spells.
This commit is contained in:
parent
4aebcd2399
commit
a33ed68c74
4 changed files with 91 additions and 28 deletions
|
|
@ -53,7 +53,6 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class PossibilityStorm extends CardImpl {
|
||||
|
||||
public PossibilityStorm(UUID ownerId) {
|
||||
|
|
@ -77,7 +76,6 @@ public class PossibilityStorm extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class PossibilityStormTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public PossibilityStormTriggeredAbility() {
|
||||
|
|
@ -132,11 +130,11 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null && spell != null) {
|
||||
Player spellController = game.getPlayer(spell.getControllerId());
|
||||
if (spellController != null &&
|
||||
spellController.moveCardToExileWithInfo(spell, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.STACK, true)) {
|
||||
if (spellController != null
|
||||
&& spellController.moveCardToExileWithInfo(spell, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.STACK, true)) {
|
||||
if (spellController.getLibrary().size() > 0) {
|
||||
Library library = spellController.getLibrary();
|
||||
Card card;
|
||||
|
|
@ -147,9 +145,9 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
}
|
||||
} while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));
|
||||
|
||||
if (card != null && sharesType(card, spell.getCardType()) &&
|
||||
!card.getCardType().contains(CardType.LAND) &&
|
||||
card.getSpellAbility().getTargets().canChoose(spellController.getId(), game)) {
|
||||
if (card != null && sharesType(card, spell.getCardType())
|
||||
&& !card.getCardType().contains(CardType.LAND)
|
||||
&& card.getSpellAbility().canChooseTarget(game)) {
|
||||
if (spellController.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + " without paying cost?", source, game)) {
|
||||
spellController.cast(card.getSpellAbility(), game, true);
|
||||
}
|
||||
|
|
@ -171,7 +169,7 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean sharesType (Card card, List<CardType> cardTypes) {
|
||||
private boolean sharesType(Card card, List<CardType> cardTypes) {
|
||||
for (CardType type : card.getCardType()) {
|
||||
if (cardTypes.contains(type)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.GameLog;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -59,7 +60,6 @@ public class SteamAugury extends CardImpl {
|
|||
super(ownerId, 205, "Steam Augury", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{U}{R}");
|
||||
this.expansionSetCode = "THS";
|
||||
|
||||
|
||||
// Reveal the top five cards of your library and separate them into two piles. An opponent chooses one of those piles. Put that pile into your hand and the other into your graveyard.
|
||||
this.getSpellAbility().addEffect(new SteamAuguryEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
|
@ -102,7 +102,7 @@ class SteamAuguryEffect extends OneShotEffect {
|
|||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
Player opponent;
|
||||
Set<UUID> opponents = game.getOpponents(controller.getId());
|
||||
|
|
@ -131,14 +131,14 @@ class SteamAuguryEffect extends OneShotEffect {
|
|||
}
|
||||
List<Card> pile2 = new ArrayList<>();
|
||||
Cards pile2CardsIds = new CardsImpl();
|
||||
for (UUID cardId :cards) {
|
||||
for (UUID cardId : cards) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && !pile1.contains(card)) {
|
||||
pile2.add(card);
|
||||
pile2CardsIds.add(card.getId());
|
||||
}
|
||||
}
|
||||
boolean choice = opponent.choosePile(Outcome.Detriment, new StringBuilder("Choose a pile to put into ").append(controller.getLogName()).append("'s hand.").toString(), pile1, pile2, game);
|
||||
boolean choice = opponent.choosePile(Outcome.Detriment, "Choose a pile to put into " + controller.getName() + "'s hand.", pile1, pile2, game);
|
||||
|
||||
Zone pile1Zone = Zone.GRAVEYARD;
|
||||
Zone pile2Zone = Zone.HAND;
|
||||
|
|
@ -147,13 +147,13 @@ class SteamAuguryEffect extends OneShotEffect {
|
|||
pile2Zone = Zone.GRAVEYARD;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (": ");
|
||||
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": ");
|
||||
int i = 0;
|
||||
for (UUID cardUuid : pile1CardsIds) {
|
||||
i++;
|
||||
Card card = game.getCard(cardUuid);
|
||||
if (card != null) {
|
||||
sb.append(card.getName());
|
||||
sb.append(GameLog.getColoredObjectName(card));
|
||||
if (i < pile1CardsIds.size()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
|
|
@ -162,13 +162,13 @@ class SteamAuguryEffect extends OneShotEffect {
|
|||
}
|
||||
game.informPlayers(sb.toString());
|
||||
|
||||
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":");
|
||||
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(":");
|
||||
i = 0;
|
||||
for (UUID cardUuid : pile2CardsIds) {
|
||||
Card card = game.getCard(cardUuid);
|
||||
if (card != null) {
|
||||
i++;
|
||||
sb.append(" ").append(card.getName());
|
||||
sb.append(" ").append(GameLog.getColoredObjectName(card));
|
||||
if (i < pile2CardsIds.size()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue