Merge origin/master

This commit is contained in:
fireshoes 2015-07-02 23:01:57 -05:00
commit 56d8055532
8 changed files with 346 additions and 137 deletions

View file

@ -39,7 +39,6 @@ import java.awt.Component;
import java.awt.EventQueue;
import java.awt.KeyboardFocusManager;
import java.awt.MenuComponent;
import java.awt.TrayIcon;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
import java.lang.reflect.InvocationTargetException;
@ -119,10 +118,11 @@ public class MageDialog extends javax.swing.JInternalFrame {
Object source = event.getSource();
boolean dispatch = true;
if (event.getSource() != null && event.getSource() instanceof TrayIcon) {
return;
}
// LINUX: Workaround fix for announce X Value Bug that closes modal windows under linux before values can be entered
// https://github.com/magefree/mage/issues/584
// if (event.getSource() != null && event.getSource() instanceof TrayIcon) {
// return;
// }
if (event instanceof MouseEvent && event.getSource() instanceof Component) {
MouseEvent e = (MouseEvent) event;
MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
@ -226,7 +226,6 @@ public class MageDialog extends javax.swing.JInternalFrame {
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View file

@ -27,30 +27,27 @@
*/
package mage.sets.innistrad;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Rarity;
import mage.constants.TimingRule;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
* @author nantuko
*/
@ -93,10 +90,10 @@ class DivineReckoningEffect extends OneShotEffect {
List<Card> chosen = new ArrayList<>();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : controller.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), false);
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
if (target.canChoose(player.getId(), game)) {
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.chooseTarget(Outcome.Benefit, target, source, game);

View file

@ -49,6 +49,7 @@ import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Commander;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -65,7 +66,6 @@ public class SavageSummoning extends CardImpl {
super(ownerId, 194, "Savage Summoning", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{G}");
this.expansionSetCode = "M14";
// Savage Summoning can't be countered.
Ability ability = new CantBeCounteredAbility();
ability.setRuleAtTheTop(true);
@ -91,6 +91,7 @@ public class SavageSummoning extends CardImpl {
}
class SavageSummoningAsThoughEffect extends AsThoughEffectImpl {
private SavageSummoningWatcher watcher;
private int zoneChangeCounter;
@ -126,13 +127,20 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl {
return new SavageSummoningAsThoughEffect(this);
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (watcher.isSavageSummoningSpellActive()) {
Card card = game.getCard(sourceId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getOwnerId().equals(source.getControllerId())) {
return card.getSpellAbility().isInUseableZone(game, card, null);
MageObject mageObject = game.getBaseObject(objectId);
if (mageObject instanceof Commander) {
Commander commander = (Commander) mageObject;
if (commander.getCardType().contains(CardType.CREATURE) && commander.getControllerId().equals(source.getControllerId())) {
return true;
}
} else if (mageObject != null && mageObject instanceof Card) {
Card card = (Card) mageObject;
if (card.getCardType().contains(CardType.CREATURE) && card.getOwnerId().equals(source.getControllerId())) {
return true;
}
}
}
return false;
@ -140,10 +148,10 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl {
}
class SavageSummoningWatcher extends Watcher {
private Set<String> savageSummoningSpells = new HashSet<>();;
private Set<String> savageSummoningSpells = new HashSet<>();
;
private Map<UUID, Set<String>> spellsCastWithSavageSummoning = new LinkedHashMap<>();
private Map<String, Set<String>> cardsCastWithSavageSummoning = new LinkedHashMap<>();
@ -216,6 +224,7 @@ class SavageSummoningWatcher extends Watcher {
}
class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
private SavageSummoningWatcher watcher;
private int zoneChangeCounter;
@ -273,6 +282,7 @@ class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl
}
class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl {
private SavageSummoningWatcher watcher;
private int zoneChangeCounter;

View file

@ -62,7 +62,6 @@ public class DelayingShield extends CardImpl {
super(ownerId, 17, "Delaying Shield", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
this.expansionSetCode = "ODY";
// If damage would be dealt to you, put that many delay counters on Delaying Shield instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DelayingShieldReplacementEffect()));
@ -94,7 +93,7 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageEvent damageEvent = (DamageEvent) event;
new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount())).apply(game, source);
new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount()), true).apply(game, source);
return true;
}
@ -132,13 +131,13 @@ class DelayingShieldUpkeepEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
if (controller != null && permanent != null) {
int numCounters = permanent.getCounters().getCount(CounterType.DELAY);
permanent.removeCounters(CounterType.DELAY.createInstance(), game);
permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), game);
for (int i = numCounters; i > 0; i--) {
if (player.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) {
if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) {
Cost cost = new ManaCostsImpl<>("{1}{W}");
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
continue;

View file

@ -114,10 +114,10 @@ class GildedDrakeEffect extends OneShotEffect {
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
effect.setTargetPointer(targetPointer);
game.addEffect(effect, source);
} else {
return true;
}
}
sourceObject.sacrifice(source.getSourceId(), game);
}
}
return true;
}
return false;

View file

@ -0,0 +1,84 @@
NAME:Power Hungry
7 [THS:246] Forest
1 [C13:78] Fell Shepherd
1 [C13:76] Endrek Sahr, Master Breeder
1 [C13:75] Endless Cockroaches
7 [THS:242] Mountain
1 [C13:73] Dirge of Dread
1 [C13:219] Sprouting Thrinax
1 [C13:259] Sol Ring
1 [C13:138] Brooding Saurian
1 [C13:335] Vivid Grove
1 [C13:213] Shattergang Brothers
1 [C13:254] Plague Boiler
1 [C13:210] Sek'Kuar, Deathkeeper
1 [C13:298] Jund Panorama
1 [C13:252] Obelisk of Jund
1 [C13:175] Walker of the Grove
1 [C13:131] Widespread Panic
1 [C13:294] Gruul Guildgate
1 [C13:172] Spoils of Victory
1 [C13:292] Grim Backwoods
1 [C13:291] Golgari Rot Farm
1 [C13:80] Hooded Horror
1 [C13:290] Golgari Guildgate
1 [C13:84] Ophiomancer
1 [C13:109] Furnace Celebration
1 [C13:229] Golgari Guildmage
6 [THS:238] Swamp
1 [C13:304] Llanowar Reborn
1 [C13:149] Hua Tuo, Honored Physician
1 [C13:105] Curse of Chaos
1 [C13:303] Kher Keep
1 [C13:302] Khalni Garden
1 [C13:301] Kazandu Refuge
1 [C13:102] Capricious Efreet
1 [C13:146] Foster
1 [C13:101] Blood Rites
1 [C13:145] Fecundity
1 [C13:100] Wight of Precinct Six
1 [C13:143] Elvish Skysweeper
1 [C13:263] Swiftfoot Boots
1 [C13:185] Deepfire Elemental
1 [C13:184] Deathbringer Thoctar
1 [C13:140] Curse of Predation
1 [C13:260] Spine of Ish Sah
1 [C13:93] Stronghold Assassin
1 [C13:180] Charnelhoard Wurm
1 [C13:90] Quagmire Druid
1 [C13:99] Viscera Seer
1 [C13:98] Vile Requiem
1 [C13:317] Savage Lands
1 [C13:118] Rough // Tumble
1 [C13:315] Rupture Spire
1 [C13:238] Carnage Altar
1 [C13:314] Rakdos Guildgate
1 [C13:116] Mass Mutiny
1 [C13:235] Armillary Sphere
1 [C13:114] Inferno Titan
1 [C13:158] Night Soil
1 [C13:310] Opal Palace
1 [C13:111] Goblin Sharpshooter
1 [C13:110] Goblin Bombardment
1 [C13:272] Akoum Refuge
1 [C13:195] Jund Charm
1 [C13:151] Jade Mage
1 [C13:150] Hunted Troll
1 [C13:209] Scarland Thrinax
1 [C13:328] Terramorphic Expanse
1 [C13:327] Temple of the False God
1 [C13:127] Tooth and Claw
1 [C13:126] Terra Ravager
1 [C13:125] Tempt with Vengeance
1 [C13:169] Silklash Spider
1 [C13:124] Sudden Demise
1 [C13:168] Sakura-Tribe Elder
1 [C13:167] Restore
1 [C13:244] Jar of Eyeballs
1 [C13:166] Reincarnation
1 [C13:287] Evolving Wilds
1 [C13:121] Stalking Vengeance
1 [C13:162] Primal Vigor
1 [C13:71] Curse of Shallow Graves
1 [C13:281] Command Tower
SB: 1 [C13:204] Prossh, Skyraider of Kher

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.abilities.keywords;
import mage.constants.CardType;
@ -44,9 +43,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class BestowTest extends CardTestPlayerBase {
/**
* Tests that if from bestow permanent targeted creature
* gets protection from the color of the bestow permanent,
* the bestow permanent becomes a creature on the battlefield.
* Tests that if from bestow permanent targeted creature gets protection
* from the color of the bestow permanent, the bestow permanent becomes a
* creature on the battlefield.
*
*/
@ -67,7 +66,6 @@ public class BestowTest extends CardTestPlayerBase {
* Scry 1. (Look at the top card of your library. You may put that card on the bottom of your library.)
*
*/
@Test
public void bestowEnchantmentToCreature() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
@ -120,7 +118,8 @@ public class BestowTest extends CardTestPlayerBase {
}
/**
* Test that the bestow enchantment becomes a creature if the enchanted creature dies
* Test that the bestow enchantment becomes a creature if the enchanted
* creature dies
*/
@Test
public void bestowEnchantmentBecomesCreature() {
@ -149,11 +148,11 @@ public class BestowTest extends CardTestPlayerBase {
Assert.assertTrue("Hopeful Eidolon has to be a creature but is not", hopefulEidolon.getCardType().contains(CardType.CREATURE));
Assert.assertTrue("Hopeful Eidolon has to be an enchantment but is not", hopefulEidolon.getCardType().contains(CardType.ENCHANTMENT));
}
/**
* Test that card cast with bestow will not be tapped, if creatures come into play tapped
* Test that card cast with bestow will not be tapped, if creatures come
* into play tapped
*/
@Test
public void bestowEnchantmentWillNotBeTapped() {
@ -180,9 +179,10 @@ public class BestowTest extends CardTestPlayerBase {
}
/**
* If I have a bestowed creature on the battlefield and my opponent uses Far // Away casting
* both sides, will the creature that has bestow come in time for it to be sacrificed or does
* it fully resolve before the creature comes in?
* If I have a bestowed creature on the battlefield and my opponent uses Far
* // Away casting both sides, will the creature that has bestow come in
* time for it to be sacrificed or does it fully resolve before the creature
* comes in?
*
* Bestowed creature can be used to sacrifice a creature for the Away part.
* http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/513828-bestow-far-away
@ -192,18 +192,15 @@ public class BestowTest extends CardTestPlayerBase {
public void bestowWithFusedSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
/**
* Cyclops of One-Eyed Pass {2}{R}{R}
* Creature - Cyclops
* 5/2
* Cyclops of One-Eyed Pass {2}{R}{R} Creature - Cyclops 5/2
*/
addCard(Zone.BATTLEFIELD, playerA, "Cyclops of One-Eyed Pass");
/**
* Nyxborn Rollicker {R}
* Enchantment Creature - Satyr
* 1/1
* Bestow {1}{R} (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)
* Enchanted creature gets +1/+1.
* Nyxborn Rollicker {R} Enchantment Creature - Satyr 1/1 Bestow {1}{R}
* (If you cast this card for its bestow cost, it's an Aura spell with
* enchant creature. It becomes a creature again if it's not attached to
* a creature.) Enchanted creature gets +1/+1.
*/
addCard(Zone.HAND, playerA, "Nyxborn Rollicker");
@ -211,13 +208,9 @@ public class BestowTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
/**
* Far {1}{U}
* Instant
* Return target creature to its owner's hand.
* Away {2}{B}
* Instant
* Target player sacrifices a creature.
* Fuse (You may cast one or both halves of this card from your hand.)
* Far {1}{U} Instant Return target creature to its owner's hand. Away
* {2}{B} Instant Target player sacrifices a creature. Fuse (You may
* cast one or both halves of this card from your hand.)
*/
addCard(Zone.HAND, playerB, "Far // Away");
@ -240,9 +233,9 @@ public class BestowTest extends CardTestPlayerBase {
}
/**
* Test that CMC of a spell cast with bestowed is correct
* Disdainful Stroke doesn't check converted mana cost correctly. Opponent was
* able to use it to counter a Hypnotic Siren cast with Bestow.
* Test that CMC of a spell cast with bestowed is correct Disdainful Stroke
* doesn't check converted mana cost correctly. Opponent was able to use it
* to counter a Hypnotic Siren cast with Bestow.
*/
@Test
public void bestowCheckForCorrectCMC() {
@ -312,4 +305,59 @@ public class BestowTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
}
/*
* Bug with the Nighthowler Card. Card does sometimes not get a creature
* after Bestow.
Steps:
1) Cast any creature
2) Cast Nightowler using Bestow on that creature
3) Make sure creature is tapped
4) Opponent uses any spell that kills creature which is bestowed by nighthowler
5) Result: Nighthowler is still on the field, but is no creature (no Power/Toughness)
Expected:Nighthowler gets on field as a creature
Important: This happens ONLY if the creature is killed with a spell when
its TAPPED!
*/
@Test
public void bestowNighthowlerTest() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
// Instant - {2}{R}{R}
// Chandra's Outrage deals 4 damage to target creature and 2 damage to that creature's controller.
addCard(Zone.HAND, playerA, "Chandra's Outrage");
// Enchantment Creature Horror
// 0/0
// Bestow {2}{B}{B}
// Nighthowler and enchanted creature each get +X/+X, where X is the number of creature cards in all graveyards.
addCard(Zone.HAND, playerB, "Nighthowler");
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 4);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerB, "Pillarfield Ox");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Nighthowler using bestow", "Silvercoat Lion");
attack(2, playerB, "Silvercoat Lion");
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Chandra's Outrage", "Silvercoat Lion");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertLife(playerB, 18); // -2 from Chandra's Outrage
assertLife(playerA, 17); // -3 from attack Nighthowler
assertGraveyardCount(playerA, "Chandra's Outrage", 1);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Nighthowler", 1);
assertPowerToughness(playerB, "Nighthowler", 2, 2);
Permanent nighthowler = getPermanent("Nighthowler", playerB);
Assert.assertEquals("Nighthowler has to be a creature", true, nighthowler.getCardType().contains(CardType.CREATURE));
}
}

View file

@ -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 org.mage.test.commander.duel;
import java.io.FileNotFoundException;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestCommanderDuelBase;
/**
*
* @author LevelX2
*/
public class CastBRGCommanderTest extends CardTestCommanderDuelBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Flying
// When you cast Prossh, Skyraider of Kher, put X 0/1 red Kobold creature tokens named Kobolds of Kher Keep onto the battlefield, where X is the amount of mana spent to cast Prossh.
// Sacrifice another creature: Prossh gets +1/+0 until end of turn.
setDecknamePlayerA("Power Hungry.dck"); // Commander = Prosssh, Skyrider of Kher {3}{B}{R}{G}
return super.createNewGameAndPlayers();
}
@Test
public void castCommanderWithFlash() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Zone.HAND, playerA, "Savage Summoning");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Savage Summoning");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Prossh, Skyraider of Kher");
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertGraveyardCount(playerA, "Savage Summoning", 1);
assertPermanentCount(playerA, "Prossh, Skyraider of Kher", 1);
assertPermanentCount(playerA, "Kobolds of Kher Keep", 6);
}
}