mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
All 1-character strings converted to primitives
"b" + "r" now changed to 'b' + 'w'. It's more straight-forward, and may cause perfomance improvements - character primitives allocation is faster and less expensive than string creation.
This commit is contained in:
parent
31589778ca
commit
f60ebfbb1f
451 changed files with 989 additions and 978 deletions
|
|
@ -108,7 +108,7 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
|
||||
@Override
|
||||
public String getIdName() {
|
||||
return getName() + " [" + getId().toString().substring(0, 3) + "]";
|
||||
return getName() + " [" + getId().toString().substring(0, 3) + ']';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|
|||
public String toString() {
|
||||
StringBuilder sbMana = new StringBuilder();
|
||||
if (generic > 0) {
|
||||
sbMana.append("{").append(Integer.toString(generic)).append("}");
|
||||
sbMana.append('{').append(Integer.toString(generic)).append('}');
|
||||
}
|
||||
for (int i = 0; i < colorless; i++) {
|
||||
sbMana.append("{C}");
|
||||
|
|
|
|||
|
|
@ -231,19 +231,19 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
|||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(5);
|
||||
if (white) {
|
||||
sb.append("W");
|
||||
sb.append('W');
|
||||
}
|
||||
if (blue) {
|
||||
sb.append("U");
|
||||
sb.append('U');
|
||||
}
|
||||
if (black) {
|
||||
sb.append("B");
|
||||
sb.append('B');
|
||||
}
|
||||
if (red) {
|
||||
sb.append("R");
|
||||
sb.append('R');
|
||||
}
|
||||
if (green) {
|
||||
sb.append("G");
|
||||
sb.append('G');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
for (Cost cost : optionalCosts) {
|
||||
if (cost instanceof ManaCost) {
|
||||
cost.clearPaid();
|
||||
if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + "?", this, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + '?', this, game)) {
|
||||
manaCostsToPay.add((ManaCost) cost);
|
||||
}
|
||||
}
|
||||
|
|
@ -507,11 +507,11 @@ public abstract class AbilityImpl implements Ability {
|
|||
// set the xcosts to paid
|
||||
variableCost.setAmount(xValue);
|
||||
((Cost) variableCost).setPaid();
|
||||
String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ")";
|
||||
String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ')';
|
||||
if (announceString == null) {
|
||||
announceString = message;
|
||||
} else {
|
||||
announceString = announceString + " " + message;
|
||||
announceString = announceString + ' ' + message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
int amountMana = xValue * variableManaCost.getMultiplier();
|
||||
StringBuilder manaString = threadLocalBuilder.get();
|
||||
if (variableManaCost.getFilter() == null || variableManaCost.getFilter().isGeneric()) {
|
||||
manaString.append("{").append(amountMana).append("}");
|
||||
manaString.append('{').append(amountMana).append('}');
|
||||
} else {
|
||||
String manaSymbol = null;
|
||||
if (variableManaCost.getFilter().isBlack()) {
|
||||
|
|
@ -564,7 +564,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
throw new UnsupportedOperationException("ManaFilter is not supported: " + this.toString());
|
||||
}
|
||||
for (int i = 0; i < amountMana; i++) {
|
||||
manaString.append("{").append(manaSymbol).append("}");
|
||||
manaString.append('{').append(manaSymbol).append('}');
|
||||
}
|
||||
}
|
||||
manaCostsToPay.add(new ManaCostsImpl(manaString.toString()));
|
||||
|
|
@ -745,7 +745,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
if (costs.size() > 0) {
|
||||
if (sbRule.length() > 0) {
|
||||
sbRule.append(",");
|
||||
sbRule.append(',');
|
||||
}
|
||||
sbRule.append(costs.getText());
|
||||
}
|
||||
|
|
@ -1069,7 +1069,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
for (Mode mode : spellModes.values()) {
|
||||
item++;
|
||||
if (mode.getId().equals(selectedMode.getId())) {
|
||||
sb.append(" (mode ").append(item).append(")");
|
||||
sb.append(" (mode ").append(item).append(')');
|
||||
sb.append(getTargetDescriptionForLog(selectedMode.getTargets(), game));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class ActivationInfo {
|
|||
Integer activations = (Integer) game.getState().getValue(key);
|
||||
ActivationInfo activationInfo;
|
||||
if (activations != null) {
|
||||
Integer turnNum = (Integer) game.getState().getValue(key + "T");
|
||||
Integer turnNum = (Integer) game.getState().getValue(key + 'T');
|
||||
activationInfo = new ActivationInfo(game, turnNum, activations);
|
||||
} else {
|
||||
activationInfo = new ActivationInfo(game, game.getTurnNum(), 0);
|
||||
|
|
@ -79,7 +79,7 @@ public class ActivationInfo {
|
|||
activationCounter++;
|
||||
}
|
||||
game.getState().setValue(key, activationCounter);
|
||||
game.getState().setValue(key + "T", turnNum);
|
||||
game.getState().setValue(key + 'T', turnNum);
|
||||
}
|
||||
|
||||
public int getActivationCounter() {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class KinshipBaseEffect extends OneShotEffect {
|
|||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards(sourcePermanent.getName(), cards, game);
|
||||
if (CardUtil.shareSubtypes(sourcePermanent, card, game)) {
|
||||
if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append("?").toString(), source, game)) {
|
||||
if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append('?').toString(), source, game)) {
|
||||
controller.revealCards(sourcePermanent.getName(), cards, game);
|
||||
for (Effect effect: kinshipEffects) {
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class ActivateIfConditionActivatedAbility extends ActivatedAbilityImpl {
|
|||
!condition.toString().startsWith("before")) {
|
||||
sb.append("if ");
|
||||
}
|
||||
sb.append(condition.toString()).append(".");
|
||||
sb.append(condition.toString()).append('.');
|
||||
} else {
|
||||
sb.append(" [Condition toSting() == null] ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class ChancellorAbility extends StaticAbility implements OpeningHandActio
|
|||
|
||||
@Override
|
||||
public boolean askUseOpeningHandAction(Card card, Player player, Game game) {
|
||||
return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + "?", this, game);
|
||||
return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + '?', this, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class PutCardIntoGraveFromAnywhereAllTriggeredAbility extends TriggeredAb
|
|||
sb.append("your");
|
||||
break;
|
||||
default:
|
||||
sb.append("a");
|
||||
sb.append('a');
|
||||
}
|
||||
sb.append(" graveyard, ");
|
||||
ruleText = sb.toString();
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl {
|
|||
if (controller == null || object == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) {
|
||||
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class PactEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) {
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -67,14 +67,14 @@ public class CreatureCountCondition implements Condition {
|
|||
case ANY:
|
||||
sb.append("if ");
|
||||
sb.append(creatureCount);
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
sb.append(" are on the battlefield");
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(" control exactly ");
|
||||
sb.append(creatureCount);
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
|
|||
if (dynamicCost != null) {
|
||||
costChoiceText = dynamicCost.getText(ability, game);
|
||||
} else {
|
||||
costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ")";
|
||||
costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ')';
|
||||
}
|
||||
|
||||
if (alternativeCostsToCheck.canPay(ability, ability.getSourceId(), ability.getControllerId(), game)
|
||||
|
|
@ -263,9 +263,9 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
|
|||
} else if (alternateCosts.isEmpty()) {
|
||||
sb.append("cast {this} without paying its mana cost");
|
||||
}
|
||||
sb.append(".");
|
||||
sb.append('.');
|
||||
if (numberCosts == 1 && remarkText != null) {
|
||||
sb.append(" ").append(remarkText);
|
||||
sb.append(' ').append(remarkText);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class OrCost implements Cost {
|
|||
if (firstCost instanceof ManaCost) {
|
||||
sb.append("Pay ");
|
||||
}
|
||||
sb.append(firstCost.getText()).append("?");
|
||||
sb.append(firstCost.getText()).append('?');
|
||||
if (controller.chooseUse(Outcome.Detriment, sb.toString(), ability, game)) {
|
||||
selectedCost = firstCost;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class DiscardXTargetCost extends VariableCostImpl {
|
|||
public DiscardXTargetCost(FilterCard filter, boolean additionalCostText) {
|
||||
super(new StringBuilder(filter.getMessage()).append(" to discard").toString());
|
||||
this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, discard ":"Discard ")
|
||||
.append(xText).append(" ").append(filter.getMessage()).toString();
|
||||
.append(xText).append(' ').append(filter.getMessage()).toString();
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class ExileFromGraveCost extends CostImpl {
|
|||
+ (target.getNumberOfTargets() == 1 && target.getMaxNumberOfTargets() == Integer.MAX_VALUE ? "one or more"
|
||||
: ((target.getNumberOfTargets() < target.getMaxNumberOfTargets() ? "up to " : ""))
|
||||
+ CardUtil.numberToText(target.getMaxNumberOfTargets()))
|
||||
+ " " + target.getTargetName();
|
||||
+ ' ' + target.getTargetName();
|
||||
} else {
|
||||
this.text = "Exile " + target.getTargetName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class ExileXFromYourGraveCost extends VariableCostImpl {
|
|||
public ExileXFromYourGraveCost(FilterCard filter, boolean additionalCostText) {
|
||||
super(filter.getMessage() + " to exile");
|
||||
this.filter = filter;
|
||||
this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + " " + filter.getMessage();
|
||||
this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + ' ' + filter.getMessage();
|
||||
}
|
||||
|
||||
public ExileXFromYourGraveCost(final ExileXFromYourGraveCost cost) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class PayLoyaltyCost extends CostImpl {
|
|||
this.amount = amount;
|
||||
this.text = Integer.toString(amount);
|
||||
if (amount >= 0) {
|
||||
this.text = "+" + this.text;
|
||||
this.text = '+' + this.text;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class PayVariableLifeCost extends VariableCostImpl {
|
|||
public PayVariableLifeCost(boolean additionalCostText) {
|
||||
super("life to pay");
|
||||
this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, pay ":"Pay ")
|
||||
.append(xText).append(" ").append("life").toString();
|
||||
.append(xText).append(' ').append("life").toString();
|
||||
}
|
||||
|
||||
public PayVariableLifeCost(final PayVariableLifeCost cost) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class PutCountersSourceCost extends CostImpl {
|
|||
this.amount = counter.getCount();
|
||||
this.name = counter.getName();
|
||||
this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount)))
|
||||
.append(" ").append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(' ').append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(" on {this}").toString();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class RemoveCounterCost extends CostImpl {
|
|||
countersRemoved += numberOfCountersSelected;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(controller.getLogName())
|
||||
.append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(" ")
|
||||
.append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(' ')
|
||||
.append(counterName).append(numberOfCountersSelected == 1 ? " counter from " : " counters from ")
|
||||
.append(permanent.getName()).toString());
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ public class RemoveCounterCost extends CostImpl {
|
|||
|
||||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("Remove ");
|
||||
sb.append(CardUtil.numberToText(countersToRemove, "a")).append(" ");
|
||||
sb.append(CardUtil.numberToText(countersToRemove, "a")).append(' ');
|
||||
if (counterTypeToRemove != null) {
|
||||
sb.append(counterTypeToRemove.getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class RemoveCountersSourceCost extends CostImpl {
|
|||
this.amount = counter.getCount();
|
||||
this.name = counter.getName();
|
||||
this.text = new StringBuilder("Remove ").append((amount == 1 ? "a" : CardUtil.numberToText(amount)))
|
||||
.append(" ").append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(' ').append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(" from {this}").toString();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl {
|
|||
}
|
||||
|
||||
public RemoveVariableCountersTargetCost(FilterPermanent filter, CounterType counterTypeToRemove, String xText, int minValue) {
|
||||
super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + " ":"").append("counters to remove").toString());
|
||||
super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + ' ' :"").append("counters to remove").toString());
|
||||
this.filter = filter;
|
||||
this.counterTypeToRemove = counterTypeToRemove;
|
||||
this.text = setText();
|
||||
|
|
@ -79,7 +79,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl {
|
|||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("Remove ").append(xText);
|
||||
if (counterTypeToRemove != null) {
|
||||
sb.append(" ").append(counterTypeToRemove.getName());
|
||||
sb.append(' ').append(counterTypeToRemove.getName());
|
||||
}
|
||||
sb.append(" counters from among ").append(filter.getMessage());
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
|||
target.setNotTarget(true);
|
||||
this.addTarget(target);
|
||||
if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
|
||||
this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " " + target.getTargetName() + " you control to their owner's hand";
|
||||
this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ' + target.getTargetName() + " you control to their owner's hand";
|
||||
} else {
|
||||
this.text = "return " + target.getTargetName() + " you control to its owner's hand";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class ReturnToHandFromGraveyardCost extends CostImpl {
|
|||
public ReturnToHandFromGraveyardCost(TargetCardInYourGraveyard target) {
|
||||
this.addTarget(target);
|
||||
if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
|
||||
this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(" ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString();
|
||||
this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(' ').append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString();
|
||||
} else {
|
||||
this.text = new StringBuilder("return ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class SacrificeXTargetCost extends VariableCostImpl {
|
|||
|
||||
public SacrificeXTargetCost(FilterControlledPermanent filter, boolean additionalCostText) {
|
||||
super(filter.getMessage() + " to sacrifice");
|
||||
this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + " " + filter.getMessage();
|
||||
this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + ' ' + filter.getMessage();
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class TapTargetCost extends CostImpl {
|
|||
this.text
|
||||
= new StringBuilder("Tap ")
|
||||
.append((target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") || target.getTargetName().startsWith("another"))
|
||||
? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + " ")
|
||||
? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ')
|
||||
.append(target.getTargetName()).toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class TapVariableTargetCost extends VariableCostImpl {
|
|||
super(xText, new StringBuilder(filter.getMessage()).append(" to tap").toString());
|
||||
this.filter = filter;
|
||||
this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, tap ":"Tap ")
|
||||
.append(this.xText).append(" ").append(filter.getMessage()).toString();
|
||||
.append(this.xText).append(' ').append(filter.getMessage()).toString();
|
||||
}
|
||||
|
||||
public TapVariableTargetCost(final TapVariableTargetCost cost) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class UntapTargetCost extends CostImpl {
|
|||
|
||||
public UntapTargetCost(TargetControlledPermanent target) {
|
||||
this.target = target;
|
||||
this.text = "Untap " + target.getMaxNumberOfTargets() + " " + target.getTargetName();
|
||||
this.text = "Untap " + target.getMaxNumberOfTargets() + ' ' + target.getTargetName();
|
||||
}
|
||||
|
||||
public UntapTargetCost(final UntapTargetCost cost) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ColoredManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "{" + mana.toString() + "}";
|
||||
return '{' + mana.toString() + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class GenericManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "{" + Integer.toString(mana) + "}";
|
||||
return '{' + Integer.toString(mana) + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class HybridManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "{" + mana1.toString() + "/" + mana2.toString() + "}";
|
||||
return '{' + mana1.toString() + '/' + mana2.toString() + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class MonoHybridManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "{2/" + mana.toString() + "}";
|
||||
return "{2/" + mana.toString() + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost {
|
|||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "{" + mana.toString() + "P}";
|
||||
return '{' + mana.toString() + "P}";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class ParleyCount implements DynamicValue, MageSingleton {
|
|||
if (!card.getCardType().contains(CardType.LAND)) {
|
||||
parleyValue++;
|
||||
}
|
||||
player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", new CardsImpl(card), game);
|
||||
player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', new CardsImpl(card), game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class SignInversionDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "-" + value.toString();
|
||||
return '-' + value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl {
|
|||
if (controller == null || object == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) {
|
||||
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1234,9 +1234,9 @@ public class ContinuousEffects implements Serializable {
|
|||
for (Ability ability : entry.getValue()) {
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object != null) {
|
||||
texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName()));
|
||||
texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName()));
|
||||
} else {
|
||||
texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), entry.getKey().getText(null));
|
||||
texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), entry.getKey().getText(null));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class Effects extends ArrayList<Effect> {
|
|||
!lastRule.startsWith("<b>Level ") &&
|
||||
!lastRule.endsWith(".)") &&
|
||||
!lastRule.endsWith("</i>") ) {
|
||||
sbText.append(".");
|
||||
sbText.append('.');
|
||||
}
|
||||
return sbText.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
if (controller == null || object == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + "?", source, game)) {
|
||||
if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + '?', source, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
|
|||
if (i > 1) {
|
||||
sb.append(" and/or ");
|
||||
}
|
||||
sb.append("{").append(coloredManaSymbol.toString()).append("}");
|
||||
sb.append('{').append(coloredManaSymbol.toString()).append('}');
|
||||
}
|
||||
}
|
||||
sb.append(" to your mana pool");
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" {this} can't be regenerated");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect
|
|||
}
|
||||
sb.append(" can't be regenerated");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
sb.append("spells");
|
||||
}
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI
|
|||
sb.append(" can't be the target of ");
|
||||
sb.append(filterSource.getMessage());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append("this turn");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} can't be the target of ");
|
||||
sb.append(filterSource.getMessage());
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp
|
|||
sb.append(" can't be the target of ");
|
||||
sb.append(filterSource.getMessage());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append("this turn");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe
|
|||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
||||
validTargets = true;
|
||||
if (name != null
|
||||
&& controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) {
|
||||
&& controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + '?', source, game)) {
|
||||
oldTargetName = getTargetName(targetId, game);
|
||||
target.remove(targetId);
|
||||
// The source is still the spell on the stack
|
||||
|
|
@ -97,7 +97,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe
|
|||
}
|
||||
}
|
||||
if (oldTargetName == null) {
|
||||
game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + "!");
|
||||
game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + '!');
|
||||
}
|
||||
} while (validTargets && oldTargetName == null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton {
|
|||
cards.add(cardController);
|
||||
controller.revealCards(sourceObject.getIdName() + ": Clash card of " + controller.getName(), cards, game);
|
||||
cmcController = cardController.getConvertedManaCost();
|
||||
message.append(" (").append(cmcController).append(")");
|
||||
message.append(" (").append(cmcController).append(')');
|
||||
} else {
|
||||
message.append(" no card");
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton {
|
|||
cards.add(cardOpponent);
|
||||
opponent.revealCards(sourceObject.getIdName() + ": Clash card of " + opponent.getName(), cards, game);
|
||||
cmcOpponent = cardOpponent.getConvertedManaCost();
|
||||
message.append(" (").append(cmcOpponent).append(")");
|
||||
message.append(" (").append(cmcOpponent).append(')');
|
||||
} else {
|
||||
message.append(" no card");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,11 +466,11 @@ class TargetWithAdditionalFilter<T extends MageItem> extends TargetImpl {
|
|||
for (UUID targetId : getTargets()) {
|
||||
MageObject object = game.getObject(targetId);
|
||||
if (object != null) {
|
||||
sb.append(object.getLogName()).append(" ");
|
||||
sb.append(object.getLogName()).append(' ');
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
sb.append(player.getLogName()).append(" ");
|
||||
sb.append(player.getLogName()).append(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public abstract class CouncilsDilemmaVoteEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + "?", source, game)) {
|
||||
if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) {
|
||||
voteOneCount++;
|
||||
game.informPlayers(player.getName() + " has voted for " + choiceOne);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append(token.getDescription());
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString())).append(" ");
|
||||
sb.append(CardUtil.numberToText(amount.toString())).append(' ');
|
||||
if (tapped && !attacking) {
|
||||
sb.append("tapped ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class CreateTokenTargetEffect extends OneShotEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder("put ");
|
||||
sb.append(CardUtil.numberToText(amount.toString(), "a"));
|
||||
sb.append(" ").append(token.getDescription()).append(" onto the battlefield");
|
||||
sb.append(' ').append(token.getDescription()).append(" onto the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class DestroyMultiTargetEffect extends OneShotEffect {
|
|||
while (iterator.hasNext()) {
|
||||
Target target = iterator.next();
|
||||
if (target.getNumberOfTargets() > 1) {
|
||||
sb.append(target.getNumberOfTargets()).append(" ");
|
||||
sb.append(target.getNumberOfTargets()).append(' ');
|
||||
}
|
||||
sb.append("target ").append(target.getTargetName());
|
||||
if (iterator.hasNext()) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') {
|
||||
effectText = effectText.substring(0, effectText.length() - 1);
|
||||
}
|
||||
message = getCostText() + " and " + effectText + "?";
|
||||
message = getCostText() + " and " + effectText + '?';
|
||||
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
|
||||
} else {
|
||||
message = chooseUseText;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR
|
|||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
return "{this} doesn't untap (" + mageObject.getLogName() + ")";
|
||||
return "{this} doesn't untap (" + mageObject.getLogName() + ')';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
|
|||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
Permanent permanentToUntap = game.getPermanent((event.getTargetId()));
|
||||
if (permanentToUntap != null && mageObject != null) {
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")";
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu
|
|||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted != null) {
|
||||
return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ")";
|
||||
return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ')';
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM
|
|||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
Permanent permanentToUntap = game.getPermanent((event.getTargetId()));
|
||||
if (permanentToUntap != null && mageObject != null) {
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")";
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleMo
|
|||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
Permanent permanentToUntap = game.getPermanent((event.getTargetId()));
|
||||
if (permanentToUntap != null && mageObject != null) {
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")";
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect {
|
|||
|| amount instanceof PermanentsOnBattlefieldCount || amount.toString().equals("1");
|
||||
sb.append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card");
|
||||
if (!oneCard) {
|
||||
sb.append("s");
|
||||
sb.append('s');
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ public class DrawCardTargetEffect extends OneShotEffect {
|
|||
sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card");
|
||||
try {
|
||||
if (Integer.parseInt(amount.toString()) > 1) {
|
||||
sb.append("s");
|
||||
sb.append('s');
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sb.append("s");
|
||||
sb.append('s');
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ")";
|
||||
return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ')';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class ExileCardYouChooseTargetOpponentEffect extends OneShotEffect {
|
|||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null && opponent != null) {
|
||||
if (!opponent.getHand().isEmpty()) {
|
||||
opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ")" : "Exile", opponent.getHand(), game);
|
||||
opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Exile", opponent.getHand(), game);
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
|
|
|
|||
|
|
@ -106,6 +106,6 @@ public class ExileFromZoneTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
private void setText() {
|
||||
staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + " " + filter.getMessage() + " from his or her " + zone.toString().toLowerCase();
|
||||
staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from his or her " + zone.toString().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
StringBuilder sb = new StringBuilder(cost.getText()).append("?");
|
||||
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
|
||||
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
|
||||
sb.insert(0, "Pay ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ public class GainLifeEffect extends OneShotEffect {
|
|||
String message = life.getMessage();
|
||||
sb.append("you gain ");
|
||||
if (message.startsWith("that")) {
|
||||
sb.append(message).append(" ");
|
||||
sb.append(message).append(' ');
|
||||
} else if (message.isEmpty() || !message.equals("1")) {
|
||||
sb.append(life).append(" ");
|
||||
sb.append(life).append(' ');
|
||||
}
|
||||
sb.append("life");
|
||||
if (message.length() > 0 && !message.startsWith("that")) {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class GainLifeTargetEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append(" gains ");
|
||||
if (message.isEmpty() || !message.equals("1")) {
|
||||
sb.append(life.toString()).append(" ");
|
||||
sb.append(life.toString()).append(' ');
|
||||
}
|
||||
sb.append("life");
|
||||
if (message.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class GetEmblemEffect extends OneShotEffect {
|
|||
public GetEmblemEffect(Emblem emblem) {
|
||||
super(Outcome.Benefit);
|
||||
this.emblem = emblem;
|
||||
this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + "\"";
|
||||
this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + '"';
|
||||
}
|
||||
|
||||
public GetEmblemEffect(final GetEmblemEffect effect) {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,6 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + "\"";
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + '"';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
|||
sb.append("put ").append(filter.getMessage()).append(" into your graveyard");
|
||||
break;
|
||||
}
|
||||
return sb.append("?").toString();
|
||||
return sb.append('?').toString();
|
||||
}
|
||||
|
||||
private String getPickText() {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
|
|||
|
||||
sb.append("each opponent loses ");
|
||||
if (message.isEmpty() || !message.equals("1")) {
|
||||
sb.append(amount).append(" ");
|
||||
sb.append(amount).append(' ');
|
||||
}
|
||||
sb.append("life");
|
||||
if (message.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class LoseLifeTargetEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append(" loses ");
|
||||
if (message.isEmpty() || !message.equals("1")) {
|
||||
sb.append(amount).append(" ");
|
||||
sb.append(amount).append(' ');
|
||||
}
|
||||
sb.append("life");
|
||||
if (message.length() > 0) {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class NameACardEffect extends OneShotEffect {
|
|||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]");
|
||||
game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + ']');
|
||||
}
|
||||
game.getState().setValue(source.getSourceId().toString() + INFO_KEY, cardName);
|
||||
if (sourceObject instanceof Permanent) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class PreventAllDamageToAllEffect extends PreventionEffectImpl {
|
|||
+ (onlyCombat ? "combat ":"")
|
||||
+ "damage that would be dealt to "
|
||||
+ filter.getMessage()
|
||||
+ (duration.toString().isEmpty() ?"": " "+ duration.toString());
|
||||
+ (duration.toString().isEmpty() ?"": ' ' + duration.toString());
|
||||
}
|
||||
|
||||
public PreventAllDamageToAllEffect(final PreventAllDamageToAllEffect effect) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
|
|||
public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterInPlay filter) {
|
||||
super(duration, Integer.MAX_VALUE, false);
|
||||
this.filter = filter;
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + " " + duration.toString();
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString();
|
||||
}
|
||||
|
||||
public PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) {
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ public class PreventDamageToControllerEffect extends PreventionEffectImpl {
|
|||
if (amountToPrevent == Integer.MAX_VALUE) {
|
||||
sb.append("all ");
|
||||
} else if (amountToPreventDynamic != null) {
|
||||
sb.append("the next ").append(amountToPreventDynamic.toString()).append(" ");
|
||||
sb.append("the next ").append(amountToPreventDynamic.toString()).append(' ');
|
||||
} else {
|
||||
sb.append("the next ").append(amountToPrevent).append(" ");
|
||||
sb.append("the next ").append(amountToPrevent).append(' ');
|
||||
}
|
||||
if (onlyCombat) {
|
||||
sb.append("combat ");
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl {
|
|||
}
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append("this turn");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect {
|
|||
if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on ");
|
||||
sb.append(onTop ? "top" : "the bottom").append(" of its owner's library");
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect
|
|||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield");
|
||||
if (tapped) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect {
|
|||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
if (!mode.getTargets().get(0).getTargetName().startsWith("another")) {
|
||||
sb.append("target ");
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class ReturnToHandChosenControlledPermanentEffect extends ReturnToHandCho
|
|||
if (!filter.getMessage().startsWith("another")) {
|
||||
sb.append(CardUtil.numberToText(number, "a"));
|
||||
}
|
||||
sb.append(" ").append(filter.getMessage());
|
||||
sb.append(' ').append(filter.getMessage());
|
||||
if (number > 1) {
|
||||
sb.append(" to their owner's hand");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect {
|
|||
if (!filter.getMessage().startsWith("another")) {
|
||||
sb.append(CardUtil.numberToText(number, "a"));
|
||||
}
|
||||
sb.append(" ").append(filter.getMessage());
|
||||
sb.append(' ').append(filter.getMessage());
|
||||
sb.append(" he or she controls");
|
||||
if (number > 1) {
|
||||
sb.append(" to their owner's hand");
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
|
|||
return sb.toString();
|
||||
} else {
|
||||
if (target.getNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(' ');
|
||||
}
|
||||
if (!target.getTargetName().startsWith("another")) {
|
||||
sb.append("target ");
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class SacrificeAllEffect extends OneShotEffect {
|
|||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString(), "a"));
|
||||
}
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class SacrificeEffect extends OneShotEffect{
|
|||
sb.append(" sacrifice ");
|
||||
}
|
||||
}
|
||||
sb.append(CardUtil.numberToText(count.toString(), "a")).append(" ");
|
||||
sb.append(CardUtil.numberToText(count.toString(), "a")).append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,13 +114,13 @@ public class SacrificeOpponentsEffect extends OneShotEffect {
|
|||
} else {
|
||||
if (amount.toString().equals("1")) {
|
||||
if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
|
||||
sb.append("a");
|
||||
sb.append('a');
|
||||
}
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString()));
|
||||
}
|
||||
}
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,14 +189,14 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect{
|
|||
} else {
|
||||
if (amount.toString().equals("1")) {
|
||||
if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
|
||||
sb.append("a");
|
||||
sb.append('a');
|
||||
}
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
|
||||
sb.append(" unless he or she pays ");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
StringBuilder sb = new StringBuilder(cost.getText()).append("?");
|
||||
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
|
||||
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
|
||||
sb.insert(0, "Pay ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class SkipUntapOptionalSourceEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + "?", source, game);
|
||||
return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + '?', source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ public class TapTargetEffect extends OneShotEffect {
|
|||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
|
||||
return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + "s";
|
||||
return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + 's';
|
||||
} else {
|
||||
return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + "s";
|
||||
return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + 's';
|
||||
}
|
||||
} else if (target.getMaxNumberOfTargets() == 0){
|
||||
return "tap X target " + mode.getTargets().get(0).getTargetName();
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class UntapTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append("s");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append('s');
|
||||
} else {
|
||||
if (!target.getTargetName().startsWith("another")) {
|
||||
sb.append("target ");
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class WishEffect extends OneShotEffect {
|
|||
List<Card> exile = game.getExile().getAllCards(game);
|
||||
boolean noTargets = cards.isEmpty() && (alsoFromExile ? exile.isEmpty() : true);
|
||||
if (noTargets) {
|
||||
game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + ".");
|
||||
game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ public class WishEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (filteredCards.isEmpty()) {
|
||||
game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + ".");
|
||||
game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + '.');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class CanAttackAsThoughItDidntHaveDefenderAllEffect extends AsThoughEffec
|
|||
} else {
|
||||
sb.append(duration.toString());
|
||||
}
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append("as though they didn't have defender");
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect {
|
|||
this.filter = filter;
|
||||
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
}
|
||||
staticText = sb.toString();
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ public class CantAttackBlockAllEffect extends RestrictionEffect {
|
|||
this.filter = filter;
|
||||
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack or block");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
}
|
||||
staticText = sb.toString();
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect {
|
|||
}
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
|
|
|
|||
|
|
@ -62,10 +62,10 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
|
|||
sb.append("Equipped creature can't block");
|
||||
}
|
||||
if (!filter.getMessage().equals("creature")) {
|
||||
sb.append(" ").append(filter.getMessage());
|
||||
sb.append(' ').append(filter.getMessage());
|
||||
}
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,17 +75,17 @@ public class CantBlockTargetEffect extends RestrictionEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
|
||||
sb.append("any number of ");
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
|
||||
sb.append("any number of ");
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append("s");
|
||||
sb.append('s');
|
||||
}
|
||||
|
||||
sb.append(" can't block");
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl {
|
|||
break;
|
||||
default:
|
||||
if (duration.toString().length() > 0) {
|
||||
text += " " + duration.toString();
|
||||
text += ' ' + duration.toString();
|
||||
}
|
||||
}
|
||||
return text;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue