mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09: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
Mage.Sets/src/mage/cards
Mage.Tests/src/test/java/org/mage/test/cards/cost/modification
Mage/src/main/java/mage/abilities/costs/mana
|
@ -27,10 +27,9 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -39,6 +38,9 @@ import mage.abilities.keyword.IntimidateAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
|
@ -54,7 +56,7 @@ import mage.target.common.TargetCardInOpponentsGraveyard;
|
|||
public class SepulchralPrimordial extends CardImpl {
|
||||
|
||||
public SepulchralPrimordial(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.power = new MageInt(5);
|
||||
|
@ -65,19 +67,19 @@ public class SepulchralPrimordial extends CardImpl {
|
|||
|
||||
// When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one
|
||||
// target creature card from that player's graveyard onto the battlefield under your control.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SepulchralPrimordialEffect(),false));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SepulchralPrimordialEffect(), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
ability.getTargets().clear();
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
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));
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0,1, filter);
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
@ -113,15 +115,19 @@ class SepulchralPrimordialEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (Target target: source.getTargets()) {
|
||||
if (controller != null) {
|
||||
Set<Card> cardsToBattlefield = new HashSet<>();
|
||||
for (Target target : source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
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 false;
|
||||
|
|
|
@ -51,7 +51,7 @@ import mage.util.CardUtil;
|
|||
public class Trinisphere extends CardImpl {
|
||||
|
||||
public Trinisphere(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TrinisphereEffect()));
|
||||
|
@ -81,7 +81,7 @@ class TrinisphereEffect extends CostModificationEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
int manaCost = abilityToModify.getManaCostsToPay().convertedManaCost();
|
||||
if(manaCost < 3){
|
||||
if (manaCost < 3) {
|
||||
CardUtil.increaseCost(abilityToModify, 3 - manaCost);
|
||||
}
|
||||
return true;
|
||||
|
@ -91,10 +91,7 @@ class TrinisphereEffect extends CostModificationEffectImpl {
|
|||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if(permanent != null && !permanent.isTapped())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return permanent != null && !permanent.isTapped();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@ public class CostModificationTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCard1() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Trinisphere"); // Set mana cost to min 3
|
||||
public void testCardTrinisphere() {
|
||||
// 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, "Mountain", 3);
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
@ -45,6 +46,27 @@ public class CostModificationTest extends CardTestPlayerBase {
|
|||
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
|
||||
* Superion Spend only mana produced by creatures to cast Myr Superion
|
||||
|
|
|
@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return new StringBuilder("{").append(mana.toString()).append("P}").toString();
|
||||
return "{" + mana.toString() + "P}";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue