mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
finished implementation of cards. CardView bug fix for card number change.
This commit is contained in:
parent
b7c4eec90f
commit
f593623508
3 changed files with 34 additions and 28 deletions
|
@ -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();
|
||||
|
|
|
@ -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,18 +96,21 @@ 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)) {
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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,6 +86,7 @@ class SyphonMindEffect extends OneShotEffect {
|
|||
int amount = 0;
|
||||
boolean result = false;
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
for (UUID playerId : you.getInRange()) {
|
||||
if (!playerId.equals(source.getControllerId())) {
|
||||
Player otherPlayer = game.getPlayer(playerId);
|
||||
|
@ -105,7 +105,6 @@ class SyphonMindEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (you != null) {
|
||||
you.drawCards(amount, game);
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue