Merge origin/master

This commit is contained in:
LevelX2 2017-02-06 21:21:16 +01:00
commit b8cc0120cb
737 changed files with 1701 additions and 1729 deletions

View file

@ -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

View file

@ -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}");

View file

@ -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();
}

View file

@ -93,7 +93,7 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
continue;
}
if (ability instanceof SpellAbility) {
if (ability.getAdditionalCostsRuleVisible() && ability.getCosts().size() > 0) {
if (ability.getAdditionalCostsRuleVisible() && !ability.getCosts().isEmpty()) {
StringBuilder sbRule = threadLocalBuilder.get();
for (Cost cost : ability.getCosts()) {
if (cost.getText() != null && !cost.getText().isEmpty()) {
@ -107,7 +107,7 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
}
String rule = ability.getRule();
if (rule != null) {
if (rule.length() > 0) {
if (!rule.isEmpty()) {
rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1));
}
} else { // logging so we can still can be made aware of rule problems a card has

View file

@ -274,7 +274,7 @@ public abstract class AbilityImpl implements Ability {
// if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid.
// For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability
if (noMana) {
if (this.getManaCostsToPay().getVariableCosts().size() > 0) {
if (!this.getManaCostsToPay().getVariableCosts().isEmpty()) {
int xValue = this.getManaCostsToPay().getX();
this.getManaCostsToPay().clear();
VariableManaCost xCosts = new VariableManaCost();
@ -333,7 +333,7 @@ public abstract class AbilityImpl implements Ability {
}
// Flashback abilities haven't made the choices the underlying spell might need for targeting.
if (!(this instanceof FlashbackAbility)
&& getTargets().size() > 0) {
&& !getTargets().isEmpty()) {
Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome();
if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) {
if ((variableManaCost != null || announceString != null) && !game.isSimulation()) {
@ -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()));
@ -740,12 +740,12 @@ public abstract class AbilityImpl implements Ability {
public String getRule(boolean all) {
StringBuilder sbRule = threadLocalBuilder.get();
if (all || this.abilityType != AbilityType.SPELL) {
if (manaCosts.size() > 0) {
if (!manaCosts.isEmpty()) {
sbRule.append(manaCosts.getText());
}
if (costs.size() > 0) {
if (!costs.isEmpty()) {
if (sbRule.length() > 0) {
sbRule.append(",");
sbRule.append(',');
}
sbRule.append(costs.getText());
}
@ -1038,7 +1038,7 @@ public abstract class AbilityImpl implements Ability {
} else {
half = " right";
}
if (spellAbility.getTargets().size() > 0) {
if (!spellAbility.getTargets().isEmpty()) {
sb.append(half).append(" half targeting ");
for (Target target : spellAbility.getTargets()) {
sb.append(target.getTargetedName(game));
@ -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;
}
@ -1088,7 +1088,7 @@ public abstract class AbilityImpl implements Ability {
protected String getTargetDescriptionForLog(Targets targets, Game game) {
StringBuilder sb = new StringBuilder(); // threadLocal StringBuilder can't be used because calling method already uses it
if (targets.size() > 0) {
if (!targets.isEmpty()) {
String usedVerb = null;
for (Target target : targets) {
if (!target.getTargets().isEmpty()) {

View file

@ -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() {

View file

@ -92,8 +92,6 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl {
}
}
;
public boolean isInactive(Game game) {
return false;
}

View file

@ -207,7 +207,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
if (isEachModeOnlyOnce()) {
setAlreadySelectedModes(selectedModes, source, game);
}
return selectedModes.size() > 0;
return !selectedModes.isEmpty();
}
// 700.2d

View file

@ -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()));

View file

@ -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] ");
}

View file

@ -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

View file

@ -88,7 +88,7 @@ public class EntersBattlefieldAbility extends StaticAbility {
@Override
public void addEffect(Effect effect) {
if (getEffects().size() > 0) {
if (!getEffects().isEmpty()) {
Effect entersBattlefieldEffect = this.getEffects().get(0);
if (entersBattlefieldEffect instanceof EntersBattlefieldEffect) {
((EntersBattlefieldEffect) entersBattlefieldEffect).addEffect(effect);

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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;

View file

@ -46,7 +46,7 @@ public class CardsInHandCondition implements Condition {
public static enum CountType {
MORE_THAN, FEWER_THAN, EQUAL_TO
};
}
private Condition condition;
private CountType type;

View file

@ -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();

View file

@ -49,7 +49,7 @@ public class FerociousCondition implements Condition {
private static final FerociousCondition fInstance = new FerociousCondition();
private FerociousCondition() {};
private FerociousCondition() {}
public static FerociousCondition getInstance() {
return fInstance;

View file

@ -44,8 +44,8 @@ import mage.game.Game;
public class OpponentControlsPermanentCondition implements Condition {
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO };
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }
private FilterPermanent filter;
private CountType type;
private int count;

View file

@ -43,7 +43,7 @@ public class PermanentHasCounterCondition implements Condition {
public static enum CountType {
MORE_THAN, FEWER_THAN, EQUAL_TO
};
}
private CounterType counterType;
private int amount;

View file

@ -45,7 +45,8 @@ import mage.game.Game;
*/
public class PermanentsOnTheBattlefieldCondition implements Condition {
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO };
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }
private FilterPermanent filter;
private Condition condition;
private CountType type;

View file

@ -40,7 +40,7 @@ import mage.players.PlayerList;
*/
public class TenOrLessLifeCondition implements Condition {
public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER };
public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER }
private final CheckType type;

View file

@ -41,7 +41,7 @@ public class TopLibraryCardTypeCondition implements Condition {
public static enum CheckType {
CREATURE, LAND, SORCERY, INSTANT
};
}
private TopLibraryCardTypeCondition.CheckType type;

View file

@ -145,8 +145,6 @@ public class AlternativeCost2Impl<T extends AlternativeCost2Impl<T>> extends Cos
return activated;
}
;
@Override
public AlternativeCost2Impl copy() {
return new AlternativeCost2Impl(this);

View file

@ -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();
}

View file

@ -152,7 +152,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
protected T getFirstUnpaid() {
Costs<T> unpaid = getUnpaid();
if (unpaid.size() > 0) {
if (!unpaid.isEmpty()) {
return unpaid.get(0);
}
return null;

View file

@ -130,8 +130,6 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
++activatedCounter;
}
;
/**
* Reset the activate and count information
*
@ -162,8 +160,6 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
return repeatable;
}
;
/**
* Returns if the cost was activated
*
@ -174,8 +170,6 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
return activated;
}
;
/**
* Returns the number of times the cost was activated
* @return
@ -185,8 +179,6 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
return activatedCounter;
}
;
@Override
public OptionalAdditionalCostImpl copy() {

View file

@ -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 {

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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) {

View file

@ -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;
}
}

View file

@ -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) {

View file

@ -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();
}
@ -72,7 +72,7 @@ public class PutCountersSourceCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
this.paid = permanent.addCounters(counter, null, game);;
this.paid = permanent.addCounters(counter, null, game);
}
return paid;
}

View file

@ -93,7 +93,7 @@ public class RemoveCounterCost extends CostImpl {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
if (permanent.getCounters(game).size() > 0 && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) {
if (!permanent.getCounters(game).isEmpty() && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) {
String counterName = null;
if (counterTypeToRemove != null) {
@ -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());
}

View file

@ -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();
}

View file

@ -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();

View file

@ -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";
}

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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) {

View file

@ -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) {

View file

@ -69,7 +69,7 @@ public class ColoredManaCost extends ManaCostImpl {
@Override
public String getText() {
return "{" + mana.toString() + "}";
return '{' + mana.toString() + '}';
}
@Override

View file

@ -73,7 +73,7 @@ public class GenericManaCost extends ManaCostImpl {
@Override
public String getText() {
return "{" + Integer.toString(mana) + "}";
return '{' + Integer.toString(mana) + '}';
}
@Override

View file

@ -76,7 +76,7 @@ public class HybridManaCost extends ManaCostImpl {
@Override
public String getText() {
return "{" + mana1.toString() + "/" + mana2.toString() + "}";
return '{' + mana1.toString() + '/' + mana2.toString() + '}';
}
@Override

View file

@ -326,7 +326,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
String[] symbols = mana.split("^\\{|\\}\\{|\\}$");
int modifierForX = 0;
for (String symbol : symbols) {
if (symbol.length() > 0) {
if (!symbol.isEmpty()) {
if (symbol.length() == 1 || isNumeric(symbol)) {
if (Character.isDigit(symbol.charAt(0))) {
this.add(new GenericManaCost(Integer.valueOf(symbol)));

View file

@ -77,7 +77,7 @@ public class MonoHybridManaCost extends ManaCostImpl {
@Override
public String getText() {
return "{2/" + mana.toString() + "}";
return "{2/" + mana.toString() + '}';
}
@Override

View file

@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost {
@Override
public String getText() {
return "{" + mana.toString() + "P}";
return '{' + mana.toString() + "P}";
}
@Override

View file

@ -65,10 +65,10 @@ public class MultikickerCount implements DynamicValue {
@Override
public String toString() {
return "a";
};
}
@Override
public String getMessage() {
return "time it was kicked";
};
}
}

View file

@ -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);
}
}

View file

@ -29,7 +29,7 @@ public class SignInversionDynamicValue implements DynamicValue {
@Override
public String toString() {
return "-" + value.toString();
return '-' + value.toString();
}
@Override

View file

@ -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;
}
}

View file

@ -688,7 +688,7 @@ public class ContinuousEffects implements Serializable {
}
// check if player wants to use splice
if (spliceAbilities.size() > 0) {
if (!spliceAbilities.isEmpty()) {
Player controller = game.getPlayer(abilityToModify.getControllerId());
if (controller.chooseUse(Outcome.Benefit, "Splice a card?", abilityToModify, game)) {
Cards cardsToReveal = new CardsImpl();
@ -899,7 +899,7 @@ public class ContinuousEffects implements Serializable {
}
}
//Reload layerEffect if copy effects were applied
if (layer.size() > 0) {
if (!layer.isEmpty()) {
activeLayerEffects = getLayeredEffects(game);
}
@ -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 {

View file

@ -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();
}

View file

@ -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;
}
}

View file

@ -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");

View file

@ -80,7 +80,7 @@ public class AddManaOfAnyTypeProducedEffect extends ManaEffect {
if (types.getColorless() > 0) {
choice.getChoices().add("Colorless");
}
if (choice.getChoices().size() > 0) {
if (!choice.getChoices().isEmpty()) {
if (choice.getChoices().size() == 1) {
choice.setChoice(choice.getChoices().iterator().next());
} else {

View file

@ -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();

View file

@ -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();

View file

@ -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();
}

View file

@ -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 {

View file

@ -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();
}

View file

@ -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 {

View file

@ -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);
}

View file

@ -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");
}

View file

@ -170,7 +170,7 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
if (playerTargetCopyMap.containsKey(player.getId())) {
Map<UUID, Spell> targetCopyMap = playerTargetCopyMap.get(player.getId());
if (targetCopyMap != null) {
while (targetCopyMap.size() > 0) {
while (!targetCopyMap.isEmpty()) {
FilterInPlay<T> setFilter = filter.copy();
setFilter.add(new FromSetPredicate(targetCopyMap.keySet()));
Target target = new TargetWithAdditionalFilter(sampleTarget, setFilter);
@ -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(' ');
}
}
}

View file

@ -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 {

View file

@ -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 ");
}
@ -134,7 +134,7 @@ public class CreateTokenEffect extends OneShotEffect {
sb.append(" attacking");
}
String message = amount.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
if (amount.toString().equals("X")) {
sb.append(", where X is ");
} else {

View file

@ -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");
}
@ -80,7 +80,7 @@ public class CreateTokenTargetEffect extends OneShotEffect {
sb.append(" attacking");
}
String message = amount.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
sb.append(" for each ");
}
sb.append(message);

View file

@ -81,7 +81,7 @@ public class DamageAllEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
sb.append("{source} deals ").append(amount.toString()).append(" damage to each ").append(filter.getMessage());
String message = amount.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
if (amount.toString().equals("X")) {
sb.append(", where X is ");
} else {

View file

@ -103,7 +103,7 @@ public class DamageControllerEffect extends OneShotEffect {
sb.append(amount);
}
sb.append(" damage to you");
if (message.length() > 0) {
if (!message.isEmpty()) {
if (message.equals("1")) {
sb.append(" equal to the number of ");
} else {

View file

@ -68,7 +68,7 @@ public class DamageMultiEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (source.getTargets().size() > 0) {
if (!source.getTargets().isEmpty()) {
Target multiTarget = source.getTargets().get(0);
for (UUID target : multiTarget.getTargets()) {
Permanent permanent = game.getPermanent(target);

View file

@ -152,12 +152,12 @@ public class DamageTargetEffect extends OneShotEffect {
sb.append(amount);
}
sb.append(" damage to ");
if (targetDescription.length() > 0) {
if (!targetDescription.isEmpty()) {
sb.append(targetDescription);
} else {
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
}
if (message.length() > 0) {
if (!message.isEmpty()) {
if (message.equals("1")) {
sb.append(" equal to the number of ");
} else {

View file

@ -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()) {

View file

@ -112,7 +112,7 @@ public class DevourEffect extends ReplacementEffectImpl {
}
if (controller.chooseUse(Outcome.Detriment, "Devour creatures?", source, game)) {
controller.chooseTarget(Outcome.Detriment, target, source, game);
if (target.getTargets().size() > 0) {
if (!target.getTargets().isEmpty()) {
List<ArrayList<String>> cardSubtypes = new ArrayList<>();
int devouredCreatures = target.getTargets().size();
if (!game.isSimulation()) {

View file

@ -56,10 +56,10 @@ public class DoIfCostPaid extends OneShotEffect {
String message;
if (chooseUseText == null) {
String effectText = executingEffects.getText(source.getModes().getMode());
if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') {
if (!effectText.isEmpty() && 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;

View file

@ -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;
}

View file

@ -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;
}
@ -158,7 +158,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
if (targetName != null && targetName.length() > 0) {
if (targetName != null && !targetName.isEmpty()) {
if (targetName.equals("Those creatures") || targetName.equals("They")) {
return targetName + " don't untap during their controller's next untap step";
} else

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -80,10 +80,10 @@ 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) {
if (!message.isEmpty()) {
sb.append(" for each ");
}
sb.append(message);

View file

@ -108,7 +108,7 @@ public class DrawCardTargetEffect extends OneShotEffect {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
Target target;
if (targetPointer instanceof SecondTargetPointer && mode.getTargets().size() > 1) {
target = mode.getTargets().get(1);
@ -130,13 +130,13 @@ 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) {
if (!message.isEmpty()) {
sb.append(" for each ");
}
sb.append(message);

View file

@ -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;
}

View file

@ -26,7 +26,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
public static enum Gender {
MALE, FEMAL
};
}
protected Effect additionalEffect;

View file

@ -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);

View file

@ -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();
}
}

View file

@ -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 ");
}

View file

@ -87,12 +87,12 @@ 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")) {
if (!message.isEmpty() && !message.startsWith("that")) {
sb.append(message.equals("1") ? " equal to the number of " : " for each ");
sb.append(message);
}

View file

@ -85,17 +85,17 @@ public class GainLifeTargetEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
String message = life.getMessage();
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
} else {
sb.append("that player");
}
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) {
if (!message.isEmpty()) {
sb.append(message.equals("1") ? " equal to the number of " : " for each ");
sb.append(message);
}

View file

@ -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) {

View file

@ -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) + '"';
}
}

View file

@ -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() {

View file

@ -88,7 +88,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
sb.append("its controller loses ").append(amount.toString()).append(" life");
String message = amount.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
sb.append(" for each ");
sb.append(message);
}

View file

@ -84,10 +84,10 @@ 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) {
if (!message.isEmpty()) {
sb.append(message.equals("1") || message.startsWith("the ") ? " equal to the number of " : " for each ");
sb.append(message);
}

View file

@ -78,7 +78,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
sb.append("you lose ").append(amount.toString()).append(" life");
String message = amount.getMessage();
if (message.length() > 0) {
if (!message.isEmpty()) {
sb.append(" for each ");
}
sb.append(message);

View file

@ -81,17 +81,17 @@ public class LoseLifeTargetEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
String message = amount.getMessage();
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
} else {
sb.append("that player");
}
sb.append(" loses ");
if (message.isEmpty() || !message.equals("1")) {
sb.append(amount).append(" ");
sb.append(amount).append(' ');
}
sb.append("life");
if (message.length() > 0) {
if (!message.isEmpty()) {
if (amount.toString().equals("X")) {
sb.append(", where X is ");
} else {

View file

@ -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) {

View file

@ -73,7 +73,7 @@ public class PhaseOutTargetEffect extends OneShotEffect {
}
StringBuilder sb = new StringBuilder();
if (targetDescription != null && targetDescription.length() > 0) {
if (targetDescription != null && !targetDescription.isEmpty()) {
sb.append(targetDescription);
} else {
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());

Some files were not shown because too many files have changed in this diff Show more