forked from External/mage
Fixed Mortician Beetle
This commit is contained in:
parent
22acb87c37
commit
f786727b40
2 changed files with 44 additions and 4 deletions
|
|
@ -27,11 +27,11 @@
|
|||
*/
|
||||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
|
|
@ -41,6 +41,8 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
|
|
@ -56,6 +58,7 @@ public class MorticianBeetle extends CardImpl<MorticianBeetle> {
|
|||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever a player sacrifices a creature, you may put a +1/+1 counter on Mortician Beetle.
|
||||
this.addAbility(new PlayerSacrificesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true));
|
||||
}
|
||||
|
||||
|
|
@ -81,9 +84,11 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl<Play
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.SACRIFICE_PERMANENT
|
||||
&& game.getPermanent(event.getTargetId()).getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
if (event.getType() == EventType.SACRIFICED_PERMANENT) {
|
||||
MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (mageObject != null && mageObject.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package org.mage.test.cards.abilities.oneshot.sacrifice;
|
||||
|
||||
import mage.Constants;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class MorticianBeetleTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Checks that pro black can still be sacrificed
|
||||
*/
|
||||
@Test
|
||||
public void testSacrifice() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
addCard(Constants.Zone.HAND, playerA, "Cruel Edict");
|
||||
addCard(Constants.Zone.HAND, playerA, "Geth's Verdict");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mortician Beetle");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Savannah Lions");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Sigiled Paladin");
|
||||
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Cruel Edict");
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Geth's Verdict");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, 0);
|
||||
assertPowerToughness(playerA, "Mortician Beetle", 3, 3);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue