mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28: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.getLblCastSpell().addMouseListener(madCastASpell);
|
||||
view.getLblRepeatAddCard().addMouseListener(madRepeatAddCard);
|
||||
view.getLblCounterPermanent().addMouseListener(madCounter);
|
||||
view.getLblAddCounterPermanent().addMouseListener(madAddCounter);
|
||||
view.getLblSubCounterPermanent().addMouseListener(madSubCounter);
|
||||
view.getLblTapPermanent().addMouseListener(madTap);
|
||||
view.getLblUntapPermanent().addMouseListener(madUntap);
|
||||
view.getLblSetLife().addMouseListener(madLife);
|
||||
@@ -198,7 +199,7 @@ public final class CDev implements ICDoc {
|
||||
getController().cheat().exileCardsFromHand();;
|
||||
}
|
||||
|
||||
private final MouseListener madCounter = new MouseAdapter() {
|
||||
private final MouseListener madAddCounter = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
addCounterToPermanent();
|
||||
@@ -208,6 +209,16 @@ public final class CDev implements ICDoc {
|
||||
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() {
|
||||
@Override
|
||||
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 lblDumpGame = new DevLabel("Dump Game State");
|
||||
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 lblUntapPermanent = new DevLabel("Untap Permanents");
|
||||
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.lblSetLife, halfConstraintsLeft);
|
||||
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.lblDumpGame, halfConstraints);
|
||||
viewport.add(this.lblTapPermanent, halfConstraintsLeft);
|
||||
@@ -244,8 +246,13 @@ public class VDev implements IVDoc<CDev>, IDevListener {
|
||||
}
|
||||
|
||||
/** @return {@link forge.screens.match.views.VDev.DevLabel} */
|
||||
public DevLabel getLblCounterPermanent() {
|
||||
return this.lblCounterPermanent;
|
||||
public DevLabel getLblAddCounterPermanent() {
|
||||
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} */
|
||||
|
||||
@@ -204,7 +204,7 @@ public class VDevMenu extends FDropDownMenu {
|
||||
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
|
||||
public void handleEvent(FEvent e) {
|
||||
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() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
|
||||
@@ -16,6 +16,8 @@ public interface IDevModeCheats {
|
||||
|
||||
void addCountersToPermanent();
|
||||
|
||||
void removeCountersFromPermanent();
|
||||
|
||||
void tapPermanents();
|
||||
|
||||
void untapPermanents();
|
||||
@@ -100,6 +102,9 @@ public interface IDevModeCheats {
|
||||
public void addCountersToPermanent() {
|
||||
}
|
||||
@Override
|
||||
public void removeCountersFromPermanent() {
|
||||
}
|
||||
@Override
|
||||
public void addCardToHand() {
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -2046,9 +2046,24 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
*/
|
||||
@Override
|
||||
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 Card card = game
|
||||
.getCard(getGui().oneOrNone("Add counters to which card?", CardView.getCollection(cards)));
|
||||
.getCard(getGui().oneOrNone(titleMsg, CardView.getCollection(cards)));
|
||||
if (card == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2063,9 +2078,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
return;
|
||||
}
|
||||
|
||||
if (subtract) {
|
||||
card.subtractCounter(counter, count);
|
||||
} else {
|
||||
card.addCounter(counter, count, card, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user