mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
removed isClassUpdated old methods (I already forgot what they were used for)
made showMessage method to remove dependency on CMatchUI in inherited inputs. made stop() protected, removed stopSetNext
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -13815,7 +13815,6 @@ src/main/java/forge/control/input/InputPaySacCost.java -text
|
||||
src/main/java/forge/control/input/InputPayment.java -text
|
||||
src/main/java/forge/control/input/InputSelectMany.java -text
|
||||
src/main/java/forge/control/input/InputSelectManyCards.java -text
|
||||
src/main/java/forge/control/input/InputSelectManyPlayers.java -text
|
||||
src/main/java/forge/control/input/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/control/package-info.java -text
|
||||
src/main/java/forge/deck/CardCollections.java -text
|
||||
|
||||
@@ -495,9 +495,8 @@ public class CardFactoryCreatures {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputBase onCancel() {
|
||||
protected void onCancel() {
|
||||
Singletons.getModel().getGame().getAction().sacrifice(card, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -507,11 +506,10 @@ public class CardFactoryCreatures {
|
||||
} // selectCard()
|
||||
|
||||
@Override
|
||||
protected InputBase onDone() {
|
||||
protected void onDone() {
|
||||
for (final Card sac : selected) {
|
||||
Singletons.getModel().getGame().getAction().sacrifice(sac, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,6 @@ import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.control.input.InputBase;
|
||||
import forge.control.input.InputSelectManyCards;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.zone.Zone;
|
||||
@@ -76,20 +75,18 @@ class CardFactoryLands {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputBase onDone() {
|
||||
protected void onDone() {
|
||||
if (selected.isEmpty()) {
|
||||
return onCancel();
|
||||
onCancel();
|
||||
}
|
||||
|
||||
String cardName = selected.get(0).getName();
|
||||
JOptionPane.showMessageDialog(null, "Revealed card: " + cardName, cardName, JOptionPane.PLAIN_MESSAGE);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputBase onCancel() {
|
||||
public void onCancel() {
|
||||
card.setTapped(true);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3155,10 +3155,9 @@ public class CardFactoryUtil {
|
||||
private static final long serialVersionUID = 1981791992623774490L;
|
||||
|
||||
@Override
|
||||
protected InputBase onDone() {
|
||||
protected void onDone() {
|
||||
haunterDiesWork.setTargetCard(selected.get(0));
|
||||
Singletons.getModel().getGame().getStack().add(haunterDiesWork);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -132,11 +132,4 @@ public class InputAttack extends InputBase {
|
||||
public void unselectCard(final Card card, final PlayerZone zone) {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,93 +40,28 @@ public abstract class InputBase implements java.io.Serializable {
|
||||
* showMessage.
|
||||
* </p>
|
||||
*/
|
||||
public void showMessage() {
|
||||
showMessage("Blank Input");
|
||||
}
|
||||
public abstract void showMessage();
|
||||
|
||||
public void selectCard(final Card c) { }
|
||||
public void selectPlayer(final Player player) { }
|
||||
public void selectButtonOK() { }
|
||||
public void selectButtonCancel() { }
|
||||
|
||||
// to remove need for CMatchUI dependence
|
||||
protected void showMessage(String message) {
|
||||
CMatchUI.SINGLETON_INSTANCE.showMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* selectCard.
|
||||
* </p>
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public void selectCard(final Card c) {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* selectPlayer.
|
||||
* </p>
|
||||
*
|
||||
* @param player
|
||||
* a {@link forge.game.player.Player} object.
|
||||
*/
|
||||
public void selectPlayer(final Player player) {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* selectButtonOK.
|
||||
* </p>
|
||||
*/
|
||||
public void selectButtonOK() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* selectButtonCancel.
|
||||
* </p>
|
||||
*/
|
||||
public void selectButtonCancel() {
|
||||
}
|
||||
|
||||
// helper methods, since they are used alot
|
||||
// to be used by anything in CardFactory like SetTargetInput
|
||||
// NOT TO BE USED by Input_Main or any of the "regular" Inputs objects that
|
||||
// are not set using AllZone.getInputControl().setInput(Input)
|
||||
/**
|
||||
* <p>
|
||||
* stop.
|
||||
* </p>
|
||||
*/
|
||||
public final void stop() {
|
||||
protected final void stop() {
|
||||
// clears a "temp" Input like Input_PayManaCost if there is one
|
||||
Singletons.getModel().getMatch().getInput().resetInput();
|
||||
|
||||
afterStop(); // sync inputs will release their latch there
|
||||
}
|
||||
|
||||
// exits the "current" Input and sets the next Input
|
||||
/**
|
||||
* <p>
|
||||
* stopSetNext.
|
||||
* </p>
|
||||
*
|
||||
* @param in
|
||||
* a {@link forge.control.input.InputBase} object.
|
||||
*/
|
||||
public final void stopSetNext(final InputBase in) {
|
||||
this.stop();
|
||||
Singletons.getModel().getMatch().getInput().setInput(in);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String toString() {
|
||||
return "blank";
|
||||
} // returns the Input name like "EmptyStack"
|
||||
|
||||
|
||||
/**
|
||||
* This method is used to mark old descendants of Input
|
||||
* TODO: Write javadoc for this method.
|
||||
*/
|
||||
public /*abstract */void isClassUpdated() {
|
||||
} //;
|
||||
|
||||
|
||||
protected void afterStop() { }
|
||||
}
|
||||
|
||||
@@ -144,11 +144,4 @@ public class InputBlock extends InputBase {
|
||||
|
||||
this.showMessage();
|
||||
} // selectCard()
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,18 +82,4 @@ public class InputCleanup extends InputBase {
|
||||
}
|
||||
}
|
||||
} // selectCard()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* AI_CleanupDiscard.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,8 +192,4 @@ public class InputMulligan extends InputBase {
|
||||
SDisplayUtil.remind(VMessage.SINGLETON_INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,4 @@ public class InputPassPriority extends InputBase {
|
||||
SDisplayUtil.remind(VMessage.SINGLETON_INSTANCE);
|
||||
}
|
||||
} // selectCard()
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,4 @@ public class InputPayDiscardCostWithCommands extends InputBase implements InputP
|
||||
bPaid = false;
|
||||
cdlDone.countDown();
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,8 +184,4 @@ public class InputPayManaExecuteCommands extends InputPayManaBase implements Inp
|
||||
|
||||
CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString());
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,4 @@ public class InputPayManaOfCostPayment extends InputPayManaBase {
|
||||
this.done();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,4 @@ public class InputPayManaSimple extends InputPayManaBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,13 +92,6 @@ public class InputPayManaX extends InputPayManaBase {
|
||||
useManaFromPool(color, this.colorX.isEmpty() ? this.manaCost : new ManaCostBeingPaid(this.colorX));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
|
||||
@@ -187,8 +187,4 @@ public class InputPayReturnCost extends InputBase implements InputPayment {
|
||||
bPaid = false;
|
||||
cdlDone.countDown();
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -185,7 +185,4 @@ public class InputPaySacCost extends InputBase {
|
||||
}
|
||||
this.unpaid.execute();
|
||||
}
|
||||
|
||||
@Override public void isClassUpdated() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,18 +65,7 @@ public abstract class InputSelectMany<T extends GameEntity> extends InputBase {
|
||||
|
||||
@Override
|
||||
public final void selectButtonCancel() {
|
||||
// this.stop();
|
||||
InputBase next = onCancel(); // might add ability to stack from here
|
||||
// if ( next != null ) {
|
||||
// Singletons.getModel().getMatch().getInput().setInput(next);
|
||||
// }
|
||||
|
||||
if (null == next) {
|
||||
this.stop();
|
||||
} else {
|
||||
this.stopSetNext(next);
|
||||
}
|
||||
|
||||
this.stop();
|
||||
// for a next use
|
||||
selected.clear();
|
||||
}
|
||||
@@ -87,36 +76,21 @@ public abstract class InputSelectMany<T extends GameEntity> extends InputBase {
|
||||
// if an ability is put on stack before this input is stopped;
|
||||
// if it does, uncomment the 5 lines below, use them as method body
|
||||
|
||||
// this.stop();
|
||||
InputBase next = onDone(); // might add ability to stack from here
|
||||
// if ( next != null ) {
|
||||
// Singletons.getModel().getMatch().getInput().setInput(next);
|
||||
// }
|
||||
|
||||
if (null == next) {
|
||||
this.stop();
|
||||
} else {
|
||||
this.stopSetNext(next);
|
||||
}
|
||||
|
||||
this.stop();
|
||||
// for a next use
|
||||
selected.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isClassUpdated() {
|
||||
}
|
||||
|
||||
public void setMessage(String message0) {
|
||||
this.message = message0; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
// must define these
|
||||
protected abstract InputBase onDone();
|
||||
protected abstract void onDone();
|
||||
protected abstract boolean isValidChoice(T choice);
|
||||
|
||||
// might re-define later
|
||||
protected InputBase onCancel() { return null; }
|
||||
protected void onCancel() {}
|
||||
protected boolean canCancelWithSomethingSelected() { return false; }
|
||||
protected boolean hasEnoughTargets() { return selected.size() >= min; }
|
||||
protected boolean hasAllTargets() { return selected.size() >= max; }
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.game.player.Player;
|
||||
|
||||
public class InputSelectManyPlayers extends InputSelectMany<Player> {
|
||||
private static final long serialVersionUID = -8209690791522735L;
|
||||
|
||||
protected final Function<List<Player>, InputBase> onComplete;
|
||||
private final Predicate<Player> allowedFilter;
|
||||
|
||||
public InputSelectManyPlayers(final Predicate<Player> allowedRule, int min, int max, final Function<List<Player>, InputBase> onDone) {
|
||||
|
||||
super(min, max);
|
||||
allowedFilter = allowedRule;
|
||||
onComplete = onDone;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void selectPlayer(final Player p) {
|
||||
selectEntity(p);
|
||||
}
|
||||
|
||||
protected boolean isValidChoice(Player choice) {
|
||||
if (allowedFilter != null && !allowedFilter.apply(choice)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputBase onDone() {
|
||||
return onComplete.apply(selected);
|
||||
}
|
||||
}
|
||||
@@ -73,12 +73,4 @@ public class AiInputCommon extends InputBase {
|
||||
computer.onPriorityRecieved();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.input.Input#isClassUpdated()
|
||||
*/
|
||||
@Override public void isClassUpdated() { }
|
||||
}
|
||||
|
||||
@@ -478,9 +478,8 @@ public class Upkeep extends Phase {
|
||||
};
|
||||
|
||||
@Override
|
||||
protected InputBase onDone() {
|
||||
protected void onDone() {
|
||||
game.getAction().destroyNoRegeneration(selected.get(0));
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if (player.isHuman() && targets.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user