mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge.
This commit is contained in:
parent
47b2a64cee
commit
c3f32a39bd
5 changed files with 321 additions and 5 deletions
52
Mage.Sets/src/mage/sets/pdsslivers/WildPair.java
Normal file
52
Mage.Sets/src/mage/sets/pdsslivers/WildPair.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.pdsslivers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fenhl
|
||||
*/
|
||||
public class WildPair extends mage.sets.planarchaos.WildPair {
|
||||
|
||||
public WildPair(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 30;
|
||||
this.expansionSetCode = "H09";
|
||||
}
|
||||
|
||||
public WildPair(final WildPair card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WildPair copy() {
|
||||
return new WildPair(this);
|
||||
}
|
||||
}
|
139
Mage.Sets/src/mage/sets/planarchaos/WildPair.java
Normal file
139
Mage.Sets/src/mage/sets/planarchaos/WildPair.java
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* 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.planarchaos;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.condition.common.CastFromHandCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.IntComparePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fenhl
|
||||
*/
|
||||
public class WildPair extends CardImpl {
|
||||
|
||||
public WildPair(UUID ownerID) {
|
||||
super(ownerID, 30, "Wild Pair", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}{G}");
|
||||
this.expansionSetCode = "PLC";
|
||||
|
||||
// Whenever a creature enters the battlefield, if you cast it from your hand, you may search your library for a creature card with the same total power and toughness and put it onto the battlefield. If you do, shuffle your library.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new WildPairEffect(), new FilterCreaturePermanent("a creature"), true),
|
||||
new CastFromHandCondition(),
|
||||
"Whenever a creature enters the battlefield, if you cast it from your hand, you may search your library for a creature card with the same total power and toughness and put it onto the battlefield. If you do, shuffle your library."
|
||||
));
|
||||
}
|
||||
|
||||
public WildPair(final WildPair card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WildPair copy() {
|
||||
return new WildPair(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WildPairEffect extends OneShotEffect {
|
||||
|
||||
public WildPairEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "search your library for a creature card with the same total power and toughness and put it onto the battlefield";
|
||||
}
|
||||
|
||||
public WildPairEffect(final WildPairEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WildPairEffect copy() {
|
||||
return new WildPairEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
int totalPT = permanent.getPower().getValue() + permanent.getToughness().getValue();
|
||||
FilterCreatureCard filter = new FilterCreatureCard("creature card with total power and toughness " + totalPT);
|
||||
filter.add(new TotalPowerAndToughnessPredicate(Filter.ComparisonType.Equal, totalPT));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fenhl
|
||||
*/
|
||||
class TotalPowerAndToughnessPredicate extends IntComparePredicate<MageObject> {
|
||||
|
||||
public TotalPowerAndToughnessPredicate(Filter.ComparisonType type, int value) {
|
||||
super(type, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInputValue(MageObject input) {
|
||||
return input.getPower().getValue() + input.getToughness().getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TotalPowerAndToughness" + super.toString();
|
||||
}
|
||||
}
|
|
@ -29,14 +29,14 @@ public class SkylineCascadeTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Skyline Cascade enters the battlefield tapped.
|
||||
* When Skyline Cascade enters the battlefield, target creature an opponent controls doesn't untap during its controller's next untap step.
|
||||
* Tap: Add {B} to your mana pool.
|
||||
* Tap: Add {U} to your mana pool.
|
||||
*/
|
||||
addCard(Zone.HAND, playerB, "Skyline Cascade");
|
||||
|
||||
attack(1, playerA, "Savannah Lions");
|
||||
|
||||
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Skyline Cascade");
|
||||
addTarget(playerA, "Savannah Lions");
|
||||
addTarget(playerB, "Savannah Lions");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
|
||||
|
@ -64,12 +64,12 @@ public class SkylineCascadeTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Skyline Cascade enters the battlefield tapped.
|
||||
* When Skyline Cascade enters the battlefield, target creature an opponent controls doesn't untap during its controller's next untap step.
|
||||
* Tap: Add {B} to your mana pool.
|
||||
* Tap: Add {U} to your mana pool.
|
||||
*/
|
||||
addCard(Zone.HAND, playerB, "Skyline Cascade");
|
||||
|
||||
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Skyline Cascade");
|
||||
addTarget(playerA, "Savannah Lions");
|
||||
addTarget(playerB, "Savannah Lions");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
|
||||
|
|
|
@ -640,6 +640,91 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reflector Mage bouncing a creature that can be played as a morph should not prevent the card
|
||||
* from being replayed as a morph. Morph creatures are nameless.
|
||||
*
|
||||
* Reported bug:
|
||||
* Face-up morph creatures that are bounced by Reflector Mage should be able to be replayed as morphs
|
||||
* without the "until the next turn" restriction."
|
||||
*/
|
||||
@Test
|
||||
public void testReflectorMageBouncesFaceupCreatureReplayAsMorph() {
|
||||
|
||||
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
|
||||
// That creature's owner can't cast spells with the same name as that creature until your next turn.
|
||||
addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
//Tap: Add {G}, {U}, or {R} to your mana pool.
|
||||
// Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.)
|
||||
// When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Rattleclaw Mystic"); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage");
|
||||
addTarget(playerA, "Rattleclaw Mystic");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rattleclaw Mystic");
|
||||
setChoice(playerB, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Reflector Mage", 1);
|
||||
assertPermanentCount(playerB, "Rattleclaw Mystic", 0);
|
||||
assertHandCount(playerB, "Rattleclaw Mystic", 0); // should have been replayed
|
||||
assertPermanentCount(playerB, "", 1); // Rattleclaw played as a morph
|
||||
}
|
||||
|
||||
/**
|
||||
* Reflector Mage bouncing a creature that can be played as a morph should not prevent the card
|
||||
* from being replayed as a morph. Morph creatures are nameless.
|
||||
*
|
||||
* Reported bug:
|
||||
* Face-up morph creatures that are bounced by Reflector Mage should be able to be replayed as morphs
|
||||
* without the "until the next turn" restriction."
|
||||
*
|
||||
* Testing bouncing a face-down creature played next turn face-up.
|
||||
*/
|
||||
@Test
|
||||
public void testReflectorMageBouncesMorphCreatureReplayAsFaceup() {
|
||||
|
||||
//Tap: Add {G}, {U}, or {R} to your mana pool.
|
||||
// Morph 2 (You may cast this card face down as a 2/2 creature for 3. Turn it face up any time for its morph cost.)
|
||||
// When Rattleclaw Mystic is turned face up, add {G}{U}{R} to your mana pool.
|
||||
addCard(Zone.HAND, playerA, "Rattleclaw Mystic"); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
|
||||
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
|
||||
// That creature's owner can't cast spells with the same name as that creature until your next turn.
|
||||
addCard(Zone.HAND, playerB, "Reflector Mage"); // 2/3
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Reflector Mage");
|
||||
addTarget(playerB, "");
|
||||
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Rattleclaw Mystic");
|
||||
setChoice(playerA, "No"); // cast it face down as 2/2 creature
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Reflector Mage", 1);
|
||||
assertPermanentCount(playerA, "Rattleclaw Mystic", 1);
|
||||
assertHandCount(playerA, "Rattleclaw Mystic", 0); // should have been replayed faceup
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
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 BetaSteward
|
||||
*/
|
||||
public class AliFromCairoTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCard() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Ali from Cairo", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 12);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Soulfire Grand Master", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 12);
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 7);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 7);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 1);
|
||||
assertLife(playerB, 23);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue