[VOW] Implemented Undead Butler

This commit is contained in:
Evan Kranzler 2021-11-08 20:30:30 -05:00
parent 5dbc8f11f3
commit 1656324329
5 changed files with 71 additions and 6 deletions

View file

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

View file

@ -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() {

View file

@ -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) {