Merged changes from trunk to GuiRefactoring: 27198-27235

This commit is contained in:
elcnesh
2014-09-07 09:27:46 +00:00
parent c931379ce8
commit 5925c35486
33 changed files with 742 additions and 100 deletions

View File

@@ -176,6 +176,7 @@ public class GameAction {
HashMap<String, Object> repParams = new HashMap<String, Object>();
repParams.put("Event", "Moved");
repParams.put("Affected", copied);
repParams.put("CardLKI", lastKnownInfo);
repParams.put("Origin", zoneFrom != null ? zoneFrom.getZoneType() : null);
repParams.put("Destination", zoneTo.getZoneType());

View File

@@ -34,7 +34,7 @@ public enum GameType {
mainDeck.add("Island", 12);
mainDeck.add("Swamp", 12);
mainDeck.add("Mountain", 12);
mainDeck.add("Swamp", 12);
mainDeck.add("Forest", 12);
deck.getOrCreate(DeckSection.Avatar).add(StaticData.instance().getVariantCards()
.getCard("Momir Vig, Simic Visionary Avatar"), 1);
return deck;

View File

@@ -152,7 +152,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
for (int i = 0; i < multiplier; i++) {
final Card copy = CardFactory.copyCopiableCharacteristics(c, sa.getActivatingPlayer());
copy.setToken(true);
copy.setCopiedToken(true);
copy.setCopiedPermanent(c);
CardFactory.copyCopiableAbilities(c, copy);
// add keywords from sa
for (final String kw : keywords) {

View File

@@ -147,7 +147,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private boolean tapped = false;
private boolean sickness = true; // summoning sickness
private boolean token = false;
private boolean copiedToken = false;
private Card copiedPermanent = null;
private boolean copiedSpell = false;
private ArrayList<Card> mustBlockCards = null;
@@ -2906,25 +2906,25 @@ public class Card extends GameEntity implements Comparable<Card> {
/**
* <p>
* Setter for the field <code>copiedToken</code>.
* Getter for the field <code>copiedPermanent</code>.
* </p>
*
* @param b
* a boolean.
* @return a Card.
*/
public final void setCopiedToken(final boolean b) {
this.copiedToken = b;
public final Card getCopiedPermanent() {
return this.copiedPermanent;
}
/**
* <p>
* isCopiedToken.
* Setter for the field <code>copiedPermanent</code>.
* </p>
*
* @return a boolean.
* @param c
* a Card.
*/
public final boolean isCopiedToken() {
return this.copiedToken;
public final void setCopiedPermanent(final Card c) {
this.copiedPermanent = c;
}
/**
@@ -6438,6 +6438,11 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
}
} else if (property.startsWith("hasKeyword")) {
// "withFlash" would find Flashback cards, add this to fix Mystical Teachings
if (!this.hasKeyword(property.substring(10))) {
return false;
}
} else if (property.startsWith("withFlashback")) {
boolean fb = false;
if (this.hasStartOfUnHiddenKeyword("Flashback")) {
@@ -8848,6 +8853,8 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public boolean canBeShownTo(final Player viewer) {
if (viewer == null) { return false; }
Zone zone = this.getZone();
if (zone == null) { return true; } //cards outside any zone are visible to all
@@ -8922,7 +8929,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public int getCMC(SplitCMCMode mode) {
if (isToken() && !isCopiedToken()) {
if (isToken() && getCopiedPermanent() == null) {
return 0;
}
@@ -9140,4 +9147,12 @@ public class Card extends GameEntity implements Comparable<Card> {
public Card getCardForUi() {
return this;
}
public String getOracleText() {
CardRules rules = cardRules;
if (copiedPermanent != null) { //return oracle text of copied permanent if applicable
rules = copiedPermanent.getRules();
}
return rules != null ? rules.getOracleText() : "";
}
} // end Card class

View File

@@ -73,7 +73,7 @@ public class CardFactory {
*/
public final static Card copyCard(final Card in, boolean assignNewId) {
Card out;
if (!(in.isToken() || in.isCopiedToken())) {
if (!(in.isToken() || in.getCopiedPermanent() != null)) {
out = assignNewId ? getCard(in.getPaperCard(), in.getOwner())
: getCard(in.getPaperCard(), in.getOwner(), in.getUniqueNumber());
} else { // token

View File

@@ -38,6 +38,7 @@ import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.CardPredicates.Presets;
import forge.game.cost.Cost;
import forge.game.cost.CostPayment;
import forge.game.event.GameEventCardStatsChanged;
import forge.game.phase.PhaseHandler;
import forge.game.player.Player;
@@ -137,7 +138,7 @@ public class CardFactoryUtil {
@Override
public boolean canPlay() {
return sourceCard.getController().equals(this.getActivatingPlayer()) && sourceCard.isFaceDown()
&& sourceCard.isInPlay();
&& sourceCard.isInPlay() && CostPayment.canPayAdditionalCosts(cost, this);
}
}; // morph_up

View File

@@ -172,7 +172,7 @@ public class Combat {
return ab;
}
CombatLki lki = lkiCache.get(c);
return lki == null ? null : lki.getFirstBand();
return lki == null || lki.isAttacker ? null : lki.getFirstBand();
}
public final List<AttackingBand> getAttackingBands() {

View File

@@ -72,6 +72,7 @@ public class ReplaceMoved extends ReplacementEffect {
@Override
public void setReplacingObjects(Map<String, Object> runParams, SpellAbility sa) {
sa.setReplacingObject("Card", runParams.get("Affected"));
sa.setReplacingObject("CardLKI", runParams.get("CardLKI"));
}
}