mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDM] Implement Host of the Hereafter
This commit is contained in:
parent
79bf1851e5
commit
178bd22025
3 changed files with 194 additions and 0 deletions
99
Mage.Sets/src/mage/cards/h/HostOfTheHereafter.java
Normal file
99
Mage.Sets/src/mage/cards/h/HostOfTheHereafter.java
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.MoveCountersFromSourceToTargetEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.CounterAnyPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public final class HostOfTheHereafter extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("this creature or another creature you control");
|
||||
|
||||
static {
|
||||
filter.add(CounterAnyPredicate.instance);
|
||||
}
|
||||
|
||||
public HostOfTheHereafter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}");
|
||||
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.subtype.add(SubType.WARLOCK);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// This creature enters with two +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)),
|
||||
null, "This creature enters with two +1/+1 counters on it.", "")
|
||||
);
|
||||
|
||||
// Whenever this creature or another creature you control dies, if it had counters on it, put its counters on up to one target creature you control.
|
||||
Ability ability = new DiesCreatureTriggeredAbility(new HostOfTheHereafterDiesEffect(), false, filter)
|
||||
.setTriggerPhrase("Whenever " + filter.getMessage() + " dies, if it had counters on it, ");
|
||||
ability.addTarget(new TargetControlledCreaturePermanent(0, 1));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private HostOfTheHereafter(final HostOfTheHereafter card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostOfTheHereafter copy() {
|
||||
return new HostOfTheHereafter(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HostOfTheHereafterDiesEffect extends OneShotEffect {
|
||||
|
||||
HostOfTheHereafterDiesEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put its counters on up to one target creature you control";
|
||||
}
|
||||
|
||||
private HostOfTheHereafterDiesEffect(final HostOfTheHereafterDiesEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostOfTheHereafterDiesEffect copy() {
|
||||
return new HostOfTheHereafterDiesEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
Permanent deadCreature = (Permanent) this.getValue("creatureDied");
|
||||
if (permanent == null || deadCreature == null) {
|
||||
return false;
|
||||
}
|
||||
Counters counters = deadCreature.getCounters(game);
|
||||
counters.values().stream()
|
||||
.filter(counter -> counter.getCount() > 0)
|
||||
.forEach(counter -> permanent.addCounters(counter, source, game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -124,6 +124,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Herd Heirloom", 144, Rarity.RARE, mage.cards.h.HerdHeirloom.class));
|
||||
cards.add(new SetCardInfo("Heritage Reclamation", 145, Rarity.COMMON, mage.cards.h.HeritageReclamation.class));
|
||||
cards.add(new SetCardInfo("Highspire Bell-Ringer", 47, Rarity.COMMON, mage.cards.h.HighspireBellRinger.class));
|
||||
cards.add(new SetCardInfo("Host of the Hereafter", 193, Rarity.UNCOMMON, mage.cards.h.HostOfTheHereafter.class));
|
||||
cards.add(new SetCardInfo("Humbling Elder", 48, Rarity.COMMON, mage.cards.h.HumblingElder.class));
|
||||
cards.add(new SetCardInfo("Iceridge Serpent", 49, Rarity.COMMON, mage.cards.i.IceridgeSerpent.class));
|
||||
cards.add(new SetCardInfo("Inevitable Defeat", 194, Rarity.RARE, mage.cards.i.InevitableDefeat.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
package org.mage.test.cards.single.tdm;
|
||||
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class HostOfTheHereafterTest extends CardTestPlayerBase {
|
||||
|
||||
public static final String HOST = "Host of the Hereafter";
|
||||
public static final String BAYOU = "Bayou";
|
||||
public static final String CUB = "Bear Cub";
|
||||
public static final String DOWNFALL = "Hero's Downfall";
|
||||
public static final String FEED = "Feed the Serpent";
|
||||
|
||||
@Test
|
||||
public void testEntersWithCounters() {
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.HAND, playerA, HOST);
|
||||
addCard(Zone.BATTLEFIELD, playerA, BAYOU, 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, HOST);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, HOST, 1);
|
||||
assertCounterCount(playerA, HOST, CounterType.P1P1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiesMoveCounters() {
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.HAND, playerA, HOST);
|
||||
addCard(Zone.HAND, playerA, DOWNFALL);
|
||||
addCard(Zone.BATTLEFIELD, playerA, BAYOU, 7);
|
||||
addCard(Zone.BATTLEFIELD, playerA, CUB);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, HOST);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, DOWNFALL, HOST);
|
||||
addTarget(playerA, CUB);
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, CUB, 1);
|
||||
assertCounterCount(playerA, CUB, CounterType.P1P1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exileNoCounters() {
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.HAND, playerA, HOST);
|
||||
addCard(Zone.HAND, playerA, FEED);
|
||||
addCard(Zone.BATTLEFIELD, playerA, BAYOU, 8);
|
||||
addCard(Zone.BATTLEFIELD, playerA, CUB);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, HOST);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, FEED, HOST);
|
||||
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, CUB, 1);
|
||||
assertCounterCount(playerA, CUB, CounterType.P1P1, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOtherCounters() {
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.BATTLEFIELD, playerA, HOST);
|
||||
addCard(Zone.HAND, playerA, DOWNFALL);
|
||||
addCard(Zone.BATTLEFIELD, playerA, BAYOU, 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, CUB);
|
||||
|
||||
addCounters(1, PhaseStep.PRECOMBAT_MAIN, playerA, CUB, CounterType.FLYING, 1);
|
||||
addCounters(1, PhaseStep.PRECOMBAT_MAIN, playerA, CUB, CounterType.LIFELINK, 1);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, DOWNFALL, CUB);
|
||||
addTarget(playerA, HOST);
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, HOST, 1);
|
||||
assertCounterCount(playerA, HOST, CounterType.FLYING, 1);
|
||||
assertCounterCount(playerA, HOST, CounterType.LIFELINK, 1);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue