forked from External/mage
[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:
parent
26012ee135
commit
249e7bf31b
6 changed files with 106 additions and 3 deletions
55
Mage.Sets/src/mage/cards/c/CourtOfEmbereth.java
Normal file
55
Mage.Sets/src/mage/cards/c/CourtOfEmbereth.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.MonarchIsSourceControllerCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesYouControlCount;
|
||||
import mage.abilities.effects.common.BecomesMonarchSourceEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.abilities.hint.common.CreaturesYouControlHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.permanent.token.Knight31RedToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class CourtOfEmbereth extends CardImpl {
|
||||
|
||||
public CourtOfEmbereth(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
|
||||
|
||||
|
||||
// When Court of Embereth enters the battlefield, you become the monarch.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new BecomesMonarchSourceEffect()));
|
||||
|
||||
// At the beginning of your upkeep, create a 3/1 red Knight creature token. Then if you're the monarch, Court of Embereth deals X damage to each opponent, where X is the number of creatures you control.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(
|
||||
new CreateTokenEffect(new Knight31RedToken()),
|
||||
TargetController.YOU, false
|
||||
);
|
||||
ability.addEffect(new ConditionalOneShotEffect(
|
||||
new DamagePlayersEffect(CreaturesYouControlCount.instance, TargetController.OPPONENT)
|
||||
.setText("{this} deals X damage to each opponent, where X is the number of creatures you control"),
|
||||
MonarchIsSourceControllerCondition.instance
|
||||
).concatBy("Then"));
|
||||
ability.addHint(CreaturesYouControlHint.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private CourtOfEmbereth(final CourtOfEmbereth card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourtOfEmbereth copy() {
|
||||
return new CourtOfEmbereth(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ public final class WildsOfEldraineCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Command Tower", 156, Rarity.COMMON, mage.cards.c.CommandTower.class));
|
||||
cards.add(new SetCardInfo("Consider", 87, Rarity.COMMON, mage.cards.c.Consider.class));
|
||||
cards.add(new SetCardInfo("Court of Ardenvale", 21, Rarity.RARE, mage.cards.c.CourtOfArdenvale.class));
|
||||
cards.add(new SetCardInfo("Court of Embereth", 24, Rarity.RARE, mage.cards.c.CourtOfEmbereth.class));
|
||||
cards.add(new SetCardInfo("Court of Vantress", 22, Rarity.RARE, mage.cards.c.CourtOfVantress.class));
|
||||
cards.add(new SetCardInfo("Danitha Capashen, Paragon", 64, Rarity.UNCOMMON, mage.cards.d.DanithaCapashenParagon.class));
|
||||
cards.add(new SetCardInfo("Darkwater Catacombs", 157, Rarity.RARE, mage.cards.d.DarkwaterCatacombs.class));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue