mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge pull request #22 from tool4ever/costfix
707.10: Copied spells incomplete
This commit is contained in:
@@ -403,7 +403,7 @@ public class GameAction {
|
|||||||
if (copied.isAura() && !copied.isAttachedToEntity() && toBattlefield) {
|
if (copied.isAura() && !copied.isAttachedToEntity() && toBattlefield) {
|
||||||
if (zoneFrom != null && zoneFrom.is(ZoneType.Stack) && game.getStack().isResolving(c)) {
|
if (zoneFrom != null && zoneFrom.is(ZoneType.Stack) && game.getStack().isResolving(c)) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (Iterables.any(game.getPlayers(),PlayerPredicates.canBeAttached(copied))) {
|
if (Iterables.any(game.getPlayers(), PlayerPredicates.canBeAttached(copied))) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(copied))) {
|
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(copied))) {
|
||||||
@@ -815,7 +815,7 @@ public class GameAction {
|
|||||||
} else {
|
} else {
|
||||||
c.setCastFrom(zoneFrom);
|
c.setCastFrom(zoneFrom);
|
||||||
}
|
}
|
||||||
if (cause != null && cause.isSpell() && c.equals(cause.getHostCard()) && !c.isCopiedSpell()) {
|
if (cause != null && cause.isSpell() && c.equals(cause.getHostCard())) {
|
||||||
c.setCastSA(cause);
|
c.setCastSA(cause);
|
||||||
} else {
|
} else {
|
||||||
c.setCastSA(null);
|
c.setCastSA(null);
|
||||||
|
|||||||
@@ -1715,6 +1715,12 @@ public class AbilityUtils {
|
|||||||
return doXMath(root.getXManaCostPaid(), expr, c, ctb);
|
return doXMath(root.getXManaCostPaid(), expr, c, ctb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the chosen creature has X in its mana cost, that X is considered to be 0.
|
||||||
|
// The value of X in Altered Ego’s last ability will be whatever value was chosen for X while casting Altered Ego.
|
||||||
|
if (sa.isCopiedTrait() && !sa.getHostCard().equals(c)) {
|
||||||
|
return doXMath(0, expr, c, ctb);
|
||||||
|
}
|
||||||
|
|
||||||
if (root.isTrigger()) {
|
if (root.isTrigger()) {
|
||||||
Trigger t = root.getTrigger();
|
Trigger t = root.getTrigger();
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
@@ -1755,16 +1761,8 @@ public class AbilityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the chosen creature has X in its mana cost, that X is considered to be 0.
|
if (root.isReplacementAbility() && sa.hasParam("ETB")) {
|
||||||
// The value of X in Altered Ego’s last ability will be whatever value was chosen for X while casting Altered Ego.
|
return doXMath(c.getXManaCostPaid(), expr, c, ctb);
|
||||||
if (sa.isCopiedTrait() || !sa.getHostCard().equals(c)) {
|
|
||||||
return doXMath(0, expr, c, ctb);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.isReplacementAbility()) {
|
|
||||||
if (sa.hasParam("ETB")) {
|
|
||||||
return doXMath(c.getXManaCostPaid(), expr, c, ctb);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return doXMath(0, expr, c, ctb);
|
return doXMath(0, expr, c, ctb);
|
||||||
|
|||||||
@@ -1258,14 +1258,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final int getXManaCostPaid() {
|
public final int getXManaCostPaid() {
|
||||||
SpellAbility castSA;
|
if (getCastSA() != null) {
|
||||||
if (getCopiedPermanent() != null) {
|
Integer paid = getCastSA().getXManaCostPaid();
|
||||||
castSA = getCopiedPermanent().getCastSA();
|
|
||||||
} else {
|
|
||||||
castSA = getCastSA();
|
|
||||||
}
|
|
||||||
if (castSA != null) {
|
|
||||||
Integer paid = castSA.getXManaCostPaid();
|
|
||||||
return paid == null ? 0 : paid;
|
return paid == null ? 0 : paid;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -172,8 +172,10 @@ public class CardFactory {
|
|||||||
if (targetSA.isBestow()) {
|
if (targetSA.isBestow()) {
|
||||||
c.animateBestow();
|
c.animateBestow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* copySpellAbilityAndPossiblyHost.
|
* copySpellAbilityAndPossiblyHost.
|
||||||
@@ -203,6 +205,9 @@ public class CardFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copySA.setCopied(true);
|
copySA.setCopied(true);
|
||||||
|
// 707.10b
|
||||||
|
copySA.setOriginalAbility(targetSA);
|
||||||
|
c.setCastSA(copySA);
|
||||||
|
|
||||||
if (targetSA.usesTargeting()) {
|
if (targetSA.usesTargeting()) {
|
||||||
// do for SubAbilities too?
|
// do for SubAbilities too?
|
||||||
@@ -304,7 +309,7 @@ public class CardFactory {
|
|||||||
buildPlaneAbilities(card);
|
buildPlaneAbilities(card);
|
||||||
}
|
}
|
||||||
CardFactoryUtil.setupKeywordedAbilities(card); // Should happen AFTER setting left/right split abilities to set Fuse ability to both sides
|
CardFactoryUtil.setupKeywordedAbilities(card); // Should happen AFTER setting left/right split abilities to set Fuse ability to both sides
|
||||||
card.getView().updateState(card);
|
card.updateStateForView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void buildPlaneAbilities(Card card) {
|
private static void buildPlaneAbilities(Card card) {
|
||||||
@@ -792,9 +797,6 @@ public class CardFactory {
|
|||||||
state.setImageKey(ImageKeys.getTokenKey("eternalize_" + name + "_" + set));
|
state.setImageKey(ImageKeys.getTokenKey("eternalize_" + name + "_" + set));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the host card for copied replacement effects
|
|
||||||
// needed for copied xPaid ETB effects (for the copy, xPaid = 0)
|
|
||||||
|
|
||||||
if (sa.hasParam("GainTextOf") && originalState != null) {
|
if (sa.hasParam("GainTextOf") && originalState != null) {
|
||||||
state.setSetCode(originalState.getSetCode());
|
state.setSetCode(originalState.getSetCode());
|
||||||
state.setRarity(originalState.getRarity());
|
state.setRarity(originalState.getRarity());
|
||||||
|
|||||||
@@ -3396,7 +3396,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
equippedThisTurn = 0;
|
equippedThisTurn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasUrzaLands() {
|
public boolean hasUrzaLands() {
|
||||||
final CardCollectionView landsControlled = getCardsIn(ZoneType.Battlefield);
|
final CardCollectionView landsControlled = getCardsIn(ZoneType.Battlefield);
|
||||||
return Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Mine")))
|
return Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Mine")))
|
||||||
|
|||||||
@@ -1115,7 +1115,11 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
clone.changeZoneTable = new CardZoneTable(changeZoneTable);
|
clone.changeZoneTable = new CardZoneTable(changeZoneTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
clone.payingMana = Lists.newArrayList(payingMana);
|
clone.payingMana = Lists.newArrayList();
|
||||||
|
// mana is not copied
|
||||||
|
if (lki) {
|
||||||
|
clone.payingMana.addAll(payingMana);
|
||||||
|
}
|
||||||
clone.paidAbilities = Lists.newArrayList();
|
clone.paidAbilities = Lists.newArrayList();
|
||||||
clone.setPaidHash(Maps.newHashMap(getPaidHash()));
|
clone.setPaidHash(Maps.newHashMap(getPaidHash()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user