mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
[10E, USG] Added No Rest for the Wicked
and test
This commit is contained in:
parent
fce9f8a1a7
commit
ab773ab509
3 changed files with 324 additions and 0 deletions
52
Mage.Sets/src/mage/sets/tenthedition/NoRestForTheWicked.java
Normal file
52
Mage.Sets/src/mage/sets/tenthedition/NoRestForTheWicked.java
Normal file
|
@ -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.tenthedition;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
*/
|
||||
public class NoRestForTheWicked extends mage.sets.urzassaga.NoRestForTheWicked {
|
||||
|
||||
public NoRestForTheWicked(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 165;
|
||||
this.expansionSetCode = "10E";
|
||||
}
|
||||
|
||||
public NoRestForTheWicked(final NoRestForTheWicked card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoRestForTheWicked copy() {
|
||||
return new NoRestForTheWicked(this);
|
||||
}
|
||||
}
|
144
Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java
Normal file
144
Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* 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.urzassaga;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
*/
|
||||
public class NoRestForTheWicked extends CardImpl {
|
||||
|
||||
public NoRestForTheWicked(UUID ownerId) {
|
||||
super(ownerId, 142, "No Rest for the Wicked", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
|
||||
this.expansionSetCode = "USG";
|
||||
|
||||
// Sacrifice No Rest for the Wicked: Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NoRestForTheWickedEffect(), new SacrificeSourceCost());
|
||||
Watcher watcher = new NoRestForTheWickedWatcher();
|
||||
addAbility(ability, watcher);
|
||||
}
|
||||
|
||||
public NoRestForTheWicked(final NoRestForTheWicked card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoRestForTheWicked copy() {
|
||||
return new NoRestForTheWicked(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NoRestForTheWickedEffect extends OneShotEffect {
|
||||
|
||||
NoRestForTheWickedEffect() {
|
||||
super(Outcome.Sacrifice);
|
||||
staticText = "Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn";
|
||||
}
|
||||
|
||||
NoRestForTheWickedEffect(final NoRestForTheWickedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
NoRestForTheWickedWatcher watcher = (NoRestForTheWickedWatcher) game.getState().getWatchers().get("NoRestForTheWickedWatcher");
|
||||
if (watcher != null) {
|
||||
for (UUID id : watcher.cards) {
|
||||
Card c = game.getCard(id);
|
||||
if (c != null) {
|
||||
if (game.getState().getZone(id) == Zone.GRAVEYARD) {
|
||||
if (c.getCardType().contains(CardType.CREATURE) && c.getOwnerId().equals(source.getControllerId())) {
|
||||
//400.3
|
||||
c.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoRestForTheWickedEffect copy() {
|
||||
return new NoRestForTheWickedEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NoRestForTheWickedWatcher extends Watcher {
|
||||
|
||||
ArrayList<UUID> cards = new ArrayList<UUID>();
|
||||
|
||||
public NoRestForTheWickedWatcher() {
|
||||
super("NoRestForTheWickedWatcher", WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public NoRestForTheWickedWatcher(final NoRestForTheWickedWatcher watcher) {
|
||||
super(watcher);
|
||||
this.cards.addAll(watcher.cards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).isDiesEvent()
|
||||
&& ((ZoneChangeEvent) event).getPlayerId().equals(this.getControllerId())) {
|
||||
//400.3 Intercept only the controller's events
|
||||
cards.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoRestForTheWickedWatcher copy() {
|
||||
return new NoRestForTheWickedWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
cards.clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* 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 org.mage.test.cards.single;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author anonymous
|
||||
*/
|
||||
public class NoRestForTheWickedTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Checks that all playerA creatures are back to playerA's hand
|
||||
*/
|
||||
//@Test
|
||||
public void testSacrifice() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Zone.HAND, playerA, "No Rest for the Wicked");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Royal Assassin");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Sengir Vampire");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Flowering Lumberknot");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Moorland Inquisitor");
|
||||
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "No Rest for the Wicked");
|
||||
|
||||
attack(3, playerA, "Memnite");
|
||||
attack(3, playerA, "Royal Assassin");
|
||||
attack(3, playerA, "Sengin Vampire");
|
||||
block(3, playerB, "Moorland Inquisitor", "Memnite");
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice {this}: Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.");
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, 1); //No Rest only
|
||||
assertGraveyardCount(playerA, "No Rest for the Wicked", 1);
|
||||
assertGraveyardCount(playerA, "Memnite", 0);
|
||||
assertHandCount(playerA, "Memnite", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all playerA creatures sacrificed prior to playing
|
||||
* No Rest for the Wicked are back to playerA's hand
|
||||
*/
|
||||
//@Test
|
||||
public void testSacrificeAfterDying() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Zone.HAND, playerA, "No Rest for the Wicked");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Royal Assassin");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Sengir Vampire");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Flowering Lumberknot");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Moorland Inquisitor");
|
||||
|
||||
attack(3, playerA, "Memnite");
|
||||
attack(3, playerA, "Royal Assassin");
|
||||
attack(3, playerA, "Sengin Vampire");
|
||||
block(3, playerB, "Moorland Inquisitor", "Memnite");
|
||||
|
||||
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "No Rest for the Wicked");
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice {this}: Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.");
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "No Rest for the Wicked", 0);
|
||||
assertGraveyardCount(playerA, 1); //No Rest only
|
||||
assertGraveyardCount(playerA, "No Rest for the Wicked", 1);
|
||||
assertGraveyardCount(playerA, "Memnite", 0);
|
||||
assertHandCount(playerA, "Memnite", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take ownership of a creature from playerB and destroy it.
|
||||
* Checks that after sacrificing No Rest for the Wicked it is on playerB's
|
||||
* graveyard, and that it's not on either player's hand.
|
||||
* 400.3
|
||||
*/
|
||||
@Test
|
||||
public void testTakeControlThenSacrifice() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
|
||||
addCard(Zone.HAND, playerA, "No Rest for the Wicked");
|
||||
addCard(Zone.HAND, playerA, "Beacon of Unrest");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Moorland Inquisitor");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Moorland Inquisitor");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Memnite");
|
||||
|
||||
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "No Rest for the Wicked");
|
||||
|
||||
attack(4, playerB, "Memnite");
|
||||
block(4, playerA, "Moorland Inquisitor", "Memnite");
|
||||
|
||||
castSpell(5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Beacon of Unrest", "Memnite");
|
||||
|
||||
attack(7, playerA, "Memnite");
|
||||
block(7, playerB, "Moorland Inquisitor", "Memnite");
|
||||
activateAbility(7, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice {this}: Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.");
|
||||
|
||||
setStopAt(7, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Memnite", 1);
|
||||
assertHandCount(playerB, "Memnite", 0);
|
||||
|
||||
assertPermanentCount(playerA, "No Rest for the Wicked", 0);
|
||||
assertGraveyardCount(playerA, 1); //No Rest only
|
||||
assertGraveyardCount(playerA, "No Rest for the Wicked", 1);
|
||||
assertGraveyardCount(playerA, "Memnite", 0);
|
||||
assertHandCount(playerA, "Memnite", 0);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue