mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* Liliana, Defiant Necromancer - Fixed target bug of -X ability.
This commit is contained in:
parent
acf5df7f94
commit
270ffcb88a
4 changed files with 32 additions and 27 deletions
|
@ -109,7 +109,7 @@ public class LilianaDefiantNecromancer extends CardImpl {
|
||||||
FilterCard newFilter = filter.copy();
|
FilterCard newFilter = filter.copy();
|
||||||
newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
|
newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.addTarget(new TargetCardInYourGraveyard(filter));
|
ability.addTarget(new TargetCardInYourGraveyard(newFilter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||||
*/
|
*/
|
||||||
public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
// Reported bug: -X allowing returning creatures with higher CMC than counters removed
|
// Reported bug: -X allowing returning creatures with higher CMC than counters removed
|
||||||
@Test
|
@Test
|
||||||
public void testMinusAbilityShouldNotReturnHigherCmcCreature() {
|
public void testMinusAbilityShouldNotReturnHigherCmcCreature() {
|
||||||
|
@ -31,28 +31,25 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
||||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt");
|
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt", "Hill Giant");
|
||||||
addTarget(playerB, "Hill Giant");
|
|
||||||
|
|
||||||
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
||||||
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
||||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:");
|
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:", "Hill Giant");
|
||||||
setChoice(playerA, "X=1");
|
setChoice(playerA, "X=1");
|
||||||
addTarget(playerA, "Hill Giant"); // dunno which to use for returning from grave, both target/choice seem to work
|
|
||||||
setChoice(playerA, "Hill Giant");
|
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||||
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
||||||
assertPermanentCount(playerA, "Zombie", 1);
|
assertPermanentCount(playerA, "Zombie", 1);
|
||||||
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
||||||
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 2);
|
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3); // No balid target with X=1 so no counter is removed
|
||||||
assertPermanentCount(playerA, "Hill Giant", 0);
|
assertPermanentCount(playerA, "Hill Giant", 0);
|
||||||
assertGraveyardCount(playerA, "Hill Giant", 1);
|
assertGraveyardCount(playerA, "Hill Giant", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinusAbilityShouldNotReturnLegendaryCreature() {
|
public void testMinusAbilityShouldNotReturnLegendaryCreature() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Alesha, Who Smiles at Death", 1); // {2}{R} 3/2 Legendary first strike
|
addCard(Zone.BATTLEFIELD, playerA, "Alesha, Who Smiles at Death", 1); // {2}{R} 3/2 Legendary first strike
|
||||||
|
@ -68,7 +65,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
||||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt");
|
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt");
|
||||||
addTarget(playerB, "Alesha, Who Smiles at Death");
|
addTarget(playerB, "Alesha, Who Smiles at Death");
|
||||||
|
|
||||||
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
||||||
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
||||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:");
|
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:");
|
||||||
|
@ -78,8 +75,8 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||||
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
||||||
assertPermanentCount(playerA, "Zombie", 1);
|
assertPermanentCount(playerA, "Zombie", 1);
|
||||||
assertPermanentCount(playerA, "Alesha, Who Smiles at Death", 0);
|
assertPermanentCount(playerA, "Alesha, Who Smiles at Death", 0);
|
||||||
|
@ -88,10 +85,10 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
|
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
|
||||||
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinusAbilityShouldReturnNonLegendaryCreature() {
|
public void testMinusAbilityShouldReturnNonLegendaryCreature() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable", 1); // {2} 2/1
|
addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable", 1); // {2} 2/1
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||||
|
|
||||||
// Lifelink
|
// Lifelink
|
||||||
|
@ -104,7 +101,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
|
||||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt");
|
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt");
|
||||||
addTarget(playerB, "Bronze Sable");
|
addTarget(playerB, "Bronze Sable");
|
||||||
|
|
||||||
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
|
||||||
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
|
||||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:");
|
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:");
|
||||||
|
@ -114,8 +111,8 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||||
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
||||||
assertPermanentCount(playerA, "Zombie", 1);
|
assertPermanentCount(playerA, "Zombie", 1);
|
||||||
assertPermanentCount(playerA, "Bronze Sable", 1);
|
assertPermanentCount(playerA, "Bronze Sable", 1);
|
||||||
|
@ -123,6 +120,5 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
||||||
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 1);
|
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,14 +254,15 @@ public abstract class AbilityImpl implements Ability {
|
||||||
if (!getModes().choose(game, this)) {
|
if (!getModes().choose(game, this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSourceObject(game);
|
||||||
|
|
||||||
if (controller.isTestMode()) {
|
if (controller.isTestMode()) {
|
||||||
if (!controller.addTargets(this, game)) {
|
if (!controller.addTargets(this, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSourceObject(game);
|
|
||||||
|
|
||||||
/* 20130201 - 601.2b
|
/* 20130201 - 601.2b
|
||||||
* If the player wishes to splice any cards onto the spell (see rule 702.45), he
|
* If the player wishes to splice any cards onto the spell (see rule 702.45), he
|
||||||
* or she reveals those cards in his or her hand.
|
* or she reveals those cards in his or her hand.
|
||||||
|
@ -269,7 +270,7 @@ public abstract class AbilityImpl implements Ability {
|
||||||
if (this.abilityType.equals(AbilityType.SPELL)) {
|
if (this.abilityType.equals(AbilityType.SPELL)) {
|
||||||
game.getContinuousEffects().applySpliceEffects(this, game);
|
game.getContinuousEffects().applySpliceEffects(this, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid.
|
// if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid.
|
||||||
// For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability
|
// For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability
|
||||||
if (noMana) {
|
if (noMana) {
|
||||||
|
|
|
@ -241,12 +241,20 @@ public class PermanentCard extends PermanentImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
card.adjustTargets(ability, game);
|
if (this.isTransformed()) {
|
||||||
|
card.getSecondCardFace().adjustTargets(ability, game);
|
||||||
|
} else {
|
||||||
|
card.adjustTargets(ability, game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
card.adjustCosts(ability, game);
|
if (this.isTransformed()) {
|
||||||
|
card.getSecondCardFace().adjustCosts(ability, game);
|
||||||
|
} else {
|
||||||
|
card.adjustCosts(ability, game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue