From ed66104575121c6a4c6f83b05a8f035e7f8ec311 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 25 Apr 2020 20:39:45 -0400 Subject: [PATCH] more misc text fixes --- .../src/mage/cards/a/AnyaMercilessAngel.java | 63 ++++++++++--------- Mage.Sets/src/mage/cards/b/BelbesArmor.java | 20 +++--- .../src/mage/cards/c/CapitalOffense.java | 60 ++++++++++-------- Mage.Sets/src/mage/cards/j/JandorsRing.java | 3 +- .../common/TurnFaceUpTargetEffect.java | 7 +-- 5 files changed, 79 insertions(+), 74 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java index fcd66fa2b2..2accd0b07c 100644 --- a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java +++ b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java @@ -1,14 +1,11 @@ - package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.MultipliedValue; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; @@ -16,18 +13,22 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** - * * @author emerald000 */ public final class AnyaMercilessAngel extends CardImpl { public AnyaMercilessAngel(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{W}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.ANGEL); this.power = new MageInt(4); @@ -35,21 +36,24 @@ public final class AnyaMercilessAngel extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // Anya, Merciless Angel gets +3/+3 for each opponent whose life total is less than half their starting life total. - DynamicValue dValue = new MultipliedValue(new AnyaMercilessAngelDynamicValue(), 3); - Effect effect = new BoostSourceEffect(dValue, dValue, Duration.WhileOnBattlefield); - effect.setText("{this} gets +3/+3 for each opponent whose life total is less than half their starting life total"); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(dValue, dValue, Duration.WhileOnBattlefield))); - + this.addAbility(new SimpleStaticAbility(new BoostSourceEffect( + AnyaMercilessAngelDynamicValue.instance, + AnyaMercilessAngelDynamicValue.instance, + Duration.WhileOnBattlefield + ).setText("{this} gets +3/+3 for each opponent whose life total is less than half their starting life total"))); + // As long as an opponent's life total is less than half their starting life total, Anya has indestructible. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), - AnyaMercilessAngelCondition.instance, - "As long as an opponent's life total is less than half their starting life total, {this} has indestructible"))); + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new GainAbilitySourceEffect( + IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield + ), AnyaMercilessAngelCondition.instance, "As long as an opponent's life total " + + "is less than half their starting life total, {this} has indestructible" + ))); } - public AnyaMercilessAngel(final AnyaMercilessAngel card) { + private AnyaMercilessAngel(final AnyaMercilessAngel card) { super(card); } @@ -59,27 +63,29 @@ public final class AnyaMercilessAngel extends CardImpl { } } -class AnyaMercilessAngelDynamicValue implements DynamicValue { +enum AnyaMercilessAngelDynamicValue implements DynamicValue { + instance; @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int opponentCount = 0; Player controller = game.getPlayer(sourceAbility.getControllerId()); - if (controller != null) { - int startingLifeTotal = game.getLife(); - for (UUID opponentId : game.getOpponents(controller.getId())) { - Player opponent = game.getPlayer(opponentId); - if (opponent != null && opponent.getLife() < startingLifeTotal / 2) { - opponentCount++; - } + if (controller == null) { + return 3 * opponentCount; + } + int startingLifeTotal = game.getLife(); + for (UUID opponentId : game.getOpponents(controller.getId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null && opponent.getLife() < startingLifeTotal / 2) { + opponentCount++; } } - return opponentCount; + return 3 * opponentCount; } @Override public AnyaMercilessAngelDynamicValue copy() { - return new AnyaMercilessAngelDynamicValue(); + return instance; } @Override @@ -96,9 +102,10 @@ class AnyaMercilessAngelDynamicValue implements DynamicValue { enum AnyaMercilessAngelCondition implements Condition { instance; + @Override public boolean apply(Game game, Ability source) { - return new AnyaMercilessAngelDynamicValue().calculate(game, source, null) > 0; + return AnyaMercilessAngelDynamicValue.instance.calculate(game, source, null) > 0; } @Override diff --git a/Mage.Sets/src/mage/cards/b/BelbesArmor.java b/Mage.Sets/src/mage/cards/b/BelbesArmor.java index d9cc57f6a2..f3b1409964 100644 --- a/Mage.Sets/src/mage/cards/b/BelbesArmor.java +++ b/Mage.Sets/src/mage/cards/b/BelbesArmor.java @@ -1,7 +1,5 @@ - package mage.cards.b; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; @@ -13,11 +11,11 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Zone; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class BelbesArmor extends CardImpl { @@ -26,20 +24,16 @@ public final class BelbesArmor extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); // {X}, {tap}: Target creature gets -X/+X until end of turn. - Ability ability = new SimpleActivatedAbility( - Zone.BATTLEFIELD, - new BoostTargetEffect( - new MultipliedValue(ManacostVariableValue.instance, -1), - ManacostVariableValue.instance, - Duration.EndOfTurn - ), - new ManaCostsImpl("{X}")); + Ability ability = new SimpleActivatedAbility(new BoostTargetEffect( + new MultipliedValue(ManacostVariableValue.instance, -1), + ManacostVariableValue.instance, Duration.EndOfTurn + ).setText("Target creature gets -X/+X until end of turn"), new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } - public BelbesArmor(final BelbesArmor card) { + private BelbesArmor(final BelbesArmor card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/c/CapitalOffense.java b/Mage.Sets/src/mage/cards/c/CapitalOffense.java index 56a678cb46..43f2106fb4 100644 --- a/Mage.Sets/src/mage/cards/c/CapitalOffense.java +++ b/Mage.Sets/src/mage/cards/c/CapitalOffense.java @@ -1,8 +1,5 @@ - package mage.cards.c; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; @@ -11,15 +8,17 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.repository.CardInfo; -import mage.constants.CardType; import mage.cards.repository.CardRepository; +import mage.constants.CardType; import mage.constants.Duration; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; +import java.util.List; +import java.util.UUID; + /** - * * @author spjspj */ public final class CapitalOffense extends CardImpl { @@ -28,12 +27,15 @@ public final class CapitalOffense extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}{B}"); // target creature gets -x/-x until end of turn, where x is the number of times a capital letter appears in its rules text. (ignore reminder text and flavor text.) - DynamicValue xValue = new NumberOfCapitalsInTextOfTargetCreatureCount(); - this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true)); + this.getSpellAbility().addEffect(new BoostTargetEffect( + capitaloffensecount.instance, capitaloffensecount.instance, Duration.EndOfTurn, true + ).setText("target creature gets -x/-x until end of turn, where x is the number of times " + + "a capital letter appears in its rules text. (ignore reminder text and flavor text.)" + )); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } - public CapitalOffense(final CapitalOffense card) { + private CapitalOffense(final CapitalOffense card) { super(card); } @@ -43,39 +45,43 @@ public final class CapitalOffense extends CardImpl { } } -class NumberOfCapitalsInTextOfTargetCreatureCount implements DynamicValue { +enum capitaloffensecount implements DynamicValue { + instance; @Override - public NumberOfCapitalsInTextOfTargetCreatureCount copy() { - return new NumberOfCapitalsInTextOfTargetCreatureCount(); + public capitaloffensecount copy() { + return instance; } @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent permanent = game.getPermanent(sourceAbility.getTargets().get(0).getFirstTarget()); - if (permanent != null) { - int capitals = 0; - List cards = CardRepository.instance.findCards(permanent.getName()); + if (permanent == null) { + return 0; + } + int capitals = 0; + List cards = CardRepository.instance.findCards(permanent.getName()); - if (cards != null) { - for (CardInfo cardInfo : cards) { - Card dummy = cardInfo != null ? cardInfo.getCard() : null; - if (dummy != null) { - for (String line : dummy.getRules()) { - line = line.replaceAll("(?i)", ""); // Ignoring reminder text in italic - line = line.replaceAll("\\{this\\}", permanent.getName()); - capitals += line.length() - line.replaceAll("[A-Z]", "").length(); - } - } - return -1 * capitals; - } + if (cards == null) { + return 0; + } + for (CardInfo cardInfo : cards) { + Card dummy = cardInfo != null ? cardInfo.getCard() : null; + if (dummy == null) { + return -1 * capitals; } + for (String line : dummy.getRules()) { + line = line.replaceAll("(?i)", ""); // Ignoring reminder text in italic + line = line.replaceAll("\\{this\\}", permanent.getName()); + capitals += line.length() - line.replaceAll("[A-Z]", "").length(); + } + return -1 * capitals; } return 0; } @Override public String getMessage() { - return "target creature gets -x/-x until end of turn, where x is the number of times a capital letter appears in its rules text. (ignore reminder text and flavor text.)"; + return ""; } } diff --git a/Mage.Sets/src/mage/cards/j/JandorsRing.java b/Mage.Sets/src/mage/cards/j/JandorsRing.java index c74ce25a50..13bfcd8a20 100644 --- a/Mage.Sets/src/mage/cards/j/JandorsRing.java +++ b/Mage.Sets/src/mage/cards/j/JandorsRing.java @@ -37,8 +37,7 @@ public final class JandorsRing extends CardImpl { Watcher watcher = new JandorsRingWatcher(); // {2}, {tap}, Discard the last card you drew this turn: Draw a card. // TODO: discard has to be a cost not a payment during resolution - Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, - new JandorsRingEffect(), new ManaCostsImpl("{2}"), WatchedCardInHandCondition.instance, "Last drawn card still in hand?"); + Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new JandorsRingEffect(), new ManaCostsImpl("{2}"), WatchedCardInHandCondition.instance, "{2}, {T}, Discard the last card you drew this turn: Draw a card."); ability.addCost(new TapSourceCost()); this.addAbility(ability, watcher); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java index e3fbd63110..edcf579fa4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java @@ -1,7 +1,5 @@ - package mage.abilities.effects.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; @@ -9,8 +7,9 @@ import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author cg5 */ public class TurnFaceUpTargetEffect extends OneShotEffect { @@ -42,6 +41,6 @@ public class TurnFaceUpTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - return "turn target " + mode.getTargets().toString() + " face-up"; + return "turn target " + mode.getTargets().get(0).getTargetName() + " face-up"; } }