Check if card for PlayEffect is worth it

This commit is contained in:
tool4EvEr
2021-05-05 21:14:15 +02:00
parent 122baba999
commit d6e7d1ffee
4 changed files with 11 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ public abstract class SpellAbilityEffect {
public abstract void resolve(SpellAbility sa);
protected String getStackDescription(final SpellAbility sa) {
// Unless overriden, let the spell description also be the stack description
// Unless overridden, let the spell description also be the stack description
return sa.getDescription();
}
@@ -218,7 +218,6 @@ public abstract class SpellAbilityEffect {
: AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), sa.getParam(definedParam), sa);
}
// Targets of card or player type
protected final static List<GameEntity> getTargetEntities(final SpellAbility sa) { return getEntities(false, "Defined", sa); }
protected final static List<GameEntity> getTargetEntities(final SpellAbility sa, final String definedParam) { return getEntities(false, definedParam, sa); }

View File

@@ -40,6 +40,10 @@ import forge.util.Lang;
import forge.util.Localizer;
public class PlayEffect extends SpellAbilityEffect {
private Card tgtCard;
public Card getTgtCard() { return tgtCard; }
@Override
protected String getStackDescription(final SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
@@ -181,7 +185,7 @@ public class PlayEffect extends SpellAbilityEffect {
final CardCollection saidNoTo = new CardCollection();
while (tgtCards.size() > saidNoTo.size() && saidNoTo.size() < amount && amount > 0) {
activator.getController().tempShowCards(showCards);
Card tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), null);
tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), null);
activator.getController().endTempShowCards();
if (tgtCard == null) {
break;