Skip to content

Commit d75e36d

Browse files
committed
implement [SOS] Moseo, Vein's New Dean
1 parent f114aa6 commit d75e36d

File tree

3 files changed

+194
-0
lines changed

3 files changed

+194
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package mage.cards.m;
2+
3+
import mage.MageInt;
4+
import mage.abilities.TriggeredAbility;
5+
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
6+
import mage.abilities.condition.common.YouGainedLifeCondition;
7+
import mage.abilities.dynamicvalue.common.ControllerGainedLifeCount;
8+
import mage.abilities.effects.common.CreateTokenEffect;
9+
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
10+
import mage.abilities.keyword.FlyingAbility;
11+
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
12+
import mage.cards.Card;
13+
import mage.cards.CardImpl;
14+
import mage.cards.CardSetInfo;
15+
import mage.constants.AbilityWord;
16+
import mage.constants.CardType;
17+
import mage.constants.SubType;
18+
import mage.constants.SuperType;
19+
import mage.filter.FilterCard;
20+
import mage.filter.common.FilterCreatureCard;
21+
import mage.filter.predicate.ObjectSourcePlayer;
22+
import mage.filter.predicate.ObjectSourcePlayerPredicate;
23+
import mage.game.Game;
24+
import mage.game.permanent.token.PestBlackGreenAttacksToken;
25+
import mage.target.common.TargetCardInYourGraveyard;
26+
import mage.watchers.common.PlayerGainedLifeWatcher;
27+
28+
import java.util.UUID;
29+
30+
/**
31+
* @author Susucr
32+
*/
33+
public final class MoseoVeinsNewDean extends CardImpl {
34+
35+
private static final FilterCard filter = new FilterCreatureCard(
36+
"creature card with mana value X or less from your graveyard to the battlefield, "
37+
+ "where X is the amount of life you gained this turn"
38+
);
39+
40+
static {
41+
filter.add(MoseoVeinsNewDeanPredicate.instance);
42+
}
43+
44+
public MoseoVeinsNewDean(UUID ownerId, CardSetInfo setInfo) {
45+
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
46+
47+
this.supertype.add(SuperType.LEGENDARY);
48+
this.subtype.add(SubType.BIRD);
49+
this.subtype.add(SubType.SKELETON);
50+
this.subtype.add(SubType.WARLOCK);
51+
this.power = new MageInt(2);
52+
this.toughness = new MageInt(1);
53+
54+
// Flying
55+
this.addAbility(FlyingAbility.getInstance());
56+
57+
// When Moseo enters, create a 1/1 black and green Pest creature token with "Whenever this token attacks, you gain 1 life."
58+
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new PestBlackGreenAttacksToken())));
59+
60+
// Infusion -- At the beginning of your end step, if you gained life this turn, return up to one target creature card with mana value X or less from your graveyard to the battlefield, where X is the amount of life you gained this turn.
61+
TriggeredAbility ability = new BeginningOfEndStepTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect());
62+
ability.addTarget(new TargetCardInYourGraveyard(0, 1, filter));
63+
ability.withInterveningIf(YouGainedLifeCondition.getZero());
64+
ability.setAbilityWord(AbilityWord.INFUSION);
65+
ability.addHint(ControllerGainedLifeCount.getHint());
66+
this.addAbility(ability, new PlayerGainedLifeWatcher());
67+
}
68+
69+
private MoseoVeinsNewDean(final MoseoVeinsNewDean card) {
70+
super(card);
71+
}
72+
73+
@Override
74+
public MoseoVeinsNewDean copy() {
75+
return new MoseoVeinsNewDean(this);
76+
}
77+
}
78+
79+
enum MoseoVeinsNewDeanPredicate implements ObjectSourcePlayerPredicate<Card> {
80+
instance;
81+
82+
@Override
83+
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
84+
return input.getObject().getManaValue()
85+
<= ControllerGainedLifeCount.instance.calculate(game, input.getSource(), null);
86+
}
87+
}

