Fixed Unlicensed Disintegration damage part (#6614)

* Damage to creature's controller abilities -- fixed that damage part can be skipped if that creature died/destroyed (example: Unlicensed Disintegration, see #6614)

Co-authored-by: johnm <johnm@WINDOWS-QR5QIIL.lan>
Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
johnmeat 2020-06-09 02:51:58 +01:00 committed by GitHub
parent 07309003b4
commit 3119e7e78c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 130 additions and 2 deletions

View file

@ -28,7 +28,7 @@ public final class UnlicensedDisintegration extends CardImpl {
new DamageTargetControllerEffect(3),
new PermanentsOnTheBattlefieldCondition(new FilterControlledArtifactPermanent()),
"If you control an artifact, Unlicensed Disintegration deals 3 damage to that creature's controller"));
}
public UnlicensedDisintegration(final UnlicensedDisintegration card) {

View file

@ -0,0 +1,128 @@
package org.mage.test.cards.abilities.oneshot.destroy;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/*
Unlicensed Disintigration - Hi! Noticed that everytime that i succesfully cast
Unlicensed Disintigration with an artifact on the board the opponent wont lose 3 life.
The creature dies but the last piece of text does not work (teM, 2020-02-24 15:17:36)
*/
public class UnlicensedDisintegrationTest extends CardTestPlayerBase{
/*
Unlicensed Disintegration {1}{B}{R}
Destroy target creature. If you control an artifact,
Unlicensed Disintegration deals 3 damage to that creature's controller.
Avacyn, Angel of Hope {5}{W}{W}
Flying, vigilance, indestructible
Other permanents you control have indestructible.
*/
@Test
public void testDestroyCreatureLifeLoss(){
addCard(Zone.HAND, playerA, "Unlicensed Disintegration");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Swamp",2);
// Need an artifact to trigger the damage
addCard(Zone.BATTLEFIELD, playerA, "Sol Ring");
// Play Unlicensed Disintegration, targeting Balduvian Bears
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Balduvian Bears");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Unlicensed Disintegration", 1);
assertLife(playerB, 17);
assertGraveyardCount(playerB, "Balduvian Bears", 1);
}
@Test
public void testDestroyCreatureLifeLossIndestructible(){
addCard(Zone.HAND, playerA, "Unlicensed Disintegration");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears");
addCard(Zone.BATTLEFIELD, playerB, "Avacyn, Angel of Hope");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Swamp",2);
// Need an artifact to trigger the damage
addCard(Zone.BATTLEFIELD, playerA, "Sol Ring");
// Play Unlicensed Disintegration, targeting Balduvian Bears
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Balduvian Bears");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Unlicensed Disintegration", 1);
assertLife(playerB, 17);
assertPermanentCount(playerB, "Balduvian Bears", 1);
assertPermanentCount(playerB, "Avacyn, Angel of Hope", 1);
}
@Test
public void testDestroyCreatureNoLifeLossNoArtifact(){
addCard(Zone.HAND, playerA, "Unlicensed Disintegration");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Swamp",2);
// Play Unlicensed Disintegration, targeting Balduvian Bears
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Balduvian Bears");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Unlicensed Disintegration", 1);
assertLife(playerB, 20);
assertGraveyardCount(playerB, "Balduvian Bears", 1);
}
@Test
public void testDestroyCreatureNoLifeLossNoArtifactIndestructible(){
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Swamp",2);
addCard(Zone.HAND, playerA, "Unlicensed Disintegration");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears");
addCard(Zone.BATTLEFIELD, playerB, "Avacyn, Angel of Hope");
// Play Unlicensed Disintegration, targeting Balduvian Bears
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Balduvian Bears");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Unlicensed Disintegration", 1);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Balduvian Bears", 1);
assertPermanentCount(playerB, "Avacyn, Angel of Hope", 1);
}
}

View file

@ -49,7 +49,7 @@ public class DamageTargetControllerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
if (permanent != null) {
Player targetController = game.getPlayer(permanent.getControllerId());
if (targetController != null) {