mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Fixed that converted mana costs for stack objects were not always calculated correctly (e.g. a Mental Misstep could counter a Cahlice of the Coid with X=1).
This commit is contained in:
parent
1c6f6c5f3d
commit
7ad45a2a6e
6 changed files with 41 additions and 17 deletions
|
@ -54,6 +54,8 @@ public class MentalMisstep extends CardImpl {
|
|||
super(ownerId, 38, "Mental Misstep", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{UP}");
|
||||
this.expansionSetCode = "NPH";
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Counter target spell with converted mana cost 1.
|
||||
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetSpell(filter));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
|
|||
*/
|
||||
|
||||
@Test
|
||||
public void testCopiedSteelHellkite() {
|
||||
public void testX1CountsFor2CMC() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Zone.HAND, playerA, "Chalice of the Void", 2);
|
||||
|
||||
|
@ -56,10 +56,34 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void");
|
||||
setChoice(playerA, "X=1");
|
||||
|
||||
setStopAt(4, PhaseStep.BEGIN_COMBAT);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Chalice of the Void", 2);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
If X=1 the cmc of Chalice on the stack is 2. So it can't be countered by Mental Misstep
|
||||
*/
|
||||
@Test
|
||||
public void testCantBeCounteredByMentalMisstep() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.HAND, playerA, "Chalice of the Void", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 1);
|
||||
addCard(Zone.HAND, playerB, "Mental Misstep", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void");
|
||||
setChoice(playerA, "X=1");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Mental Misstep", "Chalice of the Void", "Chalice of the Void");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerB, "Mental Misstep", 1); // cannot be cast because no legal target exists
|
||||
assertPermanentCount(playerA, "Chalice of the Void", 1); // was not countered
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
package mage.filter.predicate.mageobject;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.predicate.IntComparePredicate;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -46,19 +44,9 @@ public class ConvertedManaCostPredicate extends IntComparePredicate<MageObject>
|
|||
|
||||
@Override
|
||||
protected int getInputValue(MageObject input) {
|
||||
if(input instanceof StackObject){
|
||||
int manaCost = 0;
|
||||
for(ManaCost cost : input.getManaCost()){
|
||||
if(cost instanceof VariableManaCost){
|
||||
manaCost += ((StackObject)input).getStackAbility().getManaCostsToPay().getX();
|
||||
}
|
||||
else{
|
||||
manaCost += cost.convertedManaCost();
|
||||
}
|
||||
}
|
||||
return manaCost;
|
||||
}
|
||||
else{
|
||||
if (input instanceof StackObject) {
|
||||
return ((StackObject) input).getConvertedManaCost();
|
||||
} else{
|
||||
return input.getManaCost().convertedManaCost();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -609,6 +609,7 @@ public class Spell implements StackObject, Card {
|
|||
* treated as the number chosen for it while the object is on the stack.
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getConvertedManaCost() {
|
||||
int cmc = 0;
|
||||
for (Ability spellAbility: spellAbilities) {
|
||||
|
|
|
@ -208,6 +208,14 @@ public class StackAbility implements StackObject, Ability {
|
|||
return emptyCosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConvertedManaCost() {
|
||||
// Activated abilities have an "activation cost" but they don't have a characteristic related to that while on the stack.
|
||||
// There are certain effects that interact with the cost to activate an ability (e.g., Training Grounds, Power Artifact)
|
||||
// but nothing that looks for that quality of an ability once it's on the stack.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effects getEffects() {
|
||||
return ability.getEffects();
|
||||
|
|
|
@ -40,6 +40,7 @@ public interface StackObject extends MageObject, Controllable {
|
|||
UUID getSourceId();
|
||||
void counter(UUID sourceId, Game game);
|
||||
Ability getStackAbility();
|
||||
int getConvertedManaCost();
|
||||
@Override
|
||||
StackObject copy();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue