mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Merge origin/master
This commit is contained in:
commit
ee1f12bacb
3 changed files with 208 additions and 4 deletions
|
@ -27,20 +27,30 @@
|
|||
*/
|
||||
package mage.sets.dissension;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutOnLibraryEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
|
@ -76,9 +86,7 @@ public class MomirVigSimicVisionary extends CardImpl {
|
|||
this.addAbility(new SpellCastControllerTriggeredAbility(effect, filter, true));
|
||||
|
||||
// Whenever you cast a blue creature spell, reveal the top card of your library. If it's a creature card, put that card into your hand.
|
||||
Effect effect2 = new RevealLibraryPutIntoHandEffect(1, new FilterCreatureCard(), false);
|
||||
effect2.setText("reveal the top card of your library. If it's a creature card, put that card into your hand");
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(effect2, filter2, false));
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new MomirVigSimicVisionaryEffect(), filter2, false));
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,3 +99,44 @@ public class MomirVigSimicVisionary extends CardImpl {
|
|||
return new MomirVigSimicVisionary(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MomirVigSimicVisionaryEffect extends OneShotEffect {
|
||||
|
||||
public MomirVigSimicVisionaryEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "reveal the top card of your library. If it's a creature card, put that card into your hand";
|
||||
}
|
||||
|
||||
public MomirVigSimicVisionaryEffect(final MomirVigSimicVisionaryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MomirVigSimicVisionaryEffect copy() {
|
||||
return new MomirVigSimicVisionaryEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardsImpl cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 1));
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
Set<Card> cardsList = cards.getCards(game);
|
||||
Cards cardsToHand = new CardsImpl();
|
||||
for (Card card : cardsList) {
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
cardsToHand.add(card);
|
||||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
125
Mage.Sets/src/mage/sets/onslaught/HarshMercy.java
Normal file
125
Mage.Sets/src/mage/sets/onslaught/HarshMercy.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* 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.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DestroyAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pcasaretto
|
||||
*/
|
||||
public class HarshMercy extends CardImpl {
|
||||
|
||||
public HarshMercy(UUID ownerId) {
|
||||
super(ownerId, 39, "Harsh Mercy", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{W}");
|
||||
this.expansionSetCode = "ONS";
|
||||
|
||||
// Each player chooses a creature type. Destroy all creatures that aren't of a type chosen this way. They can't be regenerated.
|
||||
this.getSpellAbility().addEffect(new HarshMercyEffect());
|
||||
}
|
||||
|
||||
public HarshMercy(final HarshMercy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HarshMercy copy() {
|
||||
return new HarshMercy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HarshMercyEffect extends OneShotEffect {
|
||||
|
||||
public HarshMercyEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "Each player chooses a creature type. Destroy all creatures that aren't of a type chosen this way. They can't be regenerated.";
|
||||
}
|
||||
|
||||
public HarshMercyEffect(final HarshMercyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HarshMercyEffect copy() {
|
||||
return new HarshMercyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Set<String> chosenTypes = new HashSet<>();
|
||||
PlayerIteration:
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose a creature type");
|
||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||
while (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
continue PlayerIteration;
|
||||
}
|
||||
}
|
||||
String chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null) {
|
||||
game.informPlayers(sourceObject.getIdName() + ": " + player.getLogName() + " has chosen " + chosenType);
|
||||
chosenTypes.add(chosenType);
|
||||
}
|
||||
}
|
||||
|
||||
FilterPermanent filter = new FilterCreaturePermanent("creatures");
|
||||
for (String type : chosenTypes) {
|
||||
filter.add(Predicates.not(new SubtypePredicate(type)));
|
||||
}
|
||||
|
||||
return new DestroyAllEffect(filter, true).apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -198,4 +198,34 @@ public class PersistTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Glen Elendra Archmage", 1);
|
||||
assertPowerToughness(playerA, "Glen Elendra Archmage", 1, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMeliraSylvokOutcast() {
|
||||
|
||||
// You can't get poison counters.
|
||||
// Creatures you control can't have -1/-1 counters placed on them.
|
||||
// Creatures your opponents control lose infect.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Melira, Sylvok Outcast", 1); // 2/2
|
||||
// When Murderous Redcap enters the battlefield, it deals damage equal to its power to target creature or player.
|
||||
// Persist
|
||||
addCard(Zone.HAND, playerA, "Murderous Redcap", 1); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murderous Redcap");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Murderous Redcap");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 2);
|
||||
assertPowerToughness(playerA, "Murderous Redcap", 2, 2); // Got no -1/-1 after returning because of Melira in play
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue