mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Activating a card with multiple mana abilities which produce differing amounts of mana should prompt the user to select one
This commit is contained in:
@@ -519,13 +519,40 @@ public final class GameActionUtil {
|
||||
&& Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Tower")));
|
||||
}
|
||||
|
||||
public static String generatedMana(final SpellAbility sa) {
|
||||
public static int amountOfManaGenerated(final SpellAbility sa, boolean multiply) {
|
||||
// Calculate generated mana here for stack description and resolving
|
||||
|
||||
int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("Amount"), sa) : 1;
|
||||
AbilityManaPart abMana = sa.getManaPart();
|
||||
|
||||
if (sa.hasParam("Bonus")) {
|
||||
// For mana abilities that get a bonus
|
||||
// Bonus currently MULTIPLIES the base amount. Base Amounts should
|
||||
// ALWAYS be Base
|
||||
int bonus = 0;
|
||||
if (sa.getParam("Bonus").equals("UrzaLands")) {
|
||||
if (hasUrzaLands(sa.getActivatingPlayer())) {
|
||||
bonus = Integer.parseInt(sa.getParam("BonusProduced"));
|
||||
}
|
||||
}
|
||||
|
||||
amount += bonus;
|
||||
}
|
||||
|
||||
if (!multiply || abMana.isAnyMana() || abMana.isComboMana() || abMana.isSpecialMana()) {
|
||||
return amount;
|
||||
} else {
|
||||
// For cards that produce like {C}{R} vs cards that produce {R}{R}.
|
||||
return abMana.mana().split(" ").length * amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String generatedMana(final SpellAbility sa) {
|
||||
int amount = amountOfManaGenerated(sa, false);
|
||||
AbilityManaPart abMana = sa.getManaPart();
|
||||
String baseMana;
|
||||
|
||||
if (abMana.isComboMana()) {
|
||||
baseMana = abMana.getExpressChoice();
|
||||
if (baseMana.isEmpty()) {
|
||||
@@ -544,20 +571,6 @@ public final class GameActionUtil {
|
||||
baseMana = abMana.mana();
|
||||
}
|
||||
|
||||
if (sa.hasParam("Bonus")) {
|
||||
// For mana abilities that get a bonus
|
||||
// Bonus currently MULTIPLIES the base amount. Base Amounts should
|
||||
// ALWAYS be Base
|
||||
int bonus = 0;
|
||||
if (sa.getParam("Bonus").equals("UrzaLands")) {
|
||||
if (hasUrzaLands(sa.getActivatingPlayer())) {
|
||||
bonus = Integer.parseInt(sa.getParam("BonusProduced"));
|
||||
}
|
||||
}
|
||||
|
||||
amount += bonus;
|
||||
}
|
||||
|
||||
if (sa.getSubAbility() != null) {
|
||||
// Mark SAs with subAbilities as undoable. These are generally things like damage, and other stuff
|
||||
// that's hard to track and remove
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
import forge.game.GameActionUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.FThreads;
|
||||
@@ -200,6 +201,7 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
boolean guessAbilityWithRequiredColors = true;
|
||||
int amountOfMana = -1;
|
||||
for (SpellAbility ma : card.getManaAbilities()) {
|
||||
ma.setActivatingPlayer(player);
|
||||
|
||||
@@ -209,6 +211,16 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
if (ma.isAbility() && ma.getRestrictions().isInstantSpeed()) { continue; }
|
||||
if (!m.meetsManaRestrictions(saPaidFor)) { continue; }
|
||||
|
||||
// If Mana Abilities produce differing amounts of mana, let the player choose
|
||||
int maAmount = GameActionUtil.amountOfManaGenerated(ma, true);
|
||||
if (amountOfMana == -1) {
|
||||
amountOfMana = maAmount;
|
||||
} else {
|
||||
if (amountOfMana != maAmount) {
|
||||
guessAbilityWithRequiredColors = false;
|
||||
}
|
||||
}
|
||||
|
||||
abilities.add(ma);
|
||||
|
||||
// skip express mana if the ability is not undoable or reusable
|
||||
|
||||
Reference in New Issue
Block a user