[AVR] Necrobite + Regenerate effect test

This commit is contained in:
magenoxx 2012-05-12 15:46:07 +04:00
parent ce85896c87
commit 9e45c0a911
2 changed files with 111 additions and 0 deletions

View file

@ -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<Necrobite> {
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);
}
}

View file

@ -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());
}
}