Added a button that starts a duel against a random opponent in quest mode.

Fixed some Android pom spacing.
Fixed a bug when generating booster boxes.
This commit is contained in:
Krazy
2014-05-27 02:52:01 +00:00
parent c646adf1e5
commit 22ae54c2bd
6 changed files with 107 additions and 55 deletions

View File

@@ -213,7 +213,7 @@
<inherited>true</inherited> <inherited>true</inherited>
<configuration> <configuration>
<removeExistingSignatures>true</removeExistingSignatures> <removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/> <archiveDirectory />
<includes> <includes>
<include>${project.build.directory}/${project.build.finalName}/${project.build.finalName}.apk</include> <include>${project.build.directory}/${project.build.finalName}/${project.build.finalName}.apk</include>
</includes> </includes>
@@ -277,12 +277,21 @@
<include name="res/**" /> <include name="res/**" />
<exclude name="res/cardsfolder/**" /> <exclude name="res/cardsfolder/**" />
</fileset> </fileset>
<fileset dir="${project.build.directory}" includes="${project.build.finalName}-signed-aligned.apk" /> <fileset dir="${project.build.directory}"
includes="${project.build.finalName}-signed-aligned.apk" />
</copy> </copy>
<mkdir dir="${project.build.directory}/${project.build.finalName}/res/cardsfolder" /> <mkdir
<zip destfile="${project.build.directory}/${project.build.finalName}/res/cardsfolder/cardsfolder.zip" basedir="${basedir}/../forge-gui/res/cardsfolder" level="1" /> dir="${project.build.directory}/${project.build.finalName}/res/cardsfolder" />
<zip destfile="${project.build.directory}/${project.build.finalName}/res.zip" basedir="${basedir}/../forge-gui/res" level="1" /> <zip
<zip destfile="${project.build.directory}/${project.build.finalName}.zip" basedir="${project.build.directory}/${project.build.finalName}" level="1" /> destfile="${project.build.directory}/${project.build.finalName}/res/cardsfolder/cardsfolder.zip"
basedir="${basedir}/../forge-gui/res/cardsfolder" level="1" />
<zip
destfile="${project.build.directory}/${project.build.finalName}/res.zip"
basedir="${basedir}/../forge-gui/res" level="1" />
<zip
destfile="${project.build.directory}/${project.build.finalName}.zip"
basedir="${project.build.directory}/${project.build.finalName}"
level="1" />
</target> </target>
</configuration> </configuration>
<goals> <goals>
@@ -299,52 +308,57 @@
<properties> <properties>
<packaging.type>apk</packaging.type> <packaging.type>apk</packaging.type>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version> <version>1.7</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId> <artifactId>ant-nodeps</artifactId>
<version>1.8.1</version> <version>1.8.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-net</groupId> <groupId>commons-net</groupId>
<artifactId>commons-net</artifactId> <artifactId>commons-net</artifactId>
<version>1.4.1</version> <version>1.4.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ant</groupId> <groupId>ant</groupId>
<artifactId>ant-commons-net</artifactId> <artifactId>ant-commons-net</artifactId>
<version>1.6.5</version> <version>1.6.5</version>
</dependency> </dependency>
</dependencies> </dependencies>
<executions> <executions>
<execution> <execution>
<id>android-ftp</id> <id>android-ftp</id>
<phase>package</phase> <phase>package</phase>
<configuration> <configuration>
<target> <target>
<ftp action="mkdir" password="${cardforge.pass}" server="ftp.cardforge.org" userid="${cardforge.user}" passive="true" remotedir="releases/forge/forge-gui-android/${maven.build.timestamp}" /> <ftp action="mkdir" password="${cardforge.pass}" server="ftp.cardforge.org"
<ftp password="${cardforge.pass}" server="ftp.cardforge.org" userid="${cardforge.user}" passive="true" remotedir="releases/forge/forge-gui-android/${maven.build.timestamp}/"> userid="${cardforge.user}" passive="true"
<fileset dir="${project.build.directory}/${project.build.finalName}"> remotedir="releases/forge/forge-gui-android/${maven.build.timestamp}" />
<include name="${project.build.finalName}-signed-aligned.apk"/> <ftp password="${cardforge.pass}" server="ftp.cardforge.org"
<include name="res.zip"/> userid="${cardforge.user}" passive="true"
</fileset> remotedir="releases/forge/forge-gui-android/${maven.build.timestamp}/">
</ftp> <fileset
</target> dir="${project.build.directory}/${project.build.finalName}">
</configuration> <include name="${project.build.finalName}-signed-aligned.apk" />
<goals> <include name="res.zip" />
<goal>run</goal> </fileset>
</goals> </ftp>
</execution> </target>
</executions> </configuration>
</plugin> <goals>
</plugins> <goal>run</goal>
</build> </goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> </profile>
</profiles> </profiles>
</project> </project>

