Fix North Star (#7163)

This commit is contained in:
tool4ever
2025-03-15 14:03:51 +01:00
committed by GitHub
parent 37a5958750
commit b363db2bbd
6 changed files with 29 additions and 46 deletions

View File

@@ -642,7 +642,8 @@ public class ComputerUtilMana {
List<SpellAbility> paymentList = Lists.newArrayList();
final ManaPool manapool = ai.getManaPool();
// Apply the color/type conversion matrix if necessary
// Apply color/type conversion matrix if necessary (already done via autopay)
if (ai.getControllingPlayer() == null) {
manapool.restoreColorReplacements();
CardPlayOption mayPlay = sa.getMayPlayOption();
if (!effect) {
@@ -656,6 +657,7 @@ public class ComputerUtilMana {
AbilityUtils.applyManaColorConversion(manapool, sa.getParam("ManaConversion"));
}
StaticAbilityManaConvert.manaConvert(manapool, ai, sa.getHostCard(), effect && !sa.isCastFromPlayEffect() ? null : sa);
}
if (manapool.payManaCostFromPool(cost, sa, test, manaSpentToPay)) {
CostPayment.handleOfferings(sa, test, cost.isPaid());

View File

@@ -26,10 +26,8 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
@SuppressWarnings("serial")
@Override
public void resolve(SpellAbility sa) {
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final Player controller = sa.hasParam("Controller") ? AbilityUtils.getDefinedPlayers(
sa.getHostCard(), sa.getParam("Controller"), sa).get(0) : activator;
final Player controller = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("Controller"), sa).get(0);
final Game game = controller.getGame();
for (final Player pTarget: getTargetPlayers(sa)) {
// before next untap gain control

View File

@@ -181,7 +181,6 @@ public class Player extends GameEntity implements Comparable<Player> {
private CardCollection gainedOwnership = new CardCollection();
private ManaPool manaPool = new ManaPool(this);
private int numManaConversion = 0;
// The SA currently being paid for
private Deque<SpellAbility> paidForStack = new ArrayDeque<>();
@@ -2228,20 +2227,6 @@ public class Player extends GameEntity implements Comparable<Player> {
numLibrarySearchedOwn++;
}
public final void setNumManaConversion(final int l) {
numManaConversion = l;
}
public final boolean hasManaConversion() {
return numManaConversion < getAmountOfKeyword("You may spend mana as though"
+ " it were mana of any type to cast a spell this turn.");
}
public final void incNumManaConversion() {
numManaConversion++;
}
public final void decNumManaConversion() {
numManaConversion--;
}
@Override
public final boolean isValid(final String restriction, final Player sourceController, final Card source, CardTraitBase spellAbility) {
final String[] incR = restriction.split("\\.", 2);
@@ -2587,7 +2572,6 @@ public class Player extends GameEntity implements Comparable<Player> {
lifeGainedByTeamThisTurn = 0;
setLifeStartedThisTurnWith(getLife());
setLibrarySearched(0);
setNumManaConversion(0);
setCommitedCrimeThisTurn(0);
diceRollsThisTurn = Lists.newArrayList();

View File

@@ -39,6 +39,15 @@ public class StaticAbilityManaConvert {
if (!stAb.matchesValidParam("ValidSA", sa)) {
return false;
}
if (stAb.hasParam("Optional")) {
stAb.getHostCard().clearRemembered();
if (!p.getController().confirmStaticApplication(card, null, "Do you want to spend mana as though it were mana of any type to pay the cost?", null)) {
return false;
}
stAb.getHostCard().addRemembered(sa.getHostCard());
}
return true;
}
}

View File

@@ -1,6 +1,7 @@
Name:North Star
ManaCost:4
Types:Artifact
A:AB$ Pump | Cost$ 4 T | Defined$ You | KW$ You may spend mana as though it were mana of any type to cast a spell this turn. | SpellDescription$ For one spell this turn, you may spend mana as though it were mana of any type to pay that spell's mana cost. (Additional costs are still paid normally.)
A:AB$ Effect | Cost$ 4 T | ForgetOnCast$ Card.IsRemembered | StaticAbilities$ Convert | SpellDescription$ For one spell this turn, you may spend mana as though it were mana of any type to pay that spell's mana cost. (Additional costs are still paid normally.)
SVar:Convert:Mode$ ManaConvert | ValidPlayer$ You | ValidSA$ Spell | Optional$ True | ManaConversion$ AnyType->AnyType | Description$ For one spell this turn, you may spend mana as though it were mana of any type to pay that spell's mana cost.
AI:RemoveDeck:All
Oracle:{4}, {T}: For one spell this turn, you may spend mana as though it were mana of any type to pay that spell's mana cost. (Additional costs are still paid normally.)

View File

@@ -19,7 +19,6 @@ package forge.player;
import com.google.common.collect.Iterables;
import forge.card.CardType;
import forge.card.MagicColor;
import forge.game.Game;
import forge.game.GameActionUtil;
import forge.game.GameObject;
@@ -116,8 +115,6 @@ public class HumanPlaySpellAbility {
Cost abCost = ability.getPayCosts();
CostPayment payment = new CostPayment(abCost, ability);
final boolean playerManaConversion = human.hasManaConversion()
&& human.getController().confirmStaticApplication(c, null, "Do you want to spend mana as though it were mana of any type to pay the cost?", null);
boolean manaColorConversion = false;
if (!ability.isCopied()) {
@@ -141,16 +138,11 @@ public class HumanPlaySpellAbility {
}
if (ability.hasParam("ManaConversion")) {
AbilityUtils.applyManaColorConversion(manapool, ability.getParam("ManaConversion"));
AbilityUtils.applyManaColorConversion(payment, ability.getParam("ManaConversion"));
manaColorConversion = true;
}
}
if (playerManaConversion) {
AbilityUtils.applyManaColorConversion(payment, MagicColor.Constant.ANY_TYPE_CONVERSION);
human.incNumManaConversion();
}
// reset is also done early here, because if an ability is canceled from targeting it might otherwise lead to refunding mana from earlier cast
ability.clearManaPaid();
ability.getPayingManaAbilities().clear();
@@ -195,10 +187,7 @@ public class HumanPlaySpellAbility {
if (manaColorConversion) {
manapool.restoreColorReplacements();
}
if (playerManaConversion) {
manapool.restoreColorReplacements();
human.decNumManaConversion();
}
return false;
}