Merge branch 'master' into samut-the-tested

This commit is contained in:
LevelX2 2017-06-05 11:17:06 +02:00 committed by GitHub
commit 92b1cd27be
5 changed files with 306 additions and 4 deletions

View file

@ -0,0 +1,244 @@
/*
* 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.cards.n;
import java.util.HashMap;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.players.Library;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author Will
*/
public class NicolBolasGodPharoh extends CardImpl {
private UUID exileId = UUID.randomUUID();
private static final FilterPermanent opponentsNonlandPermanentsFilter = new FilterNonlandPermanent("non-land permanents your opponents control");
static {
opponentsNonlandPermanentsFilter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public NicolBolasGodPharoh(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{U}{B}{R}");
this.subtype.add("Bolas");
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(7));
// +2: Target opponent exiles cards from the top of his or her library until he or she exiles a nonland card. Until end of turn, you may cast that card without paying its mana cost.
LoyaltyAbility ability = new LoyaltyAbility(new NicolBolasGodPharohPlusTwoEffect(exileId), 2);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
// +1: Each opponent exiles two cards from his or her hand.
this.addAbility(new LoyaltyAbility(new NicolBolasGodPharohPlusOneEffect(exileId), 1));
// -4: Nicol Bolas, God-Pharoh deals 7 damage to target creature or player.
ability = new LoyaltyAbility(new DamageTargetEffect(7), -2);
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
// -12: Exile each nonland permanent your opponents control.
this.addAbility(new LoyaltyAbility(new ExileAllEffect(opponentsNonlandPermanentsFilter, exileId, this.getIdName()), -12));
}
public NicolBolasGodPharoh(final NicolBolasGodPharoh card) {
super(card);
}
@Override
public NicolBolasGodPharoh copy() {
return new NicolBolasGodPharoh(this);
}
}
class NicolBolasGodPharohPlusOneEffect extends OneShotEffect {
private UUID exileId;
NicolBolasGodPharohPlusOneEffect(UUID exileId) {
super(Outcome.Exile);
this.exileId = exileId;
this.staticText = "Each opponent exiles two cards from his or her hand.";
}
NicolBolasGodPharohPlusOneEffect(final NicolBolasGodPharohPlusOneEffect effect) {
super(effect);
this.exileId = effect.exileId;
}
@Override
public NicolBolasGodPharohPlusOneEffect copy() {
return new NicolBolasGodPharohPlusOneEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// Store for each player the cards to exile, that's important because all exile shall happen at the same time
HashMap<UUID, Cards> cardsToExile = new HashMap<>();
// Each player chooses 2 cards to discard
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
int numberOfCardsToExile = Math.min(2, player.getHand().size());
Cards cards = new CardsImpl();
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
player.chooseTarget(Outcome.Exile, target, source, game);
cards.addAll(target.getTargets());
cardsToExile.put(playerId, cards);
}
// Exile all choosen cards
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
Cards cardsPlayerChoseToExile = cardsToExile.get(playerId);
if (cardsPlayerChoseToExile == null) {
continue;
}
player.moveCardsToExile(cardsPlayerChoseToExile.getCards(game), source, game, true, exileId, source.getSourceObject(game).getIdName());
}
return true;
}
}
class NicolBolasGodPharohPlusTwoEffect extends OneShotEffect {
private UUID exileId;
public NicolBolasGodPharohPlusTwoEffect(UUID exileId) {
super(Outcome.Detriment);
this.exileId = exileId;
this.staticText = "Target opponent exiles cards from the top of his or her library until he or she exiles a nonland card. Until end of turn, you may cast that card without paying its mana cost";
}
public NicolBolasGodPharohPlusTwoEffect(final NicolBolasGodPharohPlusTwoEffect effect) {
super(effect);
this.exileId = effect.exileId;
}
@Override
public NicolBolasGodPharohPlusTwoEffect copy() {
return new NicolBolasGodPharohPlusTwoEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (opponent != null && opponent.getLibrary().hasCards() && sourceObject != null) {
Library library = opponent.getLibrary();
Card card;
do {
card = library.removeFromTop(game);
if (card != null) {
opponent.moveCardsToExile(card, source, game, true, exileId, sourceObject.getIdName());
}
} while (library.hasCards() && card != null && card.isLand());
if (card != null) {
ContinuousEffect effect = new NicolBolasGodPharohFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
game.addEffect(effect, source);
}
return true;
}
return false;
}
}
class NicolBolasGodPharohFromExileEffect extends AsThoughEffectImpl {
public NicolBolasGodPharohFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may cast card from exile";
}
public NicolBolasGodPharohFromExileEffect(final NicolBolasGodPharohFromExileEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public NicolBolasGodPharohFromExileEffect copy() {
return new NicolBolasGodPharohFromExileEffect(this);
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId != null && sourceId.equals(getTargetPointer().getFirst(game, source))
&& affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(sourceId);
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
Player player = game.getPlayer(affectedControllerId);
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
return true;
}
}
return false;
}
}

