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

View File

@@ -26,10 +26,8 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
@SuppressWarnings("serial") @SuppressWarnings("serial")
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
final Player activator = sa.getActivatingPlayer(); final Player controller = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("Controller"), sa).get(0);
final Game game = activator.getGame(); final Game game = controller.getGame();
final Player controller = sa.hasParam("Controller") ? AbilityUtils.getDefinedPlayers(
sa.getHostCard(), sa.getParam("Controller"), sa).get(0) : activator;
for (final Player pTarget: getTargetPlayers(sa)) { for (final Player pTarget: getTargetPlayers(sa)) {
// before next untap gain control // 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 CardCollection gainedOwnership = new CardCollection();
private ManaPool manaPool = new ManaPool(this); private ManaPool manaPool = new ManaPool(this);
private int numManaConversion = 0;
// The SA currently being paid for // The SA currently being paid for
private Deque<SpellAbility> paidForStack = new ArrayDeque<>(); private Deque<SpellAbility> paidForStack = new ArrayDeque<>();
@@ -2228,20 +2227,6 @@ public class Player extends GameEntity implements Comparable<Player> {
numLibrarySearchedOwn++; 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 @Override
public final boolean isValid(final String restriction, final Player sourceController, final Card source, CardTraitBase spellAbility) { public final boolean isValid(final String restriction, final Player sourceController, final Card source, CardTraitBase spellAbility) {
final String[] incR = restriction.split("\\.", 2); final String[] incR = restriction.split("\\.", 2);
@@ -2587,7 +2572,6 @@ public class Player extends GameEntity implements Comparable<Player> {
lifeGainedByTeamThisTurn = 0; lifeGainedByTeamThisTurn = 0;
setLifeStartedThisTurnWith(getLife()); setLifeStartedThisTurnWith(getLife());
setLibrarySearched(0); setLibrarySearched(0);
setNumManaConversion(0);
setCommitedCrimeThisTurn(0); setCommitedCrimeThisTurn(0);
diceRollsThisTurn = Lists.newArrayList(); diceRollsThisTurn = Lists.newArrayList();

View File

@@ -39,6 +39,15 @@ public class StaticAbilityManaConvert {
if (!stAb.matchesValidParam("ValidSA", sa)) { if (!stAb.matchesValidParam("ValidSA", sa)) {
return false; 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; return true;
} }
} }

View File

@@ -1,6 +1,7 @@
Name:North Star Name:North Star
ManaCost:4 ManaCost:4
Types:Artifact 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 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.) 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 com.google.common.collect.Iterables;
import forge.card.CardType; import forge.card.CardType;
import forge.card.MagicColor;
import forge.game.Game; import forge.game.Game;
import forge.game.GameActionUtil; import forge.game.GameActionUtil;
import forge.game.GameObject; import forge.game.GameObject;
@@ -116,8 +115,6 @@ public class HumanPlaySpellAbility {
Cost abCost = ability.getPayCosts(); Cost abCost = ability.getPayCosts();
CostPayment payment = new CostPayment(abCost, ability); 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; boolean manaColorConversion = false;
if (!ability.isCopied()) { if (!ability.isCopied()) {
@@ -141,16 +138,11 @@ public class HumanPlaySpellAbility {
} }
if (ability.hasParam("ManaConversion")) { if (ability.hasParam("ManaConversion")) {
AbilityUtils.applyManaColorConversion(manapool, ability.getParam("ManaConversion")); AbilityUtils.applyManaColorConversion(payment, ability.getParam("ManaConversion"));
manaColorConversion = true; 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 // 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.clearManaPaid();
ability.getPayingManaAbilities().clear(); ability.getPayingManaAbilities().clear();
@@ -195,10 +187,7 @@ public class HumanPlaySpellAbility {
if (manaColorConversion) { if (manaColorConversion) {
manapool.restoreColorReplacements(); manapool.restoreColorReplacements();
} }
if (playerManaConversion) {
manapool.restoreColorReplacements();
human.decNumManaConversion();
}
return false; return false;
} }