mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Merge branch '1358-choosegenericeffect-atrandom-param-update-needed' into 'master'
Resolve "ChooseGenericEffect AtRandom param update needed" Closes #1358 See merge request core-developers/forge!2693
This commit is contained in:
@@ -67,8 +67,9 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
SpellAbility chosenSA = null;
|
SpellAbility chosenSA = null;
|
||||||
if (sa.hasParam("AtRandom")) {
|
if (sa.hasParam("AtRandom")) {
|
||||||
int idxChosen = MyRandom.getRandom().nextInt(abilities.size());
|
if (!abilities.isEmpty()) {
|
||||||
chosenSA = abilities.get(idxChosen);
|
chosenSA = abilities.get(MyRandom.getRandom().nextInt(abilities.size()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
chosenSA = p.getController().chooseSingleSpellForEffect(abilities, sa, Localizer.getInstance().getMessage("lblChooseOne"),
|
chosenSA = p.getController().chooseSingleSpellForEffect(abilities, sa, Localizer.getInstance().getMessage("lblChooseOne"),
|
||||||
ImmutableMap.of());
|
ImmutableMap.of());
|
||||||
@@ -90,7 +91,7 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
|||||||
if (fallback != null) {
|
if (fallback != null) {
|
||||||
p.getGame().fireEvent(new GameEventCardModeChosen(p, host.getName(), fallback.getDescription(), sa.hasParam("ShowChoice")));
|
p.getGame().fireEvent(new GameEventCardModeChosen(p, host.getName(), fallback.getDescription(), sa.hasParam("ShowChoice")));
|
||||||
AbilityUtils.resolve(fallback);
|
AbilityUtils.resolve(fallback);
|
||||||
} else {
|
} else if (!sa.hasParam("AtRandom")) {
|
||||||
System.err.println("Warning: all Unless costs were unpayable for " + host.getName() +", but it had no FallbackAbility defined. Doing nothing (this is most likely incorrect behavior).");
|
System.err.println("Warning: all Unless costs were unpayable for " + host.getName() +", but it had no FallbackAbility defined. Doing nothing (this is most likely incorrect behavior).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user