mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Dev Mode: added a way to remove counters from permanent.
This commit is contained in:
@@ -42,7 +42,8 @@ public final class CDev implements ICDoc {
|
|||||||
view.getLblCardToExile().addMouseListener(madCardToExile);
|
view.getLblCardToExile().addMouseListener(madCardToExile);
|
||||||
view.getLblCastSpell().addMouseListener(madCastASpell);
|
view.getLblCastSpell().addMouseListener(madCastASpell);
|
||||||
view.getLblRepeatAddCard().addMouseListener(madRepeatAddCard);
|
view.getLblRepeatAddCard().addMouseListener(madRepeatAddCard);
|
||||||
view.getLblCounterPermanent().addMouseListener(madCounter);
|
view.getLblAddCounterPermanent().addMouseListener(madAddCounter);
|
||||||
|
view.getLblSubCounterPermanent().addMouseListener(madSubCounter);
|
||||||
view.getLblTapPermanent().addMouseListener(madTap);
|
view.getLblTapPermanent().addMouseListener(madTap);
|
||||||
view.getLblUntapPermanent().addMouseListener(madUntap);
|
view.getLblUntapPermanent().addMouseListener(madUntap);
|
||||||
view.getLblSetLife().addMouseListener(madLife);
|
view.getLblSetLife().addMouseListener(madLife);
|
||||||
@@ -198,7 +199,7 @@ public final class CDev implements ICDoc {
|
|||||||
getController().cheat().exileCardsFromHand();;
|
getController().cheat().exileCardsFromHand();;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MouseListener madCounter = new MouseAdapter() {
|
private final MouseListener madAddCounter = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
addCounterToPermanent();
|
addCounterToPermanent();
|
||||||
@@ -208,6 +209,16 @@ public final class CDev implements ICDoc {
|
|||||||
getController().cheat().addCountersToPermanent();
|
getController().cheat().addCountersToPermanent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final MouseListener madSubCounter = new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mousePressed(final MouseEvent e) {
|
||||||
|
removeCountersFromPermanent();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public void removeCountersFromPermanent() {
|
||||||
|
getController().cheat().removeCountersFromPermanent();
|
||||||
|
}
|
||||||
|
|
||||||
private final MouseListener madTap = new MouseAdapter() {
|
private final MouseListener madTap = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
|||||||
private final DevLabel lblSetupGame = new DevLabel("Setup Game State");
|
private final DevLabel lblSetupGame = new DevLabel("Setup Game State");
|
||||||
private final DevLabel lblDumpGame = new DevLabel("Dump Game State");
|
private final DevLabel lblDumpGame = new DevLabel("Dump Game State");
|
||||||
private final DevLabel lblTutor = new DevLabel("Tutor for Card");
|
private final DevLabel lblTutor = new DevLabel("Tutor for Card");
|
||||||
private final DevLabel lblCounterPermanent = new DevLabel("Add Counters to Permanent");
|
private final DevLabel lblAddCounterPermanent = new DevLabel("Add Counters to Card");
|
||||||
|
private final DevLabel lblSubCounterPermanent = new DevLabel("Sub Counters from Card");
|
||||||
private final DevLabel lblTapPermanent = new DevLabel("Tap Permanents");
|
private final DevLabel lblTapPermanent = new DevLabel("Tap Permanents");
|
||||||
private final DevLabel lblUntapPermanent = new DevLabel("Untap Permanents");
|
private final DevLabel lblUntapPermanent = new DevLabel("Untap Permanents");
|
||||||
private final DevLabel lblSetLife = new DevLabel("Set Player Life");
|
private final DevLabel lblSetLife = new DevLabel("Set Player Life");
|
||||||
@@ -106,7 +107,8 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
|||||||
viewport.add(this.lblExileFromPlay, halfConstraints);
|
viewport.add(this.lblExileFromPlay, halfConstraints);
|
||||||
viewport.add(this.lblSetLife, halfConstraintsLeft);
|
viewport.add(this.lblSetLife, halfConstraintsLeft);
|
||||||
viewport.add(this.lblWinGame, halfConstraints);
|
viewport.add(this.lblWinGame, halfConstraints);
|
||||||
viewport.add(this.lblCounterPermanent, constraints);
|
viewport.add(this.lblAddCounterPermanent, halfConstraintsLeft);
|
||||||
|
viewport.add(this.lblSubCounterPermanent, halfConstraints);
|
||||||
viewport.add(this.lblSetupGame, halfConstraintsLeft);
|
viewport.add(this.lblSetupGame, halfConstraintsLeft);
|
||||||
viewport.add(this.lblDumpGame, halfConstraints);
|
viewport.add(this.lblDumpGame, halfConstraints);
|
||||||
viewport.add(this.lblTapPermanent, halfConstraintsLeft);
|
viewport.add(this.lblTapPermanent, halfConstraintsLeft);
|
||||||
@@ -244,8 +246,13 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||||
public DevLabel getLblCounterPermanent() {
|
public DevLabel getLblAddCounterPermanent() {
|
||||||
return this.lblCounterPermanent;
|
return this.lblAddCounterPermanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||||
|
public DevLabel getLblSubCounterPermanent() {
|
||||||
|
return this.lblSubCounterPermanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
MatchController.instance.getGameController().cheat().setViewAllCards(!viewAll);
|
MatchController.instance.getGameController().cheat().setViewAllCards(!viewAll);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
addItem(new FMenuItem("Add Counters to Permanent", new FEventHandler() {
|
addItem(new FMenuItem("Add Counters to Card", new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@@ -215,6 +215,17 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
addItem(new FMenuItem("Sub Counters from Card", new FEventHandler() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(FEvent e) {
|
||||||
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MatchController.instance.getGameController().cheat().removeCountersFromPermanent();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}));
|
||||||
addItem(new FMenuItem("Tap Permanents", new FEventHandler() {
|
addItem(new FMenuItem("Tap Permanents", new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public interface IDevModeCheats {
|
|||||||
|
|
||||||
void addCountersToPermanent();
|
void addCountersToPermanent();
|
||||||
|
|
||||||
|
void removeCountersFromPermanent();
|
||||||
|
|
||||||
void tapPermanents();
|
void tapPermanents();
|
||||||
|
|
||||||
void untapPermanents();
|
void untapPermanents();
|
||||||
@@ -100,6 +102,9 @@ public interface IDevModeCheats {
|
|||||||
public void addCountersToPermanent() {
|
public void addCountersToPermanent() {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public void removeCountersFromPermanent() {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void addCardToHand() {
|
public void addCardToHand() {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2046,9 +2046,24 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addCountersToPermanent() {
|
public void addCountersToPermanent() {
|
||||||
|
modifyCountersOnPermanent(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see forge.player.IDevModeCheats#addCountersToPermanent()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeCountersFromPermanent() {
|
||||||
|
modifyCountersOnPermanent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void modifyCountersOnPermanent(boolean subtract) {
|
||||||
|
final String titleMsg = subtract ? "Remove counters from which card?" : "Add counters to which card?";
|
||||||
final CardCollectionView cards = game.getCardsIn(ZoneType.Battlefield);
|
final CardCollectionView cards = game.getCardsIn(ZoneType.Battlefield);
|
||||||
final Card card = game
|
final Card card = game
|
||||||
.getCard(getGui().oneOrNone("Add counters to which card?", CardView.getCollection(cards)));
|
.getCard(getGui().oneOrNone(titleMsg, CardView.getCollection(cards)));
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2063,9 +2078,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subtract) {
|
||||||
|
card.subtractCounter(counter, count);
|
||||||
|
} else {
|
||||||
card.addCounter(counter, count, card, false);
|
card.addCounter(counter, count, card, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user