mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Moved input_targetValid code into CardFactoryUtil
This commit is contained in:
@@ -172,7 +172,6 @@ public class CardFactory implements NewConstants {
|
||||
ArrayList<String> a = c.getIntrinsicKeyword();
|
||||
for(int i = 0; i < a.size(); i++)
|
||||
if(a.get(i).toString().contains(": add ")) return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2434,7 +2433,8 @@ public class CardFactory implements NewConstants {
|
||||
}
|
||||
}; //SpDstryTgt
|
||||
|
||||
Input InGetTarget = new Input() {
|
||||
Input InGetTarget = CardFactoryUtil.input_targetValid(spDstryTgt, Tgts, Selec);
|
||||
/*new Input() {
|
||||
private static final long serialVersionUID = -142142142142L;
|
||||
|
||||
@Override
|
||||
@@ -2442,18 +2442,18 @@ public class CardFactory implements NewConstants {
|
||||
CardList allCards = new CardList();
|
||||
allCards.addAll(AllZone.Human_Play.getCards());
|
||||
allCards.addAll(AllZone.Computer_Play.getCards());
|
||||
allCards.filter(new CardListFilter() {
|
||||
/ *allCards.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
return (CardFactoryUtil.canTarget(card, c));
|
||||
}
|
||||
});
|
||||
});* ///Input_targetSpecific already checks for this
|
||||
|
||||
CardList choices = allCards.getValidCards(Tgts);
|
||||
boolean free = false;
|
||||
if(this.isFree()) free = true;
|
||||
stopSetNext(CardFactoryUtil.input_targetSpecific(spDstryTgt, choices, Selec, true, free));
|
||||
}
|
||||
};//InGetTarget
|
||||
};*///InGetTarget
|
||||
|
||||
//card.clearSpellAbility();
|
||||
spDstryTgt.setBeforePayMana(InGetTarget);
|
||||
|
||||
@@ -1471,6 +1471,24 @@ public class CardFactoryUtil {
|
||||
return desc;
|
||||
}//soul_desc()
|
||||
|
||||
public static Input input_targetValid(final SpellAbility sa, final String[] Tgts, final String message)
|
||||
{
|
||||
return new Input() {
|
||||
private static final long serialVersionUID = -142142142142L;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
CardList allCards = new CardList();
|
||||
allCards.addAll(AllZone.Human_Play.getCards());
|
||||
allCards.addAll(AllZone.Computer_Play.getCards());
|
||||
|
||||
CardList choices = allCards.getValidCards(Tgts);
|
||||
boolean free = false;
|
||||
if(this.isFree()) free = true;
|
||||
stopSetNext(CardFactoryUtil.input_targetSpecific(sa, choices, message, true, free));
|
||||
}
|
||||
};
|
||||
}//input_targetValid
|
||||
//CardList choices are the only cards the user can successful select
|
||||
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message, final boolean targeted, final boolean free) {
|
||||
return input_targetSpecific(spell, choices, message, Command.Blank, targeted, free);
|
||||
|
||||
Reference in New Issue
Block a user