mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38: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.spellability.SpellAbility;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
|
import io.sentry.Sentry;
|
||||||
|
import io.sentry.event.BreadcrumbBuilder;
|
||||||
|
|
||||||
public class ManaEffect extends SpellAbilityEffect {
|
public class ManaEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -199,13 +201,21 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
abMana.setExpressChoice(sb.toString().trim());
|
abMana.setExpressChoice(sb.toString().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abMana.getExpressChoice().isEmpty()) {
|
|
||||||
System.out.println("AbilityFactoryMana::manaResolve() - special mana effect is empty for " + sa.getHostCard().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abMana.produceMana(GameActionUtil.generatedMana(sa), p, sa);
|
String mana = GameActionUtil.generatedMana(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
|
// Only clear express choice after mana has been produced
|
||||||
|
|||||||
@@ -500,6 +500,8 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public final boolean canProduce(final String s, final SpellAbility sa) {
|
public final boolean canProduce(final String s, final SpellAbility sa) {
|
||||||
|
// TODO: need to handle replacement effects like 106.7
|
||||||
|
|
||||||
// Any mana never means Colorless?
|
// Any mana never means Colorless?
|
||||||
if (isAnyMana() && !s.equals("C")) {
|
if (isAnyMana() && !s.equals("C")) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user