mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix transformed backside cast failing when some AltCost apply (#6070)
This commit is contained in:
@@ -2821,12 +2821,7 @@ public class CardFactoryUtil {
|
||||
final String[] k = keyword.split(":");
|
||||
final Cost disturbCost = new Cost(k[1], true);
|
||||
|
||||
SpellAbility newSA;
|
||||
if (host.getAlternateState().getType().hasSubtype("Aura")) {
|
||||
newSA = host.getAlternateState().getFirstAbility().copyWithDefinedCost(disturbCost);
|
||||
} else {
|
||||
newSA = new SpellPermanent(host, host.getAlternateState(), disturbCost);
|
||||
}
|
||||
SpellAbility newSA = host.getAlternateState().getFirstSpellAbilityWithFallback().copyWithDefinedCost(disturbCost);
|
||||
newSA.setCardState(host.getAlternateState());
|
||||
|
||||
StringBuilder sbCost = new StringBuilder("Disturb");
|
||||
@@ -3137,7 +3132,7 @@ public class CardFactoryUtil {
|
||||
} else if (keyword.startsWith("Freerunning")) {
|
||||
final String[] k = keyword.split(":");
|
||||
final Cost freerunningCost = new Cost(k[1], false);
|
||||
final SpellAbility newSA = card.getFirstSpellAbility().copyWithDefinedCost(freerunningCost);
|
||||
final SpellAbility newSA = card.getFirstSpellAbilityWithFallback().copyWithDefinedCost(freerunningCost);
|
||||
|
||||
if (host.isInstant() || host.isSorcery()) {
|
||||
newSA.putParam("Secondary", "True");
|
||||
@@ -3463,7 +3458,7 @@ public class CardFactoryUtil {
|
||||
} else if (keyword.startsWith("Prowl")) {
|
||||
final String[] k = keyword.split(":");
|
||||
final Cost prowlCost = new Cost(k[1], false);
|
||||
final SpellAbility newSA = card.getFirstSpellAbility().copyWithDefinedCost(prowlCost);
|
||||
final SpellAbility newSA = card.getFirstSpellAbilityWithFallback().copyWithDefinedCost(prowlCost);
|
||||
|
||||
if (host.isInstant() || host.isSorcery()) {
|
||||
newSA.putParam("Secondary", "True");
|
||||
|
||||
@@ -45,6 +45,7 @@ import forge.game.player.Player;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityPredicates;
|
||||
import forge.game.spellability.SpellPermanent;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.game.trigger.Trigger;
|
||||
import forge.util.ITranslatable;
|
||||
@@ -377,6 +378,15 @@ public class CardState extends GameObject implements IHasSVars, ITranslatable {
|
||||
return Iterables.getFirst(getNonManaAbilities(), null);
|
||||
}
|
||||
|
||||
public final SpellAbility getFirstSpellAbilityWithFallback() {
|
||||
SpellAbility sa = getFirstSpellAbility();
|
||||
if (sa != null || getTypeWithChanges().isLand()) {
|
||||
return sa;
|
||||
}
|
||||
// this happens if it's transformed backside (e.g. Disturbed)
|
||||
return new SpellPermanent(getCard(), this);
|
||||
}
|
||||
|
||||
public final boolean hasSpellAbility(final SpellAbility sa) {
|
||||
return getSpellAbilities().contains(sa);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user