Merge branch 'master' into bigRefactoring

This commit is contained in:
sotovdev 2017-01-10 15:37:43 +03:00 committed by GitHub
commit fe7aaedf1c
8 changed files with 307 additions and 178 deletions

View file

@ -37,9 +37,11 @@ import javax.swing.JLabel;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import mage.cards.Card;
import javax.swing.JSlider; import javax.swing.JSlider;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.JToggleButton; import javax.swing.JToggleButton;
@ -49,6 +51,9 @@ import javax.swing.SwingUtilities;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.cards.decks.DeckCardInfo; import mage.cards.decks.DeckCardInfo;
import mage.cards.decks.DeckCardLayout; import mage.cards.decks.DeckCardLayout;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.constants.Constants; import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
@ -63,6 +68,7 @@ import mage.client.util.Event;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.constants.CardType; import mage.constants.CardType;
import mage.util.RandomUtil;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CardsView; import mage.view.CardsView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -595,11 +601,13 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
BigCard lastBigCard = null; BigCard lastBigCard = null;
// Top bar with dropdowns for sort / filter / etc // Top bar with dropdowns for sort / filter / etc
final JButton sortButton; JButton sortButton;
final JButton filterButton; JButton filterButton;
final JButton visibilityButton; JButton visibilityButton;
final JButton selectByButton; JButton selectByButton;
final JButton analyseButton; JButton analyseButton;
JButton blingButton;
// Popup for toolbar // Popup for toolbar
final JPopupMenu filterPopup; final JPopupMenu filterPopup;
@ -750,9 +758,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
// Toolbar // Toolbar
sortButton = new JButton("Sort"); sortButton = new JButton("Sort");
filterButton = new JButton("Filter"); filterButton = new JButton("Filter");
visibilityButton = new JButton("Visibility"); visibilityButton = new JButton("V"); // "Visibility" button
selectByButton = new JButton("Select By"); selectByButton = new JButton("Select By");
analyseButton = new JButton("Mana"); analyseButton = new JButton("M"); // "Mana" button
blingButton = new JButton("B"); // "Bling" button
// Name and count label // Name and count label
deckNameAndCountLabel = new JLabel(); deckNameAndCountLabel = new JLabel();
@ -773,9 +782,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
toolbarInner.add(creatureCountLabel); toolbarInner.add(creatureCountLabel);
toolbarInner.add(sortButton); toolbarInner.add(sortButton);
toolbarInner.add(filterButton); toolbarInner.add(filterButton);
toolbarInner.add(visibilityButton);
toolbarInner.add(selectByButton); toolbarInner.add(selectByButton);
toolbarInner.add(visibilityButton);
toolbarInner.add(analyseButton); toolbarInner.add(analyseButton);
toolbarInner.add(blingButton);
toolbar.add(toolbarInner, BorderLayout.WEST); toolbar.add(toolbarInner, BorderLayout.WEST);
JPanel sliderPanel = new JPanel(new GridBagLayout()); JPanel sliderPanel = new JPanel(new GridBagLayout());
sliderPanel.setOpaque(false); sliderPanel.setOpaque(false);
@ -923,6 +933,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
JMenuItem showAll = new JMenuItem("Show all"); JMenuItem showAll = new JMenuItem("Show all");
showAll.addActionListener(e -> showAll()); showAll.addActionListener(e -> showAll());
visPopup.add(showAll); visPopup.add(showAll);
visibilityButton.setToolTipText("Visibility of cards. Right click to get the same options this provides");
visibilityButton.addMouseListener(new MouseAdapter() { visibilityButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -956,9 +967,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
selectByTypeMode.add(multiplesButton); selectByTypeMode.add(multiplesButton);
selectByTypeModeGroup.add(multiplesButton); selectByTypeModeGroup.add(multiplesButton);
multiplesButton.addActionListener(e -> { multiplesButton.addActionListener(e -> {
multiplesButton.setSelected(!multiplesButton.isSelected()); multiplesButton.setSelected(!multiplesButton.isSelected());
reselectBy(); reselectBy();
}); });
continue; continue;
} }
@ -1005,10 +1016,19 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
} }
// Analyse Mana (aka #blue pips, #islands, #white pips, #plains etc.) // Analyse Mana (aka #blue pips, #islands, #white pips, #plains etc.)
analyseButton.setToolTipText("Counts coloured/colourless mana costs. Counts land types."); analyseButton.setToolTipText("Mana Analyser! Counts coloured/colourless mana costs. Counts land types.");
analyseButton.addActionListener(evt -> analyseDeck()); analyseButton.addActionListener(evt -> analyseDeck());
// Bling button - aka Add in a premium 'JR', 'MBP', 'CS' etc card
blingButton.setToolTipText("Bling your deck! Select the original and added cards by selecting 'Multiples' in the selection options");
blingButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
blingDeck();
}
});
// Filter popup // Filter popup
filterPopup = new JPopupMenu(); filterPopup = new JPopupMenu();
filterPopup.setPreferredSize(new Dimension(300, 300)); filterPopup.setPreferredSize(new Dimension(300, 300));
@ -1468,6 +1488,84 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
MageFrame.getInstance().showMessage(finalInfo); MageFrame.getInstance().showMessage(finalInfo);
} }
public void blingDeck() {
if (!(this.mode == Constants.DeckEditorMode.FREE_BUILDING)) {
return;
}
if (JOptionPane.showConfirmDialog(null, "Are you sure you want to bling your deck? This process will add cards!", "WARNING",
JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
return;
}
HashMap<String, Integer> pimpedSets = new HashMap<>();
HashMap<CardView, Integer> pimpedCards = new HashMap<>();
pimpedSets.put("CP", 1);
pimpedSets.put("JR", 1);
pimpedSets.put("MPS", 1);
pimpedSets.put("CLASH", 1);
pimpedSets.put("ARENA", 1);
pimpedSets.put("UGIN", 1);
pimpedSets.put("WMCQ", 1);
pimpedSets.put("APAC", 1);
pimpedSets.put("EURO", 1);
pimpedSets.put("FNMP", 1);
pimpedSets.put("MGDC", 1);
pimpedSets.put("MPRP", 1);
pimpedSets.put("EXP", 1);
pimpedSets.put("GPX", 1);
pimpedSets.put("GRC", 1);
pimpedSets.put("MBP", 1);
pimpedSets.put("MLP", 1);
pimpedSets.put("PLS", 1);
pimpedSets.put("PTC", 1);
pimpedSets.put("SUS", 1);
String[] sets = pimpedSets.keySet().toArray(new String[pimpedSets.keySet().size()]);
Boolean didModify = false;
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
for (ArrayList<CardView> stack : gridRow) {
for (CardView card : stack) {
if (card.getSuperTypes().contains("Basic")) {
continue;
}
if (!pimpedSets.containsKey(card.getExpansionSetCode())) {
final CardCriteria cardCriteria = new CardCriteria();
cardCriteria.setCodes(sets);
cardCriteria.name(card.getName());
List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);
if (cardPool.size() > 0) {
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
if (acard.getName().equals(card.getName())) {
CardView pimpedCard = new CardView(acard);
addCardView(pimpedCard, false);
eventSource.addSpecificCard(pimpedCard, "add-specific-card");
pimpedCards.put(pimpedCard, 1);
didModify = true;
}
}
}
}
}
if (didModify) {
for (CardView c : pimpedCards.keySet()) {
sortIntoGrid(c);
}
layoutGrid();
cardScroll.revalidate();
repaint();
JOptionPane.showMessageDialog(null, "Added " + pimpedCards.size() + " cards. You can select them and the originals by choosing 'Multiples'");
}
}
}
// Update the contents of the card grid // Update the contents of the card grid
public void setCards(CardsView cardsView, DeckCardLayout layout, BigCard bigCard) { public void setCards(CardsView cardsView, DeckCardLayout layout, BigCard bigCard) {
if (bigCard != null) { if (bigCard != null) {

View file

@ -62,7 +62,9 @@ public class Modern extends Constructed {
banned.add("Dig Through Time"); banned.add("Dig Through Time");
banned.add("Dread Return"); banned.add("Dread Return");
banned.add("Eye of Ugin"); banned.add("Eye of Ugin");
banned.add("Gitaxian Probe");
banned.add("Glimpse of Nature"); banned.add("Glimpse of Nature");
banned.add("Golgari Grave-Troll");
banned.add("Great Furnace"); banned.add("Great Furnace");
banned.add("Green Sun's Zenith"); banned.add("Green Sun's Zenith");
banned.add("Hypergenesis"); banned.add("Hypergenesis");

View file

@ -67,5 +67,8 @@ public class Standard extends Constructed {
} }
} }
} }
banned.add("Emrakul, the Promised End");
banned.add("Reflector Mage");
banned.add("Smuggler's Copter");
} }
} }

View file

@ -118,7 +118,7 @@ class TezzeretMasterOfMetalEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game); List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game);
for (Permanent permanent : permanents) { for (Permanent permanent : permanents) {
ContinuousEffect effect = new TibaltTheFiendBloodedControlEffect(source.getControllerId()); ContinuousEffect effect = new TezzeretMasterOfMetalControlEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(permanent.getId())); effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
} }

View file

@ -52,8 +52,7 @@ import mage.target.common.TargetCardInLibrary;
public class WhirOfInvention extends CardImpl { public class WhirOfInvention extends CardImpl {
public WhirOfInvention(UUID ownerId, CardSetInfo setInfo) { public WhirOfInvention(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}{U}{U}");
// Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.) // Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)
addAbility(new ImproviseAbility()); addAbility(new ImproviseAbility());

View file

@ -227,11 +227,31 @@ foreach my $ability (@abilities) {
$ability =~ m/({.*})/g; $ability =~ m/({.*})/g;
$vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, new ManaCostsImpl("' . fixCost($1) . '")));'; $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, new ManaCostsImpl("' . fixCost($1) . '")));';
$vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;"; $vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;";
} elsif ($keywords{$kw} eq 'type') {
$ability =~ m/\s([a-zA-Z\s]*)/g;
if ($1 =~ m/(^.*\s.*)/g) {
$vars{'abilities'} .= "\n TargetPermanent auraTarget = new TargetPermanent(filter);";
} else {
$vars{'abilities'} .= "\n TargetPermanent auraTarget = new Target". toCamelCase($1) . "Permanent();";
$vars{'abilitiesImports'} .= "\nimport mage.target.common.Target". toCamelCase($1) . "Permanent;";
}
$vars{'abilities'} .= "\n this.getSpellAbility().addTarget(auraTarget);";
$vars{'abilities'} .= "\n this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));";
$vars{'abilities'} .= "\n Ability ability = new EnchantAbility(auraTarget.getTargetName());";
$vars{'abilities'} .= "\n this.addAbility(ability);";
$vars{'abilitiesImports'} .= "\nimport mage.abilities.Ability;";
$vars{'abilitiesImports'} .= "\nimport mage.abilities.effects.common.AttachEffect;";
$vars{'abilitiesImports'} .= "\nimport mage.constants.Outcome;";
$vars{'abilitiesImports'} .= "\nimport mage.target.TargetPermanent;";
} elsif ($keywords{$kw} eq 'manaString') {
$ability =~ m/({.*})/g;
$vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability("' . fixCost($1) . '"));';
} }
$vars{'abilitiesImports'} .= "\nimport mage.abilities.keyword." . $kw . "Ability;"; $vars{'abilitiesImports'} .= "\nimport mage.abilities.keyword." . $kw . "Ability;";
} else { } else {
$vars{'abilities'} .= "\n // $kwUnchanged"; $vars{'abilities'} .= "\n // $kwUnchanged";
} }
$vars{'abilities'} .= "\n";
} }
} }
} }

