finished implementation of cards. CardView bug fix for card number change.

This commit is contained in:
drmDev 2016-07-26 22:58:20 -04:00
parent b7c4eec90f
commit f593623508
3 changed files with 34 additions and 28 deletions

View file

@ -275,7 +275,8 @@ public class CardView extends SimpleCardView {
this.isToken = true; this.isToken = true;
this.mageObjectType = MageObjectType.TOKEN; this.mageObjectType = MageObjectType.TOKEN;
this.rarity = Rarity.COMMON; this.rarity = Rarity.COMMON;
if (!((PermanentToken) card).getToken().getOriginalCardNumber().isEmpty() && !"0".equals(((PermanentToken) card).getToken().getOriginalCardNumber())) { boolean originalCardNumberIsNull = ((PermanentToken) card).getToken().getOriginalCardNumber() == null;
if (!originalCardNumberIsNull && !"0".equals(((PermanentToken) card).getToken().getOriginalCardNumber())) {
// a token copied from permanent // a token copied from permanent
this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode(); this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode();
this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber(); this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber();

View file

@ -43,6 +43,7 @@ import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetOpponent;
/** /**
* *
@ -55,7 +56,9 @@ public class Gravestorm extends CardImpl {
this.expansionSetCode = "ODY"; this.expansionSetCode = "ODY";
// At the beginning of your upkeep, target opponent may exile a card from his or her graveyard. If that player doesn't, you may draw a card. // At the beginning of your upkeep, target opponent may exile a card from his or her graveyard. If that player doesn't, you may draw a card.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new GravestormEffect(), TargetController.YOU, false)); Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new GravestormEffect(), TargetController.YOU, false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
} }
public Gravestorm(final Gravestorm card) { public Gravestorm(final Gravestorm card) {
@ -93,17 +96,20 @@ class GravestormEffect extends OneShotEffect {
filter.add(new OwnerIdPredicate(targetPlayer.getId())); filter.add(new OwnerIdPredicate(targetPlayer.getId()));
TargetCardInGraveyard target = new TargetCardInGraveyard(filter); TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
boolean opponentChoosesExile = targetPlayer.chooseUse(Outcome.Exile, "Exile a card from your graveyard?", source, game); boolean opponentChoosesExile = targetPlayer.chooseUse(Outcome.Exile, "Exile a card from your graveyard?", source, game);
boolean opponentExilesACard = false;
if (opponentChoosesExile && targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) { if (opponentChoosesExile && targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {
if (targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true)) { opponentExilesACard = targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
if (you.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { }
you.drawCards(1, game);
}
}
}
return true;
} }
if (!opponentExilesACard) {
if (you.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) {
you.drawCards(1, game);
}
}
return true;
} }
return false; return false;
} }

View file

@ -28,14 +28,13 @@
package mage.sets.onslaught; package mage.sets.onslaught;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
@ -87,25 +86,25 @@ class SyphonMindEffect extends OneShotEffect {
int amount = 0; int amount = 0;
boolean result = false; boolean result = false;
Player you = game.getPlayer(source.getControllerId()); Player you = game.getPlayer(source.getControllerId());
for (UUID playerId : you.getInRange()) { if (you != null) {
if (!playerId.equals(source.getControllerId())) { for (UUID playerId : you.getInRange()) {
Player otherPlayer = game.getPlayer(playerId); if (!playerId.equals(source.getControllerId())) {
if (otherPlayer != null && otherPlayer.getHand().size() > 0) { Player otherPlayer = game.getPlayer(playerId);
TargetCardInHand target = new TargetCardInHand(); if (otherPlayer != null && otherPlayer.getHand().size() > 0) {
if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) { TargetCardInHand target = new TargetCardInHand();
Card card = game.getCard(target.getFirstTarget()); if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) {
if (card != null) { Card card = game.getCard(target.getFirstTarget());
if (otherPlayer.discard(card, source, game)) { if (card != null) {
amount += 1; if (otherPlayer.discard(card, source, game)) {
result = true; amount += 1;
target.clearChosen(); result = true;
target.clearChosen();
}
} }
} }
} }
} }
} }
}
if (you != null) {
you.drawCards(amount, game); you.drawCards(amount, game);
} }
return result; return result;