mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
add Optional param and prompt to CharmEffect.java
This commit is contained in:
@@ -13,7 +13,9 @@ import forge.game.player.Player;
|
|||||||
import forge.game.spellability.AbilitySub;
|
import forge.game.spellability.AbilitySub;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
|
import forge.util.CardTranslation;
|
||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
|
import forge.util.Localizer;
|
||||||
import forge.util.collect.FCollection;
|
import forge.util.collect.FCollection;
|
||||||
|
|
||||||
public class CharmEffect extends SpellAbilityEffect {
|
public class CharmEffect extends SpellAbilityEffect {
|
||||||
@@ -65,6 +67,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParamOrDefault("MinCharmNum", "1"), sa) : num;
|
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParamOrDefault("MinCharmNum", "1"), sa) : num;
|
||||||
|
|
||||||
|
boolean optional = sa.hasParam("Optional");
|
||||||
boolean repeat = sa.hasParam("CanRepeatModes");
|
boolean repeat = sa.hasParam("CanRepeatModes");
|
||||||
boolean random = sa.hasParam("Random");
|
boolean random = sa.hasParam("Random");
|
||||||
boolean limit = sa.hasParam("ActivationLimit");
|
boolean limit = sa.hasParam("ActivationLimit");
|
||||||
@@ -107,8 +110,12 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (additionalDesc) {
|
if (additionalDesc) {
|
||||||
|
if (optional) {
|
||||||
|
sb.append(". ").append(sa.getParam("AdditionalDescription").trim());
|
||||||
|
} else {
|
||||||
sb.append(" ").append(sa.getParam("AdditionalDescription").trim());
|
sb.append(" ").append(sa.getParam("AdditionalDescription").trim());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
if (!repeat && !additionalDesc && !limit) {
|
if (!repeat && !additionalDesc && !limit) {
|
||||||
@@ -158,6 +165,11 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isOptional = sa.hasParam("Optional");
|
||||||
|
if (isOptional && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeCharm", CardTranslation.getTranslatedName(source.getName())))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Random")) {
|
if (sa.hasParam("Random")) {
|
||||||
chainAbilities(sa, Aggregates.random(choices, num));
|
chainAbilities(sa, Aggregates.random(choices, num));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user