Merge pull request #2085 from cg5-/master

Add Infernal Caretaker
This commit is contained in:
Derek M 2016-07-21 06:09:06 -04:00 committed by GitHub
commit b8091cc3a8
2 changed files with 132 additions and 0 deletions

View file

@ -0,0 +1,76 @@
/*
* 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.legions;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnToHandFromGraveyardAllEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterCard;
import mage.filter.common.FilterBySubtypeCard;
/**
*
* @author cg5
*/
public class InfernalCaretaker extends CardImpl {
private static FilterCard zombieCard = new FilterBySubtypeCard("Zombie");
public InfernalCaretaker(UUID ownerId) {
super(ownerId, 76, "Infernal Caretaker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.expansionSetCode = "LGN";
this.subtype.add("Human");
this.subtype.add("Cleric");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Morph {3}{B}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{3}{B}")));
// When Infernal Caretaker is turned face up, return all Zombie cards from all graveyards to their owners' hands.
Effect effect = new ReturnToHandFromGraveyardAllEffect(zombieCard);
effect.setText("return all Zombie cards from all graveyards to their owners' hands");
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(effect));
}
public InfernalCaretaker(final InfernalCaretaker card) {
super(card);
}
@Override
public InfernalCaretaker copy() {
return new InfernalCaretaker(this);
}
}

View file

@ -0,0 +1,56 @@
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 cg5
*/
public class InfernalCaretakerTest extends CardTestPlayerBase {
@Test
/*
* Infernal Caretaker {3}{B}
* Creature - Human Cleric
* Morph {3}{B}
* When Infernal Caretaker is turned face up, return all Zombie cards from
* all graveyards to their owners' hands.
*/
public void testInfernalCaretaker() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
addCard(Zone.BATTLEFIELD, playerA, "Walking Corpse", 1);
addCard(Zone.HAND, playerA, "Infernal Caretaker", 1);
addCard(Zone.GRAVEYARD, playerA, "Walking Corpse", 4);
addCard(Zone.GRAVEYARD, playerA, "Storm Crow", 4);
addCard(Zone.GRAVEYARD, playerB, "Festering Goblin", 4);
addCard(Zone.GRAVEYARD, playerB, "Elvish Visionary", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Infernal Caretaker");
setChoice(playerA, "Yes"); // Cast as a morph
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{B}: Turn this face-down permanent face up.");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Infernal Caretaker", 1);
assertPermanentCount(playerA, "Walking Corpse", 1);
assertHandCount(playerA, "Walking Corpse", 4);
assertHandCount(playerA, "Storm Crow", 0);
assertHandCount(playerA, "Festering Goblin", 0);
assertHandCount(playerA, "Elvish Visionary", 0);
assertGraveyardCount(playerA, 4); // 4 * Storm Crow
assertPermanentCount(playerB, "Infernal Caretaker", 0);
assertPermanentCount(playerB, "Walking Corpse", 0);
assertHandCount(playerB, "Walking Corpse", 0);
assertHandCount(playerB, "Storm Crow", 0);
assertHandCount(playerB, "Festering Goblin", 4);
assertHandCount(playerB, "Elvish Visionary", 0);
assertGraveyardCount(playerB, 4); // 4 * Elvish Visionary
}
}