View file

@ -117,6 +117,7 @@ public class FridayNightMagic extends ExpansionSet {
cards.add(new SetCardInfo("Fact or Fiction", 61, Rarity.UNCOMMON, mage.cards.f.FactOrFiction.class));
cards.add(new SetCardInfo("Fanatic of Xenagos", 173, Rarity.UNCOMMON, mage.cards.f.FanaticOfXenagos.class));
cards.add(new SetCardInfo("Farseek", 154, Rarity.COMMON, mage.cards.f.Farseek.class));
cards.add(new SetCardInfo("Fatal Push", 208, Rarity.SPECIAL, mage.cards.f.FatalPush.class));
cards.add(new SetCardInfo("Fiery Temper", 198, Rarity.UNCOMMON, mage.cards.f.FieryTemper.class));
cards.add(new SetCardInfo("Fireblast", 18, Rarity.COMMON, mage.cards.f.Fireblast.class));
cards.add(new SetCardInfo("Firebolt", 80, Rarity.UNCOMMON, mage.cards.f.Firebolt.class));
@ -193,7 +194,9 @@ public class FridayNightMagic extends ExpansionSet {
cards.add(new SetCardInfo("Reanimate", 53, Rarity.UNCOMMON, mage.cards.r.Reanimate.class));
cards.add(new SetCardInfo("Reliquary Tower", 153, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class));
cards.add(new SetCardInfo("Remand", 92, Rarity.UNCOMMON, mage.cards.r.Remand.class));
cards.add(new SetCardInfo("Renegade Rallier", 207, Rarity.SPECIAL, mage.cards.r.RenegadeRallier.class));
cards.add(new SetCardInfo("Resurrection", 97, Rarity.UNCOMMON, mage.cards.r.Resurrection.class));
cards.add(new SetCardInfo("Reverse Engineer", 206, Rarity.SPECIAL, mage.cards.r.ReverseEngineer.class));
cards.add(new SetCardInfo("Rhox War Monk", 133, Rarity.UNCOMMON, mage.cards.r.RhoxWarMonk.class));
cards.add(new SetCardInfo("Rift Bolt", 125, Rarity.COMMON, mage.cards.r.RiftBolt.class));
cards.add(new SetCardInfo("Rise from the Tides", 197, Rarity.UNCOMMON, mage.cards.r.RiseFromTheTides.class));

View file

@ -27,8 +27,13 @@
*/
package mage.sets;
import java.util.ArrayList;
import java.util.List;
import mage.cards.ExpansionSet;
import mage.constants.Rarity;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.constants.SetType;
/**
@ -43,6 +48,8 @@ public class HourOfDevastation extends ExpansionSet {
return instance;
}
protected final List<CardInfo> savedSpecialLand = new ArrayList<>();
private HourOfDevastation() {
super("Hour of Devastation", "HOU", ExpansionSet.buildDate(2017, 7, 14), SetType.EXPANSION);
this.blockName = "Amonkhet";
@ -54,9 +61,23 @@ public class HourOfDevastation extends ExpansionSet {
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
this.ratioBoosterSpecialLand = 144;
cards.add(new SetCardInfo("Samut, the Tested", 144, Rarity.MYTHIC, mage.cards.s.SamutTheTested.class));
cards.add(new SetCardInfo("Samut, the Tested", 144, Rarity.MYTHIC, mage.cards.s.SamutTheTested.class));
cards.add(new SetCardInfo("Nicol Bolas, God-Pharoh", 140, Rarity.MYTHIC, mage.cards.n.NicolBolasGodPharoh.class));
}
@Override
public List<CardInfo> getSpecialLand() {
if (savedSpecialLand.isEmpty()) {
CardCriteria criteria = new CardCriteria();
criteria.setCodes("MPS-AKH");
criteria.minCardNumber(31);
criteria.maxCardNumber(54);
savedSpecialLand.addAll(CardRepository.instance.findCards(criteria));
}
return new ArrayList<>(savedSpecialLand);
}
}

View file

@ -154,7 +154,6 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
}
/*
* NOTE: test is failing due to bug in code. See issue #3402
Reported bug: Nest of Scarabs not triggering off infect damage dealt by creatures such as Blight Mamba
*/
@Test
@ -179,4 +178,30 @@ public class NestOfScarabsTest extends CardTestPlayerBase {
assertCounterCount(playerB, wOmens, CounterType.M1M1, 1);
assertPermanentCount(playerA, "Insect", 1);
}
/*
Reported bug: Nest of Scarabs not triggering off wither damage dealt by creatures such as Sickle Ripper
*/
@Test
public void scarab_witherDamageTriggers() {
String sickleRipper = "Sickle Ripper"; // {1}{B} 2/1 Creature - Elemental Warrior, Wither
String wOmens = "Wall of Omens"; // {1}{W} 0/4 defender ETB: draw a card
addCard(Zone.BATTLEFIELD, playerA, nestScarabs);
addCard(Zone.BATTLEFIELD, playerA, sickleRipper);
addCard(Zone.BATTLEFIELD, playerB, wOmens);
attack(3, playerA, sickleRipper);
block(3, playerB, wOmens, sickleRipper);
setStopAt(3, PhaseStep.END_COMBAT);
execute();
assertLife(playerB, 20);
assertPowerToughness(playerB, wOmens, -2, 2); // 0/4 with two -1/-1 counters
assertCounterCount(playerB, wOmens, CounterType.M1M1, 2);
assertPermanentCount(playerA, "Insect", 2);
}
}

View file

@ -8062,7 +8062,7 @@ Magma Spray|Friday Night Magic|170|U|{R}|Instant|||Magma Spray deals 2 damage to
Bile Blight|Friday Night Magic|171|U|{B}{B}|Instant|||Target creature and all other creatures with the same name as that creature get -3/-3 until end of turn.|
Banishing Light|Friday Night Magic|172|U|{2}{W}|Enchantment|||When Banishing Light enters the battlefield, exile target nonland permanent an opponent controls until Banishing Light leaves the battlefield. <i>(That permanent returns under its owner's control.)</i>|
Fanatic of Xenagos|Friday Night Magic|173|U|{1}{R}{G}|Creature - Centaur Warrior|3|3|Trample$Tribute 1 <i>(As this creature enters the battlefield, an opponent of your choice may place a +1/+1 counter on it.)</i>$When Fanatic of Xenagos enters the battlefield, if tribute wasn't paid, it gets +1/+1 and gains haste until end of turn.|
Brain Maggot|Friday Night Magic||174|U|{1}{B}|Enchantment Creature - Insect|1|1|When Brain Maggot enters the battlefield, target opponent reveals his or her hand and you choose a nonland card from it. Exile that card until Brain Maggot leaves the battlefield.|
Brain Maggot|Friday Night Magic|174|U|{1}{B}|Enchantment Creature - Insect|1|1|When Brain Maggot enters the battlefield, target opponent reveals his or her hand and you choose a nonland card from it. Exile that card until Brain Maggot leaves the battlefield.|
Stoke the Flames|Friday Night Magic|175|U|{2}{R}{R}|Instant|||Convoke <i>(Your creatures can help cast this spell. Each creature you tap while casting this spell pays for {1} or one mana of that creature's color.)</i>$Stoke the Flames deals 4 damage to target creature or player.|
Frenzied Goblin|Friday Night Magic|176|U|{R}|Creature - Goblin Berserker|1|1|Whenever Frenzied Goblin attacks, you may pay {R}. If you do, target creature can't block this turn.|
Disdainful Stroke|Friday Night Magic|177|U|{1}{U}|Instant|||Counter target spell with converted mana cost 4 or greater.|
@ -8091,6 +8091,12 @@ Call the Bloodline|Friday Night Magic|199|Special|{1}{B}|Enchantment|||{1}, Disc
Noose Constrictor|Friday Night Magic|200|Special|{1}{G}|Creature - Snake|2|2|Reach$Discard a card: Noose Constrictor gets +1/+1 until end of turn.|
Fortune's Favor|Friday Night Magic|201|Special|{3}{U}|Instant|||Target opponent looks at the top four cards of your library and separates them into a face-down pile and a face-up pile. Put one pile into your hand and the other into your graveyard.|
Incendiary Flow|Friday Night Magic|202|Special|{1}{R}|Sorcery|||Incendiary Flow deals 3 damage to target creature or player. If a creature dealt damage this way would die this turn, exile it instead.|
Servo Exhibition|Friday Night Magic|203|Special|{1}{W}|Sorcery|||Create two 1/1 colorless Servo artifact creature tokens.|
Unlicensed Disintegration|Friday Night Magic|204|Special|{1}{B}{R}|Instant|||Destroy target creature. If you control an artifact, Unlicensed Disintegration deals 3 damage to that creature's controller.|
Aether Hub|Friday Night Magic|205|Special||Land|||When Aether Hub enters the battlefield, you get {E}.${T}: Add {C} to your mana pool.${T}, Pay {E}: Add one mana of any color to your mana pool.|
Reverse Engineer|Friday Night Magic|206|Special|{3}{U}{U}|Sorcery|||Improvise$Draw three cards.|
Fatal Push|Friday Night Magic|207|Special|{B}|Instant|||Destroy target creature if it has converted mana cost 2 or less.$<i>Revolt</i> &mdash; Destroy that creature if it has converted mana cost 4 or less instead if a permanent you controlled left the battlefield this turn.|
Renegade Rallier|Friday Night Magic|208|Special|{1}{G}{W}|Creature - Human Warrior|3|2|<i>Revolt</i> &mdash; When Renegade Rallier enters the battlefield, if a permanent you controlled left the battlefield this turn, return target permanent card with converted mana cost 2 or less from your graveyard to the battlefield.|
Akroma, Angel of Fury|From the Vault: Angels|1|M|{5}{R}{R}{R}|Legendary Creature - Angel|6|6|Akroma, Angel of Fury can't be countered.$Flying, trample, protection from white and from blue${R}: Akroma, Angel of Fury gets +1/+0 until end of turn.$Morph {3}{R}{R}{R} <i>You may cast this card face downn as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)</i>|
Akroma, Angel of Wrath|From the Vault: Angels|2|M|{5}{W}{W}{W}|Legendary Creature - Angel|6|6|Flying, first strike, vigilance, trample, haste, protection from black and from red|
Archangel of Strife|From the Vault: Angels|3|M|{5}{W}{W}|Creature - Angel|6|6|Flying$As Archangel of Strife enters the battlefield, each player chooses war or peace.$Creatures controlled by players who chose war get +3/+0.$Creatures controlled by players who chose peace get +0/+3.|
@ -31157,4 +31163,7 @@ The Ur-Dragon|Commander 2017|2|M|{4}{W}{U}{B}{R}{G}|Legendary Creature - Dragon
O-Kagachi, Vengeful Kami|Commander 2017|3|M|{1}{W}{U}{B}{R}{G}|Legendary Creature - Dragon Spirit|6|6|Flying, Trample$Whenever O-Kagachi, Vengeful Kami deals combat damage to a player, if that player attacked you during his or her last turn, exile target nonland permanent that player controls|
Wasitora, Nekoru Queen|Commander 2017|48|M|{2}{B}{R}{G}|Legendary Creature - Cat Dragon|5|4|Flying, trample$Whenever Wasitora, Nekoru Queen deals combat damage to a player, that player sacrifices a creature. If the player can't, you create a 3/3 black, red, and green Cat Dragon creature token with flying|
Ramos, Dragon Engine|Commander 2017|55|M|{6}|Legendary Artifact Creature - Dragon|4|4|Flying$Whenever you cast a spell, put a +1/+1 counter on Ramos, Dragon Engine for each of that spell's colors. Remove five +1/+1 counters from Ramos: Add {W}{W}{U}{U}{B}{B}{R}{R}{G}{G} to your mana pool. Activate this ability only once each turn.|
Taigam, Ojutai Master|Commander 2017|46|{2}{W}{U}|Legendary Creature - Human Monk|3|4|Instant, sorcery, and Dragon spells you control can't be countered by spells or abilities.$Whenever you cast an instant or sorcery spell from your hand, if Taigam, Ojutai Master attacked this turn, that spell gains rebound. <i>(Exile the spell as it resolves. At the beginning of your next upkeep, you may cast that card from exile without paying its mana cost.)</i>|
Taigam, Ojutai Master|Commander 2017|46|R|{2}{W}{U}|Legendary Creature - Human Monk|3|4|Instant, sorcery, and Dragon spells you control can't be countered by spells or abilities.$Whenever you cast an instant or sorcery spell from your hand, if Taigam, Ojutai Master attacked this turn, that spell gains rebound. <i>(Exile the spell as it resolves. At the beginning of your next upkeep, you may cast that card from exile without paying its mana cost.)</i>|
Bontu's Last Reckoning|Hour of Devastation|60|R|{1}{B}{B}|Sorcery|||Destroy all creatures. Lands you control don't untap during your next untap step.|
Nicol Bolas, God-Pharaoh|Hour of Devastation|140|M|{4}{U}{B}{R}|Planeswalker - Bolas|||+2: Target opponent exiles cards from the top of his or her library until he or she exiles a nonland card. Until end of turn, you may cast that card without paying its mana cost.$+1: Each opponent exiles two cards from his or her hand.$-4: Nicol Bolas, God-Pharaoh deals 7 damage to target opponent or creature an opponent controls.$-12: Exile each nonland permanent your opponents control.|
Samut, the Tested|Hour of Devastation|144|M|{2}{R}{G}|Planeswalker - Samut|||+1: Up to one target creature gains double strike until end of turn.$-2: Samut, the Tested deals 2 damage divided as you choose among one or two target creatures and/or players.$-7: Search your library for up to two creature and/or planeswalker cards, put them onto the battlefield, then shuffle your library.|