mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
list.size > 0 changed to !list.isEmpty
We care about if it's empty or not, not about it's size
This commit is contained in:
parent
0de8bd2f70
commit
fc54c0156c
366 changed files with 532 additions and 548 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -330,7 +330,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()) {
|
||||
|
|
@ -737,10 +737,10 @@ 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(',');
|
||||
}
|
||||
|
|
@ -1035,7 +1035,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));
|
||||
|
|
@ -1085,7 +1085,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()) {
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public boolean isInactive(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
if (isEachModeOnlyOnce()) {
|
||||
setAlreadySelectedModes(selectedModes, source, game);
|
||||
}
|
||||
return selectedModes.size() > 0;
|
||||
return !selectedModes.isEmpty();
|
||||
}
|
||||
|
||||
// 700.2d
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class TopLibraryCardTypeCondition implements Condition {
|
|||
|
||||
public static enum CheckType {
|
||||
CREATURE, LAND, SORCERY, INSTANT
|
||||
};
|
||||
}
|
||||
|
||||
private TopLibraryCardTypeCondition.CheckType type;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,8 +145,6 @@ public class AlternativeCost2Impl<T extends AlternativeCost2Impl<T>> extends Cos
|
|||
return activated;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public AlternativeCost2Impl copy() {
|
||||
return new AlternativeCost2Impl(this);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ public class MultikickerCount implements DynamicValue {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "a";
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "time it was kicked";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ 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 + '?';
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect {
|
|||
sb.append('s');
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
sb.append(message);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -136,7 +136,7 @@ public class DrawCardTargetEffect extends OneShotEffect {
|
|||
sb.append('s');
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
sb.append(message);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
|||
public static enum Gender {
|
||||
|
||||
MALE, FEMAL
|
||||
};
|
||||
}
|
||||
|
||||
protected Effect additionalEffect;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class GainLifeEffect extends OneShotEffect {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ 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");
|
||||
|
|
@ -95,7 +95,7 @@ public class GainLifeTargetEffect extends OneShotEffect {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ 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");
|
||||
|
|
@ -91,7 +91,7 @@ public class LoseLifeTargetEffect extends OneShotEffect {
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class PlayTargetWithoutPayingManaEffect extends OneShotEffect {
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (mode.getTargets().get(0).getZone() == Zone.HAND) {
|
||||
sb.append("you may put ").append(target.getTargetName()).append(" from your hand onto the battlefield");
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class PopulateEffect extends OneShotEffect {
|
|||
|
||||
public PopulateEffect(String prefixText) {
|
||||
super(Outcome.Copy);
|
||||
this.staticText = (prefixText.length() > 0 ? prefixText + " p" : "P") + "opulate <i>(Put a token onto the battlefield that's a copy of a creature token you control.)</i>";
|
||||
this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate <i>(Put a token onto the battlefield that's a copy of a creature token you control.)</i>";
|
||||
}
|
||||
|
||||
public PopulateEffect(final PopulateEffect effect) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append("of his or her library into his or her graveyard");
|
||||
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(", where X is the number of ");
|
||||
sb.append(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class RecruiterEffect extends OneShotEffect {
|
|||
controller.revealCards(staticText, cards, game);
|
||||
controller.shuffleLibrary(source, game);
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
controller.putCardsOnTopOfLibrary(cards, game, source, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect {
|
|||
// Put the rest in correct zone
|
||||
switch (zoneToPutRest) {
|
||||
case LIBRARY: {
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
if (shuffleRestInto) {
|
||||
library.addAll(cards.getCards(game), game);
|
||||
} else {
|
||||
|
|
@ -121,7 +121,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
controller.moveCards(cards, zoneToPutRest, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = null;
|
||||
if (targetPointer != null) {
|
||||
if (targetPointer.getTargets(game, source).size() > 0) {
|
||||
if (!targetPointer.getTargets(game, source).isEmpty()) {
|
||||
player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
} else {
|
||||
player = game.getPlayer(source.getControllerId());
|
||||
|
|
@ -82,7 +82,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect {
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (staticText.length() > 0) {
|
||||
if (!staticText.isEmpty()) {
|
||||
sb.append(staticText).append(" player skips his or her next untap step");
|
||||
} else {
|
||||
sb.append("You skip your next untap step");
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class TapTargetEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText.length() > 0) {
|
||||
if (!staticText.isEmpty()) {
|
||||
return "tap " + staticText;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class TransformTargetEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && staticText.length() > 0) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
|
||||
} else {
|
||||
sb.append("It ");
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl {
|
|||
text += " this combat";
|
||||
break;
|
||||
default:
|
||||
if (duration.toString().length() > 0) {
|
||||
if (!duration.toString().isEmpty()) {
|
||||
text += ' ' + duration.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,11 +118,11 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("target ");
|
||||
sb.append(mode.getTargets().get(0).getFilter().getMessage());
|
||||
sb.append(" becomes the color or colors of your choice");
|
||||
if (duration.toString().length() > 0) {
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getCardType().size() > 0) {
|
||||
if (!token.getCardType().isEmpty()) {
|
||||
for (CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
|
|
@ -86,7 +86,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
if (type == null) {
|
||||
permanent.getSubtype(game).clear();
|
||||
}
|
||||
if (token.getSubtype(game).size() > 0) {
|
||||
if (!token.getSubtype(game).isEmpty()) {
|
||||
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
||||
}
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getAbilities().size() > 0) {
|
||||
if (!token.getAbilities().isEmpty()) {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
sb.append(" become ");
|
||||
}
|
||||
sb.append(token.getDescription());
|
||||
if (type != null && type.length() > 0) {
|
||||
if (type != null && !type.isEmpty()) {
|
||||
sb.append(". They are still ").append(type);
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
public enum LoseType {
|
||||
|
||||
NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT
|
||||
};
|
||||
}
|
||||
|
||||
protected Token token;
|
||||
protected String type;
|
||||
|
|
@ -86,7 +86,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getSupertype().size() > 0) {
|
||||
if (!token.getSupertype().isEmpty()) {
|
||||
for (String t : token.getSupertype()) {
|
||||
if (!permanent.getSupertype().contains(t)) {
|
||||
permanent.getSupertype().add(t);
|
||||
|
|
@ -100,7 +100,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
permanent.getCardType().clear();
|
||||
break;
|
||||
}
|
||||
if (token.getCardType().size() > 0) {
|
||||
if (!token.getCardType().isEmpty()) {
|
||||
for (CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
|
|
@ -115,7 +115,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
|
||||
break;
|
||||
}
|
||||
if (token.getSubtype(game).size() > 0) {
|
||||
if (!token.getSubtype(game).isEmpty()) {
|
||||
for (String t : token.getSubtype(game)) {
|
||||
if (!permanent.getSubtype(game).contains(t)) {
|
||||
permanent.getSubtype(game).add(t);
|
||||
|
|
@ -148,7 +148,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
break;
|
||||
}
|
||||
if (token.getAbilities().size() > 0) {
|
||||
if (!token.getAbilities().isEmpty()) {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
if (losePreviousTypes) {
|
||||
permanent.getCardType().clear();
|
||||
}
|
||||
if (token.getCardType().size() > 0) {
|
||||
if (!token.getCardType().isEmpty()) {
|
||||
for (CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
|
|
@ -123,7 +123,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
if ("".equals(type) || type == null && permanent.getCardType().contains(CardType.LAND)) {
|
||||
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
|
||||
}
|
||||
if (token.getSubtype(game).size() > 0) {
|
||||
if (!token.getSubtype(game).isEmpty()) {
|
||||
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
||||
}
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getAbilities().size() > 0) {
|
||||
if (!token.getAbilities().isEmpty()) {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
}
|
||||
|
||||
private void setText() {
|
||||
if (type != null && type.length() > 0) {
|
||||
if (type != null && !type.isEmpty()) {
|
||||
staticText = duration.toString() + " {this} becomes a " + token.getDescription() + " that's still a " + this.type;
|
||||
} else {
|
||||
staticText = duration.toString() + " {this} becomes a " + token.getDescription();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
|
||||
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
||||
} else {
|
||||
if (token.getSubtype(game).size() > 0) {
|
||||
if (!token.getSubtype(game).isEmpty()) {
|
||||
for (String subtype : token.getSubtype(game)) {
|
||||
if (!permanent.getSubtype(game).contains(subtype)) {
|
||||
permanent.getSubtype(game).add(subtype);
|
||||
|
|
@ -100,7 +100,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
|
||||
}
|
||||
}
|
||||
if (token.getCardType().size() > 0) {
|
||||
if (!token.getCardType().isEmpty()) {
|
||||
for (CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
|
|
@ -128,7 +128,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
}
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getAbilities().size() > 0) {
|
||||
if (!token.getAbilities().isEmpty()) {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
|
|||
if (duration != Duration.WhileOnBattlefield)
|
||||
sb.append(' ').append(duration.toString());
|
||||
String message = power.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
sb.append(message);
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
if (quotes) {
|
||||
sb.append('"');
|
||||
}
|
||||
if (duration.toString().length() > 0) {
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
|
||||
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) {
|
||||
super(duration, layer, subLayer,
|
||||
ability.getEffects().size() > 0 ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
|
||||
!ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
|
||||
this.ability = ability;
|
||||
staticText = rule;
|
||||
this.onCard = onCard;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
|
||||
public static enum HandSizeModification {
|
||||
SET, INCREASE, REDUCE
|
||||
};
|
||||
}
|
||||
|
||||
protected DynamicValue handSize;
|
||||
protected HandSizeModification handSizeModification;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class AddCountersAttachedEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append(counter.getName().toLowerCase()).append(" counter on ");
|
||||
sb.append(textEnchanted);
|
||||
if (amount.getMessage().length() > 0) {
|
||||
if (!amount.getMessage().isEmpty()) {
|
||||
sb.append(" for each ").append(amount.getMessage());
|
||||
}
|
||||
staticText = sb.toString();
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append(" on ");
|
||||
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getNumberOfTargets() == 0) {
|
||||
sb.append("up to ");
|
||||
|
|
@ -164,7 +164,7 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
sb.append("that creature");
|
||||
}
|
||||
|
||||
if (amount.getMessage().length() > 0) {
|
||||
if (!amount.getMessage().isEmpty()) {
|
||||
sb.append(" for each ").append(amount.getMessage());
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class DistributeCountersEffect 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);
|
||||
|
|
@ -135,7 +135,7 @@ class RemoveCountersAtEndOfTurn 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);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
UUID chosen = (UUID) target.getTargets().get(idx);
|
||||
Permanent permanent = game.getPermanent(chosen);
|
||||
if (permanent != null) {
|
||||
if (permanent.getCounters(game).size() > 0) {
|
||||
if (!permanent.getCounters(game).isEmpty()) {
|
||||
if (permanent.getCounters(game).size() == 1) {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
|
|
@ -102,7 +102,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
} else {
|
||||
Player player = game.getPlayer(chosen);
|
||||
if (player != null) {
|
||||
if (player.getCounters().size() > 0) {
|
||||
if (!player.getCounters().isEmpty()) {
|
||||
if (player.getCounters().size() == 1) {
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
|
|||
|
||||
private Counter selectCounterType(Game game, Ability source, Permanent permanent) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller != null && permanent.getCounters(game).size() > 0) {
|
||||
if(controller != null && !permanent.getCounters(game).isEmpty()) {
|
||||
String counterName = null;
|
||||
if(permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class DiscardControllerEffect extends OneShotEffect {
|
|||
sb.append(" at random");
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
sb.append(message);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class DiscardHandTargetEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (targetDescription.length() > 0) {
|
||||
if (!targetDescription.isEmpty()) {
|
||||
sb.append(targetDescription);
|
||||
} else {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class DiscardTargetEffect extends OneShotEffect {
|
|||
sb.append(" at random");
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
sb.append(message);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect {
|
|||
TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter);
|
||||
target.clearChosen();
|
||||
if (controller.choose(outcome, controller.getGraveyard(), target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
cardFound = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
|
|||
}
|
||||
target.clearChosen();
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
|
|||
return false;
|
||||
}
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
|
||||
Zone.BATTLEFIELD, source, game, tapped, false, false, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
|||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
|
||||
Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class SearchLibraryWithLessCMCPutInPlayEffect extends OneShotEffect {
|
|||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class FatesealEffect extends OneShotEffect {
|
|||
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
|
||||
target1.setRequired(false);
|
||||
// move cards to the bottom of the library
|
||||
while (cards.size() > 0 && controller.choose(Outcome.Detriment, cards, target1, game)) {
|
||||
while (!cards.isEmpty() && controller.choose(Outcome.Detriment, cards, target1, game)) {
|
||||
if (!controller.canRespond() || !opponent.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class CascadeEffect extends OneShotEffect {
|
|||
Cards cardsFromExile = new CardsImpl();
|
||||
Cards cardsToLibrary = new CardsImpl();
|
||||
cardsFromExile.addAll(exile);
|
||||
while (cardsFromExile.size() > 0) {
|
||||
while (!cardsFromExile.isEmpty()) {
|
||||
card = cardsFromExile.getRandom(game);
|
||||
cardsFromExile.remove(card.getId());
|
||||
cardsToLibrary.add(card);
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ class ConvokeEffect extends OneShotEffect {
|
|||
if (!perm.isTapped() && perm.tap(game)) {
|
||||
ManaPool manaPool = controller.getManaPool();
|
||||
Choice chooseManaType = buildChoice(perm.getColor(game), unpaid.getMana());
|
||||
if (chooseManaType.getChoices().size() > 0) {
|
||||
if (!chooseManaType.getChoices().isEmpty()) {
|
||||
if (chooseManaType.getChoices().size() > 1) {
|
||||
chooseManaType.getChoices().add("Colorless");
|
||||
chooseManaType.setMessage("Choose mana color to reduce from " + perm.getName());
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Delve <i>(Each card you exile from your graveyard while casting this spell pays for {1}.)</i>";
|
||||
return "Delve <i>(Each card you exile from your graveyard while casting this spell pays for {1}.)</i>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpecialAction(Ability source, Game game, ManaCost unpaid) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && controller.getGraveyard().size() > 0) {
|
||||
if (controller != null && !controller.getGraveyard().isEmpty()) {
|
||||
if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType().equals(AbilityType.SPELL)) {
|
||||
SpecialAction specialAction = new DelveSpecialAction();
|
||||
specialAction.setControllerId(source.getControllerId());
|
||||
|
|
@ -159,7 +159,7 @@ class DelveEffect extends OneShotEffect {
|
|||
ExileFromGraveCost exileFromGraveCost = (ExileFromGraveCost) source.getCosts().get(0);
|
||||
|
||||
List<Card> exiledCards = exileFromGraveCost.getExiledCards();
|
||||
if (exiledCards.size() > 0) {
|
||||
if (!exiledCards.isEmpty()) {
|
||||
Cards toDelve = new CardsImpl();
|
||||
for (Card card : exiledCards) {
|
||||
toDelve.add(card);
|
||||
|
|
|
|||
|
|
@ -123,16 +123,16 @@ public class FlashbackAbility extends SpellAbility {
|
|||
@Override
|
||||
public String getRule() {
|
||||
StringBuilder sbRule = new StringBuilder("Flashback");
|
||||
if (costs.size() > 0) {
|
||||
if (!costs.isEmpty()) {
|
||||
sbRule.append(" - ");
|
||||
} else {
|
||||
sbRule.append(' ');
|
||||
}
|
||||
if (manaCosts.size() > 0) {
|
||||
if (!manaCosts.isEmpty()) {
|
||||
sbRule.append(manaCosts.getText());
|
||||
}
|
||||
if (costs.size() > 0) {
|
||||
if (manaCosts.size() > 0) {
|
||||
if (!costs.isEmpty()) {
|
||||
if (!manaCosts.isEmpty()) {
|
||||
sbRule.append(", ");
|
||||
}
|
||||
sbRule.append(costs.getText());
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class HideawayExileEffect extends OneShotEffect {
|
|||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
|
||||
if (controller.choose(Outcome.Detriment, cards, target1, game)) {
|
||||
Card card = cards.get(target1.getFirstTarget(), game);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class TransmuteEffect extends OneShotEffect {
|
|||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceObject.getConvertedManaCost()));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards revealed = new CardsImpl(target.getTargets());
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
controller.moveCards(revealed, Zone.HAND, source, game);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
|
|||
*/
|
||||
@Override
|
||||
public boolean definesMana() {
|
||||
return netMana.size() > 0;
|
||||
return !netMana.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
|
|||
choice.getChoices().add("Green");
|
||||
choice.getChoices().add("White");
|
||||
}
|
||||
if (choice.getChoices().size() > 0) {
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class CommanderIdentityManaEffect extends ManaEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (choice.getChoices().size() > 0) {
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ public class ManaOptions extends ArrayList<Mana> {
|
|||
public ManaOptions() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public ManaOptions(final ManaOptions options) {
|
||||
for (Mana mana : options) {
|
||||
this.add(mana.copy());
|
||||
|
|
|
|||
|
|
@ -97,6 +97,6 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen
|
|||
*/
|
||||
@Override
|
||||
public boolean definesMana() {
|
||||
return netMana.size() > 0;
|
||||
return !netMana.isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,10 +146,10 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
Map<String, DeckCardInfo> deckCards = new HashMap<>();
|
||||
Map<String, DeckCardInfo> sideboard = new HashMap<>();
|
||||
try (PrintWriter out = new PrintWriter(file)) {
|
||||
if (deck.getName() != null && deck.getName().length() > 0) {
|
||||
if (deck.getName() != null && !deck.getName().isEmpty()) {
|
||||
out.println("NAME:" + deck.getName());
|
||||
}
|
||||
if (deck.getAuthor() != null && deck.getAuthor().length() > 0) {
|
||||
if (deck.getAuthor() != null && !deck.getAuthor().isEmpty()) {
|
||||
out.println("AUTHOR:" + deck.getAuthor());
|
||||
}
|
||||
for (DeckCardInfo deckCardInfo : deck.getCards()) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class DckDeckImporter extends DeckImporter {
|
|||
if (cardInfo == null) {
|
||||
// Try alternate based on name
|
||||
String cardName = m.group(5);
|
||||
if (cardName != null && cardName.length() > 0) {
|
||||
if (cardName != null && !cardName.isEmpty()) {
|
||||
cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, false);
|
||||
sbMessage.append("Could not find card '").append(cardName).append("' in set ").append(setCode).append(" of number ").append(cardNum).append(".\n");
|
||||
if (cardInfo != null) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class FilterCard extends FilterObject<Card> {
|
|||
}
|
||||
|
||||
public boolean hasPredicates() {
|
||||
return predicates.size() > 0;
|
||||
return !predicates.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||
Player player = getPlayer(playerId);
|
||||
if (player != null) {
|
||||
while (player.getSideboard().size() > 0) {
|
||||
while (!player.getSideboard().isEmpty()) {
|
||||
Card commander = this.getCard(player.getSideboard().iterator().next());
|
||||
if (commander != null) {
|
||||
player.addCommanderId(commander.getId());
|
||||
|
|
|
|||
|
|
@ -1898,7 +1898,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
//20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield.
|
||||
// Similarly, if a permanent thats neither an Aura, an Equipment, nor a Fortification is attached to an object or player,
|
||||
// it becomes unattached and remains on the battlefield.
|
||||
if (perm.getAttachments().size() > 0) {
|
||||
if (!perm.getAttachments().isEmpty()) {
|
||||
for (UUID attachmentId : perm.getAttachments()) {
|
||||
Permanent attachment = getPermanent(attachmentId);
|
||||
if (attachment != null
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class GameStates implements Serializable {
|
|||
}
|
||||
|
||||
public GameState rollback(int index) {
|
||||
if (states.size() > 0 && index < states.size()) {
|
||||
if (!states.isEmpty() && index < states.size()) {
|
||||
while (states.size() > index + 1) {
|
||||
states.remove(states.size() - 1);
|
||||
}
|
||||
|
|
@ -72,8 +72,8 @@ public class GameStates implements Serializable {
|
|||
}
|
||||
|
||||
public int remove(int index) {
|
||||
if (states.size() > 0 && index < states.size()) {
|
||||
while (states.size() > index && states.size() > 0) {
|
||||
if (!states.isEmpty() && index < states.size()) {
|
||||
while (states.size() > index && !states.isEmpty()) {
|
||||
states.remove(states.size() - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class ZonesHandler {
|
|||
public static boolean moveCard(ZoneChangeInfo info, Game game) {
|
||||
List<ZoneChangeInfo> list = new ArrayList<>();
|
||||
list.add(info);
|
||||
return moveCards(list, game).size() > 0;
|
||||
return !moveCards(list, game).isEmpty();
|
||||
}
|
||||
|
||||
public static List<ZoneChangeInfo> moveCards(List<ZoneChangeInfo> zoneChangeInfos, Game game) {
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
}
|
||||
if (attackerExists) {
|
||||
if (group.getBlockers().size() > 0) {
|
||||
if (!group.getBlockers().isEmpty()) {
|
||||
sb.append("blocked by ");
|
||||
for (UUID blockingCreatureId : group.getBlockerOrder()) {
|
||||
Permanent blockingCreature = game.getPermanent(blockingCreatureId);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
}
|
||||
|
||||
public void assignDamageToBlockers(boolean first, Game game) {
|
||||
if (attackers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) {
|
||||
if (!attackers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) {
|
||||
if (blockers.isEmpty()) {
|
||||
unblockedDamage(first, game);
|
||||
} else {
|
||||
|
|
@ -156,7 +156,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
}
|
||||
|
||||
public void assignDamageToAttackers(boolean first, Game game) {
|
||||
if (blockers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) {
|
||||
if (!blockers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) {
|
||||
if (attackers.size() == 1) {
|
||||
singleAttackerDamage(first, game);
|
||||
} else {
|
||||
|
|
@ -581,7 +581,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
for (UUID uuid : attackers) {
|
||||
Permanent attacker = game.getPermanent(uuid);
|
||||
// Check if there are enough blockers to have a legal block
|
||||
if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && blockers.size() > 0 && blockers.size() < attacker.getMinBlockedBy()) {
|
||||
if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && !blockers.isEmpty() && blockers.size() < attacker.getMinBlockedBy()) {
|
||||
for (UUID blockerId : blockers) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public abstract class DraftCube {
|
|||
if (!cardId.getExtension().isEmpty()) {
|
||||
CardCriteria criteria = new CardCriteria().name(cardId.getName()).setCodes(cardId.extension);
|
||||
List<CardInfo> cardList = CardRepository.instance.findCards(criteria);
|
||||
if (cardList != null && cardList.size() > 0) {
|
||||
if (cardList != null && !cardList.isEmpty()) {
|
||||
cardInfo = cardList.get(0);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class RandomBoosterDraft extends BoosterDraft {
|
|||
}
|
||||
|
||||
private ExpansionSet getNextBooster() {
|
||||
if (0 == useBoosters.size()){
|
||||
if (useBoosters.isEmpty()){
|
||||
resetBoosters();
|
||||
}
|
||||
ExpansionSet theBooster = useBoosters.get(0);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class MatchPlayer implements Serializable {
|
|||
|
||||
public Deck generateDeck() {
|
||||
//TODO: improve this
|
||||
while (deck.getCards().size() < 40 && deck.getSideboard().size() > 0) {
|
||||
while (deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) {
|
||||
Card card = deck.getSideboard().iterator().next();
|
||||
deck.getCards().add(card);
|
||||
deck.getSideboard().remove(card);
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ public class Token extends MageObjectImpl {
|
|||
}
|
||||
|
||||
public void setExpansionSetCodeForImage(String code) {
|
||||
if (availableImageSetCodes.size() > 0) {
|
||||
if (!availableImageSetCodes.isEmpty()) {
|
||||
if (availableImageSetCodes.contains(code)) {
|
||||
setOriginalExpansionSetCode(code);
|
||||
} else // we should not set random set if appropriate set is already used
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
boolean legalTargetedMode = false;
|
||||
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
|
||||
Mode mode = spellAbility.getModes().get(modeId);
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
targetedMode = true;
|
||||
if (mode.getTargets().stillLegal(spellAbility, game)) {
|
||||
legalTargetedMode = true;
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
newAbility.newId();
|
||||
StackAbility newStackAbility = new StackAbility(newAbility, newControllerId);
|
||||
game.getStack().push(newStackAbility);
|
||||
if (chooseNewTargets && newAbility.getTargets().size() > 0) {
|
||||
if (chooseNewTargets && !newAbility.getTargets().isEmpty()) {
|
||||
Player controller = game.getPlayer(newControllerId);
|
||||
Outcome outcome = newAbility.getEffects().isEmpty() ? Outcome.Detriment : newAbility.getEffects().get(0).getOutcome();
|
||||
if (controller.chooseUse(outcome, "Choose new targets?", source, game)) {
|
||||
|
|
|
|||
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