From 2e68f6c69284cc3dfe8cb9bbf8b92570281421c3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 19 Nov 2014 15:12:17 +0100 Subject: [PATCH 1/2] * Draft - Fixed that first draft direction is shown as left, second as right and third again to left. --- .../java/mage/client/draft/DraftPanel.java | 10 ++++---- .../src/mage/sets/magic2013/Spelltwine.java | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index 65d1ef0a9d8..25e3d2ba0e4 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -133,7 +133,7 @@ public class DraftPanel extends javax.swing.JPanel { int left = draftView.getPlayers().size() - right; int height = left * 18; lblTableImage.setSize(new Dimension(lblTableImage.getWidth(), height)); - Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() == 2 ? "/draft/table_right.png":"/draft/table_left.png"); + Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() == 2 ? "/draft/table_left.png":"/draft/table_right.png"); BufferedImage resizedTable = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(tableImage, BufferedImage.TYPE_INT_ARGB), lblTableImage.getWidth()); lblTableImage.setIcon(new ImageIcon(resizedTable)); @@ -150,11 +150,11 @@ public class DraftPanel extends javax.swing.JPanel { int right = players / 2; int left = players - right; if (index <= left) { - // left side up (8 - 1) - tablePosition = (9 - index) - (8- left); + // left side down (1 - 8) + tablePosition = index; } else { - // right side down (9-18) - tablePosition = 8 + (index - left); + // right side up (16 - 9) + tablePosition = 9 + right - (index - left); } switch(tablePosition) { case 1: diff --git a/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java b/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java index 1a9563078cb..bbe1da7911a 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java +++ b/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java @@ -36,6 +36,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.postresolve.ExileSpellEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -100,30 +101,29 @@ class SpelltwineEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player you = game.getPlayer(source.getControllerId()); + Player controller = game.getPlayer(source.getControllerId()); Card cardOne = game.getCard(source.getTargets().get(0).getFirstTarget()); Card cardTwo = game.getCard(source.getTargets().get(1).getFirstTarget()); - if (you != null) { + if (controller != null) { if (cardOne != null) { - cardOne.moveToExile(null, null, source.getSourceId(), game); + controller.moveCardToExileWithInfo(cardOne, null, "", source.getSourceId(), game, Zone.GRAVEYARD); } if (cardTwo != null) { - cardTwo.moveToExile(null, null, source.getSourceId(), game); + controller.moveCardToExileWithInfo(cardTwo, null, "", source.getSourceId(), game, Zone.GRAVEYARD); } - boolean castCardOne = true; - if (cardOne != null && you.chooseUse(Outcome.Neutral, "Cast the copy of " + cardOne.getName() + " first?", game)) { - Card copyOne = game.copyCard(cardOne, source, you.getId()); - you.cast(copyOne.getSpellAbility(), game, true); + if (cardOne != null && controller.chooseUse(Outcome.Neutral, "Cast the copy of " + cardOne.getName() + " first?", game)) { + Card copyOne = game.copyCard(cardOne, source, controller.getId()); + controller.cast(copyOne.getSpellAbility(), game, true); castCardOne = false; } if (cardTwo != null) { - Card copyTwo = game.copyCard(cardTwo, source, you.getId()); - you.cast(copyTwo.getSpellAbility(), game, true); + Card copyTwo = game.copyCard(cardTwo, source, controller.getId()); + controller.cast(copyTwo.getSpellAbility(), game, true); } if (cardOne != null && castCardOne) { - Card copyOne = game.copyCard(cardOne, source, you.getId()); - you.cast(copyOne.getSpellAbility(), game, true); + Card copyOne = game.copyCard(cardOne, source, controller.getId()); + controller.cast(copyOne.getSpellAbility(), game, true); } return true; } From ba96f651ef2392463c4046c84cc4befb872914b7 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 19 Nov 2014 17:46:52 -0600 Subject: [PATCH 2/2] - Added Silkbind Faerie, Swans of Bryn Argoll, and Thoughtweft Gambit. --- .../mage/sets/shadowmoor/SilkbindFaerie.java | 80 ++++++++++ .../sets/shadowmoor/SwansOfBrynArgoll.java | 140 ++++++++++++++++++ .../sets/shadowmoor/ThoughtweftGambit.java | 112 ++++++++++++++ 3 files changed, 332 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/SilkbindFaerie.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/SwansOfBrynArgoll.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/ThoughtweftGambit.java diff --git a/Mage.Sets/src/mage/sets/shadowmoor/SilkbindFaerie.java b/Mage.Sets/src/mage/sets/shadowmoor/SilkbindFaerie.java new file mode 100644 index 00000000000..61e207185f6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/SilkbindFaerie.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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.UntapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class SilkbindFaerie extends CardImpl { + + public SilkbindFaerie(UUID ownerId) { + super(ownerId, 148, "Silkbind Faerie", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W/U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Faerie"); + this.subtype.add("Rogue"); + + this.color.setWhite(true); + this.color.setBlue(true); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // {1}{WU}, {untap}: Tap target creature. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new ManaCostsImpl("{1}{W/U}")); + ability.addCost(new UntapSourceCost()); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + } + + public SilkbindFaerie(final SilkbindFaerie card) { + super(card); + } + + @Override + public SilkbindFaerie copy() { + return new SilkbindFaerie(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/SwansOfBrynArgoll.java b/Mage.Sets/src/mage/sets/shadowmoor/SwansOfBrynArgoll.java new file mode 100644 index 00000000000..e3ba6e5092c --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/SwansOfBrynArgoll.java @@ -0,0 +1,140 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamageEvent; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.game.stack.Spell; +import mage.players.Player; + +/** + * + * @author jeffwadsworth + */ +public class SwansOfBrynArgoll extends CardImpl { + + public SwansOfBrynArgoll(UUID ownerId) { + super(ownerId, 151, "Swans of Bryn Argoll", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W/U}{W/U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Bird"); + this.subtype.add("Spirit"); + + this.color.setBlue(true); + this.color.setWhite(true); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // If a source would deal damage to Swans of Bryn Argoll, prevent that damage. The source's controller draws cards equal to the damage prevented this way. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SwansOfBrynArgollEffect())); + + } + + public SwansOfBrynArgoll(final SwansOfBrynArgoll card) { + super(card); + } + + @Override + public SwansOfBrynArgoll copy() { + return new SwansOfBrynArgoll(this); + } +} + +class SwansOfBrynArgollEffect extends ReplacementEffectImpl { + + SwansOfBrynArgollEffect() { + super(Duration.WhileOnBattlefield, Outcome.PreventDamage); + staticText = "If a source would deal damage to {this}, prevent that damage. The source's controller draws cards equal to the damage prevented this way"; + } + + SwansOfBrynArgollEffect(final SwansOfBrynArgollEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Boolean passed = false; + DamageEvent damageEvent = (DamageEvent) event; + Card sourceOfDamage = game.getCard(event.getSourceId()); + if (sourceOfDamage != null) { + Spell spell = game.getStack().getSpell(sourceOfDamage.getId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(sourceOfDamage.getId()); + if (spell != null) { + Player controllerOfSpell = game.getPlayer(spell.getControllerId()); + controllerOfSpell.drawCards(damageEvent.getAmount(), game); + passed = true; + } + if (permanent != null) { + Player controllerOfPermanent = game.getPlayer(permanent.getControllerId()); + controllerOfPermanent.drawCards(damageEvent.getAmount(), game); + passed = true; + } + if (!passed) { + Player owner = game.getPlayer(sourceOfDamage.getOwnerId()); + if (owner != null) { + owner.drawCards(damageEvent.getAmount(), game); + } + } + } + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getType() == EventType.DAMAGE_CREATURE + && event.getTargetId().equals(source.getSourceId()); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public SwansOfBrynArgollEffect copy() { + return new SwansOfBrynArgollEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ThoughtweftGambit.java b/Mage.Sets/src/mage/sets/shadowmoor/ThoughtweftGambit.java new file mode 100644 index 00000000000..83f9cf1eea9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/ThoughtweftGambit.java @@ -0,0 +1,112 @@ +/* + * 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.shadowmoor; + +import java.util.Set; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author jeffwadsworth + */ +public class ThoughtweftGambit extends CardImpl { + + public ThoughtweftGambit(UUID ownerId) { + super(ownerId, 154, "Thoughtweft Gambit", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{W/U}{W/U}"); + this.expansionSetCode = "SHM"; + + this.color.setBlue(true); + this.color.setWhite(true); + + // Tap all creatures your opponents control and untap all creatures you control. + this.getSpellAbility().addEffect(new ThoughtweftGambitEffect()); + + } + + public ThoughtweftGambit(final ThoughtweftGambit card) { + super(card); + } + + @Override + public ThoughtweftGambit copy() { + return new ThoughtweftGambit(this); + } +} + +class ThoughtweftGambitEffect extends OneShotEffect { + + private static FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + public ThoughtweftGambitEffect() { + super(Outcome.Benefit); + staticText = "Tap all creatures your opponents control and untap all creatures you control"; + } + + public ThoughtweftGambitEffect(final ThoughtweftGambitEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Boolean passed = false; + Set opponents = game.getOpponents(source.getControllerId()); + Player controller = game.getPlayer(source.getControllerId()); + if (opponents != null) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { + if (opponents.contains(creature.getControllerId())) { + creature.tap(game); + } + } + passed = true; + } + if (controller != null) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { + if (controller.getId() == creature.getControllerId()) { + creature.untap(game); + } + } + passed = true; + } + return passed; + } + + @Override + public ThoughtweftGambitEffect copy() { + return new ThoughtweftGambitEffect(this); + } +}