View file

@ -1,10 +1,13 @@
Annihilator|number| Annihilator|number|
Basic landcycling|cost| Basic landcycling|cost|
Battle cry|new| Battle cry|new|
Bestow|card, manaString|
Bloodthirst|number| Bloodthirst|number|
Bushido|number| Bushido|number|
Convoke|new| Buyback|manaString|
Cascade|new| Cascade|new|
Changeling|instance|
Convoke|new|
Crew|number| Crew|number|
Cumulative upkeep|cost| Cumulative upkeep|cost|
Cycling|cost| Cycling|cost|
@ -14,10 +17,14 @@ Delve|new|
Dethrone|new| Dethrone|new|
Devoid|color| Devoid|color|
Defender|instance| Defender|instance|
Dredge|number|
Double Strike|instance| Double Strike|instance|
Dredge|number| Dredge|number|
Echo|manaString|
Enchant|type|
Entwine|manaString| Entwine|manaString|
Evoke|card, manaString| Evoke|card, manaString|
Evolve|new|
Exalted|new| Exalted|new|
Exploit|new| Exploit|new|
Extort|new| Extort|new|

View file

@ -30403,7 +30403,7 @@ Shipwreck Moray|Aether Revolt|45|C|{3}{U}|Creature - Fish|0|5|When Shipwreck Mor
Skyship Plunderer|Aether Revolt|46|U|{1}{U}|Creature - Human Pirate|2|1|Flying$Whenever Skyship Plunderer deals combat damage to a player, for each kind of counter on target permanent or player, give that permanent or player another counter of that kind.| Skyship Plunderer|Aether Revolt|46|U|{1}{U}|Creature - Human Pirate|2|1|Flying$Whenever Skyship Plunderer deals combat damage to a player, for each kind of counter on target permanent or player, give that permanent or player another counter of that kind.|
Take into Custody|Aether Revolt|47|C|{U}|Instant|||Tap target creature. It doesn't untap during its controller's next untap step.| Take into Custody|Aether Revolt|47|C|{U}|Instant|||Tap target creature. It doesn't untap during its controller's next untap step.|
Trophy Mage|Aether Revolt|48|U|{2}{U}|Creature - Human Wizard|2|2|When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library.| Trophy Mage|Aether Revolt|48|U|{2}{U}|Creature - Human Wizard|2|2|When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library.|
Whir of Invention|Aether Revolt|49|R|{X}{U}{U}{U}|Sorcery|||Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)$Search your library for an artifact card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.| Whir of Invention|Aether Revolt|49|R|{X}{U}{U}{U}|Instant|||Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)$Search your library for an artifact card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.|
Wind-King Raiders|Aether Revolt|50|U|{4}{U}{U}|Creature - Human Artificer|4|3|Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)</i>$Flying| Wind-King Raiders|Aether Revolt|50|U|{4}{U}{U}|Creature - Human Artificer|4|3|Improvise <i>(Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)</i>$Flying|
Aether Poisoner|Aether Revolt|51|C|{1}{B}|Creature - Human Artificer|1|1|Deathtouch <i>(Any amount of damage this deals to a creature is enough to destroy it.)</i>$When Aether Poisoner enters the battlefield, you get {E}{E} <i>(two energy counters)</i>.$Whenever Aether Poisoner attacks, you may pay {E}{E}. If you do, create a 1/1 colorless Servo artifact creature token.| Aether Poisoner|Aether Revolt|51|C|{1}{B}|Creature - Human Artificer|1|1|Deathtouch <i>(Any amount of damage this deals to a creature is enough to destroy it.)</i>$When Aether Poisoner enters the battlefield, you get {E}{E} <i>(two energy counters)</i>.$Whenever Aether Poisoner attacks, you may pay {E}{E}. If you do, create a 1/1 colorless Servo artifact creature token.|
Alley Strangler|Aether Revolt|52|C|{2}{B}|Creature - Aetherborn Rogue|2|3|Menace| Alley Strangler|Aether Revolt|52|C|{2}{B}|Creature - Aetherborn Rogue|2|3|Menace|