[WOC] Implement Court of Embereth (#10971)

* Clean text generation of ConditionalOneShotEffect to prevent "if if"

* [WOC] Implement Court of Embereth
This commit is contained in:
Susucre 2023-09-09 05:57:36 +02:00 committed by GitHub
parent 26012ee135
commit 249e7bf31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 3 deletions

View file

@ -85,10 +85,18 @@ public class ConditionalOneShotEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
if (otherwiseEffects.isEmpty()) {
return "if " + condition.toString() + ", " + CardUtil.getTextWithFirstCharLowerCase(effects.getText(mode));
String conditionText = condition.toString();
if (conditionText.startsWith("if ") || conditionText.startsWith("If ")) {
conditionText = conditionText.substring(3);
}
return effects.getText(mode) + ". If " + condition.toString() + ", " + CardUtil.getTextWithFirstCharLowerCase(otherwiseEffects.getText(mode));
if (otherwiseEffects.isEmpty()) {
return "if " + conditionText + ", "
+ CardUtil.getTextWithFirstCharLowerCase(effects.getText(mode));
}
return effects.getText(mode) + ". If " + conditionText + ", "
+ CardUtil.getTextWithFirstCharLowerCase(otherwiseEffects.getText(mode));
}
@Override

View file

@ -18,4 +18,10 @@ public abstract class OneShotEffect extends EffectImpl {
protected OneShotEffect(final OneShotEffect effect) {
super(effect);
}
@Override
public OneShotEffect setText(String staticText) {
super.setText(staticText);
return this;
}
}

View file

@ -38,6 +38,10 @@ public class DamagePlayersEffect extends OneShotEffect {
this(outcome, amount, TargetController.ANY);
}
public DamagePlayersEffect(DynamicValue amount, TargetController controller) {
this(Outcome.Damage, amount, controller, "{this}");
}
public DamagePlayersEffect(Outcome outcome, DynamicValue amount, TargetController controller) {
this(outcome, amount, controller, "{this}");
}

View file

@ -0,0 +1,29 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author LevelX2
*/
public final class Knight31RedToken extends TokenImpl {
public Knight31RedToken() {
super("Knight Token", "3/1 red Knight creature token");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.KNIGHT);
power = new MageInt(3);
toughness = new MageInt(1);
}
protected Knight31RedToken(final Knight31RedToken token) {
super(token);
}
public Knight31RedToken copy() {
return new Knight31RedToken(this);
}
}