mirror of
https://github.com/correl/mage.git
synced 2024-12-30 19:10:36 +00:00
fix #8097,
the sacrifice target cost was optional, but SacrificeCost.canPay first checks if there are valid targets. In this scenario there were none, but the spell should still be playable
This commit is contained in:
parent
6c837e733b
commit
271f7b812f
2 changed files with 21 additions and 0 deletions
|
@ -190,4 +190,21 @@ public class OptionalSacrificeTests extends CardTestPlayerBase {
|
|||
assertHandCount(playerB, "Propaganda", 0);
|
||||
assertPermanentCount(playerB, "Propaganda", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
As an additional cost to cast Devouring Greed, you may sacrifice any number of Spirits.
|
||||
|
||||
// Target player loses 2 life plus 2 life for each Spirit sacrificed this way. You gain that much life.
|
||||
**/
|
||||
@Test
|
||||
public void testDevouringGreedWithoutSpirits(){
|
||||
addCard(Zone.HAND, playerA, "Devouring Greed");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Devouring Greed", playerB);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertLife(playerB, 18);
|
||||
assertLife(playerA, 22);
|
||||
assertGraveyardCount(playerA, "Devouring Greed", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,10 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
// solves issue #8097, if a sacrifice cost is optional and you don't have valid targets, then the cost can be paid
|
||||
if(validTargets == 0 && targets.get(0).getMinNumberOfTargets() == 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue