mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'mana' into 'master'
ManaEffect: Skip producing mana from nothing See merge request core-developers/forge!4593
This commit is contained in:
@@ -23,6 +23,8 @@ import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Localizer;
|
||||
import io.sentry.Sentry;
|
||||
import io.sentry.event.BreadcrumbBuilder;
|
||||
|
||||
public class ManaEffect extends SpellAbilityEffect {
|
||||
|
||||
@@ -199,13 +201,21 @@ public class ManaEffect extends SpellAbilityEffect {
|
||||
}
|
||||
abMana.setExpressChoice(sb.toString().trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (abMana.getExpressChoice().isEmpty()) {
|
||||
System.out.println("AbilityFactoryMana::manaResolve() - special mana effect is empty for " + sa.getHostCard().getName());
|
||||
}
|
||||
}
|
||||
String mana = GameActionUtil.generatedMana(sa);
|
||||
|
||||
abMana.produceMana(GameActionUtil.generatedMana(sa), p, sa);
|
||||
// this can happen when mana is based on criteria that didn't match
|
||||
if (mana.isEmpty()) {
|
||||
String msg = "AbilityFactoryMana::manaResolve() - special mana effect is empty for";
|
||||
Sentry.getContext().recordBreadcrumb(
|
||||
new BreadcrumbBuilder().setMessage(msg)
|
||||
.withData("Card", card.getName()).withData("SA", sa.toString()).build()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
abMana.produceMana(mana, p, sa);
|
||||
}
|
||||
|
||||
// Only clear express choice after mana has been produced
|
||||
|
||||
@@ -500,6 +500,8 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean canProduce(final String s, final SpellAbility sa) {
|
||||
// TODO: need to handle replacement effects like 106.7
|
||||
|
||||
// Any mana never means Colorless?
|
||||
if (isAnyMana() && !s.equals("C")) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user