Mage.Sets/src/mage/sets/SecretsOfStrixhaven.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ private SecretsOfStrixhaven() {
195195
cards.add(new SetCardInfo("Molten-Core Maestro", 335, Rarity.RARE, mage.cards.m.MoltenCoreMaestro.class, NON_FULL_USE_VARIOUS));
196196
cards.add(new SetCardInfo("Moment of Reckoning", 205, Rarity.RARE, mage.cards.m.MomentOfReckoning.class, NON_FULL_USE_VARIOUS));
197197
cards.add(new SetCardInfo("Moment of Reckoning", 353, Rarity.RARE, mage.cards.m.MomentOfReckoning.class, NON_FULL_USE_VARIOUS));
198+
cards.add(new SetCardInfo("Moseo, Vein's New Dean", 326, Rarity.RARE, mage.cards.m.MoseoVeinsNewDean.class, NON_FULL_USE_VARIOUS));
199+
cards.add(new SetCardInfo("Moseo, Vein's New Dean", 91, Rarity.RARE, mage.cards.m.MoseoVeinsNewDean.class, NON_FULL_USE_VARIOUS));
198200
cards.add(new SetCardInfo("Mountain", 270, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));
199201
cards.add(new SetCardInfo("Mountain", 278, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
200202
cards.add(new SetCardInfo("Mountain", 279, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package org.mage.test.cards.single.sos;
2+
3+
import mage.constants.PhaseStep;
4+
import mage.constants.Zone;
5+
import org.junit.Assert;
6+
import org.junit.Ignore;
7+
import org.junit.Test;
8+
import org.mage.test.player.TestPlayer;
9+
import org.mage.test.serverside.base.CardTestPlayerBase;
10+
11+
/**
12+
* @author Susucr
13+
*/
14+
public class MoseoVeinsNewDeanTest extends CardTestPlayerBase {
15+
16+
/**
17+
* {@link mage.cards.m.MoseoVeinsNewDean Moseo, Vein's new Dean} {2}{B}
18+
* Legendary Creature — Bird Skeleton Warlock
19+
* Flying
20+
* When Moseo enters, create a 1/1 black and green Pest creature token with “Whenever this token attacks, you gain 1 life.”
21+
* Infusion — At the beginning of your end step, if you gained life this turn, return up to one target creature card with mana value X or less from your graveyard to the battlefield, where X is the amount of life you gained this turn.
22+
* 2/1
23+
*/
24+
private static final String moseo = "Moseo, Vein's New Dean";
25+
26+
@Test
27+
public void test_NoTrigger() {
28+
addCard(Zone.BATTLEFIELD, playerA, moseo, 1);
29+
addCard(Zone.GRAVEYARD, playerA, "Memnite", 1);
30+
31+
setStopAt(2, PhaseStep.BEGIN_COMBAT);
32+
setStrictChooseMode(true);
33+
execute();
34+
35+
assertPermanentCount(playerA, 1);
36+
}
37+
38+
@Test
39+
public void test_Gain5_NoValidTarget() {
40+
addCard(Zone.BATTLEFIELD, playerA, moseo, 1);
41+
addCard(Zone.GRAVEYARD, playerA, "Craw Wurm", 1);
42+
addCard(Zone.HAND, playerA, "Chaplain's Blessing"); // {W} gain 5 life
43+
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
44+
45+
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chaplain's Blessing");
46+
47+
// there is a trigger, but no valid target
48+
addTarget(playerA, TestPlayer.TARGET_SKIP);
49+
50+
setStopAt(2, PhaseStep.BEGIN_COMBAT);
51+
setStrictChooseMode(true);
52+
53+
execute();
54+
assertLife(playerA, 25);
55+
assertPermanentCount(playerA, "Craw Wurm", 0);
56+
}
57+
58+
@Ignore
59+
@Test
60+
public void test_Gain5_NoValidTarget_Attempt() {
61+
addCard(Zone.BATTLEFIELD, playerA, moseo, 1);
62+
addCard(Zone.GRAVEYARD, playerA, "Craw Wurm", 1);
63+
addCard(Zone.HAND, playerA, "Chaplain's Blessing"); // {W} gain 5 life
64+
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
65+
66+
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chaplain's Blessing");
67+
68+
// there is a trigger, but no valid target, target will not be used
69+
addTarget(playerA, "Craw Wurm");
70+
71+
setStopAt(2, PhaseStep.BEGIN_COMBAT);
72+
setStrictChooseMode(true);
73+
74+
try {
75+
execute();
76+
Assert.fail("must throw exception on execute");
77+
} catch (Throwable e) {
78+
if (!e.getMessage().contains("Targets list was setup by addTarget with [Craw Wurm], but not used")) {
79+
Assert.fail("must have thrown error about unused target, but got:\n" + e.getMessage());
80+
}
81+
}
82+
assertPermanentCount(playerA, "Craw Wurm", 0);
83+
}
84+
85+
@Test
86+
public void test_Gain5_ValidTarget() {
87+
addCard(Zone.BATTLEFIELD, playerA, moseo, 1);
88+
addCard(Zone.GRAVEYARD, playerA, "Craw Wurm", 1);
89+
addCard(Zone.GRAVEYARD, playerA, "Centaur Courser", 1);
90+
addCard(Zone.GRAVEYARD, playerA, "Armored Cancrix", 1);
91+
addCard(Zone.HAND, playerA, "Chaplain's Blessing"); // {W} gain 5 life
92+
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
93+
94+
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chaplain's Blessing");
95+
96+
// target for the trigger
97+
addTarget(playerA, "Armored Cancrix");
98+
99+
setStopAt(2, PhaseStep.BEGIN_COMBAT);
100+
setStrictChooseMode(true);
101+
execute();
102+
103+
assertPermanentCount(playerA, "Craw Wurm", 0);
104+
}
105+
}

0 commit comments

Comments
 (0)