View File

@@ -81,6 +81,17 @@ public enum CSubmenuDuels implements ICDoc {
quest.save(); quest.save();
} }
}); });
view.getBtnRandomOpponent().setCommand(new UiCommand() {
@Override
public void run() {
FModel.getQuest().getDuelsManager().randomizeOpponents();
final List<QuestEventDuel> duels = FModel.getQuest().getDuelsManager().generateDuels();
SSubmenuQuestUtil.setEvent(duels.get((int) (Math.random() * duels.size())));
SSubmenuQuestUtil.startGame();
}
});
} }
private final KeyAdapter _startOnEnter = new KeyAdapter() { private final KeyAdapter _startOnEnter = new KeyAdapter() {

View File

@@ -7,6 +7,10 @@ import forge.toolbox.FLabel;
/** Dictates methods required for a panel with stats/pet display. */ /** Dictates methods required for a panel with stats/pet display. */
public interface IVQuestStats { public interface IVQuestStats {
/** @return {@link forge.toolbox.FLabel} */
FLabel getBtnRandomOpponent();
/** @return {@link forge.toolbox.FLabel} */ /** @return {@link forge.toolbox.FLabel} */
FLabel getBtnBazaar(); FLabel getBtnBazaar();

View File

@@ -285,4 +285,10 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
public FCheckBox getCbCharm() { public FCheckBox getCbCharm() {
return cbCharm; return cbCharm;
} }
@Override
public FLabel getBtnRandomOpponent() {
return null;
}
} }

View File

@@ -73,15 +73,18 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
private final FLabel btnTravel = new FLabel.ButtonBuilder().text("Travel").fontSize(16).build(); private final FLabel btnTravel = new FLabel.ButtonBuilder().text("Travel").fontSize(16).build();
private final FLabel btnBazaar = new FLabel.ButtonBuilder().text("Bazaar").fontSize(16).build(); private final FLabel btnBazaar = new FLabel.ButtonBuilder().text("Bazaar").fontSize(16).build();
private final FLabel btnSpellShop = new FLabel.ButtonBuilder().text("Spell Shop").fontSize(16).build(); private final FLabel btnSpellShop = new FLabel.ButtonBuilder().text("Spell Shop").fontSize(16).build();
private final FLabel btnRandomOpponent = new FLabel.ButtonBuilder().text("Random Duel").fontSize(16).build();
/** /**
* Constructor. * Constructor.
*/ */
private VSubmenuDuels() { private VSubmenuDuels() {
final String constraints = "h 30px!, gap 0 0 0 5px"; final String constraints = "h 30px!, gap 0 0 0 5px";
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0")); pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px"); pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
pnlStats.add(btnTravel, "w 150px!, h 30px!, gap 0 0 0 10px"); pnlStats.add(btnTravel, "w 150px!, h 30px!, gap 0 0 0 10px");
pnlStats.add(btnRandomOpponent, "w 150px!, h 30px!, gap 0 0 0 10px");
pnlStats.add(btnSpellShop, "w 150px!, h 30px!, gap 0 0 0 10px"); pnlStats.add(btnSpellShop, "w 150px!, h 30px!, gap 0 0 0 10px");
pnlStats.add(btnBazaar, "w 150px!, h 30px!, gap 0 0 0 10px"); pnlStats.add(btnBazaar, "w 150px!, h 30px!, gap 0 0 0 10px");
pnlStats.add(lblWins, constraints); pnlStats.add(lblWins, constraints);
@@ -94,6 +97,9 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
pnlStats.add(cbCharm, constraints); pnlStats.add(cbCharm, constraints);
cbxPet.addTo(pnlStats, constraints); cbxPet.addTo(pnlStats, constraints);
pnlStats.setOpaque(false); pnlStats.setOpaque(false);
btnRandomOpponent.setToolTipText("Starts a duel against a randomly selected opponent.");
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -211,6 +217,11 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
return btnSpellShop; return btnSpellShop;
} }
@Override
public FLabel getBtnRandomOpponent() {
return btnRandomOpponent;
}
@Override @Override
public FCheckBox getCbPlant() { public FCheckBox getCbPlant() {
return cbPlant; return cbPlant;

View File

@@ -605,7 +605,13 @@ public final class QuestUtilCards {
Collections.shuffle(editions); Collections.shuffle(editions);
editions = editions.subList(0, Math.max(count / 2, 1)); int numberOfBoxes = Math.min(Math.max(count / 2, 1), editions.size());
if (numberOfBoxes == 0) {
return;
}
editions = editions.subList(0, numberOfBoxes);
List<BoosterBox> output = new ArrayList<>(); List<BoosterBox> output = new ArrayList<>();
for (CardEdition e : editions) { for (CardEdition e : editions) {