mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Fix for up to targeting in a List requiring Max Targets to work.
This commit is contained in:
@@ -185,15 +185,28 @@ public class Target_Selection {
|
|||||||
public static Input input_cardFromList(final SpellAbility sa, final CardList choices, final String message,
|
public static Input input_cardFromList(final SpellAbility sa, final CardList choices, final String message,
|
||||||
final boolean targeted, final Target_Selection select, final SpellAbility_Requirements req){
|
final boolean targeted, final Target_Selection select, final SpellAbility_Requirements req){
|
||||||
// Send in a list of valid cards, and popup a choice box to target
|
// Send in a list of valid cards, and popup a choice box to target
|
||||||
|
final Card dummy = new Card();
|
||||||
|
dummy.setName("[FINISH TARGETING]");
|
||||||
|
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
private static final long serialVersionUID = 9027742835781889044L;
|
private static final long serialVersionUID = 9027742835781889044L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
Object check = AllZone.Display.getChoiceOptional(message, choices.toArray());
|
Target tgt = select.getTgt();
|
||||||
|
|
||||||
|
CardList choicesWithDone = choices;
|
||||||
|
if (tgt.isMinTargetsChosen(sa.getSourceCard(), sa)){
|
||||||
|
// is there a more elegant way of doing this?
|
||||||
|
choicesWithDone.add(dummy);
|
||||||
|
}
|
||||||
|
Object check = AllZone.Display.getChoiceOptional(message, choicesWithDone.toArray());
|
||||||
if(check != null) {
|
if(check != null) {
|
||||||
Card c = (Card) check;
|
Card c = (Card) check;
|
||||||
select.getTgt().addTarget(c);
|
if (c.equals(dummy))
|
||||||
|
select.setDoneTarget(true);
|
||||||
|
else
|
||||||
|
tgt.addTarget(c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
select.setCancel(true);
|
select.setCancel(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user