mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[VOW] Implemented Undead Butler
This commit is contained in:
parent
5dbc8f11f3
commit
1656324329
5 changed files with 71 additions and 6 deletions
53
Mage.Sets/src/mage/cards/u/UndeadButler.java
Normal file
53
Mage.Sets/src/mage/cards/u/UndeadButler.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.costs.common.ExileSourceFromGraveCost;
|
||||
import mage.abilities.effects.common.DoWhenCostPaid;
|
||||
import mage.abilities.effects.common.MillCardsControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class UndeadButler extends CardImpl {
|
||||
|
||||
public UndeadButler(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// When Undead Butler enters the battlefield, mill three cards.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new MillCardsControllerEffect(3)));
|
||||
|
||||
// When Undead Butler dies, you may exile it. When you do, return target creature card from your graveyard to your hand.
|
||||
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
|
||||
new ReturnFromGraveyardToHandTargetEffect(), false
|
||||
);
|
||||
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
this.addAbility(new DiesSourceTriggeredAbility(new DoWhenCostPaid(
|
||||
ability, new ExileSourceFromGraveCost(), "Exile {this}?"
|
||||
)));
|
||||
}
|
||||
|
||||
private UndeadButler(final UndeadButler card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UndeadButler copy() {
|
||||
return new UndeadButler(this);
|
||||
}
|
||||
}
|
|
@ -286,6 +286,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Twinblade Invocation", 40, Rarity.UNCOMMON, mage.cards.t.TwinbladeInvocation.class));
|
||||
cards.add(new SetCardInfo("Ulvenwald Behemoth", 225, Rarity.RARE, mage.cards.u.UlvenwaldBehemoth.class));
|
||||
cards.add(new SetCardInfo("Ulvenwald Oddity", 225, Rarity.RARE, mage.cards.u.UlvenwaldOddity.class));
|
||||
cards.add(new SetCardInfo("Undead Butler", 133, Rarity.UNCOMMON, mage.cards.u.UndeadButler.class));
|
||||
cards.add(new SetCardInfo("Undying Malice", 134, Rarity.COMMON, mage.cards.u.UndyingMalice.class));
|
||||
cards.add(new SetCardInfo("Unhallowed Phalanx", 135, Rarity.COMMON, mage.cards.u.UnhallowedPhalanx.class));
|
||||
cards.add(new SetCardInfo("Unholy Officiant", 41, Rarity.COMMON, mage.cards.u.UnholyOfficiant.class));
|
||||
|
|
|
@ -15,6 +15,10 @@ public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility {
|
|||
|
||||
private final String text;
|
||||
|
||||
public ReflexiveTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, null);
|
||||
}
|
||||
|
||||
public ReflexiveTriggeredAbility(Effect effect, boolean optional, String text) {
|
||||
super(effect, Duration.EndOfTurn, true, optional);
|
||||
this.text = text;
|
||||
|
@ -32,19 +36,18 @@ public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals(this.getControllerId())
|
||||
return this.isControlledBy(event.getPlayerId())
|
||||
&& event.getSourceId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
if (text == null) {
|
||||
return super.getRule();
|
||||
}
|
||||
return text.substring(0, 1).toUpperCase(Locale.ENGLISH) + text.substring(1) + '.';
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflexiveTriggeredAbility copy() {
|
||||
return new ReflexiveTriggeredAbility(this);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DoWhenCostPaid extends OneShotEffect {
|
|||
if (!staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return (optional ? "you may " : "") + getCostText() + ". When you do, " + ability.getText();
|
||||
return (optional ? "you may " : "") + getCostText() + ". When you do, " + CardUtil.getTextWithFirstCharLowerCase(ability.getRule());
|
||||
}
|
||||
|
||||
private String getCostText() {
|
||||
|
|
|
@ -915,6 +915,14 @@ public final class CardUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getTextWithFirstCharLowerCase(String text) {
|
||||
if (text != null && text.length() >= 1) {
|
||||
return Character.toLowerCase(text.charAt(0)) + text.substring(1);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String vowels = "aeiouAEIOU";
|
||||
|
||||
public static String addArticle(String text) {
|
||||
|
|
Loading…
Reference in a new issue