fix #12928 (The Mindskinner)

This commit is contained in:
xenohedron 2024-09-28 22:25:16 -04:00
parent efed3a3715
commit 554ba8739e
2 changed files with 41 additions and 1 deletions

View file

@ -66,11 +66,12 @@ class TheMindskinnerEffect extends PreventionEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int amount = event.getAmount();
preventDamageAction(event, source, game);
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.millCards(event.getAmount(), source, game);
player.millCards(amount, source, game);
}
}
return true;

View file

@ -0,0 +1,39 @@
package org.mage.test.cards.replacement.prevent;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class TheMindskinnerTest extends CardTestPlayerBase {
private static final String mindskinner = "The Mindskinner"; // 10/1 can't be blocked
// If a source you control would deal damage to an opponent, prevent that damage and each opponent mills that many cards.
private static final String piker = "Goblin Piker"; // 2/1
private static final String bolt = "Lightning Bolt";
@Test
public void testPreventionAndMill() {
addCard(Zone.BATTLEFIELD, playerA, mindskinner);
addCard(Zone.BATTLEFIELD, playerA, piker);
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerB);
attack(1, playerA, piker, playerB);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 1); // bolt
assertGraveyardCount(playerB, 5);
}
}