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.mageObjectType = MageObjectType.TOKEN;
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
this.expansionSetCode = ((PermanentToken) card).getToken().getOriginalExpansionSetCode();
this.cardNumber = ((PermanentToken) card).getToken().getOriginalCardNumber();

View file

@ -43,6 +43,7 @@ import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetOpponent;
/**
*
@ -55,7 +56,9 @@ public class Gravestorm extends CardImpl {
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.
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) {
@ -93,17 +96,20 @@ class GravestormEffect extends OneShotEffect {
filter.add(new OwnerIdPredicate(targetPlayer.getId()));
TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
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)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
if (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 (card != null) {
opponentExilesACard = targetPlayer.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
}
}
if (!opponentExilesACard) {
if (you.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) {
you.drawCards(1, game);
}
}
return true;
}
return false;
}

View file

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