From 9e45c0a91152462584ba9c4e91efea4a1cb71886 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Sat, 12 May 2012 15:46:07 +0400 Subject: [PATCH] [AVR] Necrobite + Regenerate effect test --- .../mage/sets/avacynrestored/Necrobite.java | 68 +++++++++++++++++++ .../regenerate/NecrobiteRegenerateTest.java | 43 ++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/Necrobite.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/regenerate/NecrobiteRegenerateTest.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Necrobite.java b/Mage.Sets/src/mage/sets/avacynrestored/Necrobite.java new file mode 100644 index 00000000000..401ee51ee11 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/Necrobite.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.effects.common.RegenerateTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.CardImpl; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class Necrobite extends CardImpl { + + public Necrobite(UUID ownerId) { + super(ownerId, 115, "Necrobite", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}"); + this.expansionSetCode = "AVR"; + + this.color.setBlack(true); + + // Target creature gains deathtouch until end of turn. Regenerate it. + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Constants.Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new RegenerateTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public Necrobite(final Necrobite card) { + super(card); + } + + @Override + public Necrobite copy() { + return new Necrobite(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/regenerate/NecrobiteRegenerateTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/regenerate/NecrobiteRegenerateTest.java new file mode 100644 index 00000000000..f46691e2f5c --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/regenerate/NecrobiteRegenerateTest.java @@ -0,0 +1,43 @@ +package org.mage.test.cards.abilities.oneshot.regenerate; + +import mage.Constants; +import mage.game.permanent.Permanent; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author noxx + */ +public class NecrobiteRegenerateTest extends CardTestPlayerBase { + + @Test + public void testRegenerateAndDeathtouch() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Craw Wurm"); + + addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Swamp", 3); + addCard(Constants.Zone.HAND, playerB, "Necrobite"); + + attack(2, playerB, "Elite Vanguard"); + block(2, playerA, "Craw Wurm", "Elite Vanguard"); + castSpell(2, Constants.PhaseStep.DECLARE_BLOCKERS, playerB, "Necrobite", "Elite Vanguard"); + + setStopAt(2, Constants.PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + + // blocker dies because of deathtouch + assertPermanentCount(playerA, "Craw Wurm", 0); + assertGraveyardCount(playerA, "Craw Wurm", 1); + + Permanent eliteVanguard = getPermanent("Elite Vanguard", playerB.getId()); + Assert.assertNotNull(eliteVanguard); + + // regenerate causes to tap + Assert.assertTrue(eliteVanguard.isTapped()); + } +}