mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Fix #10442 (Unleash the Inferno)
This commit is contained in:
parent
74920afd71
commit
49075d6893
2 changed files with 48 additions and 10 deletions
|
@ -70,17 +70,16 @@ class UnleashTheInfernoEffect extends OneShotEffect {
|
|||
int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), 7);
|
||||
permanent.damage(7, source, game);
|
||||
int excess = 7 - lethal;
|
||||
if (lethal > 0) {
|
||||
return true;
|
||||
if (excess > 0) {
|
||||
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DestroyTargetEffect(), false);
|
||||
FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent(
|
||||
"artifact or enchantment an opponent controls with mana value less than or equal to " + excess
|
||||
);
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, excess + 1));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
game.fireReflexiveTriggeredAbility(ability, source);
|
||||
}
|
||||
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DestroyTargetEffect(), false);
|
||||
FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent(
|
||||
"artifact or enchantment an opponent controls with mana value less that or equal to " + excess
|
||||
);
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, excess));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
game.fireReflexiveTriggeredAbility(ability, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.mage.test.cards.single.snc;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class UnleashTheInfernoTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Reported bug: https://github.com/magefree/mage/issues/10442
|
||||
*/
|
||||
@Test
|
||||
public void testExcessDamage() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Stone Golem"); // creature to damage (4 toughness)
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Crucible of Worlds"); // artifact to destroy (cmc 3)
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Vedalken Orrery"); // artifact not legal target (cmc 4)
|
||||
addCard(Zone.HAND, playerA, "Unleash the Inferno"); // spell to test
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unleash the Inferno");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unleash the Inferno", 1);
|
||||
assertGraveyardCount(playerB, "Stone Golem", 1);
|
||||
assertGraveyardCount(playerB, "Crucible of Worlds", 1);
|
||||
assertPermanentCount(playerB, "Vedalken Orrery", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue