mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
placeholder for special param that picks new ability if no legal targets
This commit is contained in:
@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
|
|||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.ability.SpellAbilityEffect;
|
import forge.game.ability.SpellAbilityEffect;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardUtil;
|
||||||
import forge.game.event.GameEventCardModeChosen;
|
import forge.game.event.GameEventCardModeChosen;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -81,6 +82,20 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
|
|||||||
chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, prompt, amount, ImmutableMap.of());
|
chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, prompt, amount, ImmutableMap.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Move this up into the AtRandom area
|
||||||
|
for (SpellAbility chosenSA : chosenSAs) {
|
||||||
|
if (sa.getParam("ChangeToAtRandom").equals("Urza") && chosenSA.usesTargeting()) {
|
||||||
|
List<Card> validTargets = CardUtil.getValidCardsToTarget(chosenSA.getTargetRestrictions(), sa);
|
||||||
|
if (validTargets.isEmpty()) {
|
||||||
|
List <SpellAbility> newChosenSAs = Lists.newArrayList();
|
||||||
|
Aggregates.random(abilities, amount, newChosenSAs);
|
||||||
|
chosenSAs = newChosenSAs;
|
||||||
|
} else {
|
||||||
|
p.getController().chooseTargetsFor(chosenSA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!chosenSAs.isEmpty()) {
|
if (!chosenSAs.isEmpty()) {
|
||||||
for (SpellAbility chosenSA : chosenSAs) {
|
for (SpellAbility chosenSA : chosenSAs) {
|
||||||
String chosenValue = chosenSA.getDescription();
|
String chosenValue = chosenSA.getDescription();
|
||||||
|
|||||||
Reference in New Issue
Block a user