more misc text fixes

This commit is contained in:
Evan Kranzler 2020-04-25 20:39:45 -04:00
parent 4afefea1f5
commit ed66104575
5 changed files with 79 additions and 74 deletions

View file

@ -1,14 +1,11 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
@ -16,18 +13,22 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; 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.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class AnyaMercilessAngel extends CardImpl { public final class AnyaMercilessAngel extends CardImpl {
public AnyaMercilessAngel(UUID ownerId, CardSetInfo setInfo) { 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); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ANGEL); this.subtype.add(SubType.ANGEL);
this.power = new MageInt(4); this.power = new MageInt(4);
@ -37,19 +38,22 @@ public final class AnyaMercilessAngel extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Anya, Merciless Angel gets +3/+3 for each opponent whose life total is less than half their starting life total. // 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); this.addAbility(new SimpleStaticAbility(new BoostSourceEffect(
Effect effect = new BoostSourceEffect(dValue, dValue, Duration.WhileOnBattlefield); AnyaMercilessAngelDynamicValue.instance,
effect.setText("{this} gets +3/+3 for each opponent whose life total is less than half their starting life total"); AnyaMercilessAngelDynamicValue.instance,
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(dValue, dValue, Duration.WhileOnBattlefield))); 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. // 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, this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), new GainAbilitySourceEffect(
AnyaMercilessAngelCondition.instance, IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield
"As long as an opponent's life total is less than half their starting life total, {this} has indestructible"))); ), 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); super(card);
} }
@ -59,27 +63,29 @@ public final class AnyaMercilessAngel extends CardImpl {
} }
} }
class AnyaMercilessAngelDynamicValue implements DynamicValue { enum AnyaMercilessAngelDynamicValue implements DynamicValue {
instance;
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int opponentCount = 0; int opponentCount = 0;
Player controller = game.getPlayer(sourceAbility.getControllerId()); Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) { if (controller == null) {
int startingLifeTotal = game.getLife(); return 3 * opponentCount;
for (UUID opponentId : game.getOpponents(controller.getId())) { }
Player opponent = game.getPlayer(opponentId); int startingLifeTotal = game.getLife();
if (opponent != null && opponent.getLife() < startingLifeTotal / 2) { for (UUID opponentId : game.getOpponents(controller.getId())) {
opponentCount++; Player opponent = game.getPlayer(opponentId);
} if (opponent != null && opponent.getLife() < startingLifeTotal / 2) {
opponentCount++;
} }
} }
return opponentCount; return 3 * opponentCount;
} }
@Override @Override
public AnyaMercilessAngelDynamicValue copy() { public AnyaMercilessAngelDynamicValue copy() {
return new AnyaMercilessAngelDynamicValue(); return instance;
} }
@Override @Override
@ -96,9 +102,10 @@ class AnyaMercilessAngelDynamicValue implements DynamicValue {
enum AnyaMercilessAngelCondition implements Condition { enum AnyaMercilessAngelCondition implements Condition {
instance; instance;
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
return new AnyaMercilessAngelDynamicValue().calculate(game, source, null) > 0; return AnyaMercilessAngelDynamicValue.instance.calculate(game, source, null) > 0;
} }
@Override @Override

View file

@ -1,7 +1,5 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -13,11 +11,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class BelbesArmor extends CardImpl { public final class BelbesArmor extends CardImpl {
@ -26,20 +24,16 @@ public final class BelbesArmor extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {X}, {tap}: Target creature gets -X/+X until end of turn. // {X}, {tap}: Target creature gets -X/+X until end of turn.
Ability ability = new SimpleActivatedAbility( Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(
Zone.BATTLEFIELD, new MultipliedValue(ManacostVariableValue.instance, -1),
new BoostTargetEffect( ManacostVariableValue.instance, Duration.EndOfTurn
new MultipliedValue(ManacostVariableValue.instance, -1), ).setText("Target creature gets -X/+X until end of turn"), new ManaCostsImpl("{X}"));
ManacostVariableValue.instance,
Duration.EndOfTurn
),
new ManaCostsImpl("{X}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }
public BelbesArmor(final BelbesArmor card) { private BelbesArmor(final BelbesArmor card) {
super(card); super(card);
} }

View file

@ -1,8 +1,5 @@
package mage.cards.c; package mage.cards.c;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -11,15 +8,17 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
import mage.constants.CardType;
import mage.cards.repository.CardRepository; import mage.cards.repository.CardRepository;
import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public final class CapitalOffense extends CardImpl { 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}"); 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.) // 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(
this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true)); 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. <i>(ignore reminder text and flavor text.)</i>"
));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }
public CapitalOffense(final CapitalOffense card) { private CapitalOffense(final CapitalOffense card) {
super(card); super(card);
} }
@ -43,39 +45,43 @@ public final class CapitalOffense extends CardImpl {
} }
} }
class NumberOfCapitalsInTextOfTargetCreatureCount implements DynamicValue { enum capitaloffensecount implements DynamicValue {
instance;
@Override @Override
public NumberOfCapitalsInTextOfTargetCreatureCount copy() { public capitaloffensecount copy() {
return new NumberOfCapitalsInTextOfTargetCreatureCount(); return instance;
} }
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent permanent = game.getPermanent(sourceAbility.getTargets().get(0).getFirstTarget()); Permanent permanent = game.getPermanent(sourceAbility.getTargets().get(0).getFirstTarget());
if (permanent != null) { if (permanent == null) {
int capitals = 0; return 0;
List<CardInfo> cards = CardRepository.instance.findCards(permanent.getName()); }
int capitals = 0;
List<CardInfo> cards = CardRepository.instance.findCards(permanent.getName());
if (cards != null) { if (cards == null) {
for (CardInfo cardInfo : cards) { return 0;
Card dummy = cardInfo != null ? cardInfo.getCard() : null; }
if (dummy != null) { for (CardInfo cardInfo : cards) {
for (String line : dummy.getRules()) { Card dummy = cardInfo != null ? cardInfo.getCard() : null;
line = line.replaceAll("(?i)<i.*?</i>", ""); // Ignoring reminder text in italic if (dummy == null) {
line = line.replaceAll("\\{this\\}", permanent.getName()); return -1 * capitals;
capitals += line.length() - line.replaceAll("[A-Z]", "").length();
}
}
return -1 * capitals;
}
} }
for (String line : dummy.getRules()) {
line = line.replaceAll("(?i)<i.*?</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; return 0;
} }
@Override @Override
public String getMessage() { 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 "";
} }
} }

View file

@ -37,8 +37,7 @@ public final class JandorsRing extends CardImpl {
Watcher watcher = new JandorsRingWatcher(); Watcher watcher = new JandorsRingWatcher();
// {2}, {tap}, Discard the last card you drew this turn: Draw a card. // {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 // TODO: discard has to be a cost not a payment during resolution
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, 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.");
new JandorsRingEffect(), new ManaCostsImpl("{2}"), WatchedCardInHandCondition.instance, "Last drawn card still in hand?");
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability, watcher); this.addAbility(ability, watcher);
} }

View file

@ -1,7 +1,5 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -9,8 +7,9 @@ import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author cg5 * @author cg5
*/ */
public class TurnFaceUpTargetEffect extends OneShotEffect { public class TurnFaceUpTargetEffect extends OneShotEffect {
@ -42,6 +41,6 @@ public class TurnFaceUpTargetEffect extends OneShotEffect {
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
return "turn target " + mode.getTargets().toString() + " face-up"; return "turn target " + mode.getTargets().get(0).getTargetName() + " face-up";
} }
} }