mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
*Added Quest Item - Charm of Vigor: Let's you play best of 5 games rather than 3.
This commit is contained in:
@@ -37,10 +37,17 @@ public class Match {
|
||||
/**
|
||||
* This should become constructor once.
|
||||
*/
|
||||
public Match(GameType type, List<RegisteredPlayer> players0) {
|
||||
public Match(GameType type, List<RegisteredPlayer> players0, int games) {
|
||||
gamesPlayedRo = Collections.unmodifiableList(gamesPlayed);
|
||||
players = Collections.unmodifiableList(Lists.newArrayList(players0));
|
||||
gameType = type;
|
||||
|
||||
gamesPerMatch = games;
|
||||
gamesToWinMatch = (int)Math.ceil((gamesPerMatch+1)/2);
|
||||
}
|
||||
|
||||
public Match(GameType type, List<RegisteredPlayer> players0) {
|
||||
this(type,players0,3);
|
||||
}
|
||||
|
||||
public Match(GameType type, List<RegisteredPlayer> players0, Boolean overrideAnte) {
|
||||
@@ -48,6 +55,12 @@ public class Match {
|
||||
if( overrideAnte != null )
|
||||
this.useAnte = overrideAnte.booleanValue();
|
||||
}
|
||||
|
||||
public Match(GameType type, List<RegisteredPlayer> players0, Boolean overrideAnte, int games) {
|
||||
this(type, players0, games);
|
||||
if( overrideAnte != null )
|
||||
this.useAnte = overrideAnte.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the games played.
|
||||
@@ -67,7 +80,7 @@ public class Match {
|
||||
public int getGamesToWinMatch() {
|
||||
return gamesToWinMatch;
|
||||
}
|
||||
|
||||
|
||||
public void addGamePlayed(Game finished) {
|
||||
if (!finished.isGameOver()) {
|
||||
throw new IllegalStateException("Game is not over yet.");
|
||||
|
||||
@@ -98,6 +98,14 @@ public enum CSubmenuChallenges implements ICDoc {
|
||||
quest.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbCharm().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
quest.setCharmState(view.getCbCharm().isSelected());
|
||||
quest.save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final KeyAdapter _startOnEnter = new KeyAdapter() {
|
||||
|
||||
@@ -67,6 +67,14 @@ public enum CSubmenuDuels implements ICDoc {
|
||||
quest.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbCharm().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
quest.setCharmState(view.getCbCharm().isSelected());
|
||||
quest.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbxPet().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
|
||||
@@ -51,6 +51,9 @@ public interface IVQuestStats {
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
JCheckBox getCbPlant();
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
JCheckBox getCbCharm();
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
JLabel getLblZep();
|
||||
}
|
||||
|
||||
@@ -122,6 +122,15 @@ public class SSubmenuQuestUtil {
|
||||
view.getCbxPet().setVisible(false);
|
||||
}
|
||||
}
|
||||
if (iSlot == 2) {
|
||||
if (petList.isEmpty()) {
|
||||
view.getCbCharm().setVisible(false);
|
||||
}
|
||||
else {
|
||||
view.getCbCharm().setVisible(true);
|
||||
view.getCbCharm().setSelected(currentPetName != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (view.equals(VSubmenuChallenges.SINGLETON_INSTANCE)) {
|
||||
@@ -212,6 +221,7 @@ public class SSubmenuQuestUtil {
|
||||
// Classic mode display changes
|
||||
view0.getCbxPet().setVisible(false);
|
||||
view0.getCbPlant().setVisible(false);
|
||||
view0.getCbCharm().setVisible(false);
|
||||
view0.getLblZep().setVisible(false);
|
||||
view0.getLblNextChallengeInWins().setVisible(false);
|
||||
view0.getBtnBazaar().setVisible(false);
|
||||
@@ -448,7 +458,7 @@ public class SSubmenuQuestUtil {
|
||||
aiPlayer.setIconImageKey(event.getIconImageKey());
|
||||
starter.add(aiStart.setPlayer(aiPlayer));
|
||||
|
||||
final Match mc = new Match(GameType.Quest, starter, forceAnte);
|
||||
final Match mc = new Match(GameType.Quest, starter, forceAnte, qData.getCharmState() ? 5 : 3);
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -48,6 +48,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
private final JButton btnStart = new StartButton();
|
||||
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
|
||||
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
|
||||
private final JCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
|
||||
private final JLabel lblZep = new FLabel.Builder().text("<html>Launch<br>Zeppelin</html>")
|
||||
.hoverable(true).icon(FSkin.getIcon(FSkin.QuestIcons.ICO_ZEP))
|
||||
.fontSize(16).build();
|
||||
@@ -109,6 +110,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
pnlStats.add(lblLife, constraints);
|
||||
pnlStats.add(lblWorld, constraints);
|
||||
pnlStats.add(cbPlant, constraints);
|
||||
pnlStats.add(cbCharm, constraints);
|
||||
cbxPet.addTo(pnlStats, constraints);
|
||||
pnlStats.add(lblZep, "w 130px!, h 60px!, gap 0 0 0 5px");
|
||||
pnlStats.setOpaque(false);
|
||||
@@ -298,4 +300,11 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
public DragCell getParentCell() {
|
||||
return parentCell;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cbCharm
|
||||
*/
|
||||
public JCheckBox getCbCharm() {
|
||||
return cbCharm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
|
||||
private final JButton btnStart = new StartButton();
|
||||
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
|
||||
private final JCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
|
||||
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
|
||||
private final JLabel lblZep = new FLabel.Builder().text("Launch Zeppelin").fontSize(14).build();
|
||||
|
||||
@@ -107,6 +108,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
pnlStats.add(lblLife, constraints);
|
||||
pnlStats.add(lblWorld, constraints);
|
||||
pnlStats.add(cbPlant, constraints);
|
||||
pnlStats.add(cbCharm, constraints);
|
||||
cbxPet.addTo(pnlStats, constraints);
|
||||
pnlStats.setOpaque(false);
|
||||
}
|
||||
@@ -291,4 +293,11 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
public DragCell getParentCell() {
|
||||
return parentCell;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cbCharm
|
||||
*/
|
||||
public JCheckBox getCbCharm() {
|
||||
return cbCharm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1417,6 +1417,7 @@ public enum FSkin {
|
||||
ICO_BOTTLES (new int[] {400, 480, 80, 80}), /** */
|
||||
ICO_BOX (new int[] {480, 480, 80, 80}), /** */
|
||||
ICO_COIN (new int[] {560, 480, 80, 80}), /** */
|
||||
ICO_CHARM (new int[] {480, 800, 80, 80}), /** */
|
||||
|
||||
ICO_FOX (new int[] {0, 560, 80, 80}), /** */
|
||||
ICO_LEAF (new int[] {80, 560, 80, 80}), /** */
|
||||
|
||||
@@ -107,6 +107,17 @@ public class QuestController {
|
||||
this.model.getPetSlots().put(slot, name);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCharmState(boolean active) {
|
||||
if (this.model != null) {
|
||||
this.model.setCharmActive(active);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getCharmState() {
|
||||
return this.model == null ? false : this.model.isCharmActive();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot   int
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.bazaar;
|
||||
|
||||
import forge.quest.data.QuestAssets;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestItemAmuletOfEndurance class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: QuestItemZeppelin.java 14797 2012-03-18 18:09:02Z Max mtg $
|
||||
*/
|
||||
public class QuestItemCharmOfVigor extends QuestItemBasic {
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestItemAmuletOfEndurance.
|
||||
* </p>
|
||||
*/
|
||||
QuestItemCharmOfVigor() {
|
||||
super(QuestItemType.CHARM); // , QuestStallManager.GEAR
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean isAvailableForPurchase(QuestAssets qA) {
|
||||
return super.isAvailableForPurchase(qA);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -41,7 +41,9 @@ public enum QuestItemType {
|
||||
/** The ELIXIR_OF_LIFE. */
|
||||
ELIXIR_OF_LIFE("Elixir of Life", QuestItemElixir.class, QuestItemCondition.class),
|
||||
/** The POUND_FLESH. */
|
||||
POUND_FLESH("Pound of Flesh", QuestItemPoundFlesh.class, QuestItemCondition.class);
|
||||
POUND_FLESH("Pound of Flesh", QuestItemPoundFlesh.class, QuestItemCondition.class),
|
||||
/** The AMULET. */
|
||||
CHARM("Charm of Vigor", QuestItemCharmOfVigor.class, QuestItemCondition.class);
|
||||
|
||||
private final String saveFileKey;
|
||||
private final Class<? extends QuestItemBasic> bazaarControllerClass;
|
||||
|
||||
@@ -40,7 +40,7 @@ import forge.quest.io.QuestDataIO;
|
||||
public final class QuestData {
|
||||
|
||||
/** Holds the latest version of the Quest Data. */
|
||||
public static final int CURRENT_VERSION_NUMBER = 7;
|
||||
public static final int CURRENT_VERSION_NUMBER = 8;
|
||||
|
||||
// This field places the version number into QD instance,
|
||||
// but only when the object is created through the constructor
|
||||
@@ -62,6 +62,7 @@ public final class QuestData {
|
||||
private final QuestAssets assets;
|
||||
private final QuestAchievements achievements;
|
||||
private final Map<Integer, String> petSlots = new HashMap<Integer, String>();
|
||||
private boolean isCharmActive = false;
|
||||
|
||||
|
||||
/**
|
||||
@@ -186,4 +187,18 @@ public final class QuestData {
|
||||
worldId = newId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isCharmActive
|
||||
*/
|
||||
public boolean isCharmActive() {
|
||||
return isCharmActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isCharmActive the isCharmActive to set
|
||||
*/
|
||||
public void setCharmActive(boolean isCharmActive) {
|
||||
this.isCharmActive = isCharmActive;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -202,6 +202,11 @@ public class QuestDataIO {
|
||||
QuestDataIO.setFinalField(QuestData.class, "petSlots", newData, new HashMap<Integer, String>());
|
||||
}
|
||||
|
||||
if(saveVersion < 8) {
|
||||
QuestDataIO.setFinalField(QuestData.class, "isCharmActive", newData, false);
|
||||
}
|
||||
|
||||
|
||||
final QuestAssets qS = newData.getAssets();
|
||||
final QuestAchievements qA = newData.getAchievements();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user