Merge branch 'cleanup' into 'master'

Code cleanup

See merge request core-developers/forge!4248
This commit is contained in:
Hans Mackowiak
2021-03-23 17:17:37 +00:00
37 changed files with 196 additions and 227 deletions

View File

@@ -1120,9 +1120,8 @@ public class AiController {
CardCollection discards = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.hasCMC(cmc)); CardCollection discards = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.hasCMC(cmc));
if (discards.isEmpty()) { if (discards.isEmpty()) {
return null; return null;
} else {
return new CardCollection(ComputerUtilCard.getWorstAI(discards));
} }
return new CardCollection(ComputerUtilCard.getWorstAI(discards));
} }
if (sa.hasParam("AnyNumber")) { if (sa.hasParam("AnyNumber")) {

View File

@@ -2929,9 +2929,8 @@ public class ComputerUtil {
} }
if (targetSpellCard == null) { if (targetSpellCard == null) {
return false; return false;
} else {
sa.getTargets().add(targetSpellCard);
} }
sa.getTargets().add(targetSpellCard);
return true; return true;
} }

View File

@@ -1214,11 +1214,10 @@ public class ComputerUtilCard {
final float valueNow = Math.max(valueTempo, threat); final float valueNow = Math.max(valueTempo, threat);
if (valueNow < 0.2) { //hard floor to reduce ridiculous odds for instants over time if (valueNow < 0.2) { //hard floor to reduce ridiculous odds for instants over time
return false; return false;
} else { }
final float chance = MyRandom.getRandom().nextFloat(); final float chance = MyRandom.getRandom().nextFloat();
return chance < valueNow; return chance < valueNow;
} }
}
/** /**
* Decides if the "pump" is worthwhile * Decides if the "pump" is worthwhile

View File

@@ -162,13 +162,12 @@ public class ComputerUtilCost {
Card pref = ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList); Card pref = ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList);
if (pref == null) { if (pref == null) {
return false; return false;
} else { }
typeList.remove(pref); typeList.remove(pref);
hand.remove(pref); hand.remove(pref);
} }
} }
} }
}
return true; return true;
} }

View File

@@ -108,10 +108,8 @@ public class PlayerControllerAi extends PlayerController {
if (abilities.size() == 0) { if (abilities.size() == 0) {
return null; return null;
} }
else {
return abilities.get(0); return abilities.get(0);
} }
}
public AiController getAi() { public AiController getAi() {
return brains; return brains;

View File

@@ -30,7 +30,7 @@ public class AmassAi extends SpellAbilityAi {
if (!aiArmies.isEmpty()) { if (!aiArmies.isEmpty()) {
return CardLists.count(aiArmies, CardPredicates.canReceiveCounters(CounterEnumType.P1P1)) > 0; return CardLists.count(aiArmies, CardPredicates.canReceiveCounters(CounterEnumType.P1P1)) > 0;
} else { }
final String tokenScript = "b_0_0_zombie_army"; final String tokenScript = "b_0_0_zombie_army";
final int amount = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("Num", "1"), sa); final int amount = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("Num", "1"), sa);
@@ -64,8 +64,6 @@ public class AmassAi extends SpellAbilityAi {
return result; return result;
} }
}
@Override @Override
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) { protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) {
// TODO: Special check for instant speed logic? Something like Lazotep Plating. // TODO: Special check for instant speed logic? Something like Lazotep Plating.

View File

@@ -1452,13 +1452,12 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (sa.getTargets().size() == 0 || sa.getTargets().size() < tgt.getMinTargets(sa.getHostCard(), sa)) { if (sa.getTargets().size() == 0 || sa.getTargets().size() < tgt.getMinTargets(sa.getHostCard(), sa)) {
sa.resetTargets(); sa.resetTargets();
return false; return false;
} else { }
if (!ComputerUtil.shouldCastLessThanMax(ai, source)) { if (!ComputerUtil.shouldCastLessThanMax(ai, source)) {
return false; return false;
} }
break; break;
} }
}
list.remove(choice); list.remove(choice);
sa.getTargets().add(choice); sa.getTargets().add(choice);
@@ -1958,9 +1957,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (choice != null) { if (choice != null) {
sa.getTargets().add(choice); sa.getTargets().add(choice);
return true; return true;
} else {
return false;
} }
return false;
} }
private static CardCollection getSafeTargetsIfUnlessCostPaid(Player ai, SpellAbility sa, Iterable<Card> potentialTgts) { private static CardCollection getSafeTargetsIfUnlessCostPaid(Player ai, SpellAbility sa, Iterable<Card> potentialTgts) {

View File

@@ -141,7 +141,7 @@ public class ChooseSourceAi extends SpellAbilityAi {
Card bestCreature = ComputerUtilCard.getBestCreatureAI(permanentSources); Card bestCreature = ComputerUtilCard.getBestCreatureAI(permanentSources);
if (bestCreature != null) { if (bestCreature != null) {
return bestCreature; return bestCreature;
} else { }
// No optimal creature was found above, so try to broaden the choice. // No optimal creature was found above, so try to broaden the choice.
if (!Iterables.isEmpty(options)) { if (!Iterables.isEmpty(options)) {
List<Card> oppCreatures = CardLists.filter(options, Predicates.and(CardPredicates.Presets.CREATURES, List<Card> oppCreatures = CardLists.filter(options, Predicates.and(CardPredicates.Presets.CREATURES,
@@ -162,7 +162,6 @@ public class ChooseSourceAi extends SpellAbilityAi {
// source) in order to choose at least something, or the game will hang. // source) in order to choose at least something, or the game will hang.
return game.getStack().peekAbility().getHostCard(); return game.getStack().peekAbility().getHostCard();
} }
}
// Should never get here // Should never get here
System.err.println("Unexpected behavior: The AI was unable to choose anything for AF ChooseSource in " System.err.println("Unexpected behavior: The AI was unable to choose anything for AF ChooseSource in "

View File

@@ -140,7 +140,7 @@ public class ControlExchangeAi extends SpellAbilityAi {
return false; return false;
} }
if (aiWorst != null && aiWorst != bestFirstTgt) { if (aiWorst != bestFirstTgt) {
if (bestFirstTgt.isCreature() && aiWorst.isCreature()) { if (bestFirstTgt.isCreature() && aiWorst.isCreature()) {
if ((ComputerUtilCard.evaluateCreature(bestFirstTgt) > ComputerUtilCard.evaluateCreature(aiWorst) + creatureThreshold) || sa.isMandatory()) { if ((ComputerUtilCard.evaluateCreature(bestFirstTgt) > ComputerUtilCard.evaluateCreature(aiWorst) + creatureThreshold) || sa.isMandatory()) {
sa.getTargets().add(aiWorst); sa.getTargets().add(aiWorst);

View File

@@ -268,9 +268,8 @@ public class ControlGainAi extends SpellAbilityAi {
List<Card> list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa); List<Card> list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa);
if (list.isEmpty()) { if (list.isEmpty()) {
return false; return false;
} else {
sa.getTargets().add(ComputerUtilCard.getWorstAI(list));
} }
sa.getTargets().add(ComputerUtilCard.getWorstAI(list));
} }
} }

View File

@@ -68,7 +68,7 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
} }
} }
if (top.isWrapper() || !(top instanceof SpellAbility || top.isActivatedAbility())) { if (top.isWrapper() || top.isActivatedAbility()) {
// Shouldn't even try with triggered or wrapped abilities at this time, will crash // Shouldn't even try with triggered or wrapped abilities at this time, will crash
return false; return false;
} else if (top.getApi() == ApiType.CopySpellAbility) { } else if (top.getApi() == ApiType.CopySpellAbility) {

View File

@@ -642,10 +642,10 @@ public class BoosterGenerator {
if (toAdd == null) { if (toAdd == null) {
continue; continue;
} else {
itOp.remove();
} }
itOp.remove();
if (invert) { if (invert) {
toAdd = Predicates.not(toAdd); toAdd = Predicates.not(toAdd);
} }
@@ -658,8 +658,6 @@ public class BoosterGenerator {
} }
return Predicates.and(conditions); return Predicates.and(conditions);
} }
} }

View File

@@ -203,7 +203,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
@Override @Override
public GameLogEntry visit(GameEventTurnBegan event) { public GameLogEntry visit(GameEventTurnBegan event) {
String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());; String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());
return new GameLogEntry(GameLogEntryType.TURN, message); return new GameLogEntry(GameLogEntryType.TURN, message);
} }

View File

@@ -558,7 +558,7 @@ public class AbilityUtils {
else if (hType.startsWith("Property") && ability instanceof SpellAbility) { else if (hType.startsWith("Property") && ability instanceof SpellAbility) {
String defined = hType.split("Property")[1]; String defined = hType.split("Property")[1];
for (Player p : game.getPlayersInTurnOrder()) { for (Player p : game.getPlayersInTurnOrder()) {
if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), (SpellAbility) ability)) { if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), ability)) {
players.add(p); players.add(p);
} }
} }
@@ -1105,7 +1105,7 @@ public class AbilityUtils {
} }
// For merged permanent // For merged permanent
if (c instanceof CardCollection) { if (c instanceof CardCollection) {
o = ((CardCollection) c).get(0).getController().getOpponents();; o = ((CardCollection) c).get(0).getController().getOpponents();
} }
} }
else if (defParsed.endsWith("Owner")) { else if (defParsed.endsWith("Owner")) {
@@ -1828,7 +1828,6 @@ public class AbilityUtils {
} }
} }
if (ctb instanceof CardTraitBase) {
if (l[0].startsWith("CountersAddedThisTurn")) { if (l[0].startsWith("CountersAddedThisTurn")) {
final String[] parts = l[0].split(" "); final String[] parts = l[0].split(" ");
CounterType cType = CounterType.getType(parts[1]); CounterType cType = CounterType.getType(parts[1]);
@@ -1836,7 +1835,6 @@ public class AbilityUtils {
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c); return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
} }
} }
}
return CardFactoryUtil.xCount(c, s2); return CardFactoryUtil.xCount(c, s2);
} }

View File

@@ -54,10 +54,9 @@ public class AttachEffect extends SpellAbilityEffect {
if (targets.isEmpty()) { if (targets.isEmpty()) {
return; return;
} else {
attachTo = targets.get(0);
} }
attachTo = targets.get(0);
String attachToName = null; String attachToName = null;
if (attachTo instanceof Card) { if (attachTo instanceof Card) {
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName()); attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());

View File

@@ -261,7 +261,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
} }
for (final Card dest : tgtCards) { for (final Card dest : tgtCards) {
if (null != source && null != dest) { if (null != dest) {
// rule 121.5: If the first and second objects are the same object, nothing // rule 121.5: If the first and second objects are the same object, nothing
// happens // happens
if (source.equals(dest)) { if (source.equals(dest)) {

View File

@@ -160,11 +160,10 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
tok.attachToEntity(ge); tok.attachToEntity(ge);
return true; return true;
} else { }
// not a GameEntity, cant be attach // not a GameEntity, cant be attach
return false; return false;
} }
}
protected void addPumpUntil(SpellAbility sa, final Card c, long timestamp) { protected void addPumpUntil(SpellAbility sa, final Card c, long timestamp) {
if (!sa.hasParam("PumpDuration")) { if (!sa.hasParam("PumpDuration")) {

View File

@@ -3565,7 +3565,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
// values that are printed on card // values that are printed on card
public final void setBasePowerString(final String s) { public final void setBasePowerString(final String s) {
currentState.setBasePowerString(s);; currentState.setBasePowerString(s);
} }
public final void setBaseToughnessString(final String s) { public final void setBaseToughnessString(final String s) {

View File

@@ -1508,14 +1508,14 @@ public class CardProperty {
String what = property.substring("blocking".length()); String what = property.substring("blocking".length());
if (StringUtils.isEmpty(what)) return combat.isBlocking(card); if (StringUtils.isEmpty(what)) return combat.isBlocking(card);
if (what.startsWith("Source")) return combat.isBlocking(card, source) ; if (what.startsWith("Source")) return combat.isBlocking(card, source);
if (what.startsWith("CreatureYouCtrl")) { if (what.startsWith("CreatureYouCtrl")) {
for (final Card c : CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), Presets.CREATURES)) for (final Card c : CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), Presets.CREATURES))
if (combat.isBlocking(card, c)) if (combat.isBlocking(card, c))
return true; return true;
return false; return false;
} else { } else {
for(Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) { for (Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) {
if (combat.isBlocking(card, c)) { if (combat.isBlocking(card, c)) {
return true; return true;
} }

View File

@@ -89,7 +89,7 @@ public class CostReveal extends CostPartWithList {
} else if (this.getType().equals("SameColor")) { } else if (this.getType().equals("SameColor")) {
if (amount == null) { if (amount == null) {
return false; return false;
} else { }
for (final Card card : handList) { for (final Card card : handList) {
if (CardLists.filter(handList, new Predicate<Card>() { if (CardLists.filter(handList, new Predicate<Card>() {
@Override @Override
@@ -101,10 +101,8 @@ public class CostReveal extends CostPartWithList {
} }
} }
return false; return false;
}
} else { } else {
return (amount == null) || (amount <= getMaxAmountX(ability, payer)); return (amount == null) || (amount <= getMaxAmountX(ability, payer));
//System.out.println("revealcost - " + amount + type + handList);
} }
} }

View File

@@ -198,7 +198,7 @@ public class Player extends GameEntity implements Comparable<Player> {
private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class); private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class);
private final Map<Long, Integer> adjustLandPlays = Maps.newHashMap(); private final Map<Long, Integer> adjustLandPlays = Maps.newHashMap();
private final Set<Long> adjustLandPlaysInfinite = Sets.newHashSet(); private final Set<Long> adjustLandPlaysInfinite = Sets.newHashSet();
private Map<Card, Card> maingameCardsMap = Maps.newHashMap();; private Map<Card, Card> maingameCardsMap = Maps.newHashMap();
private CardCollection currentPlanes = new CardCollection(); private CardCollection currentPlanes = new CardCollection();
private Set<String> prowl = Sets.newHashSet(); private Set<String> prowl = Sets.newHashSet();
@@ -3448,9 +3448,10 @@ public class Player extends GameEntity implements Comparable<Player> {
return true; return true;
} }
if (this.hasKeyword("CantSearchLibrary")) { if (hasKeyword("CantSearchLibrary")) {
return false; return false;
} else return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer()) }
return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|| !hasKeyword("Spells and abilities you control can't cause you to search your library."); || !hasKeyword("Spells and abilities you control can't cause you to search your library.");
} }

View File

@@ -83,7 +83,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
} }
// do performanceMode only for cases where the activator is different than controller // do performanceMode only for cases where the activator is different than controller
if (!Spell.performanceMode && activator != null && !card.getController().equals(activator)) { if (!Spell.performanceMode && !card.getController().equals(activator)) {
// always make a lki copy in this case? // always make a lki copy in this case?
card = CardUtil.getLKICopy(card); card = CardUtil.getLKICopy(card);
card.setController(activator, 0); card.setController(activator, 0);

View File

@@ -290,7 +290,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
Card first = Iterables.getFirst(tgts, null); Card first = Iterables.getFirst(tgts, null);
if (first == null) { if (first == null) {
return false; return false;
} else { }
byte firstColor = CardUtil.getColors(first).getColor(); byte firstColor = CardUtil.getColors(first).getColor();
for (Card c : tgts) { for (Card c : tgts) {
if (CardUtil.getColors(c).getColor() != firstColor) { if (CardUtil.getColors(c).getColor() != firstColor) {
@@ -298,7 +298,6 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
} }
} }
} }
}
if (this.isSorcerySpeed() && !activator.canCastSorcery()) { if (this.isSorcerySpeed() && !activator.canCastSorcery()) {
return false; return false;

View File

@@ -489,7 +489,7 @@ public class TargetRestrictions {
if (this.tgtZone.contains(ZoneType.Stack)) { if (this.tgtZone.contains(ZoneType.Stack)) {
// Stack Zone targets are considered later // Stack Zone targets are considered later
return true; return true;
} else { }
for (final Card c : game.getCardsIn(this.tgtZone)) { for (final Card c : game.getCardsIn(this.tgtZone)) {
if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) { if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) {
continue; continue;
@@ -502,7 +502,6 @@ public class TargetRestrictions {
} }
return true; return true;
} }
}
return false; return false;
} }

View File

@@ -283,13 +283,12 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
// AbilityStatic should do nothing below // AbilityStatic should do nothing below
return; return;
} }
else {
for (OptionalCost s : sp.getOptionalCosts()) { for (OptionalCost s : sp.getOptionalCosts()) {
source.addOptionalCostPaid(s); source.addOptionalCostPaid(s);
} }
// The ability is added to stack HERE // The ability is added to stack HERE
si = push(sp); si = push(sp);
}
// Copied spells aren't cast per se so triggers shouldn't run for them. // Copied spells aren't cast per se so triggers shouldn't run for them.
Map<AbilityKey, Object> runParams = AbilityKey.newMap(); Map<AbilityKey, Object> runParams = AbilityKey.newMap();

View File

@@ -766,22 +766,28 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
if (deckType.startsWith(NetDeckCategory.PREFIX)) { if (deckType.startsWith(NetDeckCategory.PREFIX)) {
netDeckCategory = NetDeckCategory.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckCategory.PREFIX.length())); netDeckCategory = NetDeckCategory.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckCategory.PREFIX.length()));
return DeckType.NET_DECK; return DeckType.NET_DECK;
} else if (deckType.startsWith(NetDeckArchiveStandard.PREFIX)) { }
if (deckType.startsWith(NetDeckArchiveStandard.PREFIX)) {
NetDeckArchiveStandard = NetDeckArchiveStandard.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveStandard.PREFIX.length())); NetDeckArchiveStandard = NetDeckArchiveStandard.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveStandard.PREFIX.length()));
return DeckType.NET_ARCHIVE_STANDARD_DECK; return DeckType.NET_ARCHIVE_STANDARD_DECK;
} else if (deckType.startsWith(NetDeckArchivePioneer.PREFIX)) { }
if (deckType.startsWith(NetDeckArchivePioneer.PREFIX)) {
NetDeckArchivePioneer = NetDeckArchivePioneer.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchivePioneer.PREFIX.length())); NetDeckArchivePioneer = NetDeckArchivePioneer.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchivePioneer.PREFIX.length()));
return DeckType.NET_ARCHIVE_PIONEER_DECK; return DeckType.NET_ARCHIVE_PIONEER_DECK;
} else if (deckType.startsWith(NetDeckArchiveModern.PREFIX)) { }
if (deckType.startsWith(NetDeckArchiveModern.PREFIX)) {
NetDeckArchiveModern = NetDeckArchiveModern.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveModern.PREFIX.length())); NetDeckArchiveModern = NetDeckArchiveModern.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveModern.PREFIX.length()));
return DeckType.NET_ARCHIVE_MODERN_DECK; return DeckType.NET_ARCHIVE_MODERN_DECK;
} else if (deckType.startsWith(NetDeckArchiveLegacy.PREFIX)) { }
if (deckType.startsWith(NetDeckArchiveLegacy.PREFIX)) {
NetDeckArchiveLegacy = NetDeckArchiveLegacy.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveLegacy.PREFIX.length())); NetDeckArchiveLegacy = NetDeckArchiveLegacy.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveLegacy.PREFIX.length()));
return DeckType.NET_ARCHIVE_LEGACY_DECK; return DeckType.NET_ARCHIVE_LEGACY_DECK;
} else if (deckType.startsWith(NetDeckArchiveVintage.PREFIX)) { }
if (deckType.startsWith(NetDeckArchiveVintage.PREFIX)) {
NetDeckArchiveVintage = NetDeckArchiveVintage.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveVintage.PREFIX.length())); NetDeckArchiveVintage = NetDeckArchiveVintage.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveVintage.PREFIX.length()));
return DeckType.NET_ARCHIVE_VINTAGE_DECK; return DeckType.NET_ARCHIVE_VINTAGE_DECK;
} else if (deckType.startsWith(NetDeckArchiveBlock.PREFIX)) { }
if (deckType.startsWith(NetDeckArchiveBlock.PREFIX)) {
NetDeckArchiveBlock = NetDeckArchiveBlock.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveBlock.PREFIX.length())); NetDeckArchiveBlock = NetDeckArchiveBlock.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveBlock.PREFIX.length()));
return DeckType.NET_ARCHIVE_BLOCK_DECK; return DeckType.NET_ARCHIVE_BLOCK_DECK;
} }

View File

@@ -715,7 +715,7 @@ public class VLobby implements ILobbyView {
if (sel == null) { if (sel == null) {
return; return;
} else { }
if (sel.contains("Use deck's default avatar") && deck != null && deck.has(DeckSection.Avatar)) { if (sel.contains("Use deck's default avatar") && deck != null && deck.has(DeckSection.Avatar)) {
vanguardAvatar = deck.get(DeckSection.Avatar).get(0); vanguardAvatar = deck.get(DeckSection.Avatar).get(0);
} else { //Only other string is "Random" } else { //Only other string is "Random"
@@ -726,7 +726,6 @@ public class VLobby implements ILobbyView {
} }
} }
} }
}
final CardPool avatarOnce = new CardPool(); final CardPool avatarOnce = new CardPool();
avatarOnce.add(vanguardAvatar); avatarOnce.add(vanguardAvatar);

View File

@@ -126,10 +126,8 @@ public class QuickGauntletLister extends JPanel {
if (previousSelect == null) { if (previousSelect == null) {
return null; return null;
} }
else {
return GauntletIO.getGauntletFile(previousSelect.getGauntletData()); return GauntletIO.getGauntletFile(previousSelect.getGauntletData());
} }
}
private class DeleteButton extends SkinnedButton { private class DeleteButton extends SkinnedButton {
public DeleteButton(final RowPanel r0) { public DeleteButton(final RowPanel r0) {

View File

@@ -1357,7 +1357,7 @@ public final class CMatchUI
private List<GameEntityView> getTargets(SpellAbilityStackInstance si, List<GameEntityView> result){ private List<GameEntityView> getTargets(SpellAbilityStackInstance si, List<GameEntityView> result){
if(si == null) { if(si == null) {
return result; return result;
} else { }
FCollectionView<CardView> targetCards = CardView.getCollection(si.getTargetChoices().getTargetCards()); FCollectionView<CardView> targetCards = CardView.getCollection(si.getTargetChoices().getTargetCards());
for(CardView currCardView: targetCards) { for(CardView currCardView: targetCards) {
result.add(currCardView); result.add(currCardView);
@@ -1375,7 +1375,6 @@ public final class CMatchUI
return getTargets(si.getSubInstance(),result); return getTargets(si.getSubInstance(),result);
} }
}
private void addBigImageToStackModalPanel(JPanel mainPanel, SpellAbilityStackInstance si) { private void addBigImageToStackModalPanel(JPanel mainPanel, SpellAbilityStackInstance si) {
StackItemView siv = si.getView(); StackItemView siv = si.getView();

View File

@@ -90,9 +90,8 @@ public class AutoUpdater {
int option = SOptionPane.showOptionDialog(message, localizer.getMessage("lblManualCheck"), null, options, 0); int option = SOptionPane.showOptionDialog(message, localizer.getMessage("lblManualCheck"), null, options, 0);
if (option < 1) { if (option < 1) {
return false; return false;
} else {
updateChannel = options.get(option);
} }
updateChannel = options.get(option);
} }
if (buildVersion.contains("SNAPSHOT")) { if (buildVersion.contains("SNAPSHOT")) {

View File

@@ -327,7 +327,6 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
// Don't immediately close, wait for win/lose screen // Don't immediately close, wait for win/lose screen
return false; return false;
} }
else {
// since the nextGameDecision might come from somewhere else it will try and concede too // since the nextGameDecision might come from somewhere else it will try and concede too
ignoreConcedeChain = true; ignoreConcedeChain = true;
for (PlayerView player : getLocalPlayers()) { for (PlayerView player : getLocalPlayers()) {
@@ -338,7 +337,6 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
ignoreConcedeChain = false; ignoreConcedeChain = false;
return false; return false;
} }
}
else if (spectator == null) { else if (spectator == null) {
return true; //if no local players or spectator, just quit return true; //if no local players or spectator, just quit
} }

View File

@@ -28,7 +28,7 @@ public class CompatibleObjectDecoder extends LengthFieldBasedFrameDecoder {
ByteBuf frame = (ByteBuf)super.decode(ctx, in); ByteBuf frame = (ByteBuf)super.decode(ctx, in);
if (frame == null) { if (frame == null) {
return null; return null;
} else { }
ObjectInputStream ois = GuiBase.hasPropertyConfig() ? ObjectInputStream ois = GuiBase.hasPropertyConfig() ?
new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))): new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))):
new CObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true)),this.classResolver); new CObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true)),this.classResolver);
@@ -44,5 +44,4 @@ public class CompatibleObjectDecoder extends LengthFieldBasedFrameDecoder {
return var5; return var5;
} }
}
} }

View File

@@ -352,7 +352,7 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
@Override @Override
public Void visit(final GameEventCardAttachment event) { public Void visit(final GameEventCardAttachment event) {
final Game game = event.equipment.getGame(); final Game game = event.equipment.getGame();
final Zone zEq = (Zone)game.getZoneOf(event.equipment); final Zone zEq = game.getZoneOf(event.equipment);
if (event.oldEntiy instanceof Card) { if (event.oldEntiy instanceof Card) {
updateZone(game.getZoneOf((Card)event.oldEntiy)); updateZone(game.getZoneOf((Card)event.oldEntiy));
} }

View File

@@ -393,7 +393,7 @@ public abstract class GuiDownloadService implements Runnable {
protected Proxy getProxy() { protected Proxy getProxy() {
if (type == 0) { if (type == 0) {
return Proxy.NO_PROXY; return Proxy.NO_PROXY;
} else { }
try { try {
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText()))); return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
} catch (final Exception ex) { } catch (final Exception ex) {
@@ -401,7 +401,6 @@ public abstract class GuiDownloadService implements Runnable {
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s", "Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
txtAddress.getText(), txtPort.getText()); txtAddress.getText(), txtPort.getText());
} }
}
return null; return null;
} }

View File

@@ -725,17 +725,15 @@ public class HumanPlay {
if (ability.getSacrificedAsOffering() == null) { if (ability.getSacrificedAsOffering() == null) {
System.out.println("Sacrifice input for Offering cancelled"); System.out.println("Sacrifice input for Offering cancelled");
return false; return false;
} else {
offering = ability.getSacrificedAsOffering();
} }
offering = ability.getSacrificedAsOffering();
} }
if (ability.isEmerge()) { if (ability.isEmerge()) {
if (ability.getSacrificedAsEmerge() == null) { if (ability.getSacrificedAsEmerge() == null) {
System.out.println("Sacrifice input for Emerge cancelled"); System.out.println("Sacrifice input for Emerge cancelled");
return false; return false;
} else {
emerge = ability.getSacrificedAsEmerge();
} }
emerge = ability.getSacrificedAsEmerge();
} }
if (!toPay.isPaid()) { if (!toPay.isPaid()) {
// Input is somehow clearing out the offering card? // Input is somehow clearing out the offering card?

View File

@@ -694,13 +694,11 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
} }
break; break;
} }
if (sa != null) {
tempShowCard(show); tempShowCard(show);
boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message); boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message);
endTempShowCards(); endTempShowCards();
return result; return result;
} }
}
// The general case: display the source of the SA in the prompt on mouse over // The general case: display the source of the SA in the prompt on mouse over
return InputConfirm.confirm(this, sa, message); return InputConfirm.confirm(this, sa, message);

View File

@@ -318,7 +318,6 @@ public class TargetSelection {
// Not enough targets, cancel targeting // Not enough targets, cancel targeting
return false; return false;
} }
else {
Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions); Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions);
if (madeChoice == null) { if (madeChoice == null) {
return false; return false;
@@ -330,7 +329,6 @@ public class TargetSelection {
bTargetingDone = true; bTargetingDone = true;
} }
} }
}
return true; return true;
} }
} }