mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Added a test and some minor changes.
This commit is contained in:
parent
eadadd591a
commit
79c80fe24b
4 changed files with 45 additions and 20 deletions
|
|
@ -27,10 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
|
@ -39,6 +38,9 @@ import mage.abilities.keyword.IntimidateAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||||
|
|
@ -75,7 +77,7 @@ public class SepulchralPrimordial extends CardImpl {
|
||||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
Player opponent = game.getPlayer(opponentId);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
FilterCard filter = new FilterCreatureCard("creature card from " + opponent.getLogName() + "'s graveyard");
|
FilterCard filter = new FilterCreatureCard("creature card from " + opponent.getName() + "'s graveyard");
|
||||||
filter.add(new OwnerIdPredicate(opponentId));
|
filter.add(new OwnerIdPredicate(opponentId));
|
||||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
|
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
|
||||||
ability.addTarget(target);
|
ability.addTarget(target);
|
||||||
|
|
@ -114,14 +116,18 @@ class SepulchralPrimordialEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
|
Set<Card> cardsToBattlefield = new HashSet<>();
|
||||||
for (Target target : source.getTargets()) {
|
for (Target target : source.getTargets()) {
|
||||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||||
Card targetCard = game.getCard(target.getFirstTarget());
|
Card targetCard = game.getCard(target.getFirstTarget());
|
||||||
if (targetCard != null) {
|
if (targetCard != null) {
|
||||||
targetCard.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
cardsToBattlefield.add(targetCard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!cardsToBattlefield.isEmpty()) {
|
||||||
|
controller.moveCards(cardsToBattlefield, Zone.BATTLEFIELD, source, game);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,7 @@ class TrinisphereEffect extends CostModificationEffectImpl {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)) {
|
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if(permanent != null && !permanent.isTapped())
|
return permanent != null && !permanent.isTapped();
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,9 @@ public class CostModificationTest extends CardTestPlayerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCard1() {
|
public void testCardTrinisphere() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Trinisphere"); // Set mana cost to min 3
|
// As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Trinisphere");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben"); //+1
|
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben"); //+1
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||||
|
|
@ -45,6 +46,27 @@ public class CostModificationTest extends CardTestPlayerBase {
|
||||||
assertGraveyardCount(playerA, 1);
|
assertGraveyardCount(playerA, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trinisphere interacts incorrectly with Phyrexian mana. As implemented, Gitaxian Probe gets a required cost of {2}{U/P},
|
||||||
|
// which allows paying 2 life and only 2 mana. This is incorrect: Trinisphere requires that at least 3 mana be paid, and
|
||||||
|
// payment through life doesn't count. (Source: http://blogs.magicjudges.org/rulestips/2012/08/how-trinisphere-works-with-phyrexian-mana/)
|
||||||
|
@Test
|
||||||
|
public void testCardTrinispherePhyrexianMana() {
|
||||||
|
// As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Trinisphere");
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
|
||||||
|
// Look at target player's hand.
|
||||||
|
// Draw a card.
|
||||||
|
addCard(Zone.HAND, playerB, "Gitaxian Probe"); // Sorcery {UP}
|
||||||
|
|
||||||
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Gitaxian Probe", playerA);
|
||||||
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertHandCount(playerB, "Gitaxian Probe", 1);
|
||||||
|
assertGraveyardCount(playerB, "Gitaxian Probe", 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that cost reduction also works with mana source restriction Myr
|
* Test that cost reduction also works with mana source restriction Myr
|
||||||
* Superion Spend only mana produced by creatures to cast Myr Superion
|
* Superion Spend only mana produced by creatures to cast Myr Superion
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return new StringBuilder("{").append(mana.toString()).append("P}").toString();
|
return "{" + mana.toString() + "P}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue