Merge pull request #22 from tool4ever/costfix

707.10: Copied spells incomplete
This commit is contained in:
Anthony Calosa
2022-04-14 08:49:57 +08:00
committed by GitHub
6 changed files with 23 additions and 26 deletions

View File

@@ -403,7 +403,7 @@ public class GameAction {
if (copied.isAura() && !copied.isAttachedToEntity() && toBattlefield) {
if (zoneFrom != null && zoneFrom.is(ZoneType.Stack) && game.getStack().isResolving(c)) {
boolean found = false;
if (Iterables.any(game.getPlayers(),PlayerPredicates.canBeAttached(copied))) {
if (Iterables.any(game.getPlayers(), PlayerPredicates.canBeAttached(copied))) {
found = true;
}
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(copied))) {
@@ -815,7 +815,7 @@ public class GameAction {
} else {
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);
} else {
c.setCastSA(null);

View File

@@ -1715,6 +1715,12 @@ public class AbilityUtils {
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 Egos 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()) {
Trigger t = root.getTrigger();
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.
// The value of X in Altered Egos 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.isReplacementAbility()) {
if (sa.hasParam("ETB")) {
return doXMath(c.getXManaCostPaid(), expr, c, ctb);
}
if (root.isReplacementAbility() && sa.hasParam("ETB")) {
return doXMath(c.getXManaCostPaid(), expr, c, ctb);
}
return doXMath(0, expr, c, ctb);

View File

@@ -1258,14 +1258,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
public final int getXManaCostPaid() {
SpellAbility castSA;
if (getCopiedPermanent() != null) {
castSA = getCopiedPermanent().getCastSA();
} else {
castSA = getCastSA();
}
if (castSA != null) {
Integer paid = castSA.getXManaCostPaid();
if (getCastSA() != null) {
Integer paid = getCastSA().getXManaCostPaid();
return paid == null ? 0 : paid;
}
return 0;

View File

@@ -172,8 +172,10 @@ public class CardFactory {
if (targetSA.isBestow()) {
c.animateBestow();
}
return c;
}
/**
* <p>
* copySpellAbilityAndPossiblyHost.
@@ -203,6 +205,9 @@ public class CardFactory {
}
copySA.setCopied(true);
// 707.10b
copySA.setOriginalAbility(targetSA);
c.setCastSA(copySA);
if (targetSA.usesTargeting()) {
// do for SubAbilities too?
@@ -304,7 +309,7 @@ public class CardFactory {
buildPlaneAbilities(card);
}
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) {
@@ -792,9 +797,6 @@ public class CardFactory {
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) {
state.setSetCode(originalState.getSetCode());
state.setRarity(originalState.getRarity());

View File

@@ -3396,7 +3396,6 @@ public class Player extends GameEntity implements Comparable<Player> {
equippedThisTurn = 0;
}
public boolean hasUrzaLands() {
final CardCollectionView landsControlled = getCardsIn(ZoneType.Battlefield);
return Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Mine")))

View File

@@ -1115,7 +1115,11 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
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.setPaidHash(Maps.newHashMap(getPaidHash()));