mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Merge branch 'master' of git.cardforge.org:core-developers/forge into remove_some_build_warnings
# Conflicts: # forge-gui-mobile/src/forge/assets/FSkin.java
This commit is contained in:
@@ -202,6 +202,14 @@ public class GuiDesktop implements IGuiBase {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSleevesCount() {
|
||||
if (FSkin.isLoaded()) {
|
||||
return FSkin.getSleeves().size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showFileDialog(final String title, final String defaultDir) {
|
||||
final JFileChooser fc = new JFileChooser(defaultDir);
|
||||
|
||||
@@ -383,6 +383,11 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
||||
updateMatrix(FModel.getFormats().getStandard());
|
||||
}
|
||||
break;
|
||||
case PIONEER_CARDGEN_DECK:
|
||||
if(FModel.isdeckGenMatrixLoaded()) {
|
||||
updateMatrix(FModel.getFormats().getPioneer());
|
||||
}
|
||||
break;
|
||||
case MODERN_CARDGEN_DECK:
|
||||
if(FModel.isdeckGenMatrixLoaded()) {
|
||||
updateMatrix(FModel.getFormats().getModern());
|
||||
|
||||
@@ -293,6 +293,7 @@ public class GuiChoose {
|
||||
@Override
|
||||
public List<CardView> call() {
|
||||
ListCardArea tempArea = ListCardArea.show(gui,title,cards,manipulable,toTop,toBottom,toAnywhere);
|
||||
|
||||
// tempArea.pack();
|
||||
tempArea.setVisible(true);
|
||||
return tempArea.getCards();
|
||||
|
||||
@@ -28,7 +28,7 @@ public class FScreen {
|
||||
public static final FScreen HOME_SCREEN = new FScreen(
|
||||
VHomeUI.SINGLETON_INSTANCE,
|
||||
CHomeUI.SINGLETON_INSTANCE,
|
||||
"Home",
|
||||
"Home ",
|
||||
FSkin.getIcon(FSkinProp.ICO_FAVICON),
|
||||
false,
|
||||
"Exit Forge",
|
||||
@@ -46,7 +46,7 @@ public class FScreen {
|
||||
public static final FScreen DECK_EDITOR_CONSTRUCTED = new FScreen(
|
||||
VDeckEditorUI.SINGLETON_INSTANCE,
|
||||
CDeckEditorUI.SINGLETON_INSTANCE,
|
||||
"Deck Editor",
|
||||
"Deck Editor ",
|
||||
FSkin.getImage(FSkinProp.IMG_PACK),
|
||||
false,
|
||||
"Back to Home",
|
||||
|
||||
@@ -77,6 +77,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
private Point hoverScrollPos;
|
||||
private ItemInfo hoveredItem;
|
||||
private ItemInfo focalItem;
|
||||
private boolean panelOptionsCreated = false;
|
||||
|
||||
private final List<ItemInfo> orderedItems = new ArrayList<>();
|
||||
private final List<Group> groups = new ArrayList<>();
|
||||
@@ -337,7 +338,12 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
|
||||
@Override
|
||||
public void setup(ItemManagerConfig config, Map<ColumnDef, ItemTableColumn> colOverrides) {
|
||||
setPanelOptions(config.getShowUniqueCardsOption());
|
||||
// if this is the first setup call, panel options will be added to UI components
|
||||
if (!this.panelOptionsCreated){
|
||||
setPanelOptions(config.getShowUniqueCardsOption());
|
||||
this.panelOptionsCreated = true;
|
||||
}
|
||||
// set status of components in the panel
|
||||
setGroupBy(config.getGroupBy(), true);
|
||||
setPileBy(config.getPileBy(), true);
|
||||
setColumnCount(config.getImageColumnCount(), true);
|
||||
|
||||
@@ -212,6 +212,12 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
||||
}
|
||||
else {
|
||||
max = (limit == CardLimit.Singleton ? 1 : FModel.getPreferences().getPrefInt(FPref.DECK_DEFAULT_CARD_LIMIT));
|
||||
|
||||
Integer cardCopies = DeckFormat.canHaveSpecificNumberInDeck(card);
|
||||
if (cardCopies != null) {
|
||||
max = cardCopies;
|
||||
}
|
||||
|
||||
Entry<String, Integer> cardAmountInfo = Iterables.find(cardsByName, new Predicate<Entry<String, Integer>>() {
|
||||
@Override
|
||||
public boolean apply(Entry<String, Integer> t) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.swing.ButtonGroup;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import forge.screens.home.sanctioned.SleeveSelector;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -66,7 +67,8 @@ public class PlayerPanel extends FPanel {
|
||||
|
||||
private final FLabel nameRandomiser;
|
||||
private final FLabel avatarLabel = new FLabel.Builder().opaque(true).hoverable(true).iconScaleFactor(0.99f).iconInBackground(true).build();
|
||||
private int avatarIndex;
|
||||
private final FLabel sleeveLabel = new FLabel.Builder().opaque(true).hoverable(true).iconScaleFactor(0.99f).iconInBackground(true).build();
|
||||
private int avatarIndex, sleeveIndex;
|
||||
|
||||
private final FTextField txtPlayerName = new FTextField.Builder().build();
|
||||
private FRadioButton radioHuman;
|
||||
@@ -127,6 +129,10 @@ public class PlayerPanel extends FPanel {
|
||||
createAvatar();
|
||||
this.add(avatarLabel, "spany 2, width 80px, height 80px");
|
||||
|
||||
/*TODO Layout and Override for PC*/
|
||||
//createSleeve();
|
||||
//this.add(sleeveLabel, "spany 2, width 60px, height 80px");
|
||||
|
||||
createNameEditor();
|
||||
this.add(lobby.newLabel(localizer.getMessage("lblName") +":"), "w 40px, h 30px, gaptop 5px");
|
||||
this.add(txtPlayerName, "h 30px, pushx, growx");
|
||||
@@ -204,6 +210,10 @@ public class PlayerPanel extends FPanel {
|
||||
avatarLabel.setIcon(FSkin.getAvatars().get(Integer.valueOf(type == LobbySlotType.OPEN ? -1 : avatarIndex)));
|
||||
avatarLabel.repaintSelf();
|
||||
|
||||
sleeveLabel.setEnabled(mayEdit);
|
||||
sleeveLabel.setIcon(FSkin.getSleeves().get(Integer.valueOf(type == LobbySlotType.OPEN ? -1 : sleeveIndex)));
|
||||
sleeveLabel.repaintSelf();
|
||||
|
||||
txtPlayerName.setEnabled(mayEdit);
|
||||
txtPlayerName.setText(type == LobbySlotType.OPEN ? StringUtils.EMPTY : playerName);
|
||||
nameRandomiser.setEnabled(mayEdit);
|
||||
@@ -332,6 +342,62 @@ public class PlayerPanel extends FPanel {
|
||||
}
|
||||
};
|
||||
|
||||
/** Listens to sleeve buttons and gives the appropriate player focus. */
|
||||
private final FocusAdapter sleeveFocusListener = new FocusAdapter() {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
lobby.changePlayerFocus(index);
|
||||
}
|
||||
};
|
||||
|
||||
private final FMouseAdapter sleeveMouseListener = new FMouseAdapter() {
|
||||
@Override public final void onLeftClick(final MouseEvent e) {
|
||||
if (!sleeveLabel.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final FLabel sleeve = (FLabel)e.getSource();
|
||||
|
||||
lobby.changePlayerFocus(index);
|
||||
sleeve.requestFocusInWindow();
|
||||
|
||||
final SleeveSelector sSel = new SleeveSelector(playerName, sleeveIndex, lobby.getUsedSleeves());
|
||||
for (final FLabel lbl : sSel.getSelectables()) {
|
||||
lbl.setCommand(new UiCommand() {
|
||||
@Override
|
||||
public void run() {
|
||||
setSleeveIndex(Integer.valueOf(lbl.getName().substring(11)));
|
||||
sSel.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
sSel.setVisible(true);
|
||||
sSel.dispose();
|
||||
|
||||
if (index < 2) {
|
||||
lobby.updateSleevePrefs();
|
||||
}
|
||||
|
||||
lobby.firePlayerChangeListener(index);
|
||||
}
|
||||
|
||||
@Override public final void onRightClick(final MouseEvent e) {
|
||||
if (!sleeveLabel.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
lobby.changePlayerFocus(index);
|
||||
sleeveLabel.requestFocusInWindow();
|
||||
|
||||
setRandomSleeve();
|
||||
|
||||
if (index < 2) {
|
||||
lobby.updateSleevePrefs();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void updateVariantControlsVisibility() {
|
||||
final boolean isOathbreaker = lobby.hasVariant(GameType.Oathbreaker);
|
||||
final boolean isTinyLeaders = lobby.hasVariant(GameType.TinyLeaders);
|
||||
@@ -703,6 +769,20 @@ public class PlayerPanel extends FPanel {
|
||||
avatarLabel.addMouseListener(avatarMouseListener);
|
||||
}
|
||||
|
||||
private void createSleeve() {
|
||||
final String[] currentPrefs = FModel.getPreferences().getPref(FPref.UI_SLEEVES).split(",");
|
||||
if (index < currentPrefs.length) {
|
||||
sleeveIndex = Integer.parseInt(currentPrefs[index]);
|
||||
sleeveLabel.setIcon(FSkin.getSleeves().get(sleeveIndex));
|
||||
} else {
|
||||
setRandomSleeve(false);
|
||||
}
|
||||
|
||||
sleeveLabel.setToolTipText("L-click: Select sleeve. R-click: Randomize sleeve.");
|
||||
sleeveLabel.addFocusListener(sleeveFocusListener);
|
||||
sleeveLabel.addMouseListener(sleeveMouseListener);
|
||||
}
|
||||
|
||||
/** Applies a random avatar, avoiding avatars already used. */
|
||||
private void setRandomAvatar() {
|
||||
setRandomAvatar(true);
|
||||
@@ -721,6 +801,24 @@ public class PlayerPanel extends FPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/** Applies a random sleeve, avoiding sleeve already used. */
|
||||
private void setRandomSleeve() {
|
||||
setRandomSleeve(true);
|
||||
}
|
||||
private void setRandomSleeve(final boolean fireListeners) {
|
||||
int random = 0;
|
||||
|
||||
final List<Integer> usedSleeves = lobby.getUsedSleeves();
|
||||
do {
|
||||
random = MyRandom.getRandom().nextInt(FSkin.getSleeves().size());
|
||||
} while (usedSleeves.contains(random));
|
||||
setSleeveIndex(random);
|
||||
|
||||
if (fireListeners) {
|
||||
lobby.firePlayerChangeListener(index);
|
||||
}
|
||||
}
|
||||
|
||||
private final FSkin.LineSkinBorder focusedBorder = new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS).alphaColor(255), 3);
|
||||
private final FSkin.LineSkinBorder defaultBorder = new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(200), 2);
|
||||
|
||||
@@ -746,6 +844,16 @@ public class PlayerPanel extends FPanel {
|
||||
avatarLabel.repaintSelf();
|
||||
}
|
||||
|
||||
public int getSleeveIndex() {
|
||||
return sleeveIndex;
|
||||
}
|
||||
public void setSleeveIndex(final int sleeveIndex0) {
|
||||
sleeveIndex = sleeveIndex0;
|
||||
final SkinImage icon = FSkin.getSleeves().get(sleeveIndex);
|
||||
sleeveLabel.setIcon(icon);
|
||||
sleeveLabel.repaintSelf();
|
||||
}
|
||||
|
||||
public int getTeam() {
|
||||
return teamComboBox.getSelectedIndex();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package forge.screens.home;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.GuiBase;
|
||||
import forge.UiCommand;
|
||||
import forge.ai.AIOption;
|
||||
import forge.deck.*;
|
||||
@@ -222,6 +223,7 @@ public class VLobby implements ILobbyView {
|
||||
DeckType selectedDeckType = deckChooser.getSelectedDeckType();
|
||||
switch (selectedDeckType){
|
||||
case STANDARD_CARDGEN_DECK:
|
||||
case PIONEER_CARDGEN_DECK:
|
||||
case MODERN_CARDGEN_DECK:
|
||||
case LEGACY_CARDGEN_DECK:
|
||||
case VINTAGE_CARDGEN_DECK:
|
||||
@@ -258,6 +260,9 @@ public class VLobby implements ILobbyView {
|
||||
addPlayerBtn.setEnabled(activePlayersNum < MAX_PLAYERS);
|
||||
|
||||
final boolean allowNetworking = lobby.isAllowNetworking();
|
||||
|
||||
GuiBase.setNetworkplay(allowNetworking);
|
||||
|
||||
ImmutableList<VariantCheckBox> vntBoxes = null;
|
||||
if (allowNetworking) {
|
||||
vntBoxes = vntBoxesNetwork;
|
||||
@@ -397,7 +402,7 @@ public class VLobby implements ILobbyView {
|
||||
|
||||
private UpdateLobbyPlayerEvent getSlot(final int index) {
|
||||
final PlayerPanel panel = playerPanels.get(index);
|
||||
return UpdateLobbyPlayerEvent.create(panel.getType(), panel.getPlayerName(), panel.getAvatarIndex(), panel.getTeam(), panel.isArchenemy(), panel.isReady(), panel.isDevMode(), panel.getAiOptions());
|
||||
return UpdateLobbyPlayerEvent.create(panel.getType(), panel.getPlayerName(), panel.getAvatarIndex(), -1/*TODO panel.getSleeveIndex()*/, panel.getTeam(), panel.isArchenemy(), panel.isReady(), panel.isDevMode(), panel.getAiOptions());
|
||||
}
|
||||
|
||||
/** Builds the actual deck panel layouts for each player.
|
||||
@@ -858,6 +863,15 @@ public class VLobby implements ILobbyView {
|
||||
prefs.save();
|
||||
}
|
||||
|
||||
/** Saves sleeve prefs for players one and two. */
|
||||
void updateSleevePrefs() {
|
||||
final int pOneIndex = playerPanels.get(0).getSleeveIndex();
|
||||
final int pTwoIndex = playerPanels.get(1).getSleeveIndex();
|
||||
|
||||
prefs.setPref(FPref.UI_SLEEVES, pOneIndex + "," + pTwoIndex);
|
||||
prefs.save();
|
||||
}
|
||||
|
||||
/** Adds a pre-styled FLabel component with the specified title. */
|
||||
FLabel newLabel(final String title) {
|
||||
return new FLabel.Builder().text(title).fontSize(14).fontStyle(Font.ITALIC).build();
|
||||
@@ -871,6 +885,14 @@ public class VLobby implements ILobbyView {
|
||||
return usedAvatars;
|
||||
}
|
||||
|
||||
List<Integer> getUsedSleeves() {
|
||||
final List<Integer> usedSleeves = Lists.newArrayListWithCapacity(MAX_PLAYERS);
|
||||
for (final PlayerPanel pp : playerPanels) {
|
||||
usedSleeves.add(pp.getSleeveIndex());
|
||||
}
|
||||
return usedSleeves;
|
||||
}
|
||||
|
||||
|
||||
private static final ImmutableList<String> genderOptions = ImmutableList.of("Male", "Female", "Any"),
|
||||
typeOptions = ImmutableList.of("Fantasy", "Generic", "Any");
|
||||
|
||||
@@ -72,6 +72,7 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
||||
if (view.getBoxColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.COLOR_DECK); }
|
||||
if (view.getBoxStandardColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_COLOR_DECK); }
|
||||
if (view.getBoxStandardGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_CARDGEN_DECK); }
|
||||
if (view.getBoxPioneerGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.PIONEER_CARDGEN_DECK); }
|
||||
if (view.getBoxModernGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.MODERN_CARDGEN_DECK); }
|
||||
if (view.getBoxLegacyGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.LEGACY_CARDGEN_DECK); }
|
||||
if (view.getBoxVintageGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.VINTAGE_CARDGEN_DECK); }
|
||||
|
||||
@@ -56,6 +56,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
private final JCheckBox boxColorDecks = new FCheckBox(DeckType.COLOR_DECK.toString());
|
||||
private final JCheckBox boxStandardColorDecks = new FCheckBox(DeckType.STANDARD_COLOR_DECK.toString());
|
||||
private final JCheckBox boxStandardCardgenDecks = new FCheckBox(DeckType.STANDARD_CARDGEN_DECK.toString());
|
||||
private final JCheckBox boxPioneerCardgenDecks = new FCheckBox(DeckType.PIONEER_CARDGEN_DECK.toString());
|
||||
private final JCheckBox boxModernCardgenDecks = new FCheckBox(DeckType.MODERN_CARDGEN_DECK.toString());
|
||||
private final JCheckBox boxLegacyCardgenDecks = new FCheckBox(DeckType.LEGACY_CARDGEN_DECK.toString());
|
||||
private final JCheckBox boxVintageCardgenDecks = new FCheckBox(DeckType.VINTAGE_CARDGEN_DECK.toString());
|
||||
@@ -88,11 +89,13 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
boxStandardColorDecks.setSelected(true);
|
||||
if(FModel.isdeckGenMatrixLoaded()) {
|
||||
boxStandardCardgenDecks.setSelected(true);
|
||||
boxPioneerCardgenDecks.setSelected(true);
|
||||
boxModernCardgenDecks.setSelected(true);
|
||||
boxLegacyCardgenDecks.setSelected(true);
|
||||
boxVintageCardgenDecks.setSelected(true);
|
||||
}else{
|
||||
boxStandardCardgenDecks.setSelected(false);
|
||||
boxPioneerCardgenDecks.setSelected(false);
|
||||
boxModernCardgenDecks.setSelected(false);
|
||||
boxLegacyCardgenDecks.setSelected(false);
|
||||
boxVintageCardgenDecks.setSelected(false);
|
||||
@@ -121,6 +124,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
pnlOptions.add(boxColorDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
if(FModel.isdeckGenMatrixLoaded()) {
|
||||
pnlOptions.add(boxStandardCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxPioneerCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxModernCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxLegacyCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(boxVintageCardgenDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
@@ -221,6 +225,9 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
public JCheckBox getBoxModernGenDecks() {
|
||||
return boxModernCardgenDecks;
|
||||
}
|
||||
public JCheckBox getBoxPioneerGenDecks() {
|
||||
return boxPioneerCardgenDecks;
|
||||
}
|
||||
public JCheckBox getBoxLegacyGenDecks() {
|
||||
return boxLegacyCardgenDecks;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package forge.screens.home.sanctioned;
|
||||
|
||||
import forge.gui.WrapLayout;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.FSkin;
|
||||
import forge.view.FDialog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SleeveSelector extends FDialog {
|
||||
private final List<FLabel> selectables = new ArrayList<>();
|
||||
private final Map<Integer, FSkin.SkinImage> sleeveMap = FSkin.getSleeves();
|
||||
|
||||
public SleeveSelector(final String playerName, final int currentIndex, final Collection<Integer> usedIndices) {
|
||||
this.setTitle("Select Sleeve for " + playerName);
|
||||
|
||||
final JPanel pnlSleevePics = new JPanel(new WrapLayout());
|
||||
|
||||
pnlSleevePics.setOpaque(false);
|
||||
pnlSleevePics.setOpaque(false);
|
||||
|
||||
final FLabel initialSelection = makeSleeveLabel(sleeveMap.get(currentIndex), currentIndex, currentIndex);
|
||||
pnlSleevePics.add(initialSelection);
|
||||
for (final Integer i : sleeveMap.keySet()) {
|
||||
if (currentIndex != i) {
|
||||
pnlSleevePics.add(makeSleeveLabel(sleeveMap.get(i), i, currentIndex));
|
||||
}
|
||||
}
|
||||
|
||||
final int width = this.getOwner().getWidth() * 3 / 4;
|
||||
final int height = this.getOwner().getHeight() * 3 / 4;
|
||||
this.setPreferredSize(new Dimension(width, height));
|
||||
this.setSize(width, height);
|
||||
|
||||
final FScrollPane scroller = new FScrollPane(pnlSleevePics, false);
|
||||
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
this.add(scroller, "w 100%-24px!, pushy, growy, gap 12px 0 0 0");
|
||||
this.setDefaultFocus(initialSelection);
|
||||
}
|
||||
|
||||
private FLabel makeSleeveLabel(final FSkin.SkinImage img0, final int index0, final int oldIndex) {
|
||||
final FLabel lbl = new FLabel.Builder().icon(img0).iconScaleFactor(0.95).iconAlignX(SwingConstants.CENTER)
|
||||
.iconInBackground(true).hoverable(true).selectable(true).selected(oldIndex == index0)
|
||||
.unhoveredAlpha(oldIndex == index0 ? 0.9f : 0.7f).build();
|
||||
|
||||
final Dimension size = new Dimension(60, 80);
|
||||
lbl.setPreferredSize(size);
|
||||
lbl.setMaximumSize(size);
|
||||
lbl.setMinimumSize(size);
|
||||
lbl.setName("SleeveLabel" + index0);
|
||||
|
||||
if (oldIndex == index0) {
|
||||
lbl.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS).alphaColor(255), 3));
|
||||
}
|
||||
|
||||
selectables.add(lbl);
|
||||
|
||||
return lbl;
|
||||
}
|
||||
|
||||
public List<FLabel> getSelectables() {
|
||||
return this.selectables;
|
||||
}
|
||||
}
|
||||
@@ -859,6 +859,7 @@ public class FSkin {
|
||||
}
|
||||
|
||||
private static Map<Integer, SkinImage> avatars;
|
||||
private static Map<Integer, SkinImage> sleeves;
|
||||
private static Map<Integer, Font> fixedFonts = new HashMap<>();
|
||||
|
||||
public static Font getFixedFont() {
|
||||
@@ -1039,7 +1040,7 @@ public class FSkin {
|
||||
private static String preferredDir;
|
||||
private static String preferredName;
|
||||
private static BufferedImage bimDefaultSprite, bimFavIcon, bimPreferredSprite, bimFoils, bimQuestDraftDeck,
|
||||
bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies, bimAbilities, bimManaIcons;
|
||||
bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies, bimAbilities, bimManaIcons, bimDefaultSleeve, bimDefaultSleeve2;
|
||||
private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
|
||||
private static int[] tempCoords;
|
||||
private static int defaultFontSize = 12;
|
||||
@@ -1173,6 +1174,8 @@ public class FSkin {
|
||||
final File f9 = new File(defaultDir + ForgeConstants.SPRITE_FAVICONS_FILE);
|
||||
final File f10 = new File(defaultDir + ForgeConstants.SPRITE_ABILITY_FILE);
|
||||
final File f11 = new File(defaultDir + ForgeConstants.SPRITE_MANAICONS_FILE);
|
||||
final File f12 = new File(defaultDir + ForgeConstants.SPRITE_SLEEVES_FILE);
|
||||
final File f13 = new File(defaultDir + ForgeConstants.SPRITE_SLEEVES2_FILE);
|
||||
|
||||
try {
|
||||
int p = 0;
|
||||
@@ -1190,6 +1193,10 @@ public class FSkin {
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimDefaultAvatars = ImageIO.read(f4);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimDefaultSleeve = ImageIO.read(f12);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimDefaultSleeve2 = ImageIO.read(f13);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimTrophies = ImageIO.read(f7);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimQuestDraftDeck = ImageIO.read(f8);
|
||||
@@ -1255,6 +1262,8 @@ public class FSkin {
|
||||
|
||||
// Assemble avatar images
|
||||
assembleAvatars();
|
||||
// Sleeves
|
||||
assembleSleeves();
|
||||
|
||||
// Images loaded; can start UI init.
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Creating display components.");
|
||||
@@ -1266,6 +1275,8 @@ public class FSkin {
|
||||
bimOldFoils.flush();
|
||||
bimPreferredSprite.flush();
|
||||
bimDefaultAvatars.flush();
|
||||
bimDefaultSleeve.flush();
|
||||
bimDefaultSleeve2.flush();
|
||||
bimQuestDraftDeck.flush();
|
||||
bimTrophies.flush();
|
||||
bimAbilities.flush();
|
||||
@@ -1278,6 +1289,8 @@ public class FSkin {
|
||||
bimOldFoils = null;
|
||||
bimPreferredSprite = null;
|
||||
bimDefaultAvatars = null;
|
||||
bimDefaultSleeve = null;
|
||||
bimDefaultSleeve2 = null;
|
||||
bimPreferredAvatars = null;
|
||||
bimQuestDraftDeck = null;
|
||||
bimTrophies = null;
|
||||
@@ -1379,6 +1392,10 @@ public class FSkin {
|
||||
return avatars;
|
||||
}
|
||||
|
||||
public static Map<Integer, SkinImage> getSleeves() {
|
||||
return sleeves;
|
||||
}
|
||||
|
||||
public static boolean isLoaded() { return loaded; }
|
||||
|
||||
/**
|
||||
@@ -1482,6 +1499,34 @@ public class FSkin {
|
||||
}
|
||||
}
|
||||
|
||||
private static void assembleSleeves() {
|
||||
sleeves = new HashMap<>();
|
||||
int counter = 0;
|
||||
Color pxTest;
|
||||
|
||||
final int pw = bimDefaultSleeve.getWidth();
|
||||
final int ph = bimDefaultSleeve.getHeight();
|
||||
|
||||
for (int j = 0; j < ph; j += 500) {
|
||||
for (int i = 0; i < pw; i += 360) {
|
||||
pxTest = getColorFromPixel(bimDefaultSleeve.getRGB(i + 180, j + 250));
|
||||
if (pxTest.getAlpha() == 0) { continue; }
|
||||
sleeves.put(counter++, new SkinImage(bimDefaultSleeve.getSubimage(i, j, 360, 500)));
|
||||
}
|
||||
}
|
||||
//2nd set
|
||||
final int aw = bimDefaultSleeve2.getWidth();
|
||||
final int ah = bimDefaultSleeve2.getHeight();
|
||||
|
||||
for (int j = 0; j < ah; j += 500) {
|
||||
for (int i = 0; i < aw; i += 360) {
|
||||
pxTest = getColorFromPixel(bimDefaultSleeve2.getRGB(i + 180, j + 250));
|
||||
if (pxTest.getAlpha() == 0) { continue; }
|
||||
sleeves.put(counter++, new SkinImage(bimDefaultSleeve2.getSubimage(i, j, 360, 500)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setImage(final FSkinProp s0, final BufferedImage bim) {
|
||||
tempCoords = s0.getCoords();
|
||||
x0 = tempCoords[0];
|
||||
|
||||
@@ -49,6 +49,9 @@ public final class Main {
|
||||
//setup GUI interface
|
||||
GuiBase.setInterface(new GuiDesktop());
|
||||
|
||||
//set PropertyConfig log4j to true
|
||||
GuiBase.enablePropertyConfig(true);
|
||||
|
||||
//install our error handler
|
||||
ExceptionHandler.registerErrorHandling();
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import forge.CachedCardImage;
|
||||
import forge.FThreads;
|
||||
import forge.StaticData;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardTranslation;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardView;
|
||||
@@ -39,6 +38,7 @@ import forge.screens.match.CMatchUI;
|
||||
import forge.toolbox.CardFaceSymbols;
|
||||
import forge.toolbox.FSkin.SkinnedPanel;
|
||||
import forge.toolbox.IDisposable;
|
||||
import forge.util.CardTranslation;
|
||||
import forge.view.arcane.util.OutlinedLabel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -1284,7 +1284,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
int numZombies = countCardsWithName(simGame, "Zombie");
|
||||
assertTrue(numZombies == 2);
|
||||
assertEquals(2, numZombies);
|
||||
}
|
||||
|
||||
public void testKalitasNumberOfTokens() {
|
||||
@@ -1309,7 +1309,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
assertNotNull(fatalPushSA);
|
||||
fatalPushSA.setTargetCard(goblin);
|
||||
|
||||
// Electrify: should only generate 1 token
|
||||
// Electrify: should also generate 2 tokens after the Ixalan rules update
|
||||
Card electrify = addCardToZone("Electrify", p, ZoneType.Hand);
|
||||
SpellAbility electrifySA = electrify.getFirstSpellAbility();
|
||||
assertNotNull(electrifySA);
|
||||
@@ -1318,11 +1318,11 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
GameSimulator sim = createSimulator(game, p);
|
||||
int score = sim.simulateSpellAbility(fatalPushSA).value;
|
||||
assertTrue(score > 0);
|
||||
assertTrue(countCardsWithName(sim.getSimulatedGameState(), "Zombie") == 2);
|
||||
assertEquals(2, countCardsWithName(sim.getSimulatedGameState(), "Zombie"));
|
||||
|
||||
score = sim.simulateSpellAbility(electrifySA).value;
|
||||
assertTrue(score > 0);
|
||||
assertTrue(countCardsWithName(sim.getSimulatedGameState(), "Zombie") == 3);
|
||||
assertEquals(countCardsWithName(sim.getSimulatedGameState(), "Zombie"), 4);
|
||||
}
|
||||
|
||||
public void testPlayerXCount() {
|
||||
@@ -1531,7 +1531,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
assertNotNull(simGoblin);
|
||||
int effects = simGoblin.getCounters(CounterType.P1P1) + simGoblin.getKeywordMagnitude(Keyword.HASTE);
|
||||
assertTrue(effects == 2);
|
||||
assertEquals(2, effects);
|
||||
}
|
||||
|
||||
public void testTeysaKarlovXathridNecromancer() {
|
||||
@@ -1560,7 +1560,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
int numZombies = countCardsWithName(simGame, "Zombie");
|
||||
assertTrue(numZombies == 4);
|
||||
assertEquals(4, numZombies);
|
||||
}
|
||||
|
||||
public void testDoubleTeysaKarlovXathridNecromancer() {
|
||||
@@ -1588,7 +1588,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
int numZombies = countCardsWithName(simGame, "Zombie");
|
||||
assertTrue(numZombies == 3);
|
||||
assertEquals(3, numZombies);
|
||||
}
|
||||
|
||||
|
||||
@@ -1619,7 +1619,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
// Two cards drawn
|
||||
assertTrue(simGame.getPlayers().get(0).getZone(ZoneType.Hand).size() == 2);
|
||||
assertEquals(2, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size());
|
||||
}
|
||||
|
||||
public void testTeysaKarlovGitrogMonsterGitrogDies() {
|
||||
@@ -1657,7 +1657,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
// One cards drawn
|
||||
assertTrue(simGame.getPlayers().get(0).getZone(ZoneType.Hand).size() == 1);
|
||||
assertEquals(1, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size());
|
||||
}
|
||||
|
||||
public void testTeysaKarlovGitrogMonsterTeysaDies() {
|
||||
@@ -1695,7 +1695,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
// One cards drawn
|
||||
assertTrue(simGame.getPlayers().get(0).getZone(ZoneType.Hand).size() == 1);
|
||||
assertEquals(1, simGame.getPlayers().get(0).getZone(ZoneType.Hand).size());
|
||||
}
|
||||
|
||||
|
||||
@@ -1742,9 +1742,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
assertTrue(countCardsWithName(simGame, outLawName) == 0);
|
||||
assertTrue(countCardsWithName(simGame, hillGiantName) == 2);
|
||||
assertTrue(countCardsWithName(simGame, terrorName) == 0);
|
||||
assertEquals(0, countCardsWithName(simGame, outLawName));
|
||||
assertEquals(2, countCardsWithName(simGame, hillGiantName));
|
||||
assertEquals(0, countCardsWithName(simGame, terrorName));
|
||||
|
||||
Card clonedOutLaw = (Card)sim.getGameCopier().find(outlaw);
|
||||
|
||||
@@ -1754,7 +1754,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
assertTrue(clonedOutLaw.canTransform());
|
||||
assertFalse(clonedOutLaw.isBackSide());
|
||||
|
||||
assertTrue(clonedOutLaw.getName().equals(hillGiantName));
|
||||
assertEquals(clonedOutLaw.getName(), hillGiantName);
|
||||
|
||||
assertTrue(clonedOutLaw.isDoubleFaced());
|
||||
|
||||
@@ -1763,9 +1763,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
simGame = sim.getSimulatedGameState();
|
||||
|
||||
assertTrue(countCardsWithName(simGame, outLawName) == 0);
|
||||
assertTrue(countCardsWithName(simGame, hillGiantName) == 2);
|
||||
assertTrue(countCardsWithName(simGame, terrorName) == 0);
|
||||
assertEquals(0, countCardsWithName(simGame, outLawName));
|
||||
assertEquals(2, countCardsWithName(simGame, hillGiantName));
|
||||
assertEquals(0, countCardsWithName(simGame, terrorName));
|
||||
|
||||
Card transformOutLaw = (Card)sim.getGameCopier().find(outlaw);
|
||||
|
||||
@@ -1775,14 +1775,14 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
assertTrue(transformOutLaw.canTransform());
|
||||
assertTrue(transformOutLaw.isBackSide());
|
||||
|
||||
assertTrue(transformOutLaw.getName().equals(hillGiantName));
|
||||
assertEquals(transformOutLaw.getName(), hillGiantName);
|
||||
|
||||
// need to clean up the clone state
|
||||
simGame.getPhaseHandler().devAdvanceToPhase(PhaseType.CLEANUP);
|
||||
|
||||
assertTrue(countCardsWithName(simGame, outLawName) == 0);
|
||||
assertTrue(countCardsWithName(simGame, hillGiantName) == 1);
|
||||
assertTrue(countCardsWithName(simGame, terrorName) == 1);
|
||||
assertEquals(0, countCardsWithName(simGame, outLawName));
|
||||
assertEquals(1, countCardsWithName(simGame, hillGiantName));
|
||||
assertEquals(1, countCardsWithName(simGame, terrorName));
|
||||
|
||||
assertFalse(transformOutLaw.isCloned());
|
||||
assertTrue(transformOutLaw.isDoubleFaced());
|
||||
@@ -1790,7 +1790,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
assertTrue(transformOutLaw.canTransform());
|
||||
assertTrue(transformOutLaw.isBackSide());
|
||||
|
||||
assertTrue(transformOutLaw.getName().equals(terrorName));
|
||||
assertEquals(transformOutLaw.getName(), terrorName);
|
||||
}
|
||||
|
||||
public void testVolrathsShapeshifter() {
|
||||
@@ -1808,9 +1808,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
addCardToZone("Abattoir Ghoul", p, ZoneType.Graveyard);
|
||||
game.getAction().checkStateEffects(true);
|
||||
|
||||
assertTrue(volrath.getName().equals("Abattoir Ghoul"));
|
||||
assertTrue(volrath.getNetPower() == 3);
|
||||
assertTrue(volrath.getNetToughness() == 2);
|
||||
assertEquals("Abattoir Ghoul", volrath.getName());
|
||||
assertEquals(3, volrath.getNetPower());
|
||||
assertEquals(2, volrath.getNetToughness());
|
||||
assertTrue(volrath.hasKeyword(Keyword.FIRST_STRIKE));
|
||||
|
||||
SpellAbility discardAfterCopy = findSAWithPrefix(volrath, "{2}");
|
||||
@@ -1820,9 +1820,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
addCardToZone("Plains", p, ZoneType.Graveyard);
|
||||
game.getAction().checkStateEffects(true);
|
||||
|
||||
assertTrue(volrath.getName().equals("Volrath's Shapeshifter"));
|
||||
assertTrue(volrath.getNetPower() == 0);
|
||||
assertTrue(volrath.getNetToughness() == 1);
|
||||
assertEquals("Volrath's Shapeshifter", volrath.getName());
|
||||
assertEquals(0, volrath.getNetPower());
|
||||
assertEquals(1, volrath.getNetToughness());
|
||||
assertTrue(volrath.getKeywords().isEmpty());
|
||||
|
||||
SpellAbility discardAfterRevert = findSAWithPrefix(volrath, "{2}");
|
||||
@@ -1850,9 +1850,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Card simSpark = (Card)sim.getGameCopier().find(sparkDouble);
|
||||
|
||||
assertNotNull(simSpark);
|
||||
assertTrue(simSpark.getZone().is(ZoneType.Battlefield));
|
||||
assertTrue(simSpark.getCounters(CounterType.P1P1) == 1);
|
||||
assertTrue(simSpark.getCounters(CounterType.LOYALTY) == 5);
|
||||
assertTrue(simSpark.isInZone(ZoneType.Battlefield));
|
||||
assertEquals(1, simSpark.getCounters(CounterType.P1P1));
|
||||
assertEquals(5, simSpark.getCounters(CounterType.LOYALTY));
|
||||
}
|
||||
|
||||
public void testVituGhaziAndCytoshape() {
|
||||
@@ -1883,8 +1883,8 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Card awakened = findCardWithName(sim.getSimulatedGameState(), "Vitu-Ghazi");
|
||||
|
||||
assertNotNull(awakened);
|
||||
assertTrue(awakened.getName().equals("Vitu-Ghazi"));
|
||||
assertTrue(awakened.getCounters(CounterType.P1P1) == 9);
|
||||
assertEquals("Vitu-Ghazi", awakened.getName());
|
||||
assertEquals(9, awakened.getCounters(CounterType.P1P1));
|
||||
assertTrue(awakened.hasKeyword(Keyword.HASTE));
|
||||
assertTrue(awakened.getType().hasSubtype("Goblin"));
|
||||
}
|
||||
@@ -1910,7 +1910,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
SpellAbility copiedSA = findSAWithPrefix(oozeOTB, "{1}{G}:");
|
||||
assertNotNull(copiedSA);
|
||||
assertTrue(copiedSA.getRestrictions().getLimitToCheck().equals("1"));
|
||||
assertEquals("1", copiedSA.getRestrictions().getLimitToCheck());
|
||||
}
|
||||
|
||||
public void testEpochrasite() {
|
||||
@@ -1932,7 +1932,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
Card epoOTB = findCardWithName(sim.getSimulatedGameState(), "Epochrasite");
|
||||
|
||||
assertNotNull(epoOTB);
|
||||
assertTrue(epoOTB.getCounters(CounterType.P1P1) == 3);
|
||||
assertEquals(3, epoOTB.getCounters(CounterType.P1P1));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -1967,9 +1967,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
assertTrue(score > 0);
|
||||
|
||||
Card dimirdgAfterCopy1 = (Card)sim.getGameCopier().find(dimirdg);
|
||||
assertTrue(dimirdgAfterCopy1.getName().equals("Jushi Apprentice"));
|
||||
assertTrue(dimirdgAfterCopy1.getNetPower() == 1);
|
||||
assertTrue(dimirdgAfterCopy1.getNetToughness() == 2);
|
||||
assertEquals("Jushi Apprentice", dimirdgAfterCopy1.getName());
|
||||
assertEquals(1, dimirdgAfterCopy1.getNetPower());
|
||||
assertEquals(2, dimirdgAfterCopy1.getNetToughness());
|
||||
assertTrue(dimirdgAfterCopy1.isFlipCard());
|
||||
assertFalse(dimirdgAfterCopy1.isFlipped());
|
||||
assertFalse(dimirdgAfterCopy1.getType().isLegendary());
|
||||
@@ -1982,7 +1982,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
Player copiedPlayer = (Player)sim.getGameCopier().find(p);
|
||||
int handSize = copiedPlayer.getCardsIn(ZoneType.Hand).size();
|
||||
assertTrue(handSize == 9);
|
||||
assertEquals(9, handSize);
|
||||
|
||||
SpellAbility draw = findSAWithPrefix(dimirdgAfterCopy1, "{2}{U}");
|
||||
score = sim.simulateSpellAbility(draw).value;
|
||||
@@ -1990,7 +1990,7 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
copiedPlayer = (Player)sim.getGameCopier().find(p);
|
||||
handSize = copiedPlayer.getCardsIn(ZoneType.Hand).size();
|
||||
assertTrue(handSize == 10);
|
||||
assertEquals(10, handSize);
|
||||
|
||||
simGame = sim.getSimulatedGameState();
|
||||
|
||||
@@ -2006,9 +2006,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
|
||||
Card dimirdgAfterFlip1 = (Card)sim.getGameCopier().find(dimirdgAfterCopy1);
|
||||
|
||||
assertTrue(dimirdgAfterFlip1.getName().equals("Tomoya the Revealer"));
|
||||
assertTrue(dimirdgAfterFlip1.getNetPower() == 2);
|
||||
assertTrue(dimirdgAfterFlip1.getNetToughness() == 3);
|
||||
assertEquals("Tomoya the Revealer", dimirdgAfterFlip1.getName());
|
||||
assertEquals(2, dimirdgAfterFlip1.getNetPower());
|
||||
assertEquals(3, dimirdgAfterFlip1.getNetToughness());
|
||||
assertTrue(dimirdgAfterFlip1.isFlipped());
|
||||
assertTrue(dimirdgAfterFlip1.getType().isLegendary());
|
||||
|
||||
@@ -2030,9 +2030,9 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
System.out.println(dimirdgAfterCopy2.isFlipCard());
|
||||
System.out.println(dimirdgAfterCopy2.isFlipped());
|
||||
|
||||
assertTrue(dimirdgAfterCopy2.getName().equals("Runeclaw Bear"));
|
||||
assertTrue(dimirdgAfterCopy2.getNetPower() == 2);
|
||||
assertTrue(dimirdgAfterCopy2.getNetToughness() == 2);
|
||||
assertEquals("Runeclaw Bear", dimirdgAfterCopy2.getName());
|
||||
assertEquals(2, dimirdgAfterCopy2.getNetPower());
|
||||
assertEquals(2, dimirdgAfterCopy2.getNetToughness());
|
||||
assertTrue(dimirdgAfterCopy2.isFlipped());
|
||||
assertFalse(dimirdgAfterCopy2.getType().isLegendary());
|
||||
}
|
||||
@@ -2049,11 +2049,11 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
// update stats state
|
||||
game.getAction().checkStateEffects(true);
|
||||
|
||||
assertTrue(c1.getNetPower() == 4);
|
||||
assertTrue(c1.getNetToughness() == 4);
|
||||
assertEquals(4, c1.getNetPower());
|
||||
assertEquals(4, c1.getNetToughness());
|
||||
|
||||
assertTrue(c2.getNetPower() == 4);
|
||||
assertTrue(c2.getNetToughness() == 4);
|
||||
assertEquals(4, c2.getNetPower());
|
||||
assertEquals(4, c2.getNetToughness());
|
||||
}
|
||||
|
||||
public void testPathtoExileActofTreason() {
|
||||
@@ -2090,7 +2090,37 @@ public class GameSimulatorTest extends SimulationTestCase {
|
||||
simGame.getAction().checkStateEffects(true);
|
||||
|
||||
int numForest = countCardsWithName(simGame, "Forest");
|
||||
assertTrue(numForest == 1);
|
||||
assertEquals(1, numForest);
|
||||
assertEquals(0, simGame.getPlayers().get(1).getCardsIn(ZoneType.Battlefield).size());
|
||||
}
|
||||
|
||||
public void testAmassTrigger() {
|
||||
Game game = initAndCreateGame();
|
||||
Player p = game.getPlayers().get(0);
|
||||
String WCname = "Woodland Champion";
|
||||
addCard(WCname, p);
|
||||
for (int i = 0; i < 5; i++)
|
||||
addCard("Island", p);
|
||||
|
||||
String CardName = "Eternal Skylord";
|
||||
Card c = addCardToZone(CardName, p, ZoneType.Hand);
|
||||
game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p);
|
||||
game.getAction().checkStateEffects(true);
|
||||
|
||||
SpellAbility playSa = c.getSpellAbilities().get(0);
|
||||
playSa.setActivatingPlayer(p);
|
||||
|
||||
GameSimulator sim = createSimulator(game, p);
|
||||
int origScore = sim.getScoreForOrigGame().value;
|
||||
int score = sim.simulateSpellAbility(playSa).value;
|
||||
assertTrue(String.format("score=%d vs. origScore=%d", score, origScore), score > origScore);
|
||||
|
||||
Game simGame = sim.getSimulatedGameState();
|
||||
|
||||
Card simWC = findCardWithName(simGame, WCname);
|
||||
|
||||
assertEquals(1, simWC.getPowerBonusFromCounters());
|
||||
assertEquals(3, simGame.getPlayers().get(0).getCreaturesInPlay().size());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ public class PlayerControllerForTests extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, Map<String, Object> runParams) {
|
||||
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers) {
|
||||
// TODO Auto-generated method stub
|
||||
return Iterables.getFirst(possibleReplacers, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user