mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Check if card for PlayEffect is worth it
This commit is contained in:
@@ -280,7 +280,7 @@ public class ComputerUtil {
|
|||||||
SpellAbility newSA = sa.copyWithNoManaCost();
|
SpellAbility newSA = sa.copyWithNoManaCost();
|
||||||
newSA.setActivatingPlayer(ai);
|
newSA.setActivatingPlayer(ai);
|
||||||
|
|
||||||
if (!CostPayment.canPayAdditionalCosts(newSA.getPayCosts(), newSA) || !ComputerUtilMana.payManaCost(ai, newSA)) {
|
if (!CostPayment.canPayAdditionalCosts(newSA.getPayCosts(), newSA) || !ComputerUtilMana.canPayManaCost(newSA, ai, 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import forge.game.cost.Cost;
|
|||||||
import forge.game.keyword.Keyword;
|
import forge.game.keyword.Keyword;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.player.PlayerActionConfirmMode;
|
import forge.game.player.PlayerActionConfirmMode;
|
||||||
|
import forge.game.ability.effects.PlayEffect;
|
||||||
import forge.game.spellability.Spell;
|
import forge.game.spellability.Spell;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.SpellAbilityPredicates;
|
import forge.game.spellability.SpellAbilityPredicates;
|
||||||
@@ -163,9 +164,9 @@ public class PlayAi extends SpellAbilityAi {
|
|||||||
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
|
* @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
|
public boolean confirmAction(Player ai, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
|
||||||
// as called from PlayEffect:173
|
// as called from PlayEffect
|
||||||
return true;
|
return chooseSingleCard(ai, sa, new CardCollection(((PlayEffect)(sa.getApi().getSpellEffect())).getTgtCard()), true, ai, null) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public abstract class SpellAbilityEffect {
|
|||||||
public abstract void resolve(SpellAbility sa);
|
public abstract void resolve(SpellAbility sa);
|
||||||
|
|
||||||
protected String getStackDescription(final 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();
|
return sa.getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,6 @@ public abstract class SpellAbilityEffect {
|
|||||||
: AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), sa.getParam(definedParam), sa);
|
: AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), sa.getParam(definedParam), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Targets of card or player type
|
// 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) { return getEntities(false, "Defined", sa); }
|
||||||
protected final static List<GameEntity> getTargetEntities(final SpellAbility sa, final String definedParam) { return getEntities(false, definedParam, sa); }
|
protected final static List<GameEntity> getTargetEntities(final SpellAbility sa, final String definedParam) { return getEntities(false, definedParam, sa); }
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ import forge.util.Lang;
|
|||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
|
|
||||||
public class PlayEffect extends SpellAbilityEffect {
|
public class PlayEffect extends SpellAbilityEffect {
|
||||||
|
private Card tgtCard;
|
||||||
|
|
||||||
|
public Card getTgtCard() { return tgtCard; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getStackDescription(final SpellAbility sa) {
|
protected String getStackDescription(final SpellAbility sa) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
@@ -181,7 +185,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
final CardCollection saidNoTo = new CardCollection();
|
final CardCollection saidNoTo = new CardCollection();
|
||||||
while (tgtCards.size() > saidNoTo.size() && saidNoTo.size() < amount && amount > 0) {
|
while (tgtCards.size() > saidNoTo.size() && saidNoTo.size() < amount && amount > 0) {
|
||||||
activator.getController().tempShowCards(showCards);
|
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();
|
activator.getController().endTempShowCards();
|
||||||
if (tgtCard == null) {
|
if (tgtCard == null) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user