From 56b81f86358a8aa833043090fb3abcfed60c9a8e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 24 Jun 2015 16:28:30 +0200 Subject: [PATCH 01/12] Computer AI - Fixed a bug in AI target handling (e.g. AI Show and Tell selection blocked UI). --- .../java/mage/player/ai/ComputerPlayer.java | 32 +++++++-------- .../src/mage/sets/urzassaga/ShowAndTell.java | 41 +++++++++---------- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index dda37ca177f..0f7fe7b3832 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -511,7 +511,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) { Card card = pickBestCard(cardsInHand, null, target, source, game); if (card != null) { - if (target.canTarget(card.getId(), source, game)) { + if (target.canTarget(getId(), card.getId(), source, game)) { target.addTarget(card.getId(), source, game); cardsInHand.remove(card); if (target.isChosen()) { @@ -525,7 +525,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { findPlayables(game); if (unplayable.size() > 0) { for (int i = unplayable.size() - 1; i >= 0; i--) { - if (target.canTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game)) { + if (target.canTarget(getId(), unplayable.values().toArray(new Card[0])[i].getId(), source, game)) { target.addTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game); if (target.isChosen()) { return true; @@ -535,7 +535,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } if (hand.size() > 0) { for (int i = 0; i < hand.size(); i++) { - if (target.canTarget(hand.toArray(new UUID[0])[i], source, game)) { + if (target.canTarget(getId(), hand.toArray(new UUID[0])[i], source, game)) { target.addTarget(hand.toArray(new UUID[0])[i], source, game); if (target.isChosen()) { return true; @@ -600,13 +600,13 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (targets.isEmpty()) { if (outcome.isGood()) { - if (target.canTarget(abilityControllerId, source, game)) { + if (target.canTarget(getId(), abilityControllerId, source, game)) { target.addTarget(abilityControllerId, source, game); return true; } } else { - if (target.canTarget(opponentId, source, game)) { + if (target.canTarget(getId(), opponentId, source, game)) { target.addTarget(opponentId, source, game); return true; } @@ -627,13 +627,13 @@ public class ComputerPlayer extends PlayerImpl implements Player { } if (outcome.isGood()) { - if (target.canTarget(abilityControllerId, source, game)) { + if (target.canTarget(getId(),abilityControllerId, source, game)) { target.addTarget(abilityControllerId, source, game); return true; } } else { - if (target.canTarget(opponentId, source, game)) { + if (target.canTarget(getId(),opponentId, source, game)) { target.addTarget(opponentId, source, game); return true; } @@ -757,7 +757,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { targets = game.getBattlefield().getActivePermanents(new FilterPlaneswalkerPermanent(), opponentId, game); if (targets != null && !targets.isEmpty()) { for (Permanent planeswalker: targets) { - if (target.canTarget(planeswalker.getId(), source, game)) { + if (target.canTarget(getId(),planeswalker.getId(), source, game)) { target.addTarget(planeswalker.getId(), source, game); } if (target.isChosen()) { @@ -766,7 +766,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } if (!target.isChosen()) { - if (target.canTarget(opponentId, source, game)) { + if (target.canTarget(getId() ,opponentId, source, game)) { target.addTarget(opponentId, source, game); } } @@ -818,7 +818,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { card = pickWorstCard(cards, null, target, source, game); } if (source != null) { - if (target.canTarget(this.getId(), card.getId(), source, game)) { + if (target.canTarget(getId(), card.getId(), source, game)) { return card; } } @@ -849,21 +849,21 @@ public class ComputerPlayer extends PlayerImpl implements Player { targets = threats(opponentId, source.getSourceId(), new FilterCreaturePermanent(), game, target.getTargets()); } for (Permanent permanent: targets) { - if (target.canTarget(permanent.getId(), source, game)) { + if (target.canTarget(getId() ,permanent.getId(), source, game)) { if (permanent.getToughness().getValue() <= target.getAmountRemaining()) { target.addTarget(permanent.getId(), permanent.getToughness().getValue(), source, game); return true; } } } - if (outcome.isGood() && target.canTarget(playerId, playerId, source, game)) { + if (outcome.isGood() && target.canTarget(getId(), getId(), source, game)) { target.addTarget(opponentId, target.getAmountRemaining(), source, game); return true; - } else if (target.canTarget(playerId, opponentId, source, game)){ + } else if (target.canTarget(getId(), opponentId, source, game)){ // no permanent target so take opponent target.addTarget(opponentId, target.getAmountRemaining(), source, game); return true; - } else if (target.canTarget(playerId, playerId, source, game)) { + } else if (target.canTarget(getId(), playerId, source, game)) { target.addTarget(opponentId, target.getAmountRemaining(), source, game); return true; } @@ -1778,7 +1778,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } else if (score > maxScore) { // we need better card if (target != null && source != null && game != null) { // but also check it can be targeted - betterCard = target.canTarget(card.getId(), source, game); + betterCard = target.canTarget(getId(), card.getId(), source, game); } else { // target object wasn't provided, so acceptings it anyway betterCard = true; @@ -1807,7 +1807,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } else if (score < minScore) { // we need worse card if (target != null && source != null && game != null) { // but also check it can be targeted - worseCard = target.canTarget(card.getId(), source, game); + worseCard = target.canTarget(getId(), card.getId(), source, game); } else { // target object wasn't provided, so accepting it anyway worseCard = true; diff --git a/Mage.Sets/src/mage/sets/urzassaga/ShowAndTell.java b/Mage.Sets/src/mage/sets/urzassaga/ShowAndTell.java index 367ea5e0265..b347b38e6a6 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/ShowAndTell.java +++ b/Mage.Sets/src/mage/sets/urzassaga/ShowAndTell.java @@ -43,7 +43,6 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.players.Player; -import mage.players.PlayerList; import mage.target.common.TargetCardInHand; /** @@ -76,11 +75,12 @@ class ShowAndTellEffect extends OneShotEffect { private static final FilterCard filter = new FilterCard("artifact, creature, enchantment, or land card"); static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE), - new CardTypePredicate(CardType.ENCHANTMENT), - new CardTypePredicate(CardType.LAND))); + List cardTypes = new ArrayList<>(); + cardTypes.add(new CardTypePredicate(CardType.ARTIFACT)); + cardTypes.add(new CardTypePredicate(CardType.CREATURE)); + cardTypes.add(new CardTypePredicate(CardType.ENCHANTMENT)); + cardTypes.add(new CardTypePredicate(CardType.LAND)); + filter.add(Predicates.or(cardTypes)); } public ShowAndTellEffect() { @@ -105,24 +105,23 @@ class ShowAndTellEffect extends OneShotEffect { } List cardsToPutIntoPlay = new ArrayList<>(); TargetCardInHand target = new TargetCardInHand(filter); - PlayerList playerList = game.getPlayerList().copy(); - playerList.setCurrent(game.getActivePlayerId()); - Player player = game.getPlayer(game.getActivePlayerId()); - do { - if (player.chooseUse(outcome, "Put an artifact, creature, enchantment, or land card from hand onto the battlefield?", game)) { - target.clearChosen(); - if (player.chooseTarget(outcome, target, source, game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - cardsToPutIntoPlay.add(card); + + for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + if (player.chooseUse(outcome, "Put an artifact, creature, enchantment, or land card from hand onto the battlefield?", game)) { + target.clearChosen(); + if (player.chooseTarget(outcome, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + cardsToPutIntoPlay.add(card); + } } - } + } } - player = playerList.getNextInRange(controller, game); - } while (!player.getId().equals(game.getActivePlayerId())); - + } for (Card card: cardsToPutIntoPlay) { - player = game.getPlayer(card.getOwnerId()); + Player player = game.getPlayer(card.getOwnerId()); if (player != null) { player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); } From 9ea16282b038408a6e725a6c41db0b11017d3c45 Mon Sep 17 00:00:00 2001 From: fireshoes Date: Wed, 24 Jun 2015 11:18:16 -0500 Subject: [PATCH 02/12] [ORI] Updated mtg-cards-data.txt with 6/24 spoilers and added Timberpack Wolf reprint --- .../sets/magicorigins/TimberpackWolf.java | 52 +++++++++++++++++++ Utils/mtg-cards-data.txt | 5 ++ 2 files changed, 57 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/magicorigins/TimberpackWolf.java diff --git a/Mage.Sets/src/mage/sets/magicorigins/TimberpackWolf.java b/Mage.Sets/src/mage/sets/magicorigins/TimberpackWolf.java new file mode 100644 index 00000000000..f0b6523cae9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/TimberpackWolf.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magicorigins; + +import java.util.UUID; + +/** + * + * @author fireshoes + */ +public class TimberpackWolf extends mage.sets.magic2013.TimberpackWolf { + + public TimberpackWolf(UUID ownerId) { + super(ownerId); + this.cardNumber = 200; + this.expansionSetCode = "ORI"; + } + + public TimberpackWolf(final TimberpackWolf card) { + super(card); + } + + @Override + public TimberpackWolf copy() { + return new TimberpackWolf(this); + } +} diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 2e84d9ebe0a..554d49edaad 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -26062,6 +26062,7 @@ Surgical Extraction|Modern Masters 2015 Edition|99|R|{BP}|Instant|||({BP} can Akroan Jailer|Magic Origins|1|C|{W}|Creature - Human Soldier|1|1|{2}{W}, {T}: Tap target creature.| Blessed Spirits|Magic Origins|7|U|{2}{W}|Creature - Spirit|2|2|Flying$Whenever you cast an enchantment spell, put a +1/+1 counter on Blessed Spirits.| Charging Griffin|Magic Origins|9|C|{3}{W}|Creature - Griffin|2|2|Flying$Whenever Charging Griffin attacks, it gets +1/+1 until end of turn.| +Cleric of the Forward Order|Magic Origins|10|C|{1}{W}|Creature - Human Cleric|2|2|When Cleric of the Forward Order enters the battlefield, you gain 2 life for each creature you control named Cleric of the Forward Order.| Enshrouding Mist|Magic Origins|13|C|{W}|Instant|||Target creature gets +1/+1 until end of turn. Prevent all damage that would dealt to it this turn. If it's renowned, untap it.| Grasp of the Hieromancer|Magic Origins|15|C|{1}{W}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +1/+1 and has "Whenever this creature attacks, tap target creature defending player controls."| Heavy Infantry|Magic Origins|18|C|{4}{W}|Creature - Human Soldier|3|4|When Heavy Infantry enters the battlefield, tap target creature an opponent controls.| @@ -26083,6 +26084,7 @@ Claustrophobia|Magic Origins|50|C|{1}{U}{U}|Enchantment - Aura|||$Enchant creatu Day's Undoing|Magic Origins|51|M|{2}{U}|Sorcery|||Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. If it's your turn, end the turn. (Exile all spells and abilities on the stack, including this card. Discard down to your maximum hand size. Damage wears off, and "this turn" and "until end of turn" effects end.)| Disperse|Magic Origins|54|C|{1}{U}|Instant|||Return target nonland permanent to its owner's hand.| Displacement Wave|Magic Origins|55|R|{X}{U}{U}|Sorcery|||Return all nonland permanents with converted mana cost X or less to their owners' hands.| +Faerie Miscrent|Magic Orgins|57|C|{U}|Creature - Faerie Rogue|1|1|Flying (This creature can't be blocked except by creatures with flying or reach.)$When Faerie Miscreant enters the battlefield, if you control another creature named Faerie Miscreants, draw a card.| Hydrolash|Magic Origins|59|U|{2}{U}|Instant|||Attacking creatures get -2/-0 until end of turn.$Draw a card.| Jace, Telepath Unbound|Magic Origins|60|M||Planeswalker - Jace|5|+1: Up to one target creature gets -2/-0 until your next turn.$-3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.$-9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". $+1: Up to one target creature gets -2/-0 until your next turn.$-3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.$-9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". | Jace, Vryn's Prodigy|Magic Origins|60|M|{1}{U}|Legendary Creature - Human Wizard|0|2|{T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn''s Prodigy, then return him to the battefield transformed under his owner's control. ${T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn''s Prodigy, then return him to the battefield transformed under his owner's control. | @@ -26110,6 +26112,7 @@ Rabid Bloodsucker|Magic Origins|113|C|{4}{B}|Creature - Vampire|3|2|Flying$When Reave Soul|Magic Origins|115|C|{1}{B}|Sorcery|||Destroy target creature with power 3 or less.| Shambling Ghoul|Magic Origins|119|C|{1}{B}|Creature - Zombie|2|3|Shambling Ghoul enters the battlefield tapped.| Tainted Remedy|Magic Origins|120|R|{2}{B}|Enchantment|||If an opponent would gain life, that player loses that much life instead.| +Undead Servant|Magic Origins|124|C|{3}{B}|Creature - Zombie|3|2|When Undead Servant enters the battlefield, put a 2/2 black Zombie creature token onto the battlefield for each card named Undead Servant in your graveyard.| Weight of the Underworld|Magic Origins|126|C|{3}{B}|Enchantment - Aura|||Enchant creature$Enchanted creature gets -3/-2.| Act of Treason|Magic Origins|129|C|{2}{R}{2}{R}|Sorcery|||Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn.| Avaricious Dragon|Magic Origins|131|M|{2}{R}{R}|Creature - Dragon|4|4|Flying$At the beginning of your draw step, draw an additional card.$At the beginning of your end step, discard your hand.| @@ -26124,6 +26127,7 @@ Enthralling Victor|Magic Origins|142|U|{3}{R}|Creature - Human Warrior|3|2|When Fiery Conclusion|Magic Origins|144|C|{1}{R}|Instant|||As an additional cost to cast Fiery Conclusion, sacrifice a creature.$Fiery Conclusion deals 5 damage to target creature.| Fiery Impulse|Magic Origins|145|C|{R}|Instant|||Fiery Imulse deals 2 damage to target creature.$Spell mastery - If there are two or more instant and/or sorcery cards in your graveyard, Fiery Impulse deals 3 damage to that creature instead.| Flaeshadow Conjuring|Magic Origins|147|R|{3}{R}|Enchantment|||Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step.| +Infectious Bloodlust|Magic Origins|152|C|{1}{R}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +2/+1, has haste, and attacks each turn in able.$When enchanted creature dies, you may search your library for a card named Infectious Bloodlust, reveal it, put it into your hand, then shuffle your library.| Lightning Javelin|Magic Origins|153|C|{3}{R}|Sorcery|||Lightning Javelin deals 3 damage to target creature or player. Scry 1.| Pia and Kiran Nalaar|Magic Origins|157|R|{2}{R}{R}|Legendary Creature - Human Artificer|2|2|When Pia and Kiran Nalaar enters the battlefield put 2 1/1 colorless Thopter artifact creature tokens with flying onto the battlefield.${2}{R}, Sacrifice an artifact: Pia and Kiran Nalaar deals 2 damage to target creature or player.| Ravaging Blaze|Magic Origins|159|U|{X}{R}{R}|Instant|||Ravaging Blaze deals X damage to target creature. $Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.| @@ -26143,6 +26147,7 @@ Mantle of Webs|Magic Origins|187|C|{1}{G}|Enchantment - Aura|||Enchant Creature$ Nissa, Sage Animist|Magic Origins|189|M||Planeswalker - Nissa|3|+1: Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand.$-2: Put a legendary 4/4 green Elemental creature token named Ashaya, the Awoken World onto the battlefield.$-7: Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands.$| Nissa, Vastwood Seer|Magic Origins|189|M|{2}{G}|Legendary Creature - Elf Scout|2|2|When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library.$Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control.| Rhox Maulers|Magic Origins|196|C|{4}{G}|Creature - Rhino Soldier|4|4|Trample (This creature can deal excess combat damage to defending player or planeswalker while attacking.)$Renown 2 (When this creature deals combat damage to a player, if it isn't renowned, put two +1/+1 counters on it and it becomes renowned.)| +Timberpack Wolf|Magic Origins|200|C|{1}{G}|Creature - Wolf|2|2|Timberpack Wolf gets +1/+1 for each other creature you control named Timberpack Wolf.| Titanic Growth|Magic Origins|201|C|{1}{G}|Instant|||Target creature gets +4/+4 until end of turn.| Vastwood Gorger|Magic Origins|204|C|{5}{G}|Creature - Wurm|5|6|| Yeva's Forcemage|Magic Origins|208|C|{2}{G}|Creature - Elf Shaman|2|2|When Yeva's Forcemage enters the battlefield, target creature gets +2/+2 until end of turn.| From e139e4524fe938c96bc32fc107840308e3e0eb9e Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 24 Jun 2015 19:31:15 +0300 Subject: [PATCH 03/12] Don't use a proprietary class. Fixes build on OpenJDK. --- .../client/dialog/CardInfoWindowDialog.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index 18d3cbdc590..3d7eb809835 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -34,7 +34,6 @@ package mage.client.dialog; -import static com.sun.java.accessibility.util.AWTEventMonitor.addWindowListener; import java.awt.Point; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -44,6 +43,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.SwingUtilities; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import mage.client.cards.BigCard; import mage.client.util.Config; import mage.client.util.ImageHelper; @@ -61,18 +62,18 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl; public class CardInfoWindowDialog extends MageDialog { public static enum ShowType { REVEAL, LOOKED_AT, EXILE, GRAVEYARD, OTHER }; - + private ShowType showType; private boolean positioned; private String name; - + public CardInfoWindowDialog(ShowType showType, String name) { this.name = name; this.title = name; this.showType = showType; this.positioned = false; initComponents(); - + this.setModal(false); switch(this.showType) { case LOOKED_AT: @@ -88,20 +89,20 @@ public class CardInfoWindowDialog extends MageDialog { this.setIconifiable(false); this.setClosable(true); this.setDefaultCloseOperation(HIDE_ON_CLOSE); - addWindowListener(new WindowAdapter() { + addInternalFrameListener(new InternalFrameAdapter() { @Override - public void windowClosing(WindowEvent e) { + public void internalFrameClosing(InternalFrameEvent e) { CardInfoWindowDialog.this.hideDialog(); } - }); + }); break; case EXILE: this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage())); break; default: // no icon yet - } - this.setTitelBarToolTip(name); + } + this.setTitelBarToolTip(name); } public void cleanUp() { @@ -112,17 +113,17 @@ public class CardInfoWindowDialog extends MageDialog { cards.loadCards(showCards, bigCard, gameId); showAndPositionWindow(); } - + public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) { - cards.loadCards(showCards, bigCard, gameId, null); + cards.loadCards(showCards, bigCard, gameId, null); if (showType.equals(ShowType.GRAVEYARD)) { setTitle(name + "'s Graveyard (" + showCards.size() + ")"); - this.setTitelBarToolTip(name); + this.setTitelBarToolTip(name); } - showAndPositionWindow(); + showAndPositionWindow(); } - private void showAndPositionWindow() { + private void showAndPositionWindow() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -142,7 +143,7 @@ public class CardInfoWindowDialog extends MageDialog { } }); } - + public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) { boolean changed = cards.loadCards(exile, bigCard, gameId, null); if (exile.size() > 0) { From 91aae33db6baf9e6034acf89ac6a4f1412018519 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 24 Jun 2015 19:32:35 +0300 Subject: [PATCH 04/12] Fix some typos and copy-paste errors --- Mage.Sets/src/mage/sets/iceage/KnightOfStromgald.java | 2 +- Mage.Sets/src/mage/sets/iceage/OrderOfTheWhiteShield.java | 2 +- Mage.Sets/src/mage/sets/mastersedition/OrderOfLeitbur.java | 2 +- Mage.Sets/src/mage/sets/mastersedition/OrderOfTheEbonHand.java | 2 +- Mage.Sets/src/mage/sets/urzassaga/OpalArchangel.java | 2 +- Mage.Sets/src/mage/sets/urzassaga/OpalGargoyle.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/sets/iceage/KnightOfStromgald.java b/Mage.Sets/src/mage/sets/iceage/KnightOfStromgald.java index c923743d0be..904399afded 100644 --- a/Mage.Sets/src/mage/sets/iceage/KnightOfStromgald.java +++ b/Mage.Sets/src/mage/sets/iceage/KnightOfStromgald.java @@ -51,7 +51,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class KnightOfStromgald extends CardImpl { - private static final FilterCard filter = new FilterCard("White"); + private static final FilterCard filter = new FilterCard("white"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); diff --git a/Mage.Sets/src/mage/sets/iceage/OrderOfTheWhiteShield.java b/Mage.Sets/src/mage/sets/iceage/OrderOfTheWhiteShield.java index dc31f84840d..7d1907effc6 100644 --- a/Mage.Sets/src/mage/sets/iceage/OrderOfTheWhiteShield.java +++ b/Mage.Sets/src/mage/sets/iceage/OrderOfTheWhiteShield.java @@ -51,7 +51,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class OrderOfTheWhiteShield extends CardImpl { - private static final FilterCard filter = new FilterCard("Black"); + private static final FilterCard filter = new FilterCard("black"); static { filter.add(new ColorPredicate(ObjectColor.BLACK)); diff --git a/Mage.Sets/src/mage/sets/mastersedition/OrderOfLeitbur.java b/Mage.Sets/src/mage/sets/mastersedition/OrderOfLeitbur.java index fae1e77830f..f5cb2c71972 100644 --- a/Mage.Sets/src/mage/sets/mastersedition/OrderOfLeitbur.java +++ b/Mage.Sets/src/mage/sets/mastersedition/OrderOfLeitbur.java @@ -51,7 +51,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class OrderOfLeitbur extends CardImpl { - private static final FilterCard filter = new FilterCard("Black"); + private static final FilterCard filter = new FilterCard("black"); static { filter.add(new ColorPredicate(ObjectColor.BLACK)); diff --git a/Mage.Sets/src/mage/sets/mastersedition/OrderOfTheEbonHand.java b/Mage.Sets/src/mage/sets/mastersedition/OrderOfTheEbonHand.java index 2bbbd28ddca..4e5d1e939fc 100644 --- a/Mage.Sets/src/mage/sets/mastersedition/OrderOfTheEbonHand.java +++ b/Mage.Sets/src/mage/sets/mastersedition/OrderOfTheEbonHand.java @@ -51,7 +51,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; */ public class OrderOfTheEbonHand extends CardImpl { - private static final FilterCard filter = new FilterCard("White"); + private static final FilterCard filter = new FilterCard("white"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); diff --git a/Mage.Sets/src/mage/sets/urzassaga/OpalArchangel.java b/Mage.Sets/src/mage/sets/urzassaga/OpalArchangel.java index 274081c672d..cbd4c0bb594 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/OpalArchangel.java +++ b/Mage.Sets/src/mage/sets/urzassaga/OpalArchangel.java @@ -75,7 +75,7 @@ public class OpalArchangel extends CardImpl { class OpalArchangelToken extends Token { public OpalArchangelToken() { - super("Angel", "a 3/3 Angelt creature with flying and vigilance"); + super("Angel", "a 3/3 Angel creature with flying and vigilance"); cardType.add(CardType.CREATURE); subtype.add("Angel"); power = new MageInt(5); diff --git a/Mage.Sets/src/mage/sets/urzassaga/OpalGargoyle.java b/Mage.Sets/src/mage/sets/urzassaga/OpalGargoyle.java index be650e80db5..5575a46eef3 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/OpalGargoyle.java +++ b/Mage.Sets/src/mage/sets/urzassaga/OpalGargoyle.java @@ -76,7 +76,7 @@ class OpalGargoyleToken extends Token { public OpalGargoyleToken() { super("Gargoyle", "a 2/2 Gargoyle creature with flying"); cardType.add(CardType.CREATURE); - subtype.add("Knight"); + subtype.add("Gargoyle"); power = new MageInt(2); toughness = new MageInt(2); this.addAbility(FlyingAbility.getInstance()); From ccd92dd24155aa805a27754ad490e5dc52ace366 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 24 Jun 2015 19:38:53 +0300 Subject: [PATCH 05/12] Fix Urborg. It had wrong card number and produced green instead of black mana. --- Mage.Sets/src/mage/sets/legends/Urborg.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/legends/Urborg.java b/Mage.Sets/src/mage/sets/legends/Urborg.java index 6e268839122..ba88b65b3ee 100644 --- a/Mage.Sets/src/mage/sets/legends/Urborg.java +++ b/Mage.Sets/src/mage/sets/legends/Urborg.java @@ -34,7 +34,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.continuous.LoseAbilityOrAnotherAbilityTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.SwampwalkAbility; -import mage.abilities.mana.GreenManaAbility; +import mage.abilities.mana.BlackManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; @@ -48,12 +48,12 @@ import mage.target.common.TargetCreaturePermanent; public class Urborg extends CardImpl { public Urborg(UUID ownerId) { - super(ownerId, 107, "Urborg", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, ""); + super(ownerId, 255, "Urborg", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, ""); this.expansionSetCode = "LEG"; this.supertype.add("Legendary"); // {tap}: Add {B} to your mana pool. - this.addAbility(new GreenManaAbility()); + this.addAbility(new BlackManaAbility()); // {tap}: Target creature loses first strike or swampwalk until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseAbilityOrAnotherAbilityTargetEffect(FirstStrikeAbility.getInstance(), new SwampwalkAbility()), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); From 596bee33c28deb663890dfd4b1171d90c9ccea58 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 24 Jun 2015 19:56:22 +0300 Subject: [PATCH 06/12] Use ShuffleIntoLibrarySourceEffect instead of custom effect implementation for Blitz Hellion and Lightning Shrieker. This also fixes a bug where controller's library was shuffled instead of owner's. --- .../mage/sets/alarareborn/BlitzHellion.java | 46 +++---------------- .../sets/fatereforged/LightningShrieker.java | 46 +++---------------- 2 files changed, 13 insertions(+), 79 deletions(-) diff --git a/Mage.Sets/src/mage/sets/alarareborn/BlitzHellion.java b/Mage.Sets/src/mage/sets/alarareborn/BlitzHellion.java index d9a9cf556a3..ead81b9ff43 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/BlitzHellion.java +++ b/Mage.Sets/src/mage/sets/alarareborn/BlitzHellion.java @@ -29,17 +29,15 @@ package mage.sets.alarareborn; import java.util.UUID; -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.keyword.TrampleAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect; import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; +import mage.constants.*; /** * @@ -64,7 +62,9 @@ public class BlitzHellion extends CardImpl { this.addAbility(HasteAbility.getInstance()); // At the beginning of the end step, Blitz Hellion's owner shuffles it into his or her library. - this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ShuffleSourceEffect(), TargetController.ANY, null, false)); + Effect effect = new ShuffleIntoLibrarySourceEffect(); + effect.setText("{this}'s owner shuffles it into his or her library."); + this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, null, false)); } public BlitzHellion(final BlitzHellion card) { @@ -76,35 +76,3 @@ public class BlitzHellion extends CardImpl { return new BlitzHellion(this); } } - -class ShuffleSourceEffect extends OneShotEffect { - - ShuffleSourceEffect() { - super(Outcome.Neutral); - staticText = "{this}'s owner shuffles it into his or her library"; - } - - ShuffleSourceEffect(final ShuffleSourceEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - permanent.moveToZone(Zone.LIBRARY, id, game, false); - player.shuffleLibrary(game); - return true; - } - return false; - } - - @Override - public ShuffleSourceEffect copy() { - return new ShuffleSourceEffect(this); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/fatereforged/LightningShrieker.java b/Mage.Sets/src/mage/sets/fatereforged/LightningShrieker.java index 44d856d69fe..22a7fa3ed73 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/LightningShrieker.java +++ b/Mage.Sets/src/mage/sets/fatereforged/LightningShrieker.java @@ -29,21 +29,17 @@ package mage.sets.fatereforged; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect; import mage.abilities.keyword.FlyingAbility; -import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; /** * @@ -65,7 +61,9 @@ public class LightningShrieker extends CardImpl { // Haste this.addAbility(HasteAbility.getInstance()); // At the beginning of the end step, Lightning Shrieker's owner shuffles it into his or her library. - this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ShuffleSourceEffect(), TargetController.ANY, null, false)); + Effect effect = new ShuffleIntoLibrarySourceEffect(); + effect.setText("{this}'s owner shuffles it into his or her library."); + this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, null, false)); } public LightningShrieker(final LightningShrieker card) { @@ -77,35 +75,3 @@ public class LightningShrieker extends CardImpl { return new LightningShrieker(this); } } - -class ShuffleSourceEffect extends OneShotEffect { - - ShuffleSourceEffect() { - super(Outcome.Neutral); - staticText = "{this}'s owner shuffles it into his or her library"; - } - - ShuffleSourceEffect(final ShuffleSourceEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - permanent.moveToZone(Zone.LIBRARY, id, game, false); - player.shuffleLibrary(game); - return true; - } - return false; - } - - @Override - public ShuffleSourceEffect copy() { - return new ShuffleSourceEffect(this); - } -} \ No newline at end of file From 287b24bf314e0f5f252d4be7c6f1ff77f4fd2df2 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 24 Jun 2015 20:34:31 +0300 Subject: [PATCH 07/12] Implement cards: Cerulean Sphinx, Dakmor Lancer, Goblin Gardener, and Storm Shaman --- .../src/mage/sets/alliances/StormShaman1.java | 69 ++++++++++++++++ .../src/mage/sets/alliances/StormShaman2.java | 54 +++++++++++++ .../src/mage/sets/ravnica/CeruleanSphinx.java | 72 +++++++++++++++++ .../sets/seventhedition/DakmorLancer.java | 55 +++++++++++++ .../sets/seventhedition/GoblinGardener.java | 53 ++++++++++++ .../mage/sets/seventhedition/StormShaman.java | 55 +++++++++++++ .../mage/sets/starter1999/DakmorLancer.java | 80 +++++++++++++++++++ .../sets/urzasdestiny/GoblinGardener.java | 68 ++++++++++++++++ 8 files changed, 506 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/alliances/StormShaman1.java create mode 100644 Mage.Sets/src/mage/sets/alliances/StormShaman2.java create mode 100644 Mage.Sets/src/mage/sets/ravnica/CeruleanSphinx.java create mode 100644 Mage.Sets/src/mage/sets/seventhedition/DakmorLancer.java create mode 100644 Mage.Sets/src/mage/sets/seventhedition/GoblinGardener.java create mode 100644 Mage.Sets/src/mage/sets/seventhedition/StormShaman.java create mode 100644 Mage.Sets/src/mage/sets/starter1999/DakmorLancer.java create mode 100644 Mage.Sets/src/mage/sets/urzasdestiny/GoblinGardener.java diff --git a/Mage.Sets/src/mage/sets/alliances/StormShaman1.java b/Mage.Sets/src/mage/sets/alliances/StormShaman1.java new file mode 100644 index 00000000000..996bef92571 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/StormShaman1.java @@ -0,0 +1,69 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.alliances; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + + */ +public class StormShaman1 extends CardImpl { + + public StormShaman1(UUID ownerId) { + super(ownerId, 118, "Storm Shaman", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "ALL"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.subtype.add("Shaman"); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // {R}: Storm Shaman gets +1/+0 until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); + } + + public StormShaman1(final StormShaman1 card) { + super(card); + } + + @Override + public StormShaman1 copy() { + return new StormShaman1(this); + } +} diff --git a/Mage.Sets/src/mage/sets/alliances/StormShaman2.java b/Mage.Sets/src/mage/sets/alliances/StormShaman2.java new file mode 100644 index 00000000000..744d2da86f2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/StormShaman2.java @@ -0,0 +1,54 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.alliances; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class StormShaman2 extends mage.sets.alliances.StormShaman1 { + + public StormShaman2(UUID ownerId) { + super(ownerId); + this.cardNumber = 119; + this.rarity = Rarity.UNCOMMON; + } + + public StormShaman2(final StormShaman2 card) { + super(card); + } + + @Override + public StormShaman2 copy() { + return new StormShaman2(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/CeruleanSphinx.java b/Mage.Sets/src/mage/sets/ravnica/CeruleanSphinx.java new file mode 100644 index 00000000000..2fcdd83cf77 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/CeruleanSphinx.java @@ -0,0 +1,72 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.ravnica; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + + */ +public class CeruleanSphinx extends CardImpl { + + public CeruleanSphinx(UUID ownerId) { + super(ownerId, 39, "Cerulean Sphinx", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{U}{U}"); + this.expansionSetCode = "RAV"; + this.subtype.add("Sphinx"); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // {U}: Cerulean Sphinx's owner shuffles it into his or her library. + Effect effect = new ShuffleIntoLibrarySourceEffect(); + effect.setText("{this}'s owner shuffles it into his or her library."); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}"))); + } + + public CeruleanSphinx(final CeruleanSphinx card) { + super(card); + } + + @Override + public CeruleanSphinx copy() { + return new CeruleanSphinx(this); + } +} diff --git a/Mage.Sets/src/mage/sets/seventhedition/DakmorLancer.java b/Mage.Sets/src/mage/sets/seventhedition/DakmorLancer.java new file mode 100644 index 00000000000..97f58dda841 --- /dev/null +++ b/Mage.Sets/src/mage/sets/seventhedition/DakmorLancer.java @@ -0,0 +1,55 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.seventhedition; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class DakmorLancer extends mage.sets.starter1999.DakmorLancer { + + public DakmorLancer(UUID ownerId) { + super(ownerId); + this.cardNumber = 126; + this.expansionSetCode = "7ED"; + this.rarity = Rarity.UNCOMMON; + } + + public DakmorLancer(final DakmorLancer card) { + super(card); + } + + @Override + public DakmorLancer copy() { + return new DakmorLancer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/seventhedition/GoblinGardener.java b/Mage.Sets/src/mage/sets/seventhedition/GoblinGardener.java new file mode 100644 index 00000000000..181263ed763 --- /dev/null +++ b/Mage.Sets/src/mage/sets/seventhedition/GoblinGardener.java @@ -0,0 +1,53 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.seventhedition; + +import java.util.UUID; + +/** + * + * @author LoneFox + + */ +public class GoblinGardener extends mage.sets.urzasdestiny.GoblinGardener { + + public GoblinGardener(UUID ownerId) { + super(ownerId); + this.cardNumber = 188; + this.expansionSetCode = "7ED"; + } + + public GoblinGardener(final GoblinGardener card) { + super(card); + } + + @Override + public GoblinGardener copy() { + return new GoblinGardener(this); + } +} diff --git a/Mage.Sets/src/mage/sets/seventhedition/StormShaman.java b/Mage.Sets/src/mage/sets/seventhedition/StormShaman.java new file mode 100644 index 00000000000..f56e1c44ab1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/seventhedition/StormShaman.java @@ -0,0 +1,55 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.seventhedition; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class StormShaman extends mage.sets.alliances.StormShaman1 { + + public StormShaman(UUID ownerId) { + super(ownerId); + this.cardNumber = 222; + this.expansionSetCode = "7ED"; + this.rarity = Rarity.UNCOMMON; + } + + public StormShaman(final StormShaman card) { + super(card); + } + + @Override + public StormShaman copy() { + return new StormShaman(this); + } +} diff --git a/Mage.Sets/src/mage/sets/starter1999/DakmorLancer.java b/Mage.Sets/src/mage/sets/starter1999/DakmorLancer.java new file mode 100644 index 00000000000..9ed80421409 --- /dev/null +++ b/Mage.Sets/src/mage/sets/starter1999/DakmorLancer.java @@ -0,0 +1,80 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.starter1999; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + + */ +public class DakmorLancer extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature"); + + static { + filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); + } + + + public DakmorLancer(UUID ownerId) { + super(ownerId, 71, "Dakmor Lancer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); + this.expansionSetCode = "S99"; + this.subtype.add("Human"); + this.subtype.add("Knight"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Dakmor Lancer enters the battlefield, destroy target nonblack creature. + Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public DakmorLancer(final DakmorLancer card) { + super(card); + } + + @Override + public DakmorLancer copy() { + return new DakmorLancer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/GoblinGardener.java b/Mage.Sets/src/mage/sets/urzasdestiny/GoblinGardener.java new file mode 100644 index 00000000000..891a700fc8f --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzasdestiny/GoblinGardener.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.urzasdestiny; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author LoneFox + + */ +public class GoblinGardener extends CardImpl { + + public GoblinGardener(UUID ownerId) { + super(ownerId, 84, "Goblin Gardener", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "UDS"; + this.subtype.add("Goblin"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When Goblin Gardener dies, destroy target land. + Ability ability = new DiesTriggeredAbility(new DestroyTargetEffect(), false); + ability.addTarget(new TargetLandPermanent()); + this.addAbility(ability); + } + + public GoblinGardener(final GoblinGardener card) { + super(card); + } + + @Override + public GoblinGardener copy() { + return new GoblinGardener(this); + } +} From 53d524d360333697aefbdbbc8e432efc0c8ab3fb Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 24 Jun 2015 20:28:36 +0200 Subject: [PATCH 08/12] [ORI] Fixed card numbers. --- Mage.Sets/src/mage/sets/magicorigins/ActOfTreason.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/Disperse.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java | 2 +- Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magicorigins/ActOfTreason.java b/Mage.Sets/src/mage/sets/magicorigins/ActOfTreason.java index ab0270570c9..7e76135357c 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ActOfTreason.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ActOfTreason.java @@ -38,7 +38,7 @@ public class ActOfTreason extends mage.sets.magic2010.ActOfTreason { public ActOfTreason(UUID ownerId) { super(ownerId); - this.cardNumber = 999; + this.cardNumber = 129; this.expansionSetCode = "ORI"; this.rarity = Rarity.COMMON; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java b/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java index ab61208dc24..6637e48d694 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java +++ b/Mage.Sets/src/mage/sets/magicorigins/CatacombSlug.java @@ -37,7 +37,7 @@ public class CatacombSlug extends mage.sets.returntoravnica.CatacombSlug { public CatacombSlug(UUID ownerId) { super(ownerId); - this.cardNumber = 998; + this.cardNumber = 86; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java b/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java index 9415221491c..6d88b87ebc7 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ChandrasFury.java @@ -37,7 +37,7 @@ public class ChandrasFury extends mage.sets.magic2013.ChandrasFury { public ChandrasFury(UUID ownerId) { super(ownerId); - this.cardNumber = 997; + this.cardNumber = 136; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java b/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java index 60c62df9cbd..5ba9236cf96 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ChargingGriffin.java @@ -37,7 +37,7 @@ public class ChargingGriffin extends mage.sets.magic2014.ChargingGriffin { public ChargingGriffin(UUID ownerId) { super(ownerId); - this.cardNumber = 996; + this.cardNumber = 9; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java b/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java index ef033f9db46..876942979c2 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Claustrophobia.java @@ -37,7 +37,7 @@ public class Claustrophobia extends mage.sets.innistrad.Claustrophobia { public Claustrophobia(UUID ownerId) { super(ownerId); - this.cardNumber = 995; + this.cardNumber = 50; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java b/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java index 7c282ccd931..fcf25792886 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Cobblebrute.java @@ -37,7 +37,7 @@ public class Cobblebrute extends mage.sets.returntoravnica.Cobblebrute { public Cobblebrute(UUID ownerId) { super(ownerId); - this.cardNumber = 994; + this.cardNumber = 138; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java b/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java index c82e1c25a66..92d0760bf83 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java +++ b/Mage.Sets/src/mage/sets/magicorigins/CruelRevival.java @@ -37,7 +37,7 @@ public class CruelRevival extends mage.sets.onslaught.CruelRevival { public CruelRevival(UUID ownerId) { super(ownerId); - this.cardNumber = 993; + this.cardNumber = 88; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/Disperse.java b/Mage.Sets/src/mage/sets/magicorigins/Disperse.java index 962e36434b6..9338c14af4d 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/Disperse.java +++ b/Mage.Sets/src/mage/sets/magicorigins/Disperse.java @@ -37,7 +37,7 @@ public class Disperse extends mage.sets.scarsofmirrodin.Disperse { public Disperse(UUID ownerId) { super(ownerId); - this.cardNumber = 992; + this.cardNumber = 54; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java b/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java index 4b13a997457..d98a8eb514b 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java +++ b/Mage.Sets/src/mage/sets/magicorigins/ElvishVisionary.java @@ -37,7 +37,7 @@ public class ElvishVisionary extends mage.sets.shardsofalara.ElvishVisionary { public ElvishVisionary(UUID ownerId) { super(ownerId); - this.cardNumber = 991; + this.cardNumber = 175; this.expansionSetCode = "ORI"; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java b/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java index 92348e1805a..b0e9b90f317 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java +++ b/Mage.Sets/src/mage/sets/magicorigins/FieryConclusion.java @@ -37,7 +37,7 @@ public class FieryConclusion extends mage.sets.ravnica.FieryConclusion { public FieryConclusion(UUID ownerId) { super(ownerId); - this.cardNumber = 990; + this.cardNumber = 144; this.expansionSetCode = "ORI"; } From 21f61e5398c272a3fc02e297fc68526fabb1e747 Mon Sep 17 00:00:00 2001 From: fireshoes Date: Wed, 24 Jun 2015 13:53:58 -0500 Subject: [PATCH 09/12] Added Cleric of the Forward Order, Faerie Miscreant, Infectious Bloodlust, Managorger Hydra, Screaming Seahawk, Welkin Hawk, Daru Cavalier, Embermage Goblin, and Avarax --- .../sets/conspiracy/ScreamingSeahawk.java | 78 +++++++++++++ .../src/mage/sets/exodus/WelkinHawk.java | 78 +++++++++++++ .../magicorigins/ClericOfTheForwardOrder.java | 76 +++++++++++++ .../sets/magicorigins/FaerieMiscreant.java | 88 +++++++++++++++ .../magicorigins/InfectiousBloodlust.java | 103 ++++++++++++++++++ .../sets/magicorigins/ManagorgerHydra.java | 68 ++++++++++++ Mage.Sets/src/mage/sets/onslaught/Avarax.java | 85 +++++++++++++++ .../src/mage/sets/onslaught/DaruCavalier.java | 79 ++++++++++++++ .../mage/sets/onslaught/EmbermageGoblin.java | 86 +++++++++++++++ .../mage/sets/onslaught/ScreamingSeahawk.java | 52 +++++++++ Utils/mtg-cards-data.txt | 5 +- 11 files changed, 796 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/conspiracy/ScreamingSeahawk.java create mode 100644 Mage.Sets/src/mage/sets/exodus/WelkinHawk.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/ClericOfTheForwardOrder.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/FaerieMiscreant.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/ManagorgerHydra.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/Avarax.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/DaruCavalier.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/EmbermageGoblin.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/ScreamingSeahawk.java diff --git a/Mage.Sets/src/mage/sets/conspiracy/ScreamingSeahawk.java b/Mage.Sets/src/mage/sets/conspiracy/ScreamingSeahawk.java new file mode 100644 index 00000000000..a8517ec4b46 --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/ScreamingSeahawk.java @@ -0,0 +1,78 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.conspiracy; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author fireshoes + */ + +public class ScreamingSeahawk extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Screaming Seahawk"); + + static { + filter.add(new NamePredicate("Screaming Seahawk")); + } + + public ScreamingSeahawk(UUID ownerId) { + super(ownerId, 105, "Screaming Seahawk", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}"); + this.expansionSetCode = "CNS"; + this.subtype.add("Bird"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Screaming Seahawk enters the battlefield, you may search your library for a card named Screaming Seahawk, reveal it, and put it into your hand. If you do, shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + } + + public ScreamingSeahawk(final ScreamingSeahawk card) { + super(card); + } + + @Override + public ScreamingSeahawk copy() { + return new ScreamingSeahawk(this); + } +} diff --git a/Mage.Sets/src/mage/sets/exodus/WelkinHawk.java b/Mage.Sets/src/mage/sets/exodus/WelkinHawk.java new file mode 100644 index 00000000000..95663c9a621 --- /dev/null +++ b/Mage.Sets/src/mage/sets/exodus/WelkinHawk.java @@ -0,0 +1,78 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.exodus; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author fireshoes + */ + +public class WelkinHawk extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Welkin Hawk"); + + static { + filter.add(new NamePredicate("Welkin Hawk")); + } + + public WelkinHawk(UUID ownerId) { + super(ownerId, 25, "Welkin Hawk", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "EXO"; + this.subtype.add("Bird"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Welkin Hawk dies, you may search your library for a card named Welkin Hawk, reveal that card, put it into your hand, then shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new DiesTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + } + + public WelkinHawk(final WelkinHawk card) { + super(card); + } + + @Override + public WelkinHawk copy() { + return new WelkinHawk(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/ClericOfTheForwardOrder.java b/Mage.Sets/src/mage/sets/magicorigins/ClericOfTheForwardOrder.java new file mode 100644 index 00000000000..66cb48fac3c --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/ClericOfTheForwardOrder.java @@ -0,0 +1,76 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author fireshoes + */ +public class ClericOfTheForwardOrder extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each creature you control named Cleric of the Forward Order"); + + static { + filter.add(new NamePredicate("Cleric of the Forward Order")); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public ClericOfTheForwardOrder(UUID ownerId) { + super(ownerId, 10, "Cleric of the Forward Order", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Cleric of the Forward Order enters the battlefield, you gain 2 life for each creature you control named Cleric of the Forward Order. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)), false)); + } + + public ClericOfTheForwardOrder(final ClericOfTheForwardOrder card) { + super(card); + } + + @Override + public ClericOfTheForwardOrder copy() { + return new ClericOfTheForwardOrder(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magicorigins/FaerieMiscreant.java b/Mage.Sets/src/mage/sets/magicorigins/FaerieMiscreant.java new file mode 100644 index 00000000000..47771c5e4c1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/FaerieMiscreant.java @@ -0,0 +1,88 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author fireshoes + */ +public class FaerieMiscreant extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("you control another creature named Faerie Miscreant"); + + static { + filter.add(new NamePredicate("Faerie Miscreant")); + filter.add(new AnotherPredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public FaerieMiscreant(UUID ownerId) { + super(ownerId, 57, "Faerie Miscreant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{U}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Faerie"); + this.subtype.add("Rogue"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Faerie Miscreant enters the battlefield, if you control another creature named Faerie Miscreant, draw a card. + Ability ability = new ConditionalTriggeredAbility( + new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1), false), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0), + "When Faerie Miscreant enters the battlefield, if you control another creature named Faerie Miscreant, draw a card"); + this.addAbility(ability); + } + + public FaerieMiscreant(final FaerieMiscreant card) { + super(card); + } + + @Override + public FaerieMiscreant copy() { + return new FaerieMiscreant(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java b/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java new file mode 100644 index 00000000000..56631e05d85 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java @@ -0,0 +1,103 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magicorigins; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.AttacksEachTurnStaticAbility; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author fireshoes + */ +public class InfectiousBloodlust extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Infectious Bloodlust"); + + static { + filter.add(new NamePredicate("Infectious Bloodlust")); + } + + public InfectiousBloodlust(UUID ownerId) { + super(ownerId, 152, "Infectious Bloodlust", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +2/+1, has haste, and attacks each turn if able. + Effect effect = new BoostEnchantedEffect(2, 1); + effect.setText("Enchanted creature gets +2/+1"); + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); + effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.AURA); + effect.setText("has haste"); + ability.addEffect(effect); + effect = new GainAbilityAttachedEffect(new AttacksEachTurnStaticAbility(), AttachmentType.AURA); + effect.setText("and attacks each turn if able"); + ability.addEffect(effect); + this.addAbility(ability); + + // When enchanted creature dies, you may search your library for a card named Infectious Bloodlust, reveal it, put it into your hand, then shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new DiesAttachedTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), "enchanted creature", true)); + } + + public InfectiousBloodlust(final InfectiousBloodlust card) { + super(card); + } + + @Override + public InfectiousBloodlust copy() { + return new InfectiousBloodlust(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/ManagorgerHydra.java b/Mage.Sets/src/mage/sets/magicorigins/ManagorgerHydra.java new file mode 100644 index 00000000000..077a1d3fef2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/ManagorgerHydra.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; + +/** + * + * @author fireshoes + */ +public class ManagorgerHydra extends CardImpl { + + public ManagorgerHydra(UUID ownerId) { + super(ownerId, 186, "Managorger Hydra", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Hydra"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever a player casts a spell, put a +1/+1 counter on Managorger Hydra. + this.addAbility(new SpellCastAllTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + } + + public ManagorgerHydra(final ManagorgerHydra card) { + super(card); + } + + @Override + public ManagorgerHydra copy() { + return new ManagorgerHydra(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/Avarax.java b/Mage.Sets/src/mage/sets/onslaught/Avarax.java new file mode 100644 index 00000000000..b64642e74fa --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/Avarax.java @@ -0,0 +1,85 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.onslaught; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author fireshoes + */ +public class Avarax extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Avarax"); + + static { + filter.add(new NamePredicate("Avarax")); + } + + public Avarax(UUID ownerId) { + super(ownerId, 187, "Avarax", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); + this.expansionSetCode = "ONS"; + this.subtype.add("Beast"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // When Avarax enters the battlefield, you may search your library for a card named Avarax, reveal it, and put it into your hand. If you do, shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + + // {1}{R}: Avarax gets +1/+0 until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}"))); + } + + public Avarax(final Avarax card) { + super(card); + } + + @Override + public Avarax copy() { + return new Avarax(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/DaruCavalier.java b/Mage.Sets/src/mage/sets/onslaught/DaruCavalier.java new file mode 100644 index 00000000000..63e85ef2c4b --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/DaruCavalier.java @@ -0,0 +1,79 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.onslaught; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author fireshoes + */ + +public class DaruCavalier extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Daru Cavalier"); + + static { + filter.add(new NamePredicate("Daru Cavalier")); + } + + public DaruCavalier(UUID ownerId) { + super(ownerId, 18, "Daru Cavalier", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{W}"); + this.expansionSetCode = "ONS"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // When Daru Cavalier enters the battlefield, you may search your library for a card named Daru Cavalier, reveal it, and put it into your hand. If you do, shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + } + + public DaruCavalier(final DaruCavalier card) { + super(card); + } + + @Override + public DaruCavalier copy() { + return new DaruCavalier(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/EmbermageGoblin.java b/Mage.Sets/src/mage/sets/onslaught/EmbermageGoblin.java new file mode 100644 index 00000000000..2aef47a057c --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/EmbermageGoblin.java @@ -0,0 +1,86 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.onslaught; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetCreatureOrPlayer; + +/** + * + * @author fireshoes + */ + +public class EmbermageGoblin extends CardImpl { + + private static final FilterCard filter = new FilterCard("card named Embermage Goblin"); + + static { + filter.add(new NamePredicate("Embermage Goblin")); + } + + public EmbermageGoblin(UUID ownerId) { + super(ownerId, 200, "Embermage Goblin", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "ONS"; + this.subtype.add("Goblin"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // When Embermage Goblin enters the battlefield, you may search your library for a card named Embermage Goblin, reveal it, and put it into your hand. If you do, shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + + // {tap}: Embermage Goblin deals 1 damage to target creature or player. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); + ability.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(ability); + } + + public EmbermageGoblin(final EmbermageGoblin card) { + super(card); + } + + @Override + public EmbermageGoblin copy() { + return new EmbermageGoblin(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/ScreamingSeahawk.java b/Mage.Sets/src/mage/sets/onslaught/ScreamingSeahawk.java new file mode 100644 index 00000000000..889fe6088d5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/ScreamingSeahawk.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.onslaught; + +import java.util.UUID; + +/** + * + * @author fireshoes + */ +public class ScreamingSeahawk extends mage.sets.conspiracy.ScreamingSeahawk { + + public ScreamingSeahawk(UUID ownerId) { + super(ownerId); + this.cardNumber = 112; + this.expansionSetCode = "ONS"; + } + + public ScreamingSeahawk(final ScreamingSeahawk card) { + super(card); + } + + @Override + public ScreamingSeahawk copy() { + return new ScreamingSeahawk(this); + } +} diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 554d49edaad..29b43da0be7 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -26084,7 +26084,7 @@ Claustrophobia|Magic Origins|50|C|{1}{U}{U}|Enchantment - Aura|||$Enchant creatu Day's Undoing|Magic Origins|51|M|{2}{U}|Sorcery|||Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. If it's your turn, end the turn. (Exile all spells and abilities on the stack, including this card. Discard down to your maximum hand size. Damage wears off, and "this turn" and "until end of turn" effects end.)| Disperse|Magic Origins|54|C|{1}{U}|Instant|||Return target nonland permanent to its owner's hand.| Displacement Wave|Magic Origins|55|R|{X}{U}{U}|Sorcery|||Return all nonland permanents with converted mana cost X or less to their owners' hands.| -Faerie Miscrent|Magic Orgins|57|C|{U}|Creature - Faerie Rogue|1|1|Flying (This creature can't be blocked except by creatures with flying or reach.)$When Faerie Miscreant enters the battlefield, if you control another creature named Faerie Miscreants, draw a card.| +Faerie Miscreant|Magic Origins|57|C|{U}|Creature - Faerie Rogue|1|1|Flying (This creature can't be blocked except by creatures with flying or reach.)$When Faerie Miscreant enters the battlefield, if you control another creature named Faerie Miscreant, draw a card.| Hydrolash|Magic Origins|59|U|{2}{U}|Instant|||Attacking creatures get -2/-0 until end of turn.$Draw a card.| Jace, Telepath Unbound|Magic Origins|60|M||Planeswalker - Jace|5|+1: Up to one target creature gets -2/-0 until your next turn.$-3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.$-9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". $+1: Up to one target creature gets -2/-0 until your next turn.$-3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.$-9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". | Jace, Vryn's Prodigy|Magic Origins|60|M|{1}{U}|Legendary Creature - Human Wizard|0|2|{T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn''s Prodigy, then return him to the battefield transformed under his owner's control. ${T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn''s Prodigy, then return him to the battefield transformed under his owner's control. | @@ -26127,7 +26127,7 @@ Enthralling Victor|Magic Origins|142|U|{3}{R}|Creature - Human Warrior|3|2|When Fiery Conclusion|Magic Origins|144|C|{1}{R}|Instant|||As an additional cost to cast Fiery Conclusion, sacrifice a creature.$Fiery Conclusion deals 5 damage to target creature.| Fiery Impulse|Magic Origins|145|C|{R}|Instant|||Fiery Imulse deals 2 damage to target creature.$Spell mastery - If there are two or more instant and/or sorcery cards in your graveyard, Fiery Impulse deals 3 damage to that creature instead.| Flaeshadow Conjuring|Magic Origins|147|R|{3}{R}|Enchantment|||Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step.| -Infectious Bloodlust|Magic Origins|152|C|{1}{R}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +2/+1, has haste, and attacks each turn in able.$When enchanted creature dies, you may search your library for a card named Infectious Bloodlust, reveal it, put it into your hand, then shuffle your library.| +Infectious Bloodlust|Magic Origins|152|C|{1}{R}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +2/+1, has haste, and attacks each turn if able.$When enchanted creature dies, you may search your library for a card named Infectious Bloodlust, reveal it, put it into your hand, then shuffle your library.| Lightning Javelin|Magic Origins|153|C|{3}{R}|Sorcery|||Lightning Javelin deals 3 damage to target creature or player. Scry 1.| Pia and Kiran Nalaar|Magic Origins|157|R|{2}{R}{R}|Legendary Creature - Human Artificer|2|2|When Pia and Kiran Nalaar enters the battlefield put 2 1/1 colorless Thopter artifact creature tokens with flying onto the battlefield.${2}{R}, Sacrifice an artifact: Pia and Kiran Nalaar deals 2 damage to target creature or player.| Ravaging Blaze|Magic Origins|159|U|{X}{R}{R}|Instant|||Ravaging Blaze deals X damage to target creature. $Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.| @@ -26143,6 +26143,7 @@ Hitchclaw Recluse|Magic Origins|181|C|{2}{G}|Creature - Spider|1|4|Reach| Honored Hierarch|Magic Origins|182|R|{G}|Creature - Human Druid|1|1|Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.)$As long as Honored Hierarch is renowned, it has vigilance and "{t}: Add one mana of any color to your mana pool."| Joraga Invocation|Magic Origins|183|U|{4}{G}{G}|Sorcery|||Each creature you control gets +3/+3 until end of turn and must be blocked this turn if able.| Leaf Gilder|Magic Origins|184|C|{1}{G}|Creature - Elf Druid|2|1|{T}: Add {G} to your mana pool.| +Managorger Hydra|Magic Origins|186|R|{2}{G}|Creature - Hydra|1|1|Trample (This creature can deal excess combat damage to defending player or planeswalker while attacking.)$Whenever a player casts a spell, put a +1/+1 counter on Managorger Hydra.| Mantle of Webs|Magic Origins|187|C|{1}{G}|Enchantment - Aura|||Enchant Creature$Enchanted creature gets +1/+3 and has reach.| Nissa, Sage Animist|Magic Origins|189|M||Planeswalker - Nissa|3|+1: Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand.$-2: Put a legendary 4/4 green Elemental creature token named Ashaya, the Awoken World onto the battlefield.$-7: Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands.$| Nissa, Vastwood Seer|Magic Origins|189|M|{2}{G}|Legendary Creature - Elf Scout|2|2|When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library.$Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control.| From 76f989a7f0389923243a9f2298dfa8c728d5f278 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 25 Jun 2015 00:57:59 +0200 Subject: [PATCH 10/12] * Fixed a bug that prevented asThoughAs continuous effects correctly change controller (e.g. play lands from library with a controlled Courser of Kruphix did not work). --- .../abilities/effects/ContinuousEffects.java | 302 +++++++++--------- .../search/SearchLibraryPutInHandEffect.java | 23 +- 2 files changed, 167 insertions(+), 158 deletions(-) diff --git a/Mage/src/mage/abilities/effects/ContinuousEffects.java b/Mage/src/mage/abilities/effects/ContinuousEffects.java index 9cc59829286..333e964da87 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffects.java @@ -1,31 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.effects; import java.io.Serializable; @@ -138,7 +137,7 @@ public class ContinuousEffects implements Serializable { } private void collectAllEffects() { - allEffectsLists.add(layeredEffects); + allEffectsLists.add(layeredEffects); allEffectsLists.add(continuousRuleModifyingEffects); allEffectsLists.add(replacementEffects); allEffectsLists.add(preventionEffects); @@ -147,6 +146,9 @@ public class ContinuousEffects implements Serializable { allEffectsLists.add(restrictionUntapNotMoreThanEffects); allEffectsLists.add(costModificationEffects); allEffectsLists.add(spliceCardEffects); + for (ContinuousEffectsList continuousEffectsList : asThoughEffectsMap.values()) { + allEffectsLists.add(continuousEffectsList); + } } public ContinuousEffects copy() { @@ -168,7 +170,7 @@ public class ContinuousEffects implements Serializable { preventionEffects.removeEndOfCombatEffects(); requirementEffects.removeEndOfCombatEffects(); restrictionEffects.removeEndOfCombatEffects(); - for(ContinuousEffectsList asThoughtlist :asThoughEffectsMap.values()) { + for (ContinuousEffectsList asThoughtlist : asThoughEffectsMap.values()) { asThoughtlist.removeEndOfCombatEffects(); } costModificationEffects.removeEndOfCombatEffects(); @@ -182,7 +184,7 @@ public class ContinuousEffects implements Serializable { preventionEffects.removeEndOfTurnEffects(); requirementEffects.removeEndOfTurnEffects(); restrictionEffects.removeEndOfTurnEffects(); - for(ContinuousEffectsList asThoughtlist :asThoughEffectsMap.values()) { + for (ContinuousEffectsList asThoughtlist : asThoughEffectsMap.values()) { asThoughtlist.removeEndOfTurnEffects(); } costModificationEffects.removeEndOfTurnEffects(); @@ -197,7 +199,7 @@ public class ContinuousEffects implements Serializable { requirementEffects.removeInactiveEffects(game); restrictionEffects.removeInactiveEffects(game); restrictionUntapNotMoreThanEffects.removeInactiveEffects(game); - for(ContinuousEffectsList asThoughtlist :asThoughEffectsMap.values()) { + for (ContinuousEffectsList asThoughtlist : asThoughEffectsMap.values()) { asThoughtlist.removeInactiveEffects(game); } costModificationEffects.removeInactiveEffects(game); @@ -206,13 +208,13 @@ public class ContinuousEffects implements Serializable { public List getLayeredEffects(Game game) { List layerEffects = new ArrayList<>(); - for (ContinuousEffect effect: layeredEffects) { + for (ContinuousEffect effect : layeredEffects) { switch (effect.getDuration()) { case WhileOnBattlefield: case WhileOnStack: case WhileInGraveyard: HashSet abilities = layeredEffects.getAbility(effect.getId()); - for (Ability ability: abilities) { + for (Ability ability : abilities) { // If e.g. triggerd abilities (non static) created the effect, the ability must not be in usable zone (e.g. Unearth giving Haste effect) if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null)) { layerEffects.add(effect); @@ -232,9 +234,12 @@ public class ContinuousEffects implements Serializable { } /** - * Initially effect timestamp is set when game starts in game.loadCard method. - * After that timestamp should be updated whenever effect becomes "actual" meaning it becomes turned on - * that is defined by Ability.#isInUseableZone(Game, boolean) method in #getLayeredEffects(Game). + * Initially effect timestamp is set when game starts in game.loadCard + * method. After that timestamp should be updated whenever effect becomes + * "actual" meaning it becomes turned on that is defined by + * Ability.#isInUseableZone(Game, boolean) method in + * #getLayeredEffects(Game). + * * @param layerEffects */ private void updateTimestamps(List layerEffects) { @@ -254,7 +259,7 @@ public class ContinuousEffects implements Serializable { private List filterLayeredEffects(List effects, Layer layer) { List layerEffects = new ArrayList<>(); - for (ContinuousEffect effect: effects) { + for (ContinuousEffect effect : effects) { if (effect.hasLayer(layer)) { layerEffects.add(effect); } @@ -264,7 +269,7 @@ public class ContinuousEffects implements Serializable { public HashMap> getApplicableRequirementEffects(Permanent permanent, Game game) { HashMap> effects = new HashMap<>(); - for (RequirementEffect effect: requirementEffects) { + for (RequirementEffect effect : requirementEffects) { HashSet abilities = requirementEffects.getAbility(effect.getId()); HashSet applicableAbilities = new HashSet<>(); for (Ability ability : abilities) { @@ -283,7 +288,7 @@ public class ContinuousEffects implements Serializable { public HashMap> getApplicableRestrictionEffects(Permanent permanent, Game game) { HashMap> effects = new HashMap<>(); - for (RestrictionEffect effect: restrictionEffects) { + for (RestrictionEffect effect : restrictionEffects) { HashSet abilities = restrictionEffects.getAbility(effect.getId()); HashSet applicableAbilities = new HashSet<>(); for (Ability ability : abilities) { @@ -302,7 +307,7 @@ public class ContinuousEffects implements Serializable { public HashMap> getApplicableRestrictionUntapNotMoreThanEffects(Player player, Game game) { HashMap> effects = new HashMap<>(); - for (RestrictionUntapNotMoreThanEffect effect: restrictionUntapNotMoreThanEffects) { + for (RestrictionUntapNotMoreThanEffect effect : restrictionUntapNotMoreThanEffects) { HashSet abilities = restrictionUntapNotMoreThanEffects.getAbility(effect.getId()); HashSet applicableAbilities = new HashSet<>(); for (Ability ability : abilities) { @@ -318,24 +323,25 @@ public class ContinuousEffects implements Serializable { } return effects; } - + /** * * @param event * @param game - * @return a list of all {@link ReplacementEffect} that apply to the current event + * @return a list of all {@link ReplacementEffect} that apply to the current + * event */ - private HashMap> getApplicableReplacementEffects(GameEvent event, Game game) { + private HashMap> getApplicableReplacementEffects(GameEvent event, Game game) { HashMap> replaceEffects = new HashMap<>(); if (planeswalkerRedirectionEffect.checksEventType(event, game) && planeswalkerRedirectionEffect.applies(event, null, game)) { replaceEffects.put(planeswalkerRedirectionEffect, null); } - if(auraReplacementEffect.checksEventType(event, game) && auraReplacementEffect.applies(event, null, game)){ + if (auraReplacementEffect.checksEventType(event, game) && auraReplacementEffect.applies(event, null, game)) { replaceEffects.put(auraReplacementEffect, null); } // boolean checkLKI = event.getType().equals(EventType.ZONE_CHANGE) || event.getType().equals(EventType.DESTROYED_PERMANENT); //get all applicable transient Replacement effects - for (ReplacementEffect effect: replacementEffects) { + for (ReplacementEffect effect : replacementEffects) { if (!effect.checksEventType(event, game)) { continue; } @@ -362,7 +368,7 @@ public class ContinuousEffects implements Serializable { replaceEffects.put(effect, applicableAbilities); } } - for (PreventionEffect effect: preventionEffects) { + for (PreventionEffect effect : preventionEffects) { if (!effect.checksEventType(event, game)) { continue; } @@ -370,7 +376,7 @@ public class ContinuousEffects implements Serializable { // Effect already applied to this event, ignore it // TODO: Handle also gained effect that are connected to different abilities. continue; - } + } HashSet abilities = preventionEffects.getAbility(effect.getId()); HashSet applicableAbilities = new HashSet<>(); for (Ability ability : abilities) { @@ -390,11 +396,11 @@ public class ContinuousEffects implements Serializable { } private boolean checkAbilityStillExists(Ability ability, ContinuousEffect effect, GameEvent event, Game game) { - switch(effect.getDuration()) { // effects with fixed duration don't need an object with the source ability (e.g. a silence cast with isochronic Scepter has no more a card object + switch (effect.getDuration()) { // effects with fixed duration don't need an object with the source ability (e.g. a silence cast with isochronic Scepter has no more a card object case EndOfCombat: case EndOfGame: case EndOfStep: - case EndOfTurn: + case EndOfTurn: case OneUse: case Custom: // custom duration means the effect ends itself if needed return true; @@ -403,10 +409,10 @@ public class ContinuousEffects implements Serializable { return true; } MageObject object; - if (event.getType().equals(EventType.ZONE_CHANGE) && - ((ZoneChangeEvent)event).getFromZone().equals(Zone.BATTLEFIELD)&& - event.getTargetId().equals(ability.getSourceId())) { - object = ((ZoneChangeEvent)event).getTarget(); + if (event.getType().equals(EventType.ZONE_CHANGE) + && ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) + && event.getTargetId().equals(ability.getSourceId())) { + object = ((ZoneChangeEvent) event).getTarget(); } else { object = game.getObject(ability.getSourceId()); } @@ -417,23 +423,23 @@ public class ContinuousEffects implements Serializable { if (!object.getAbilities().contains(ability)) { exists = false; if (object instanceof PermanentCard) { - PermanentCard permanent = (PermanentCard)object; + PermanentCard permanent = (PermanentCard) object; if (permanent.canTransform() && event.getType() == GameEvent.EventType.TRANSFORMED) { exists = permanent.getCard().getAbilities().contains(ability); } } } else { - if (object instanceof PermanentCard) { - PermanentCard permanent = (PermanentCard)object; - if (permanent.isFaceDown(game) && !ability.getWorksFaceDown()) { - return false; - } - } else if (object instanceof Spell) { - Spell spell = (Spell)object; - if (spell.isFaceDown(game) && !ability.getWorksFaceDown()) { - return false; - } - } + if (object instanceof PermanentCard) { + PermanentCard permanent = (PermanentCard) object; + if (permanent.isFaceDown(game) && !ability.getWorksFaceDown()) { + return false; + } + } else if (object instanceof Spell) { + Spell spell = (Spell) object; + if (spell.isFaceDown(game) && !ability.getWorksFaceDown()) { + return false; + } + } } return exists; } @@ -447,7 +453,7 @@ public class ContinuousEffects implements Serializable { private List getApplicableCostModificationEffects(Game game) { List costEffects = new ArrayList<>(); - for (CostModificationEffect effect: costModificationEffects) { + for (CostModificationEffect effect : costModificationEffects) { HashSet abilities = costModificationEffects.getAbility(effect.getId()); for (Ability ability : abilities) { if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null)) { @@ -461,6 +467,7 @@ public class ContinuousEffects implements Serializable { return costEffects; } + /** * Filters out splice effects that are not active. * @@ -470,7 +477,7 @@ public class ContinuousEffects implements Serializable { private List getApplicableSpliceCardEffects(Game game, UUID playerId) { List spliceEffects = new ArrayList<>(); - for (SpliceCardEffect effect: spliceCardEffects) { + for (SpliceCardEffect effect : spliceCardEffects) { HashSet abilities = spliceCardEffects.getAbility(effect.getId()); for (Ability ability : abilities) { if (ability.getControllerId().equals(playerId) && (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null))) { @@ -491,13 +498,13 @@ public class ContinuousEffects implements Serializable { public boolean asThough(UUID objectId, AsThoughEffectType type, Ability affectedAbility, UUID controllerId, Game game) { List asThoughEffectsList = getApplicableAsThoughEffects(type, game); - for (AsThoughEffect effect: asThoughEffectsList) { + for (AsThoughEffect effect : asThoughEffectsList) { HashSet abilities = asThoughEffectsMap.get(type).getAbility(effect.getId()); for (Ability ability : abilities) { if (affectedAbility == null) { if (effect.applies(objectId, ability, controllerId, game)) { return true; - } + } } else { if (effect.applies(objectId, affectedAbility, ability, game)) { return true; @@ -506,9 +513,8 @@ public class ContinuousEffects implements Serializable { } } return false; - + } - /** * Filters out asThough effects that are not active. @@ -520,7 +526,7 @@ public class ContinuousEffects implements Serializable { private List getApplicableAsThoughEffects(AsThoughEffectType type, Game game) { List asThoughEffectsList = new ArrayList<>(); if (asThoughEffectsMap.containsKey(type)) { - for (AsThoughEffect effect: asThoughEffectsMap.get(type)) { + for (AsThoughEffect effect : asThoughEffectsMap.get(type)) { HashSet abilities = asThoughEffectsMap.get(type).getAbility(effect.getId()); for (Ability ability : abilities) { if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, null)) { @@ -537,55 +543,58 @@ public class ContinuousEffects implements Serializable { /** * 601.2e The player determines the total cost of the spell. Usually this is - * just the mana cost. Some spells have additional or alternative costs. Some - * effects may increase or reduce the cost to pay, or may provide other alternative costs. - * Costs may include paying mana, tapping permanents, sacrificing permanents, - * discarding cards, and so on. The total cost is the mana cost or alternative - * cost (as determined in rule 601.2b), plus all additional costs and cost increases, - * and minus all cost reductions. If the mana component of the total cost is reduced - * to nothing by cost reduction effects, it is considered to be {0}. - * It can’t be reduced to less than {0}. Once the total cost is determined, - * any effects that directly affect the total cost are applied. - * Then the resulting total cost becomes “locked in.” - * If effects would change the total cost after this time, they have no effect. + * just the mana cost. Some spells have additional or alternative costs. + * Some effects may increase or reduce the cost to pay, or may provide other + * alternative costs. Costs may include paying mana, tapping permanents, + * sacrificing permanents, discarding cards, and so on. The total cost is + * the mana cost or alternative cost (as determined in rule 601.2b), plus + * all additional costs and cost increases, and minus all cost reductions. + * If the mana component of the total cost is reduced to nothing by cost + * reduction effects, it is considered to be {0}. It can’t be reduced to + * less than {0}. Once the total cost is determined, any effects that + * directly affect the total cost are applied. Then the resulting total cost + * becomes “locked in.” If effects would change the total cost after this + * time, they have no effect. */ /** - * Inspects all {@link Permanent permanent's} {@link Ability abilities} on the battlefield - * for {@link CostModificationEffect cost modification effects} and applies them if necessary. + * Inspects all {@link Permanent permanent's} {@link Ability abilities} on + * the battlefield for + * {@link CostModificationEffect cost modification effects} and applies them + * if necessary. * * @param abilityToModify * @param game */ - public void costModification ( Ability abilityToModify, Game game ) { + public void costModification(Ability abilityToModify, Game game) { List costEffects = getApplicableCostModificationEffects(game); - for ( CostModificationEffect effect : costEffects) { - if(effect.getModificationType() == CostModificationType.INCREASE_COST){ + for (CostModificationEffect effect : costEffects) { + if (effect.getModificationType() == CostModificationType.INCREASE_COST) { HashSet abilities = costModificationEffects.getAbility(effect.getId()); for (Ability ability : abilities) { - if ( effect.applies(abilityToModify, ability, game) ) { + if (effect.applies(abilityToModify, ability, game)) { effect.apply(game, ability, abilityToModify); } } } } - - for ( CostModificationEffect effect : costEffects) { - if(effect.getModificationType() == CostModificationType.REDUCE_COST){ + + for (CostModificationEffect effect : costEffects) { + if (effect.getModificationType() == CostModificationType.REDUCE_COST) { HashSet abilities = costModificationEffects.getAbility(effect.getId()); for (Ability ability : abilities) { - if ( effect.applies(abilityToModify, ability, game) ) { + if (effect.applies(abilityToModify, ability, game)) { effect.apply(game, ability, abilityToModify); } } } } - - for ( CostModificationEffect effect : costEffects) { - if(effect.getModificationType() == CostModificationType.SET_COST){ + + for (CostModificationEffect effect : costEffects) { + if (effect.getModificationType() == CostModificationType.SET_COST) { HashSet abilities = costModificationEffects.getAbility(effect.getId()); for (Ability ability : abilities) { - if ( effect.applies(abilityToModify, ability, game) ) { + if (effect.applies(abilityToModify, ability, game)) { effect.apply(game, ability, abilityToModify); } } @@ -599,8 +608,8 @@ public class ContinuousEffects implements Serializable { * @param abilityToModify * @param game */ - public void applySpliceEffects ( Ability abilityToModify, Game game ) { - if ( ((SpellAbility) abilityToModify).getSpellAbilityType().equals(SpellAbilityType.SPLICE)) { + public void applySpliceEffects(Ability abilityToModify, Game game) { + if (((SpellAbility) abilityToModify).getSpellAbilityType().equals(SpellAbilityType.SPLICE)) { // on a spliced ability of a spell can't be spliced again return; } @@ -610,7 +619,7 @@ public class ContinuousEffects implements Serializable { for (SpliceCardEffect effect : spliceEffects) { HashSet abilities = spliceCardEffects.getAbility(effect.getId()); for (Ability ability : abilities) { - if (effect.applies(abilityToModify, ability, game) ) { + if (effect.applies(abilityToModify, ability, game)) { spliceAbilities.add((SpliceOntoArcaneAbility) ability); } } @@ -633,7 +642,7 @@ public class ContinuousEffects implements Serializable { UUID cardId = target.getFirstTarget(); if (cardId != null) { SpliceOntoArcaneAbility selectedAbility = null; - for(SpliceOntoArcaneAbility ability :spliceAbilities) { + for (SpliceOntoArcaneAbility ability : spliceAbilities) { if (ability.getSourceId().equals(cardId)) { selectedAbility = ability; break; @@ -654,15 +663,16 @@ public class ContinuousEffects implements Serializable { /** * Checks if an event won't happen because of an rule modifying effect - * + * * @param event * @param targetAbility ability the event is attached to. can be null. * @param game - * @param checkPlayableMode true if the event does not really happen but it's checked if the event would be replaced - * @return + * @param checkPlayableMode true if the event does not really happen but + * it's checked if the event would be replaced + * @return */ public boolean preventedByRuleModification(GameEvent event, Ability targetAbility, Game game, boolean checkPlayableMode) { - for (ContinuousRuleModifyingEffect effect: continuousRuleModifyingEffects) { + for (ContinuousRuleModifyingEffect effect : continuousRuleModifyingEffects) { if (!effect.checksEventType(event, game)) { continue; } @@ -692,17 +702,17 @@ public class ContinuousEffects implements Serializable { } } } - } + } return false; } - + public boolean replaceEvent(GameEvent event, Game game) { boolean caught = false; HashMap> consumed = new HashMap<>(); do { HashMap> rEffects = getApplicableReplacementEffects(event, game); // Remove all consumed effects (ability dependant) - for (Iterator it1 = rEffects.keySet().iterator(); it1.hasNext();){ + for (Iterator it1 = rEffects.keySet().iterator(); it1.hasNext();) { ReplacementEffect entry = it1.next(); if (consumed.containsKey(entry.getId())) { HashSet consumedAbilitiesIds = consumed.get(entry.getId()); @@ -774,7 +784,7 @@ public class ContinuousEffects implements Serializable { } break; } - } + } } if (rEffect != null) { @@ -814,14 +824,14 @@ public class ContinuousEffects implements Serializable { removeInactiveEffects(game); List layerEffects = getLayeredEffects(game); List layer = filterLayeredEffects(layerEffects, Layer.CopyEffects_1); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.CopyEffects_1, SubLayer.NA, ability, game); } } //Reload layerEffect if copy effects were applied - if (layer.size()>0) { + if (layer.size() > 0) { layerEffects = getLayeredEffects(game); } @@ -830,7 +840,7 @@ public class ContinuousEffects implements Serializable { // for cases when control over permanents with change control abilities is changed // e.g. Mind Control is controlled by Steal Enchantment while (true) { - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.ControlChangingEffects_2, SubLayer.NA, ability, game); @@ -844,21 +854,21 @@ public class ContinuousEffects implements Serializable { game.getBattlefield().resetPermanentsControl(); } layer = filterLayeredEffects(layerEffects, Layer.TextChangingEffects_3); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.TextChangingEffects_3, SubLayer.NA, ability, game); } } layer = filterLayeredEffects(layerEffects, Layer.TypeChangingEffects_4); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.TypeChangingEffects_4, SubLayer.NA, ability, game); } } layer = filterLayeredEffects(layerEffects, Layer.ColorChangingEffects_5); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.ColorChangingEffects_5, SubLayer.NA, ability, game); @@ -870,7 +880,7 @@ public class ContinuousEffects implements Serializable { while (!done) { // loop needed if a added effect adds again an effect (e.g. Level 5- of Joraga Treespeaker) done = true; layer = filterLayeredEffects(layerEffects, Layer.AbilityAddingRemovingEffects_6); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { if (layerEffects.contains(effect)) { List appliedAbilities = appliedEffects.get(effect); HashSet abilities = layeredEffects.getAbility(effect.getId()); @@ -890,38 +900,38 @@ public class ContinuousEffects implements Serializable { } } } - + layer = filterLayeredEffects(layerEffects, Layer.PTChangingEffects_7); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.PTChangingEffects_7, SubLayer.SetPT_7b, ability, game); } } - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, ability, game); } } - + applyCounters.apply(Layer.PTChangingEffects_7, SubLayer.Counters_7d, null, game); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.PTChangingEffects_7, SubLayer.SwitchPT_e, ability, game); } } layer = filterLayeredEffects(layerEffects, Layer.PlayerEffects); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.PlayerEffects, SubLayer.NA, ability, game); } } layer = filterLayeredEffects(layerEffects, Layer.RulesEffects); - for (ContinuousEffect effect: layer) { + for (ContinuousEffect effect : layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); for (Ability ability : abilities) { effect.apply(Layer.RulesEffects, SubLayer.NA, ability, game); @@ -930,9 +940,10 @@ public class ContinuousEffects implements Serializable { } /** - * Adds a continuous ability with a reference to a sourceId. - * It's used for effects that cease to exist again - * So this effects were removed again before each applyEffecs + * Adds a continuous ability with a reference to a sourceId. It's used for + * effects that cease to exist again So this effects were removed again + * before each applyEffecs + * * @param effect * @param sourceId * @param source @@ -962,32 +973,32 @@ public class ContinuousEffects implements Serializable { logger.error("Effect is null: " + source.toString()); return; } else if (source == null) { - logger.warn("Adding effect without ability : " +effect.toString()); - } + logger.warn("Adding effect without ability : " + effect.toString()); + } switch (effect.getEffectType()) { case REPLACEMENT: case REDIRECTION: - ReplacementEffect newReplacementEffect = (ReplacementEffect)effect; + ReplacementEffect newReplacementEffect = (ReplacementEffect) effect; replacementEffects.addEffect(newReplacementEffect, source); break; case PREVENTION: - PreventionEffect newPreventionEffect = (PreventionEffect)effect; + PreventionEffect newPreventionEffect = (PreventionEffect) effect; preventionEffects.addEffect(newPreventionEffect, source); break; case RESTRICTION: - RestrictionEffect newRestrictionEffect = (RestrictionEffect)effect; + RestrictionEffect newRestrictionEffect = (RestrictionEffect) effect; restrictionEffects.addEffect(newRestrictionEffect, source); break; case RESTRICTION_UNTAP_NOT_MORE_THAN: - RestrictionUntapNotMoreThanEffect newRestrictionUntapNotMoreThanEffect = (RestrictionUntapNotMoreThanEffect)effect; + RestrictionUntapNotMoreThanEffect newRestrictionUntapNotMoreThanEffect = (RestrictionUntapNotMoreThanEffect) effect; restrictionUntapNotMoreThanEffects.addEffect(newRestrictionUntapNotMoreThanEffect, source); break; case REQUIREMENT: - RequirementEffect newRequirementEffect = (RequirementEffect)effect; + RequirementEffect newRequirementEffect = (RequirementEffect) effect; requirementEffects.addEffect(newRequirementEffect, source); break; case ASTHOUGH: - AsThoughEffect newAsThoughEffect = (AsThoughEffect)effect; + AsThoughEffect newAsThoughEffect = (AsThoughEffect) effect; if (!asThoughEffectsMap.containsKey(newAsThoughEffect.getAsThoughEffectType())) { ContinuousEffectsList list = new ContinuousEffectsList<>(); allEffectsLists.add(list); @@ -996,18 +1007,18 @@ public class ContinuousEffects implements Serializable { asThoughEffectsMap.get(newAsThoughEffect.getAsThoughEffectType()).addEffect(newAsThoughEffect, source); break; case COSTMODIFICATION: - CostModificationEffect newCostModificationEffect = (CostModificationEffect)effect; + CostModificationEffect newCostModificationEffect = (CostModificationEffect) effect; costModificationEffects.addEffect(newCostModificationEffect, source); break; case SPLICE: - SpliceCardEffect newSpliceCardEffect = (SpliceCardEffect)effect; + SpliceCardEffect newSpliceCardEffect = (SpliceCardEffect) effect; spliceCardEffects.addEffect(newSpliceCardEffect, source); break; case CONTINUOUS_RULE_MODIFICATION: - ContinuousRuleModifyingEffect newContinuousRuleModifiyingEffect = (ContinuousRuleModifyingEffect)effect; + ContinuousRuleModifyingEffect newContinuousRuleModifiyingEffect = (ContinuousRuleModifyingEffect) effect; continuousRuleModifyingEffects.addEffect(newContinuousRuleModifiyingEffect, source); - break; - default: + break; + default: layeredEffects.addEffect(effect, source); break; } @@ -1063,7 +1074,7 @@ public class ContinuousEffects implements Serializable { requirementEffects.removeEffects(entry.getKey().getId(), entry.getValue()); break; case ASTHOUGH: - AsThoughEffect newAsThoughEffect = (AsThoughEffect)entry.getKey(); + AsThoughEffect newAsThoughEffect = (AsThoughEffect) entry.getKey(); if (!asThoughEffectsMap.containsKey(newAsThoughEffect.getAsThoughEffectType())) { break; } @@ -1091,10 +1102,10 @@ public class ContinuousEffects implements Serializable { Map texts = new LinkedHashMap<>(); for (Map.Entry> entry : rEffects.entrySet()) { if (entry.getValue() != null) { - for (Ability ability :entry.getValue()) { + for (Ability ability : entry.getValue()) { MageObject object = game.getObject(ability.getSourceId()); if (object != null) { - texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getName() +": " + ability.getRule(object.getName())); + texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName())); } else { texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), entry.getKey().getText(null)); } @@ -1109,10 +1120,10 @@ public class ContinuousEffects implements Serializable { public boolean existRequirementEffects() { return !requirementEffects.isEmpty(); } - + public UUID getControllerOfSourceId(UUID sourceId) { UUID controllerFound = null; - for (PreventionEffect effect: preventionEffects) { + for (PreventionEffect effect : preventionEffects) { HashSet abilities = preventionEffects.getAbility(effect.getId()); for (Ability ability : abilities) { if (ability.getSourceId().equals(sourceId)) { @@ -1125,7 +1136,7 @@ public class ContinuousEffects implements Serializable { } } } - for (ReplacementEffect effect: replacementEffects) { + for (ReplacementEffect effect : replacementEffects) { HashSet abilities = replacementEffects.getAbility(effect.getId()); for (Ability ability : abilities) { if (ability.getSourceId().equals(sourceId)) { @@ -1143,6 +1154,7 @@ public class ContinuousEffects implements Serializable { } class ContinuousEffectSorter implements Comparator, Serializable { + @Override public int compare(ContinuousEffect one, ContinuousEffect two) { return Long.compare(one.getOrder(), two.getOrder()); diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index 6d6733629e0..8c6c4e35228 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -1,16 +1,16 @@ /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,12 +20,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.search; import java.util.UUID; @@ -93,9 +92,9 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { if (controller.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { Cards cards = new CardsImpl(); - for (UUID cardId: target.getTargets()) { + for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); - if (card != null){ + if (card != null) { controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, revealCards); if (revealCards) { cards.add(card); @@ -106,7 +105,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { String name = "Reveal"; Card sourceCard = game.getCard(source.getSourceId()); if (sourceCard != null) { - name = sourceCard.getName(); + name = sourceCard.getIdName(); } controller.revealCards(name, cards, game); } @@ -126,14 +125,12 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); sb.append(target.getTargetName()).append(revealCards ? ", reveal them, " : "").append(" and put them into your hand"); - } - else { + } else { sb.append("a ").append(target.getTargetName()).append(revealCards ? ", reveal it, " : "").append(" and put that card into your hand"); } if (forceShuffle) { sb.append(". Then shuffle your library"); - } - else { + } else { sb.append(". If you do, shuffle your library"); } staticText = sb.toString(); From 81934e32e35c807f6ca5b518a491c5f87fb935af Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 25 Jun 2015 01:07:34 +0200 Subject: [PATCH 11/12] * Revealing the top card of the library is now also shown by an extra window (no longer hiding life). Now Iconyfying and deiconifying does not change the postion of the reveal window. Iconifyed window width was a bit raised to be able to read more of the title in that state. --- .../src/main/java/mage/client/MageFrame.java | 127 ++-- .../main/java/mage/client/cards/Cards.java | 118 ++-- .../client/components/MageDesktopManager.java | 64 ++ .../client/dialog/CardInfoWindowDialog.java | 98 ++-- .../main/java/mage/client/game/GamePanel.java | 549 +++++++++--------- .../java/mage/client/game/PlayerPanelExt.java | 498 ++++++++-------- .../mage/client/util/gui/GuiDisplayUtil.java | 117 ++-- 7 files changed, 833 insertions(+), 738 deletions(-) create mode 100644 Mage.Client/src/main/java/mage/client/components/MageDesktopManager.java diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 3848dc7941e..73b71ead8b3 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -1,30 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.client; import java.awt.AlphaComposite; @@ -85,6 +85,7 @@ import mage.cards.repository.CardRepository; import mage.client.cards.BigCard; import mage.client.chat.ChatPanel; import mage.client.components.MageComponents; +import mage.client.components.MageDesktopManager; import mage.client.components.MageJDesktop; import mage.client.components.MageRoundPane; import mage.client.components.MageUI; @@ -156,7 +157,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { private static final Preferences prefs = Preferences.userNodeForPackage(MageFrame.class); private JLabel title; private Rectangle titleRectangle; - private static final MageVersion version = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO); + private static final MageVersion version = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO); private UUID clientId; private static MagePane activeFrame; private static boolean liteMode = false; @@ -211,7 +212,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { */ public MageFrame() { setWindowTitle(); - + clientId = UUID.randomUUID(); EDTExceptionHandler.registerExceptionHandler(); addWindowListener(new WindowAdapter() { @@ -236,6 +237,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { Plugins.getInstance().loadPlugins(); initComponents(); + + desktopPane.setDesktopManager(new MageDesktopManager()); + setSize(1024, 768); SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768); DialogManager.updateParams(768, 1024, false); @@ -366,9 +370,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } public void setWindowTitle() { - setTitle(TITLE_NAME + " Client: " + setTitle(TITLE_NAME + " Client: " + version == null ? "" : version.toString() + " Server: " - + ((session != null && session.isConnected()) ? session.getVersionInfo():"")); + + ((session != null && session.isConnected()) ? session.getVersionInfo() : "")); } private void addTooltipContainer() { @@ -585,7 +589,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (frame instanceof GamePane) { ArrowBuilder.getBuilder().showPanel(((GamePane) frame).getGameId()); MusicPlayer.playBGM(); - }else{ + } else { MusicPlayer.stopBGM(); } } @@ -596,7 +600,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (activeFrame != frame) { frame.deactivated(); } - + } private static MagePane getTopMost(MagePane exclude) { @@ -618,11 +622,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { return topmost; } - /** + /** * Shows a game for a player of the game - * + * * @param gameId - * @param playerId + * @param playerId */ public void showGame(UUID gameId, UUID playerId) { try { @@ -638,7 +642,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { public void watchGame(UUID gameId) { try { - for(Component component :desktopPane.getComponents()) { + for (Component component : desktopPane.getComponents()) { if (component instanceof GamePane && ((GamePane) component).getGameId().equals(gameId)) { setActive((GamePane) component); @@ -678,7 +682,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } catch (PropertyVetoException ex) { } } - + public void endDraft(UUID draftId) { // inform all open draft panes about for (JInternalFrame window : desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)) { @@ -688,12 +692,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } } } - + public void showTournament(UUID tournamentId) { try { - for(Component component :desktopPane.getComponents()) { - if (component instanceof TournamentPane && - ((TournamentPane) component).getTournamentId().equals(tournamentId)) { + for (Component component : desktopPane.getComponents()) { + if (component instanceof TournamentPane + && ((TournamentPane) component).getTournamentId().equals(tournamentId)) { setActive((TournamentPane) component); return; } @@ -759,12 +763,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { connection.setProxyPort(proxyPort); connection.setProxyUsername(proxyUsername); connection.setProxyPassword(proxyPassword); - + setUserPrefsToConnection(connection); - + logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername); - if (MageFrame.connect(connection)) { - showGames(false); + if (MageFrame.connect(connection)) { + showGames(false); return true; } else { showMessage("Unable to connect to server"); @@ -778,12 +782,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { public void setUserPrefsToConnection(Connection connection) { connection.setUserData(PreferencesDialog.getUserData()); } - + /** - * This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -957,7 +960,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { session.disconnect(false); tablesPane.clearChat(); setWindowTitle(); - showMessage("You have disconnected"); + showMessage("You have disconnected"); } } else { connectDialog.showDialog(); @@ -1005,7 +1008,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } } CardRepository.instance.closeDB(); - tablesPane.cleanUp(); + tablesPane.cleanUp(); Plugins.getInstance().shutdown(); dispose(); System.exit(0); @@ -1029,7 +1032,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { this.tablesPane.hideTables(); } - public void showGames(boolean setActive) { + public void showGames(boolean setActive) { MagePane topPanebefore = getTopMost(tablesPane); if (!tablesPane.isVisible()) { this.tablesPane.setVisible(true); @@ -1042,9 +1045,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (topPanebefore != null) { setActive(topPanebefore); } - } + } } - + public void hideGames() { JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER); for (JInternalFrame window : windows) { @@ -1063,8 +1066,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { // close & remove sideboarding or construction pane if open if (window instanceof DeckEditorPane) { DeckEditorPane deckEditorPane = (DeckEditorPane) window; - if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.LIMITED_BUILDING) - || deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.SIDEBOARDING)){ + if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.LIMITED_BUILDING) + || deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.SIDEBOARDING)) { deckEditorPane.removeFrame(); } } @@ -1091,7 +1094,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } } } - + try { DeckEditorPane deckEditorPane = new DeckEditorPane(); desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER); @@ -1167,7 +1170,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { * @param args the command line arguments */ public static void main(final String args[]) { - // Workaround for #451 + // Workaround for #451 System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); logger.info("Starting MAGE client version " + version); logger.info("Logging level: " + logger.getEffectiveLevel()); @@ -1205,7 +1208,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } instance = new MageFrame(); instance.setVisible(true); - + } }); } @@ -1269,7 +1272,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { public static void removeGame(UUID gameId) { games.remove(gameId); } - public static DraftPanel getDraft(UUID draftId) { return drafts.get(draftId); @@ -1280,7 +1282,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (draftPanel != null) { drafts.remove(draftId); draftPanel.hideDraft(); - } + } } public static void addDraft(UUID draftId, DraftPanel draftPanel) { @@ -1368,6 +1370,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } class MagePaneMenuItem extends JCheckBoxMenuItem { + private final MagePane frame; public MagePaneMenuItem(MagePane frame) { diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index 14c7109b1bc..abe5da510c6 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -1,37 +1,36 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ /* * Cards.java * * Created on Dec 18, 2009, 10:40:12 AM */ - package mage.client.cards; import java.awt.Color; @@ -72,19 +71,21 @@ public class Cards extends javax.swing.JPanel { private static final int GAP_X = 5; // needed for marking cards with coloured fram (e.g. on hand) private String zone; - private static final Border emptyBorder = new EmptyBorder(0,0,0,0); + private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0); private int minOffsetY = 0; /** - * Defines whether component should be visible whenever there is no objects within. - * True by default. + * Defines whether component should be visible whenever there is no objects + * within. True by default. */ private boolean isVisibleIfEmpty = true; private Dimension cardDimension; - /** Creates new form Cards */ + /** + * Creates new form Cards + */ public Cards() { this(false); } @@ -93,7 +94,7 @@ public class Cards extends javax.swing.JPanel { initComponents(skipAddingScrollPane); setOpaque(false); //cardArea.setOpaque(false); - setBackgroundColor(new Color(0,0,0,100)); + setBackgroundColor(new Color(0, 0, 0, 100)); if (!skipAddingScrollPane) { jScrollPane1.setOpaque(false); jScrollPane1.getViewport().setOpaque(false); @@ -105,10 +106,12 @@ public class Cards extends javax.swing.JPanel { cardArea.setBorder(emptyBorder); } - public void cleanUp() {} + public void cleanUp() { + } /** * Sets components background color + * * @param color */ public void setBackgroundColor(Color color) { @@ -151,14 +154,14 @@ public class Cards extends javax.swing.JPanel { if (cardsView.size() == 0 && countCards() > 0) { // problem happens with transformable cards logger.fatal("Card object on the cards panel was not removed"); - for (Component comp: cardArea.getComponents()) { + for (Component comp : cardArea.getComponents()) { if (comp instanceof Card) { - Card card = (Card)comp; + Card card = (Card) comp; logger.fatal("Card name:" + card.getName() + " type:" + card.getType(null)); } else if (comp instanceof MageCard) { - MageCard mageCard = (MageCard)comp; + MageCard mageCard = (MageCard) comp; logger.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText()); - } else { + } else { logger.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName()); } cardArea.remove(comp); @@ -167,24 +170,24 @@ public class Cards extends javax.swing.JPanel { // order objects for display java.util.List orderedList = new ArrayList<>(); - for (CardView card: cardsView.values()) { + for (CardView card : cardsView.values()) { orderedList.add(0, card); } // add objects to the panel - for (CardView card: orderedList) { + for (CardView card : orderedList) { if (dontDisplayTapped) { if (card instanceof PermanentView) { - ((PermanentView)card).overrideTapped(false); + ((PermanentView) card).overrideTapped(false); } } if (card instanceof StackAbilityView) { - CardView tmp = ((StackAbilityView)card).getSourceCard(); + CardView tmp = ((StackAbilityView) card).getSourceCard(); tmp.overrideRules(card.getRules()); tmp.setIsAbility(true); tmp.overrideTargets(card.getTargets()); tmp.overrideId(card.getId()); - tmp.setAbilityType(((StackAbilityView)card).getAbilityType()); + tmp.setAbilityType(((StackAbilityView) card).getAbilityType()); card = tmp; } else { card.setAbilityType(null); @@ -212,11 +215,15 @@ public class Cards extends javax.swing.JPanel { } public void sizeCards(Dimension cardDimension) { - cardArea.setPreferredSize(new Dimension((int)((cards.size()) * (cardDimension.getWidth() + GAP_X)) + 20, (int)(cardDimension.getHeight()) + 20)); + cardArea.setPreferredSize(new Dimension((int) ((cards.size()) * (cardDimension.getWidth() + GAP_X)) + 20, (int) (cardDimension.getHeight()) + 20)); cardArea.revalidate(); cardArea.repaint(); } + public int getNumberOfCards() { + return cards.size(); + } + private Dimension getCardDimension() { if (cardDimension == null) { cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight); @@ -237,23 +244,23 @@ public class Cards extends javax.swing.JPanel { private void definePosition(MageCard card) { int dx = 0; - for (Component comp: cardArea.getComponents()) { + for (Component comp : cardArea.getComponents()) { if (!comp.equals(card)) { - dx = Math.max(dx, (int)comp.getLocation().getX()); + dx = Math.max(dx, (int) comp.getLocation().getX()); } } - dx += ((CardPanel)card).getCardWidth() + GAP_X; - card.setLocation(dx, (int)card.getLocation().getY()); + dx += ((CardPanel) card).getCardWidth() + GAP_X; + card.setLocation(dx, (int) card.getLocation().getY()); } private void removeCard(UUID cardId) { - for (Component comp: cardArea.getComponents()) { + for (Component comp : cardArea.getComponents()) { if (comp instanceof Card) { - if (((Card)comp).getCardId().equals(cardId)) { + if (((Card) comp).getCardId().equals(cardId)) { cardArea.remove(comp); } } else if (comp instanceof MageCard) { - if (((MageCard)comp).getOriginal().getId().equals(cardId)) { + if (((MageCard) comp).getOriginal().getId().equals(cardId)) { cardArea.remove(comp); } } @@ -264,10 +271,10 @@ public class Cards extends javax.swing.JPanel { return cardArea.getComponentCount(); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -288,7 +295,6 @@ public class Cards extends javax.swing.JPanel { } }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel cardArea; private javax.swing.JScrollPane jScrollPane1; @@ -320,7 +326,7 @@ public class Cards extends javax.swing.JPanel { for (Component component : cardArea.getComponents()) { if (component instanceof CardPanel) { - cards.add((CardPanel)component); + cards.add((CardPanel) component); } } Collections.sort(cards, new Comparator() { diff --git a/Mage.Client/src/main/java/mage/client/components/MageDesktopManager.java b/Mage.Client/src/main/java/mage/client/components/MageDesktopManager.java new file mode 100644 index 00000000000..89ec52318f6 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/components/MageDesktopManager.java @@ -0,0 +1,64 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.client.components; + +import java.awt.BorderLayout; +import javax.swing.DefaultDesktopManager; +import javax.swing.DesktopManager; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; +import mage.client.dialog.CardInfoWindowDialog; + +/** + * + * @author LevelX2 + */ +public class MageDesktopManager extends DefaultDesktopManager { + + static final int DESKTOP_ICON_WIDTH = 250; + + @Override + public void iconifyFrame(JInternalFrame f) { + super.iconifyFrame(f); + if (f instanceof CardInfoWindowDialog) { + JInternalFrame.JDesktopIcon icon = f.getDesktopIcon(); + icon.setBounds(f.getX() + (f.getWidth() - DESKTOP_ICON_WIDTH), f.getY(), DESKTOP_ICON_WIDTH, icon.getHeight()); + } + } + + @Override + public void deiconifyFrame(JInternalFrame f) { + super.deiconifyFrame(f); + if (f instanceof CardInfoWindowDialog) { + JInternalFrame.JDesktopIcon icon = f.getDesktopIcon(); + f.setBounds(icon.getX() + (DESKTOP_ICON_WIDTH - f.getWidth()), icon.getY(), f.getWidth(), f.getHeight()); + } + } + + public static void main(String args[]) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JDesktopPane desktopPane = new JDesktopPane(); + DesktopManager dm = new MageDesktopManager(); + desktopPane.setDesktopManager(dm); + JInternalFrame internalFrame = new JInternalFrame("Test Internal Frame", true, false, true, true); + internalFrame.setSize(200, 150); + internalFrame.setVisible(true); + desktopPane.add(internalFrame); + + frame.add(desktopPane, BorderLayout.CENTER); + frame.setSize(800, 600); + frame.setVisible(true); + } + }); + } +} diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index 3d7eb809835..a0abd01fbf6 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -1,42 +1,39 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ /* * CardInfoWindowDialog.java * * Created on Feb 1, 2010, 3:00:35 PM */ - package mage.client.dialog; import java.awt.Point; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.beans.PropertyVetoException; import java.util.UUID; import java.util.logging.Level; @@ -61,7 +58,10 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl; */ public class CardInfoWindowDialog extends MageDialog { - public static enum ShowType { REVEAL, LOOKED_AT, EXILE, GRAVEYARD, OTHER }; + public static enum ShowType { + + REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER + }; private ShowType showType; private boolean positioned; @@ -75,7 +75,7 @@ public class CardInfoWindowDialog extends MageDialog { initComponents(); this.setModal(false); - switch(this.showType) { + switch (this.showType) { case LOOKED_AT: this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getLookedAtImage())); this.setClosable(true); @@ -84,9 +84,12 @@ public class CardInfoWindowDialog extends MageDialog { this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getRevealedImage())); this.setClosable(true); break; + case REVEAL_TOP_LIBRARY: + this.setFrameIcon(new ImageIcon(ImageHelper.getImageFromResources("/info/library.png"))); + this.setClosable(true); + break; case GRAVEYARD: this.setFrameIcon(new ImageIcon(ImageHelper.getImageFromResources("/info/grave.png"))); - this.setIconifiable(false); this.setClosable(true); this.setDefaultCloseOperation(HIDE_ON_CLOSE); addInternalFrameListener(new InternalFrameAdapter() { @@ -100,7 +103,7 @@ public class CardInfoWindowDialog extends MageDialog { this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage())); break; default: - // no icon yet + // no icon yet } this.setTitelBarToolTip(name); } @@ -123,6 +126,19 @@ public class CardInfoWindowDialog extends MageDialog { showAndPositionWindow(); } + @Override + public void show() { + if (showType.equals(ShowType.EXILE)) { + if (cards == null || cards.getNumberOfCards() == 0) { + return; + } + } + super.show(); + if (positioned) { // check if in frame rectangle + showAndPositionWindow(); + } + } + private void showAndPositionWindow() { SwingUtilities.invokeLater(new Runnable() { @Override @@ -132,13 +148,13 @@ public class CardInfoWindowDialog extends MageDialog { if (width > 0 && height > 0) { Point centered = SettingsManager.getInstance().getComponentPosition(width, height); if (!positioned) { - positioned = true; int xPos = centered.x / 2; int yPos = centered.y / 2; CardInfoWindowDialog.this.setLocation(xPos, yPos); show(); + positioned = true; } - GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, CardInfoWindowDialog.this); + GuiDisplayUtil.keepComponentInsideFrame(centered.x, centered.y, CardInfoWindowDialog.this); } } }); @@ -155,16 +171,15 @@ public class CardInfoWindowDialog extends MageDialog { Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex); } } - } - else { + } else { this.hideDialog(); } } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -191,7 +206,6 @@ public class CardInfoWindowDialog extends MageDialog { pack(); }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables private mage.client.cards.Cards cards; // End of variables declaration//GEN-END:variables diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index ade062dacb9..fea201e9fa4 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -1,30 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.client.game; import java.awt.BorderLayout; @@ -133,7 +133,6 @@ import mage.view.SimpleCardsView; import org.apache.log4j.Logger; import org.mage.plugins.card.utils.impl.ImageManagerImpl; - /** * * @author BetaSteward_at_googlemail.com, nantuko8 @@ -145,14 +144,14 @@ public final class GamePanel extends javax.swing.JPanel { private static final int X_PHASE_WIDTH = 55; private static final int STACK_MIN_CARDS_OFFSET_Y = 7; private final Map players = new HashMap<>(); - + // non modal frames private final Map exiles = new HashMap<>(); private final Map revealed = new HashMap<>(); private final Map lookedAt = new HashMap<>(); private final Map graveyardWindows = new HashMap<>(); private final Map graveyards = new HashMap<>(); - + private final ArrayList pickTarget = new ArrayList<>(); private UUID gameId; private UUID playerId; // playerId of the player @@ -164,15 +163,15 @@ public final class GamePanel extends javax.swing.JPanel { private String chosenHandKey = "You"; private boolean smallMode = false; private boolean initialized = false; - + private boolean menuNameSet = false; private boolean handCardsOfOpponentAvailable = false; - + private Map loadedCards = new HashMap<>(); - private int storedHeight; + private int storedHeight; private Map hoverButtons; - + private MageDialogState choiceWindowState; public GamePanel() { @@ -248,37 +247,37 @@ public final class GamePanel extends javax.swing.JPanel { this.handContainer.cleanUp(); this.stack.cleanUp(); - for(Map.Entry playAreaPanelEntry: players.entrySet()) { + for (Map.Entry playAreaPanelEntry : players.entrySet()) { playAreaPanelEntry.getValue().CleanUp(); } this.players.clear(); - + jLayeredPane.remove(abilityPicker); this.abilityPicker.cleanUp(); jLayeredPane.remove(DialogManager.getManager(gameId)); DialogManager.removeGame(gameId); - + if (pickNumber != null) { pickNumber.removeDialog(); } - for (CardInfoWindowDialog exileDialog: exiles.values()) { + for (CardInfoWindowDialog exileDialog : exiles.values()) { exileDialog.cleanUp(); exileDialog.removeDialog(); } - for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) { + for (CardInfoWindowDialog graveyardDialog : graveyardWindows.values()) { graveyardDialog.cleanUp(); graveyardDialog.removeDialog(); } - for (CardInfoWindowDialog revealDialog: revealed.values()) { + for (CardInfoWindowDialog revealDialog : revealed.values()) { revealDialog.cleanUp(); revealDialog.removeDialog(); } - for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) { + for (CardInfoWindowDialog lookedAtDialog : lookedAt.values()) { lookedAtDialog.cleanUp(); lookedAtDialog.removeDialog(); } - for (ShowCardsDialog pickTargetDialog: pickTarget) { + for (ShowCardsDialog pickTargetDialog : pickTarget) { pickTargetDialog.cleanUp(); pickTargetDialog.removeDialog(); } @@ -290,7 +289,7 @@ public final class GamePanel extends javax.swing.JPanel { logger.fatal("popupContainer error:", ex); } jPanel2.remove(bigCard); - this.bigCard = null; + this.bigCard = null; } private void saveDividerLocations() { @@ -340,12 +339,11 @@ public final class GamePanel extends javax.swing.JPanel { pnlShortCuts.revalidate(); pnlShortCuts.repaint(); //this.handContainer.sizeHand(0.8, smallMode); - for (PlayAreaPanel p: players.values()) { + for (PlayAreaPanel p : players.values()) { p.sizePlayer(smallMode); } } - } - else { + } else { if (smallMode) { smallMode = false; Dimension bbDimension = new Dimension(256, 367); @@ -355,7 +353,7 @@ public final class GamePanel extends javax.swing.JPanel { pnlShortCuts.revalidate(); pnlShortCuts.repaint(); this.handContainer.sizeHand(1, smallMode); - for (PlayAreaPanel p: players.values()) { + for (PlayAreaPanel p : players.values()) { p.sizePlayer(smallMode); } } @@ -388,14 +386,14 @@ public final class GamePanel extends javax.swing.JPanel { this.btnSkipToNextMain.setVisible(true); this.btnSkipStack.setVisible(true); this.btnSkipToYourTurn.setVisible(true); - + this.pnlReplay.setVisible(false); - + this.gameChatPanel.clear(); this.gameChatPanel.connect(session.getGameChatId(gameId)); if (!session.joinGame(gameId)) { removeGame(); - } else { + } else { // play start sound AudioManager.playYourGameStarted(); } @@ -410,7 +408,6 @@ public final class GamePanel extends javax.swing.JPanel { this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); - this.btnConcede.setVisible(false); this.btnStopWatching.setVisible(true); this.btnSwitchHands.setVisible(false); @@ -421,8 +418,8 @@ public final class GamePanel extends javax.swing.JPanel { this.btnSkipToEndTurn.setVisible(false); this.btnSkipToNextMain.setVisible(false); this.btnSkipStack.setVisible(false); - this.btnSkipToYourTurn.setVisible(false); - + this.btnSkipToYourTurn.setVisible(false); + this.pnlReplay.setVisible(false); this.gameChatPanel.clear(); this.gameChatPanel.connect(session.getGameChatId(gameId)); @@ -464,7 +461,7 @@ public final class GamePanel extends javax.swing.JPanel { c = c.getParent(); } if (c != null) { - ((GamePane)c).removeGame(); + ((GamePane) c).removeGame(); } } @@ -489,7 +486,7 @@ public final class GamePanel extends javax.swing.JPanel { int row = 1; int playerSeat = 0; if (playerId != null) { - for (PlayerView player: game.getPlayers()) { + for (PlayerView player : game.getPlayers()) { if (playerId.equals(player.getPlayerId())) { break; } @@ -497,7 +494,7 @@ public final class GamePanel extends javax.swing.JPanel { } } PlayerView player = game.getPlayers().get(playerSeat); - PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this, + PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this, new PlayAreaPanelOptions(game.isPlayer(), true, game.isRollbackTurnsAllowed())); players.put(player.getPlayerId(), sessionPlayer); GridBagConstraints c = new GridBagConstraints(); @@ -521,8 +518,7 @@ public final class GamePanel extends javax.swing.JPanel { while (true) { if (row == 1) { col++; - } - else { + } else { col--; } if (col >= numColumns) { @@ -549,7 +545,7 @@ public final class GamePanel extends javax.swing.JPanel { break; } } - for (PlayAreaPanel p: players.values()) { + for (PlayAreaPanel p : players.values()) { p.sizePlayer(smallMode); } } @@ -565,7 +561,7 @@ public final class GamePanel extends javax.swing.JPanel { this.handContainer.setVisible(true); handCards.clear(); if (game.getWatchedHands() != null) { - for (Map.Entry hand: game.getWatchedHands().entrySet()) { + for (Map.Entry hand : game.getWatchedHands().entrySet()) { handCards.put(hand.getKey(), CardsViewUtil.convertSimple(hand.getValue(), loadedCards)); } } @@ -581,7 +577,7 @@ public final class GamePanel extends javax.swing.JPanel { } // Get opponents hand cards if available (only possible for players) if (game.getOpponentHands() != null) { - for (Map.Entry hand: game.getOpponentHands().entrySet()) { + for (Map.Entry hand : game.getOpponentHands().entrySet()) { handCards.put(hand.getKey(), CardsViewUtil.convertSimple(hand.getValue(), loadedCards)); } } @@ -597,11 +593,10 @@ public final class GamePanel extends javax.swing.JPanel { hideAll(); - if (playerId != null) { // set visible only if we have any other hand visible than ours btnSwitchHands.setVisible(handCards.size() > 1); - boolean change = (handCardsOfOpponentAvailable != (game.getOpponentHands() != null)); + boolean change = (handCardsOfOpponentAvailable != (game.getOpponentHands() != null)); if (change) { handCardsOfOpponentAvailable = !handCardsOfOpponentAvailable; if (handCardsOfOpponentAvailable) { @@ -620,7 +615,7 @@ public final class GamePanel extends javax.swing.JPanel { } else { this.txtPhase.setText(""); } - + if (game.getStep() != null) { updatePhases(game.getStep()); this.txtStep.setText(game.getStep().toString()); @@ -646,7 +641,7 @@ public final class GamePanel extends javax.swing.JPanel { } } - for (PlayerView player: game.getPlayers()) { + for (PlayerView player : game.getPlayers()) { if (players.containsKey(player.getPlayerId())) { if (!possibleAttackers.isEmpty()) { for (UUID permanentId : possibleAttackers) { @@ -660,7 +655,6 @@ public final class GamePanel extends javax.swing.JPanel { updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved()); } // update open or remove closed graveyard windows - graveyards.put(player.getName(), player.getGraveyard()); if (graveyardWindows.containsKey(player.getName())) { CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(player.getName()); @@ -670,12 +664,18 @@ public final class GamePanel extends javax.swing.JPanel { cardInfoWindowDialog.loadCards(player.getGraveyard(), bigCard, gameId); } } + // show top card window + if (player.getTopCard() != null) { + CardsView cardsView = new CardsView(); + cardsView.put(player.getTopCard().getId(), player.getTopCard()); + handleGameInfoWindow(revealed, ShowType.REVEAL_TOP_LIBRARY, player.getName() + "'s top library card", cardsView); + } } else { logger.warn("Couldn't find player."); logger.warn(" uuid:" + player.getPlayerId()); logger.warn(" players:"); for (PlayAreaPanel p : players.values()) { - logger.warn(""+p); + logger.warn("" + p); } } } @@ -687,7 +687,7 @@ public final class GamePanel extends javax.swing.JPanel { sb.append("Playing: "); } boolean first = true; - for (PlayerView player: game.getPlayers()) { + for (PlayerView player : game.getPlayers()) { if (first) { first = false; } else { @@ -702,7 +702,7 @@ public final class GamePanel extends javax.swing.JPanel { GameManager.getInstance().setStackSize(game.getStack().size()); displayStack(game, bigCard, feedbackPanel, gameId); - for (ExileView exile: game.getExile()) { + for (ExileView exile : game.getExile()) { if (!exiles.containsKey(exile.getId())) { CardInfoWindowDialog newExile = new CardInfoWindowDialog(ShowType.EXILE, exile.getName()); exiles.put(exile.getId(), newExile); @@ -711,7 +711,7 @@ public final class GamePanel extends javax.swing.JPanel { } exiles.get(exile.getId()).loadCards(exile, bigCard, gameId); } - + showRevealed(game); showLookedAt(game); if (game.getCombat().size() > 0) { @@ -725,49 +725,50 @@ public final class GamePanel extends javax.swing.JPanel { this.revalidate(); this.repaint(); } - + static final int BORDER_SIZE = 2; private void updateSkipButtons(boolean turn, boolean endOfTurn, boolean nextMain, boolean allTurns, boolean stack) { if (turn) { //F4 btnSkipToNextTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE)); } else { - btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE)); + btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); } if (endOfTurn) { // F5 btnSkipToEndTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE)); } else { - btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE)); + btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); } if (nextMain) { // F7 btnSkipToNextMain.setBorder(new LineBorder(Color.red, BORDER_SIZE)); } else { - btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE)); + btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); } if (stack) { // F8 btnSkipStack.setBorder(new LineBorder(Color.red, BORDER_SIZE)); } else { - btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE)); + btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); } if (allTurns) { // F9 btnSkipToYourTurn.setBorder(new LineBorder(Color.red, BORDER_SIZE)); } else { - btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE,BORDER_SIZE)); + btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); } } /** * Set the same state for menu selections to all player areas. - * @param manaPoolAutomatic - * @param manaPoolAutomaticRestricted + * + * @param manaPoolAutomatic + * @param manaPoolAutomaticRestricted */ public void setMenuStates(boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted) { - for(PlayAreaPanel playAreaPanel: players.values()) { - playAreaPanel.setMenuStates(manaPoolAutomatic, manaPoolAutomaticRestricted); - } + for (PlayAreaPanel playAreaPanel : players.values()) { + playAreaPanel.setMenuStates(manaPoolAutomatic, manaPoolAutomaticRestricted); + } } - + private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) { this.stack.loadCards(game.getStack(), bigCard, gameId, null); } @@ -828,43 +829,43 @@ public final class GamePanel extends javax.swing.JPanel { currentStep.setLocation(prevPoint.x - 15, prevPoint.y); } } - + // Called if the game frame is deactivated because the tabled the deck editor or other frames go to foreground public void deactivated() { // hide the non modal windows (because otherwise they are shown on top of the new active pane) - for (CardInfoWindowDialog exileDialog: exiles.values()) { + for (CardInfoWindowDialog exileDialog : exiles.values()) { exileDialog.hideDialog(); } - for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) { + for (CardInfoWindowDialog graveyardDialog : graveyardWindows.values()) { graveyardDialog.hideDialog(); } - for (CardInfoWindowDialog revealDialog: revealed.values()) { + for (CardInfoWindowDialog revealDialog : revealed.values()) { revealDialog.hideDialog(); } - for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) { + for (CardInfoWindowDialog lookedAtDialog : lookedAt.values()) { lookedAtDialog.hideDialog(); - } + } } - + // Called if the game frame comes to front again public void activated() { // hide the non modal windows (because otherwise they are shown on top of the new active pane) - for (CardInfoWindowDialog exileDialog: exiles.values()) { + for (CardInfoWindowDialog exileDialog : exiles.values()) { exileDialog.show(); } - for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) { + for (CardInfoWindowDialog graveyardDialog : graveyardWindows.values()) { graveyardDialog.show(); } - for (CardInfoWindowDialog revealDialog: revealed.values()) { + for (CardInfoWindowDialog revealDialog : revealed.values()) { revealDialog.show(); } - for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) { + for (CardInfoWindowDialog lookedAtDialog : lookedAt.values()) { lookedAtDialog.show(); - } - } - + } + } + public void openGraveyardWindow(String playerName) { - if(graveyardWindows.containsKey(playerName)) { + if (graveyardWindows.containsKey(playerName)) { CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName); if (cardInfoWindowDialog.isVisible()) { cardInfoWindowDialog.hideDialog(); @@ -878,21 +879,33 @@ public final class GamePanel extends javax.swing.JPanel { MageFrame.getDesktop().add(newGraveyard, JLayeredPane.MODAL_LAYER); newGraveyard.loadCards(graveyards.get(playerName), bigCard, gameId); } - + + public void openTopLibraryWindow(String playerName) { + String title = playerName + "'s top library card"; + if (revealed.containsKey(title)) { + CardInfoWindowDialog cardInfoWindowDialog = revealed.get(title); + if (cardInfoWindowDialog.isVisible()) { + cardInfoWindowDialog.hideDialog(); + } else { + cardInfoWindowDialog.show(); + } + } + } + private void showRevealed(GameView game) { - for (RevealedView revealView: game.getRevealed()) { + for (RevealedView revealView : game.getRevealed()) { handleGameInfoWindow(revealed, ShowType.REVEAL, revealView.getName(), revealView.getCards()); } removeClosedCardInfoWindows(revealed); } private void showLookedAt(GameView game) { - for (LookedAtView lookedAtView: game.getLookedAt()) { + for (LookedAtView lookedAtView : game.getLookedAt()) { handleGameInfoWindow(lookedAt, ShowType.LOOKED_AT, lookedAtView.getName(), lookedAtView.getCards()); } removeClosedCardInfoWindows(lookedAt); } - + private void handleGameInfoWindow(Map windowMap, ShowType showType, String name, LinkedHashMap cardsView) { CardInfoWindowDialog cardInfoWindowDialog; if (!windowMap.containsKey(name)) { @@ -904,8 +917,9 @@ public final class GamePanel extends javax.swing.JPanel { } if (cardInfoWindowDialog != null && !cardInfoWindowDialog.isClosed()) { - switch(showType) { + switch (showType) { case REVEAL: + case REVEAL_TOP_LIBRARY: cardInfoWindowDialog.loadCards((CardsView) cardsView, bigCard, gameId); break; case LOOKED_AT: @@ -914,31 +928,33 @@ public final class GamePanel extends javax.swing.JPanel { } } } - + private void removeClosedCardInfoWindows(Map windowMap) { // Remove closed window objects from the maps for (Iterator> iterator = windowMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = iterator.next(); if (entry.getValue().isClosed()) { iterator.remove(); - } - } + } + } } - + public void ask(String question, GameView gameView, int messageId) { updateGame(gameView); this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, false, null, messageId); } + /** - * Shows a pick target dialog and allows the player to pick a target (e.g. the pick triggered ability) - * + * Shows a pick target dialog and allows the player to pick a target (e.g. + * the pick triggered ability) + * * @param message * @param cardView * @param gameView * @param targets * @param required * @param options - * @param messageId + * @param messageId */ public void pickTarget(String message, CardsView cardView, GameView gameView, Set targets, boolean required, Map options, int messageId) { ShowCardsDialog dialog = null; @@ -948,7 +964,7 @@ public final class GamePanel extends javax.swing.JPanel { if (options.containsKey("chosen")) { choosen = (List) options.get("chosen"); } - for(CardView card: gameView.getHand().values()) { + for (CardView card : gameView.getHand().values()) { if (targets == null || targets.isEmpty()) { card.setPlayable(false); card.setChoosable(true); @@ -968,7 +984,7 @@ public final class GamePanel extends javax.swing.JPanel { dialog = showCards(message, cardView, required, options0); options0.put("dialog", dialog); } - this.feedbackPanel.getFeedback(required?FeedbackMode.INFORM:FeedbackMode.CANCEL, message, gameView.getSpecial(), options0, messageId); + this.feedbackPanel.getFeedback(required ? FeedbackMode.INFORM : FeedbackMode.CANCEL, message, gameView.getSpecial(), options0, messageId); if (dialog != null) { this.pickTarget.add(dialog); } @@ -1009,13 +1025,13 @@ public final class GamePanel extends javax.swing.JPanel { if (gameView.getActivePlayerId().equals(playerId)) { activePlayerText = "Your turn"; } else { - activePlayerText = gameView.getActivePlayerName() +"'s turn"; + activePlayerText = gameView.getActivePlayerName() + "'s turn"; } String priorityPlayerText = ""; if (controllingPlayer) { priorityPlayerText = " / priority " + gameView.getPriorityPlayerName(); } - String messageToDisplay = message + "
" + activePlayerText +" / " + gameView.getStep().toString() + priorityPlayerText + "
"; + String messageToDisplay = message + "
" + activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText + "
"; this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), panelOptions, messageId); } @@ -1044,7 +1060,7 @@ public final class GamePanel extends javax.swing.JPanel { private void hideAll() { ActionCallback callback = Plugins.getInstance().getActionCallback(); - ((MageActionCallback)callback).hideGameUpdate(gameId); + ((MageActionCallback) callback).hideGameUpdate(gameId); } private ShowCardsDialog showCards(String title, CardsView cards, boolean required, Map options) { @@ -1058,8 +1074,7 @@ public final class GamePanel extends javax.swing.JPanel { pickNumber.showDialog(min, max, message); if (pickNumber.isCancel()) { session.sendPlayerBoolean(gameId, false); - } - else { + } else { session.sendPlayerInteger(gameId, pickNumber.getAmount()); } } @@ -1067,7 +1082,7 @@ public final class GamePanel extends javax.swing.JPanel { public void getChoice(Choice choice, UUID objectId) { hideAll(); PickChoiceDialog pickChoice = new PickChoiceDialog(); - pickChoice.showDialog(choice, objectId,choiceWindowState); + pickChoice.showDialog(choice, objectId, choiceWindowState); if (choice.isKeyChoice()) { if (pickChoice.isAutoSelect()) { session.sendPlayerString(gameId, "#" + choice.getChoiceKey()); @@ -1077,7 +1092,7 @@ public final class GamePanel extends javax.swing.JPanel { } else { session.sendPlayerString(gameId, choice.getChoice()); } - choiceWindowState = new MageDialogState(pickChoice); + choiceWindowState = new MageDialogState(pickChoice); pickChoice.removeDialog(); } @@ -1116,15 +1131,15 @@ public final class GamePanel extends javax.swing.JPanel { feedbackPanel = new mage.client.game.FeedbackPanel(); txtSpellsCast = new javax.swing.JLabel(); - Font font = new Font("SansSerif", Font.BOLD,12); + Font font = new Font("SansSerif", Font.BOLD, 12); txtSpellsCast.setFont(font); - Border paddingBorder = BorderFactory.createEmptyBorder(4,4,4,4); - Border border = BorderFactory.createLineBorder(Color.DARK_GRAY,2); - txtSpellsCast.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder)); + Border paddingBorder = BorderFactory.createEmptyBorder(4, 4, 4, 4); + Border border = BorderFactory.createLineBorder(Color.DARK_GRAY, 2); + txtSpellsCast.setBorder(BorderFactory.createCompoundBorder(border, paddingBorder)); txtSpellsCast.setBackground(Color.LIGHT_GRAY); txtSpellsCast.setOpaque(true); txtSpellsCast.setToolTipText("spells cast during the current turn"); - + btnCancelSkip = new javax.swing.JButton(); // F3 btnSkipToNextTurn = new javax.swing.JButton(); // F4 btnSkipToEndTurn = new javax.swing.JButton(); // F5 @@ -1135,7 +1150,7 @@ public final class GamePanel extends javax.swing.JPanel { btnConcede = new javax.swing.JButton(); btnSwitchHands = new javax.swing.JButton(); btnStopWatching = new javax.swing.JButton(); - + bigCard = new mage.client.cards.BigCard(); stack = new mage.client.cards.Cards(); pnlReplay = new javax.swing.JPanel(); @@ -1190,7 +1205,7 @@ public final class GamePanel extends javax.swing.JPanel { lblTurn.setLabelFor(txtTurn); lblTurn.setText("Turn:"); - + txtTurn.setText("Turn"); txtTurn.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true)); txtTurn.setMinimumSize(new java.awt.Dimension(0, 16)); @@ -1209,14 +1224,14 @@ public final class GamePanel extends javax.swing.JPanel { lblPriority.setLabelFor(txtPriority); lblPriority.setText("Priority Player:"); - feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50),2)); + feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2)); feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121)); feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121)); bigCard.setBorder(new LineBorder(Color.black, 1, true)); - + int c = JComponent.WHEN_IN_FOCUSED_WINDOW; - + KeyStroke ks3 = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0); this.getInputMap(c).put(ks3, "F3_PRESS"); this.getActionMap().put("F3_PRESS", new AbstractAction() { @@ -1225,9 +1240,9 @@ public final class GamePanel extends javax.swing.JPanel { restorePriorityActionPerformed(actionEvent); } }); - + btnCancelSkip.setContentAreaFilled(false); - btnCancelSkip.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnCancelSkip.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnCancelSkip.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCancelSkipButtonImage())); btnCancelSkip.setToolTipText("Cancel all skip actions (F3)."); btnCancelSkip.setFocusable(false); @@ -1241,7 +1256,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnSkipToNextTurn.setContentAreaFilled(false); - btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToNextTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipNextTurnButtonImage())); btnSkipToNextTurn.setToolTipText("Skip to next turn (F4)."); btnSkipToNextTurn.setFocusable(false); @@ -1264,7 +1279,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnSkipToEndTurn.setContentAreaFilled(false); - btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToEndTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipEndTurnButtonImage())); btnSkipToEndTurn.setToolTipText("Skip to (opponents/next) end of turn step (F5) - adjust using preferences."); btnSkipToEndTurn.setFocusable(false); @@ -1287,7 +1302,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnSkipToNextMain.setContentAreaFilled(false); - btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToNextMain.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipMainButtonImage())); btnSkipToNextMain.setToolTipText("Skip to (your) next main phase (F7) - adjust using preferences."); btnSkipToNextMain.setFocusable(false); @@ -1310,7 +1325,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnSkipToYourTurn.setContentAreaFilled(false); - btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToYourTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipYourNextTurnButtonImage())); btnSkipToYourTurn.setToolTipText("Skip to your next turn (F9)."); btnSkipToYourTurn.setFocusable(false); @@ -1333,7 +1348,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnSkipStack.setContentAreaFilled(false); - btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipStack.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipStackButtonImage())); btnSkipStack.setToolTipText("Skip until stack is resolved (F10)."); btnSkipStack.setFocusable(false); @@ -1356,7 +1371,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnConcede.setContentAreaFilled(false); - btnConcede.setBorder(new EmptyBorder(BORDER_SIZE,BORDER_SIZE,BORDER_SIZE, BORDER_SIZE)); + btnConcede.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnConcede.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getConcedeButtonImage())); btnConcede.setToolTipText("Concede the current game."); btnConcede.setFocusable(false); @@ -1369,7 +1384,6 @@ public final class GamePanel extends javax.swing.JPanel { } }); - KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); this.getInputMap(c).put(ks2, "F2_PRESS"); this.getActionMap().put("F2_PRESS", new AbstractAction() { @@ -1387,7 +1401,7 @@ public final class GamePanel extends javax.swing.JPanel { @Override public void actionPerformed(ActionEvent actionEvent) { ActionCallback callback = Plugins.getInstance().getActionCallback(); - ((MageActionCallback)callback).enlargeCard(EnlargeMode.NORMAL); + ((MageActionCallback) callback).enlargeCard(EnlargeMode.NORMAL); } }); @@ -1397,7 +1411,7 @@ public final class GamePanel extends javax.swing.JPanel { @Override public void actionPerformed(ActionEvent actionEvent) { ActionCallback callback = Plugins.getInstance().getActionCallback(); - ((MageActionCallback)callback).enlargeCard(EnlargeMode.ALTERNATE); + ((MageActionCallback) callback).enlargeCard(EnlargeMode.ALTERNATE); } }); @@ -1442,12 +1456,12 @@ public final class GamePanel extends javax.swing.JPanel { @Override public void actionPerformed(ActionEvent actionEvent) { ActionCallback callback = Plugins.getInstance().getActionCallback(); - ((MageActionCallback)callback).hideEnlargedCard(); + ((MageActionCallback) callback).hideEnlargedCard(); } }); btnSwitchHands.setContentAreaFilled(false); - btnSwitchHands.setBorder(new EmptyBorder(0,0,0,0)); + btnSwitchHands.setBorder(new EmptyBorder(0, 0, 0, 0)); btnSwitchHands.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSwitchHandsButtonImage())); btnSwitchHands.setFocusable(false); btnSwitchHands.setToolTipText("Switch between your hand cards and hand cards of controlled players."); @@ -1461,7 +1475,7 @@ public final class GamePanel extends javax.swing.JPanel { }); btnStopWatching.setContentAreaFilled(false); - btnStopWatching.setBorder(new EmptyBorder(0,0,0,0)); + btnStopWatching.setBorder(new EmptyBorder(0, 0, 0, 0)); btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getStopWatchButtonImage())); btnStopWatching.setFocusable(false); btnStopWatching.setToolTipText("Stop watching this game."); @@ -1475,7 +1489,7 @@ public final class GamePanel extends javax.swing.JPanel { }); stack.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)); - stack.setBackgroundColor(new Color(0,0,0,0)); + stack.setBackgroundColor(new Color(0, 0, 0, 0)); btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png"))); btnStopReplay.addActionListener(new java.awt.event.ActionListener() { @@ -1516,84 +1530,83 @@ public final class GamePanel extends javax.swing.JPanel { btnPreviousPlayActionPerformed(evt); } }); - + // Replay panel to control replay of games javax.swing.GroupLayout gl_pnlReplay = new javax.swing.GroupLayout(pnlReplay); pnlReplay.setLayout(gl_pnlReplay); gl_pnlReplay.setHorizontalGroup( - gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(gl_pnlReplay.createSequentialGroup() - .addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnStopReplay, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnNextPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnSkipForward, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)) + gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(gl_pnlReplay.createSequentialGroup() + .addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnStopReplay, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnNextPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnSkipForward, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)) ); gl_pnlReplay.setVerticalGroup( - gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(btnSkipForward, 0, 0, Short.MAX_VALUE) - .addComponent(btnNextPlay, 0, 0, Short.MAX_VALUE) - .addComponent(btnStopReplay, 0, 0, Short.MAX_VALUE) - .addComponent(btnPlay, 0, 0, Short.MAX_VALUE) - .addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, Short.MAX_VALUE) + gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(btnSkipForward, 0, 0, Short.MAX_VALUE) + .addComponent(btnNextPlay, 0, 0, Short.MAX_VALUE) + .addComponent(btnStopReplay, 0, 0, Short.MAX_VALUE) + .addComponent(btnPlay, 0, 0, Short.MAX_VALUE) + .addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, Short.MAX_VALUE) ); // Game info panel (buttons on the right panel) javax.swing.GroupLayout gl_pnlShortCuts = new javax.swing.GroupLayout(pnlShortCuts); pnlShortCuts.setLayout(gl_pnlShortCuts); gl_pnlShortCuts.setHorizontalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addComponent(btnSkipToNextTurn) + .addComponent(btnSkipToEndTurn) + .addComponent(btnSkipToNextMain) + .addComponent(btnSkipToYourTurn) + .addComponent(btnSkipStack) + ) + .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addComponent(txtSpellsCast) + .addComponent(btnSwitchHands) + .addComponent(btnCancelSkip) + .addComponent(btnConcede) + .addComponent(btnStopWatching) + ) + //.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + //.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + //.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + + .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addContainerGap() + .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(51, Short.MAX_VALUE)) + ); + gl_pnlShortCuts.setVerticalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(gl_pnlShortCuts.createSequentialGroup() + //.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + //.addGap(1, 1, 1) + //.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) + //.addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE) + .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnSkipToNextTurn) .addComponent(btnSkipToEndTurn) .addComponent(btnSkipToNextMain) .addComponent(btnSkipToYourTurn) .addComponent(btnSkipStack) ) - .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtSpellsCast) .addComponent(btnSwitchHands) .addComponent(btnCancelSkip) .addComponent(btnConcede) .addComponent(btnStopWatching) ) - //.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) - //.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) - //.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) - - .addGroup(gl_pnlShortCuts.createSequentialGroup() - .addContainerGap() - .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(51, Short.MAX_VALUE)) - ); - gl_pnlShortCuts.setVerticalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(gl_pnlShortCuts.createSequentialGroup() - //.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - //.addGap(1, 1, 1) - //.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) - //.addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE) - .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - - .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(btnSkipToNextTurn) - .addComponent(btnSkipToEndTurn) - .addComponent(btnSkipToNextMain) - .addComponent(btnSkipToYourTurn) - .addComponent(btnSkipStack) - ) - .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(txtSpellsCast) - .addComponent(btnSwitchHands) - .addComponent(btnCancelSkip) - .addComponent(btnConcede) - .addComponent(btnStopWatching) - ) - ) + ) ); pnlBattlefield.setLayout(new java.awt.GridBagLayout()); @@ -1602,7 +1615,7 @@ public final class GamePanel extends javax.swing.JPanel { jPhases.setBackground(new Color(0, 0, 0, 0)); jPhases.setLayout(null); jPhases.setPreferredSize(new Dimension(X_PHASE_WIDTH, 435)); - + MouseAdapter phasesMouseAdapter = new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { @@ -1610,18 +1623,17 @@ public final class GamePanel extends javax.swing.JPanel { } }; String[] phases = {"Untap", "Upkeep", "Draw", "Main1", - "Combat_Start", "Combat_Attack", "Combat_Block", "Combat_Damage", "Combat_End", - "Main2", "Cleanup", "Next_Turn"}; + "Combat_Start", "Combat_Attack", "Combat_Block", "Combat_Damage", "Combat_End", + "Main2", "Cleanup", "Next_Turn"}; for (String name : phases) { createPhaseButton(name, phasesMouseAdapter); } - int i = 0; for (String name : hoverButtons.keySet()) { HoverButton hoverButton = hoverButtons.get(name); hoverButton.setAlignmentX(LEFT_ALIGNMENT); - hoverButton.setBounds(X_PHASE_WIDTH - 36, i*36, 36, 36); + hoverButton.setBounds(X_PHASE_WIDTH - 36, i * 36, 36, 36); jPhases.add(hoverButton); i++; } @@ -1644,26 +1656,26 @@ public final class GamePanel extends javax.swing.JPanel { JPanel empty1 = new JPanel(); empty1.setBackground(new Color(0, 0, 0, 0)); phasesContainer.add(empty1, ratio); - phasesContainer.add(jPhases); - + phasesContainer.add(jPhases); + javax.swing.GroupLayout gl_jPanel3 = new javax.swing.GroupLayout(jPanel3); gl_jPanel3.setHorizontalGroup( - gl_jPanel3.createParallelGroup(Alignment.LEADING) + gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() -// .addGap(0) + // .addGap(0) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ) - .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addComponent(pnlShortCuts, 400, 400, 400) - .addComponent(stack, 400, 400, 400) + .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) + .addComponent(pnlShortCuts, 400, 400, 400) + .addComponent(stack, 400, 400, 400) ) ) .addGap(0) - //.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + //.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_jPanel3.createSequentialGroup() .addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) .addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) @@ -1671,24 +1683,24 @@ public final class GamePanel extends javax.swing.JPanel { ); gl_jPanel3.setVerticalGroup( gl_jPanel3.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_jPanel3.createSequentialGroup() - .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) - .addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_jPanel3.createSequentialGroup() + .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) + .addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) + .addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + ) + //.addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) + .addGroup(gl_jPanel3.createSequentialGroup() + .addGap(2) + .addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ) - //.addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addGroup(gl_jPanel3.createSequentialGroup() - .addGap(2) - .addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - ) - .addGroup(gl_jPanel3.createSequentialGroup() - .addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(handContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - ) + .addGroup(gl_jPanel3.createSequentialGroup() + .addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(handContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ) ) + ) ); jPanel3.setLayout(gl_jPanel3); @@ -1697,15 +1709,18 @@ public final class GamePanel extends javax.swing.JPanel { // Set individual area sizes of big card pane GridBagLayout gbl = new GridBagLayout(); - jPanel2.setLayout( gbl ); + jPanel2.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; - gbc.gridx = 0; gbc.gridy = 0; - gbc.gridwidth = 1; gbc.gridheight = 4; // size 4/5 - gbc.weightx = 1.0; gbc.weighty = 1.0; - gbl.setConstraints( bigCard, gbc ); - jPanel2.add( bigCard ); + gbc.gridx = 0; + gbc.gridy = 0; + gbc.gridwidth = 1; + gbc.gridheight = 4; // size 4/5 + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbl.setConstraints(bigCard, gbc); + jPanel2.add(bigCard); jPanel2.setOpaque(false); @@ -1717,82 +1732,82 @@ public final class GamePanel extends javax.swing.JPanel { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE) ); layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE) ); } private void removeListener() { - for (MouseListener ml :this.getMouseListeners()) { + for (MouseListener ml : this.getMouseListeners()) { this.removeMouseListener(ml); } - for (MouseListener ml :this.btnCancelSkip.getMouseListeners()) { + for (MouseListener ml : this.btnCancelSkip.getMouseListeners()) { this.btnCancelSkip.removeMouseListener(ml); } - for (MouseListener ml :this.btnConcede.getMouseListeners()) { + for (MouseListener ml : this.btnConcede.getMouseListeners()) { this.btnConcede.removeMouseListener(ml); } - for (MouseListener ml :this.btnSkipToYourTurn.getMouseListeners()) { + for (MouseListener ml : this.btnSkipToYourTurn.getMouseListeners()) { this.btnSkipToYourTurn.removeMouseListener(ml); } - for (MouseListener ml :this.btnSkipStack.getMouseListeners()) { + for (MouseListener ml : this.btnSkipStack.getMouseListeners()) { this.btnSkipStack.removeMouseListener(ml); } - for (MouseListener ml :this.btnSkipToEndTurn.getMouseListeners()) { + for (MouseListener ml : this.btnSkipToEndTurn.getMouseListeners()) { this.btnSkipToEndTurn.removeMouseListener(ml); } - for (MouseListener ml :this.btnSkipToNextMain.getMouseListeners()) { + for (MouseListener ml : this.btnSkipToNextMain.getMouseListeners()) { this.btnSkipToNextMain.removeMouseListener(ml); } - for (MouseListener ml :this.btnSkipToNextTurn.getMouseListeners()) { + for (MouseListener ml : this.btnSkipToNextTurn.getMouseListeners()) { this.btnSkipToNextTurn.removeMouseListener(ml); } - for (MouseListener ml :this.btnSwitchHands.getMouseListeners()) { + for (MouseListener ml : this.btnSwitchHands.getMouseListeners()) { this.btnSwitchHands.removeMouseListener(ml); } - for (MouseListener ml :this.btnStopWatching.getMouseListeners()) { + for (MouseListener ml : this.btnStopWatching.getMouseListeners()) { this.btnStopWatching.removeMouseListener(ml); } - for (MouseListener ml :this.jPhases.getMouseListeners()) { + for (MouseListener ml : this.jPhases.getMouseListeners()) { this.jPhases.removeMouseListener(ml); } for (String name : hoverButtons.keySet()) { HoverButton hoverButton = hoverButtons.get(name); - for (MouseListener ml :hoverButton.getMouseListeners()) { + for (MouseListener ml : hoverButton.getMouseListeners()) { hoverButton.removeMouseListener(ml); } } - for (ActionListener al :this.btnPlay.getActionListeners()) { + for (ActionListener al : this.btnPlay.getActionListeners()) { this.btnPlay.removeActionListener(al); } - for (ActionListener al :this.btnStopReplay.getActionListeners()) { + for (ActionListener al : this.btnStopReplay.getActionListeners()) { this.btnStopReplay.removeActionListener(al); } - for (ActionListener al :this.btnNextPlay.getActionListeners()) { + for (ActionListener al : this.btnNextPlay.getActionListeners()) { this.btnNextPlay.removeActionListener(al); } - for (ActionListener al :this.btnNextPlay.getActionListeners()) { + for (ActionListener al : this.btnNextPlay.getActionListeners()) { this.btnNextPlay.removeActionListener(al); } - for (ActionListener al :this.btnPreviousPlay.getActionListeners()) { + for (ActionListener al : this.btnPreviousPlay.getActionListeners()) { this.btnPreviousPlay.removeActionListener(al); } - for (ActionListener al :this.btnSkipForward.getActionListeners()) { + for (ActionListener al : this.btnSkipForward.getActionListeners()) { this.btnSkipForward.removeActionListener(al); } final BasicSplitPaneUI myUi = (BasicSplitPaneUI) jSplitPane0.getUI(); final BasicSplitPaneDivider divider = myUi.getDivider(); final JButton upArrowButton = (JButton) divider.getComponent(0); - for (ActionListener al: upArrowButton.getActionListeners()) { + for (ActionListener al : upArrowButton.getActionListeners()) { upArrowButton.removeActionListener(al); } final JButton downArrowButton = (JButton) divider.getComponent(1); - for (ActionListener al: downArrowButton.getActionListeners()) { + for (ActionListener al : downArrowButton.getActionListeners()) { downArrowButton.removeActionListener(al); } @@ -1853,12 +1868,12 @@ public final class GamePanel extends javax.swing.JPanel { String[] choices = handCards.keySet().toArray(new String[0]); String newChosenHandKey = (String) JOptionPane.showInputDialog( - this, - "Choose hand to display:", "Switch between hands", - JOptionPane.PLAIN_MESSAGE, - null, - choices, - this.chosenHandKey); + this, + "Choose hand to display:", "Switch between hands", + JOptionPane.PLAIN_MESSAGE, + null, + choices, + this.chosenHandKey); if (newChosenHandKey != null && newChosenHandKey.length() > 0) { this.chosenHandKey = newChosenHandKey; @@ -1877,8 +1892,7 @@ public final class GamePanel extends javax.swing.JPanel { private void btnStopReplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopReplayActionPerformed if (replayTask != null && !replayTask.isDone()) { replayTask.cancel(true); - } - else if (modalQuestion("Are you sure you want to stop replay?", "Stop replay") == JOptionPane.YES_OPTION) { + } else if (modalQuestion("Are you sure you want to stop replay?", "Stop replay") == JOptionPane.YES_OPTION) { session.stopReplay(gameId); } }//GEN-LAST:event_btnStopReplayActionPerformed @@ -1958,15 +1972,15 @@ public final class GamePanel extends javax.swing.JPanel { private javax.swing.JButton btnConcede; private javax.swing.JButton btnSwitchHands; - + private javax.swing.JButton btnNextPlay; private javax.swing.JButton btnPlay; private javax.swing.JButton btnPreviousPlay; private javax.swing.JButton btnSkipForward; private javax.swing.JButton btnStopReplay; - + private javax.swing.JButton btnStopWatching; - + private mage.client.chat.ChatPanel gameChatPanel; private mage.client.game.FeedbackPanel feedbackPanel; private mage.client.chat.ChatPanel userChatPanel; @@ -2003,6 +2017,7 @@ public final class GamePanel extends javax.swing.JPanel { private boolean imagePanelState; } + class ReplayTask extends SwingWorker> { private final Session session; @@ -2032,8 +2047,8 @@ class ReplayTask extends SwingWorker> { logger.fatal("Replay Match Task error", ex); } catch (ExecutionException ex) { logger.fatal("Replay Match Task error", ex); - } catch (CancellationException ex) {} + } catch (CancellationException ex) { + } } - } diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index de217391c73..bf8a5721825 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -1,37 +1,36 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ /* * PlayerPanel.java * * Created on Nov 18, 2009, 3:01:31 PM */ - package mage.client.game; import java.awt.Color; @@ -57,18 +56,13 @@ import javax.swing.SwingConstants; import javax.swing.border.Border; import javax.swing.border.LineBorder; import mage.MageException; -import mage.cards.MageCard; -import mage.cards.action.ActionCallback; import mage.cards.decks.importer.DckDeckImporter; -import mage.cards.repository.CardRepository; import mage.client.MageFrame; import mage.client.cards.BigCard; import mage.client.components.HoverButton; import mage.client.components.MageRoundPane; import mage.client.components.ext.dlg.DialogManager; import mage.client.dialog.PreferencesDialog; -import mage.client.plugins.adapters.MageActionCallback; -import mage.client.plugins.impl.Plugins; import mage.client.util.CardsViewUtil; import mage.client.util.Command; import mage.client.util.ImageHelper; @@ -77,7 +71,6 @@ import mage.components.ImagePanel; import mage.constants.ManaType; import mage.remote.Session; import mage.utils.timer.PriorityTimer; -import mage.view.CardView; import mage.view.ManaPoolView; import mage.view.PlayerView; import org.mage.card.arcane.ManaSymbols; @@ -97,26 +90,25 @@ public class PlayerPanelExt extends javax.swing.JPanel { private BigCard bigCard; private static final int AVATAR_COUNT = 77; - + private static final String DEFAULT_AVATAR_PATH = "/avatars/51.jpg"; - + private static final int PANEL_WIDTH = 94; private static final int PANEL_HEIGHT = 242; private static final int PANEL_HEIGHT_SMALL = 212; private static final int MANA_LABEL_SIZE_HORIZONTAL = 20; - private static final Border greenBorder = new LineBorder(Color.green, 3); private static final Border redBorder = new LineBorder(Color.red, 2); - private static final Border emptyBorder = BorderFactory.createEmptyBorder(0,0,0,0); + private static final Border emptyBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0); - private static final Dimension topCardDimension = new Dimension(40, 56); - private int avatarId = -1; private PriorityTimer timer; - /** Creates new form PlayerPanel */ + /** + * Creates new form PlayerPanel + */ public PlayerPanelExt() { setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT)); initComponents(); @@ -158,7 +150,6 @@ public class PlayerPanelExt extends javax.swing.JPanel { if (timer != null) { this.timer.cancel(); } - topCardPanel.updateCallback(null, gameId); } public void update(PlayerView player) { @@ -271,26 +262,6 @@ public class PlayerPanelExt extends javax.swing.JPanel { this.avatar.setBorder(emptyBorder); this.btnPlayer.setBorder(emptyBorder); } - - - synchronized (this) { - if (player.getTopCard() != null) { - if (topCard == null || !topCard.getId().equals(player.getTopCard().getId())) { - if (topCard == null) { - topCardPanel.setVisible(true); - } - topCard = player.getTopCard(); - topCardPanel.update(topCard); - topCardPanel.updateImage(); - ActionCallback callback = Plugins.getInstance().getActionCallback(); - ((MageActionCallback)callback).refreshSession(); - topCardPanel.updateCallback(callback, gameId); - } - } else if (topCard != null) { - topCard = null; - topCardPanel.setVisible(false); - } - } update(player.getManaPool()); } @@ -304,7 +275,7 @@ public class PlayerPanelExt extends javax.swing.JPanel { int h = priorityTimeLeft / 3600; int m = (priorityTimeLeft % 3600) / 60; int s = priorityTimeLeft % 60; - return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s; + return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s; } protected void update(ManaPoolView pool) { @@ -316,10 +287,10 @@ public class PlayerPanelExt extends javax.swing.JPanel { manaLabels.get("X").setText(Integer.toString(pool.getColorless())); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") private void initComponents() { @@ -331,6 +302,7 @@ public class PlayerPanelExt extends javax.swing.JPanel { lifeLabel = new JLabel(); handLabel = new JLabel(); poisonLabel = new JLabel(); + graveLabel = new JLabel(); libraryLabel = new JLabel(); setOpaque(false); @@ -341,10 +313,6 @@ public class PlayerPanelExt extends javax.swing.JPanel { // Avatar Image image = ImageHelper.getImageFromResources(DEFAULT_AVATAR_PATH); - topCardPanel = Plugins.getInstance().getMageCard(new CardView(CardRepository.instance.findCard("Forest").getMockCard()), bigCard, topCardDimension, gameId, true); - topCardPanel.setVisible(false); - panelBackground.add(topCardPanel); - BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r); avatar = new HoverButton("player", resized, resized, resized, r); String showPlayerNamePermanently = MageFrame.getPreferences().get(PreferencesDialog.KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true"); @@ -360,7 +328,7 @@ public class PlayerPanelExt extends javax.swing.JPanel { }); // timer area /small layout) timerLabel.setToolTipText("Time left"); - timerLabel.setSize(80,12); + timerLabel.setSize(80, 12); timerLabel.setHorizontalAlignment(SwingConstants.CENTER); // life area @@ -389,22 +357,29 @@ public class PlayerPanelExt extends javax.swing.JPanel { poison = new ImagePanel(resizedPoison, ImagePanel.ACTUAL); poison.setToolTipText("Poison"); poison.setOpaque(false); - + // Library r = new Rectangle(19, 19); libraryLabel.setToolTipText("Library"); Image imageLibrary = ImageHelper.getImageFromResources("/info/library.png"); BufferedImage resizedLibrary = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLibrary, BufferedImage.TYPE_INT_ARGB), r); - library = new ImagePanel(resizedLibrary, ImagePanel.ACTUAL); + + library = new HoverButton(null, resizedLibrary, resizedLibrary, resizedLibrary, r); library.setToolTipText("Library"); library.setOpaque(false); + library.setObserver(new Command() { + @Override + public void execute() { + btnLibraryActionPerformed(null); + } + }); // Grave count and open graveyard button - graveLabel = new JLabel(); r = new Rectangle(21, 21); graveLabel.setToolTipText("Graveyard"); Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png"); BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r); + grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r); grave.setToolTipText("Graveyard"); grave.setOpaque(false); @@ -579,195 +554,192 @@ public class PlayerPanelExt extends javax.swing.JPanel { GroupLayout gl_panelBackground = new GroupLayout(panelBackground); gl_panelBackground.setHorizontalGroup( gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(9) - .addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE) - .addGap(3) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(18) - .addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) - .addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) - .addGap(4) - .addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(9) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(3) - .addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(2) - .addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(2) - .addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(2) - .addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) - ) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(18) - .addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) - .addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(20) - .addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))) - .addGap(3) - .addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(19) - .addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))) - .addGap(5) - .addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(20) - .addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(40) - .addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(40) - .addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) - /*.addGroup(gl_panelBackground.createSequentialGroup() - .addGap(18) - .addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))*/ - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(18) - .addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) - ) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(5) - .addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(40) - .addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)))) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(6) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(timerLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)) - .addGap(14)) - - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(6) - .addComponent(zonesPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(14)) - ); - gl_panelBackground.setVerticalGroup( - gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - - .addGap(6) - .addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(btnPlayer) - .addComponent(timerLabel) - .addGap(1) - // Life & Hand - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) - .addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) - .addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) - .addGap(1) - // Poison - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(4) - .addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE) - .addGap(4) - .addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) - .addGap(2) - .addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) - .addGap(2) - .addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) - .addGap(5) - .addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) - ) - - .addGroup(gl_panelBackground.createSequentialGroup() - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(1) - .addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) - .addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) - .addGap(2) - .addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(14) - .addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(14) - .addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))) - .addGap(4) - .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) - .addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(8) - .addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(39) - .addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(31) - .addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)) - .addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) - /*.addGroup(gl_panelBackground.createSequentialGroup() - .addGap(76) - .addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))*/ - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(76) - .addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) - ) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(76) - .addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(76) - .addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) - .addGroup(gl_panelBackground.createSequentialGroup() - .addGap(31) - .addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) - ) - ) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(zonesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(9) + .addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE) + .addGap(3) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(18) + .addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) + .addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) + .addGap(4) + .addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(9) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(3) + .addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(2) + .addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(2) + .addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(2) + .addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) ) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(18) + .addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) + .addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(20) + .addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))) + .addGap(3) + .addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(19) + .addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))) + .addGap(5) + .addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(20) + .addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(40) + .addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(40) + .addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) + /*.addGroup(gl_panelBackground.createSequentialGroup() + .addGap(18) + .addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))*/ + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(18) + .addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) + ) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(5) + .addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(40) + .addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)))) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(6) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(timerLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)) + .addGap(14)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(6) + .addComponent(zonesPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(14)) + ); + gl_panelBackground.setVerticalGroup( + gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(6) + .addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnPlayer) + .addComponent(timerLabel) + .addGap(1) + // Life & Hand + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)) + .addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) + .addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) + .addGap(1) + // Poison + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(4) + .addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE) + .addGap(4) + .addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) + .addGap(2) + .addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) + .addGap(2) + .addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) + .addGap(5) + .addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) + ) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(1) + .addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) + .addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) + .addGap(2) + .addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(14) + .addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(14) + .addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))) + .addGap(4) + .addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING) + .addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(8) + .addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(39) + .addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(31) + .addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)) + .addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) + /*.addGroup(gl_panelBackground.createSequentialGroup() + .addGap(76) + .addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))*/ + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(76) + .addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) + ) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(76) + .addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(76) + .addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panelBackground.createSequentialGroup() + .addGap(31) + .addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) + ) + ) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(zonesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + ) ); panelBackground.setLayout(gl_panelBackground); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(groupLayout.createSequentialGroup() + .addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(groupLayout.createSequentialGroup() + .addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) ); setLayout(groupLayout); @@ -780,8 +752,7 @@ public class PlayerPanelExt extends javax.swing.JPanel { timerLabel.setVisible(true); panelBackground.setPreferredSize(new Dimension(PANEL_WIDTH - 2, PANEL_HEIGHT_SMALL)); panelBackground.setBounds(0, 0, PANEL_WIDTH - 2, PANEL_HEIGHT_SMALL); - } - else { + } else { avatar.setVisible(true); btnPlayer.setVisible(false); timerLabel.setVisible(false); @@ -794,13 +765,12 @@ public class PlayerPanelExt extends javax.swing.JPanel { session.sendPlayerManaType(gameId, player.getPlayerId(), manaType); } - private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed + private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) { MageFrame.getGame(gameId).openGraveyardWindow(player.getName()); - /*if (graveyard == null) { - graveyard = new ShowCardsDialog(); - }*/ - //graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false); - // DialogManager.getManager(gameId).showGraveyardDialog(player.getGraveyard(), bigCard, gameId); + } + + private void btnLibraryActionPerformed(java.awt.event.ActionEvent evt) { + MageFrame.getGame(gameId).openTopLibraryWindow(player.getName()); } private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) { @@ -826,9 +796,7 @@ public class PlayerPanelExt extends javax.swing.JPanel { private ImagePanel poison; private ImagePanel hand; private HoverButton grave; - private ImagePanel library; - private CardView topCard; - private MageCard topCardPanel; + private HoverButton library; private JButton cheat; private MageRoundPane panelBackground; diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 72847cca1ad..72c3eb98af4 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -1,7 +1,21 @@ package mage.client.util.gui; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.GraphicsConfiguration; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.ArrayList; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.SwingConstants; +import mage.client.MageFrame; import mage.constants.CardType; import mage.constants.MageObjectType; +import mage.constants.Rarity; import mage.utils.CardUtil; import mage.view.CardView; import mage.view.CounterView; @@ -10,39 +24,34 @@ import org.jdesktop.swingx.JXPanel; import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.UI; -import javax.swing.*; -import java.awt.*; -import java.util.ArrayList; -import mage.constants.Rarity; - public class GuiDisplayUtil { + private static final Font cardNameFont = new Font("Calibri", Font.BOLD, 15); private static final Insets DEFAULT_INSETS = new Insets(0, 0, 70, 25); private static final Insets COMPONENT_INSETS = new Insets(0, 0, 40, 40); public static class TextLines { - + public int basicTextLength; public ArrayList lines; } - + public static JXPanel getDescription(CardView card, int width, int height) { JXPanel descriptionPanel = new JXPanel(); //descriptionPanel.setAlpha(.8f); - descriptionPanel.setBounds(0, 0, width, height); + descriptionPanel.setBounds(0, 0, width, height); descriptionPanel.setVisible(false); descriptionPanel.setLayout(null); //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green)); - JButton j = new JButton(""); - j.setBounds(0, 0, width, height); + j.setBounds(0, 0, width, height); j.setBackground(Color.black); j.setLayout(null); JLabel cardText = new JLabel(); - cardText.setBounds(5, 5, width - 10, height - 10); + cardText.setBounds(5, 5, width - 10, height - 10); cardText.setForeground(Color.white); cardText.setFont(cardNameFont); cardText.setVerticalAlignment(SwingConstants.TOP); @@ -70,36 +79,52 @@ public class GuiDisplayUtil { return out.toString().toLowerCase(); } + public static void keepComponentInsideScreen(int centerX, int centerY, Component component) { + Dimension screenDim = component.getToolkit().getScreenSize(); + GraphicsConfiguration g = component.getGraphicsConfiguration(); - public static void keepComponentInsideScreen(int x, int y, Component c) { - Dimension screenDim = c.getToolkit().getScreenSize(); - GraphicsConfiguration g = c.getGraphicsConfiguration(); if (g != null) { - Insets insets = c.getToolkit().getScreenInsets(g); + Insets insets = component.getToolkit().getScreenInsets(g); // no usable space like toolbar boolean setLocation = false; - if (x + c.getWidth() > screenDim.width - insets.right) { - x = (screenDim.width - insets.right) - c.getWidth(); + if (centerX + component.getWidth() > screenDim.width - insets.right) { + centerX = (screenDim.width - insets.right) - component.getWidth(); setLocation = true; - } else if (x < insets.left) { - x = insets.left; + } else if (centerX < insets.left) { + centerX = insets.left; setLocation = true; } - if (y + c.getHeight() > screenDim.height - insets.bottom) { - y = (screenDim.height - insets.bottom) - c.getHeight(); + if (centerY + component.getHeight() > screenDim.height - insets.bottom) { + centerY = (screenDim.height - insets.bottom) - component.getHeight(); setLocation = true; - } else if (y < insets.top) { - y = insets.top; + } else if (centerY < insets.top) { + centerY = insets.top; setLocation = true; } if (setLocation) { - c.setLocation(x, y); + component.setLocation(centerX, centerY); } } else { System.out.println("GuiDisplayUtil::keepComponentInsideScreen -> no GraphicsConfiguration"); } } + static final int OVERLAP_LIMIT = 10; + + public static void keepComponentInsideFrame(int centerX, int centerY, Component component) { + Rectangle frameRec = MageFrame.getInstance().getBounds(); + boolean setLocation = false; + if (component.getX() > (frameRec.width - OVERLAP_LIMIT)) { + setLocation = true; + } + if (component.getY() > (frameRec.height - OVERLAP_LIMIT)) { + setLocation = true; + } + if (setLocation) { + component.setLocation(centerX, centerY); + } + } + public static Point keepComponentInsideParent(Point l, Point parentPoint, Component c, Component parent) { int dx = parentPoint.x + parent.getWidth() - DEFAULT_INSETS.right - COMPONENT_INSETS.right; if (l.x + c.getWidth() > dx) { @@ -117,8 +142,8 @@ public class GuiDisplayUtil { public static TextLines getTextLinesfromCardView(CardView card) { TextLines textLines = new TextLines(); textLines.lines = new ArrayList<>(card.getRules()); - for (String rule: card.getRules()) { - textLines.basicTextLength +=rule.length(); + for (String rule : card.getRules()) { + textLines.basicTextLength += rule.length(); } if (card.getMageObjectType().equals(MageObjectType.PERMANENT)) { if (card.getPairedCard() != null) { @@ -156,7 +181,7 @@ public class GuiDisplayUtil { } } if (card.getMageObjectType().isPermanent() && card instanceof PermanentView) { - int damage = ((PermanentView)card).getDamage(); + int damage = ((PermanentView) card).getDamage(); if (damage > 0) { textLines.lines.add("Damage dealt: " + damage + ""); textLines.basicTextLength += 50; @@ -183,10 +208,10 @@ public class GuiDisplayUtil { String fontFamily = "tahoma"; /*if (prefs.fontFamily == CardFontFamily.arial) - fontFamily = "arial"; - else if (prefs.fontFamily == CardFontFamily.verdana) { - fontFamily = "verdana"; - }*/ + fontFamily = "arial"; + else if (prefs.fontFamily == CardFontFamily.verdana) { + fontFamily = "verdana"; + }*/ final StringBuilder buffer = new StringBuilder(512); buffer.append(""); buffer.append(card.getDisplayName()); if (card.isGameObject()) { - buffer.append(" [").append(card.getId().toString().substring(0,3)).append("]"); + buffer.append(" [").append(card.getId().toString().substring(0, 3)).append("]"); } buffer.append(""); - if(card.getColor().isWhite()) { + if (card.getColor().isWhite()) { buffer.append("W"); } - if(card.getColor().isBlue()) { + if (card.getColor().isBlue()) { buffer.append("U"); } - if(card.getColor().isBlack()) { + if (card.getColor().isBlack()) { buffer.append("B"); } - if(card.getColor().isRed()) { + if (card.getColor().isRed()) { buffer.append("R"); } - if(card.getColor().isGreen()) { + if (card.getColor().isGreen()) { buffer.append("G"); } - if(!card.getColor().isColorless()) { + if (!card.getColor().isColorless()) { buffer.append("  "); } buffer.append(getTypes(card)); buffer.append(""); - String rarity ; + String rarity; if (card.getRarity() == null) { rarity = Rarity.COMMON.getCode(); - buffer.append(""); - }else { + buffer.append(""); + } else { switch (card.getRarity()) { case RARE: buffer.append(""); @@ -310,7 +335,7 @@ public class GuiDisplayUtil { if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) { rule.append("

").append(textLine).append("

"); } - } + } } String legal = rule.toString(); @@ -319,12 +344,12 @@ public class GuiDisplayUtil { // legal = legal.replaceAll("#([^#]+)#", "$1"); // legal = legal.replaceAll("\\s*//\\s*", "
"); // legal = legal.replace("\r\n", "
"); - legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this":card.getName()); - legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this":card.getName()); + legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName()); + legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName()); buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.CARD)); } - buffer.append("
"); + buffer.append("
"); return buffer; } @@ -347,5 +372,5 @@ public class GuiDisplayUtil { types += subType + " "; } return types.trim(); - } + } } From 7bc8649585ad4d4aac668aa7555412a3b7907813 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 25 Jun 2015 14:31:23 +0200 Subject: [PATCH 12/12] * Animate Dead - Fixed that the target card in graveyard was not handled correct, if the Animate Dead reentered the Battlefield(e.g. with Worldgorger Dragon combo). --- .../cards/triggers/WorldgorgerDragonTest.java | 35 +++++++++++-------- .../java/org/mage/test/player/TestPlayer.java | 14 +++++--- .../effects/AuraReplacementEffect.java | 18 +++++----- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/WorldgorgerDragonTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/WorldgorgerDragonTest.java index c1f2238dfb1..db1557a3bd4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/WorldgorgerDragonTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/WorldgorgerDragonTest.java @@ -5,9 +5,10 @@ */ package org.mage.test.cards.triggers; + import mage.constants.PhaseStep; import mage.constants.Zone; -import org.junit.Ignore; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -133,7 +134,6 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase { * */ @Test - @Ignore public void testWithAnimateDeadDifferentTargets() { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); @@ -153,35 +153,40 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase { // When Staunch Defenders enters the battlefield, you gain 4 life. addCard(Zone.BATTLEFIELD, playerA, "Staunch Defenders", 1); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}"); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Worldgorger Dragon"); - addTarget(playerA, "Worldgorger Dragon"); - addTarget(playerA, "Worldgorger Dragon"); - addTarget(playerA, "Silvercoat Lion"); - - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); - activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + setChoice(playerA, "Worldgorger Dragon"); + + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9); - setChoice(playerA, "X=7"); + setChoice(playerA, "Silvercoat Lion"); + + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9); + setChoice(playerA, "X=9"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); + assertGraveyardCount(playerA, "Volcanic Geyser", 1); assertGraveyardCount(playerA, "Worldgorger Dragon", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1); - assertLife(playerA, 24); + assertLife(playerA, 28); assertLife(playerB, 11); - assertGraveyardCount(playerA, "Volcanic Geyser", 1); + Assert.assertEquals("Mana pool", "[]", playerA.getManaAvailable(currentGame).toString()); } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 6de99aff263..9fe14c7e861 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -628,8 +628,10 @@ public class TestPlayer implements Player { if (targetCardInGraveyard.canTarget(targetObject.getId(), game)) { if (alreadyTargetted != null && !alreadyTargetted.contains(targetObject.getId())) { targetCardInGraveyard.add(targetObject.getId(), game); - choices.remove(choose2); targetFound = true; + if (target.getTargets().size() >= target.getMaxNumberOfTargets()) { + break; + } } } } @@ -810,10 +812,12 @@ public class TestPlayer implements Player { @Override public int announceXMana(int min, int max, String message, Game game, Ability ability) { if (!choices.isEmpty()) { - if (choices.get(0).startsWith("X=")) { - int xValue = Integer.parseInt(choices.get(0).substring(2)); - choices.remove(0); - return xValue; + for(String choice: choices) { + if (choice.startsWith("X=")) { + int xValue = Integer.parseInt(choice.substring(2)); + choices.remove(choice); + return xValue; + } } } return computerPlayer.announceXMana(min, max, message, game, ability); diff --git a/Mage/src/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/mage/abilities/effects/AuraReplacementEffect.java index aa892d608e7..e5cdec0b930 100644 --- a/Mage/src/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/mage/abilities/effects/AuraReplacementEffect.java @@ -27,26 +27,25 @@ */ package mage.abilities.effects; +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.cards.Card; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; -import mage.MageObject; -import mage.abilities.Ability; -import mage.cards.Card; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; +import mage.game.stack.Spell; import mage.game.stack.StackAbility; import mage.players.Player; import mage.target.Target; - -import java.util.UUID; -import mage.abilities.SpellAbility; -import mage.abilities.effects.common.AttachEffect; -import mage.game.stack.Spell; import mage.target.common.TargetCardInGraveyard; /** @@ -118,6 +117,9 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (targetId == null) { Target target = card.getSpellAbility().getTargets().get(0); enchantCardInGraveyard = target instanceof TargetCardInGraveyard; + if (enchantCardInGraveyard && target != null) { + target.clearChosen(); + } Player player = game.getPlayer(card.getOwnerId()); Outcome auraOutcome = Outcome.BoostCreature; Ability: for (Ability ability:card.getAbilities()) {