mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Minor clean up
This commit is contained in:
@@ -879,7 +879,7 @@ public class AiController {
|
||||
public boolean isNonDisabledCardInPlay(final String cardName) {
|
||||
for (Card card : player.getCardsIn(ZoneType.Battlefield)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
// TODO - Better logic to detemine if a permanent is disabled by local effects
|
||||
// TODO - Better logic to determine if a permanent is disabled by local effects
|
||||
// currently assuming any permanent enchanted by another player
|
||||
// is disabled and a second copy is necessary
|
||||
// will need actual logic that determines if the enchantment is able
|
||||
|
||||
@@ -78,15 +78,13 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
return null;
|
||||
}
|
||||
return PaymentDecision.card(player.getLastDrawnCard());
|
||||
}
|
||||
else if (cost.payCostFromSource()) {
|
||||
} else if (cost.payCostFromSource()) {
|
||||
if (!hand.contains(source)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return PaymentDecision.card(source);
|
||||
}
|
||||
else if (type.equals("Hand")) {
|
||||
} else if (type.equals("Hand")) {
|
||||
if (hand.size() > 1 && ability.getActivatingPlayer() != null) {
|
||||
hand = ability.getActivatingPlayer().getController().orderMoveToZoneList(hand, ZoneType.Graveyard, ability);
|
||||
}
|
||||
@@ -107,8 +105,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
randomSubset = ability.getActivatingPlayer().getController().orderMoveToZoneList(randomSubset, ZoneType.Graveyard, ability);
|
||||
}
|
||||
return PaymentDecision.card(randomSubset);
|
||||
}
|
||||
else if (type.equals("DifferentNames")) {
|
||||
} else if (type.equals("DifferentNames")) {
|
||||
CardCollection differentNames = new CardCollection();
|
||||
CardCollection discardMe = CardLists.filter(hand, CardPredicates.hasSVar("DiscardMe"));
|
||||
while (c > 0) {
|
||||
@@ -125,8 +122,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
c--;
|
||||
}
|
||||
return PaymentDecision.card(differentNames);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
final AiController aic = ((PlayerControllerAi)player.getController()).getAi();
|
||||
|
||||
CardCollection result = aic.getCardsToDiscard(c, type.split(";"), ability, discarded);
|
||||
@@ -183,8 +179,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
else if (cost.sameZone) {
|
||||
// TODO Determine exile from same zone for AI
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CardCollectionView chosen = ComputerUtil.chooseExileFrom(player, cost.getFrom(), cost.getType(), source, ability.getTargetCard(), c, ability);
|
||||
return null == chosen ? null : PaymentDecision.card(chosen);
|
||||
}
|
||||
@@ -375,8 +370,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
|
||||
if (cost.isSameZone()) {
|
||||
list = new CardCollection(game.getCardsIn(cost.getFrom()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
list = new CardCollection(player.getCardsIn(cost.getFrom()));
|
||||
}
|
||||
|
||||
@@ -871,4 +865,3 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -947,7 +947,7 @@ public class ComputerUtil {
|
||||
canRegen = true;
|
||||
}
|
||||
|
||||
} catch (final Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
throw new RuntimeException(TextUtil.concatNoSpace("There is an error in the card code for ", c.getName(), ":", ex.getMessage()), ex);
|
||||
}
|
||||
}
|
||||
@@ -2832,7 +2832,6 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
public static boolean lifegainPositive(final Player player, final Card source) {
|
||||
|
||||
if (!player.canGainLife()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -716,6 +716,7 @@ public class ComputerUtilCard {
|
||||
|
||||
int bigCMC = -1;
|
||||
for (final Card card : all) {
|
||||
// TODO when PlayAi can consider MDFC this should also look at the back face (if not on stack or battlefield)
|
||||
int curCMC = card.getCMC();
|
||||
|
||||
// Add all cost of all auras with the same controller
|
||||
|
||||
@@ -70,13 +70,12 @@ public class PlayAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
if (sa.hasParam("ValidSA")) {
|
||||
if (cards != null & sa.hasParam("ValidSA")) {
|
||||
final String valid[] = {sa.getParam("ValidSA")};
|
||||
final Iterator<Card> itr = cards.iterator();
|
||||
while (itr.hasNext()) {
|
||||
final Card c = itr.next();
|
||||
final List<SpellAbility> validSA = Lists.newArrayList(Iterables.filter(AbilityUtils.getBasicSpellsFromPlayEffect(c, ai), SpellAbilityPredicates.isValid(valid, ai , c, sa)));
|
||||
if (validSA.size() == 0) {
|
||||
if (!Iterables.any(AbilityUtils.getBasicSpellsFromPlayEffect(c, ai), SpellAbilityPredicates.isValid(valid, ai , c, sa))) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
@@ -173,6 +172,8 @@ public class PlayAi extends SpellAbilityAi {
|
||||
List<Card> tgtCards = CardLists.filter(options, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
// TODO needs to be aligned for MDFC along with getAbilityToPlay so the knowledge
|
||||
// of which spell was the reason for the choice can be used there
|
||||
for (SpellAbility s : c.getBasicSpells(c.getState(CardStateName.Original))) {
|
||||
Spell spell = (Spell) s;
|
||||
s.setActivatingPlayer(ai);
|
||||
|
||||
@@ -87,7 +87,6 @@ public class DeckGeneratorMonoColor extends DeckGeneratorBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final CardPool getDeck(final int size, final boolean forAi) {
|
||||
addCreaturesAndSpells(size, cmcLevels, forAi);
|
||||
|
||||
@@ -61,7 +61,6 @@ import forge.util.TextUtil;
|
||||
*/
|
||||
public class BoosterGenerator {
|
||||
|
||||
|
||||
private final static Map<String, PrintSheet> cachedSheets = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
private static synchronized PrintSheet getPrintSheet(String key) {
|
||||
if( !cachedSheets.containsKey(key) )
|
||||
|
||||
@@ -31,7 +31,6 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
||||
this.poolLimited = considerNumbersInPool; // TODO: Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
|
||||
// Means to select from all unique cards (from base game, ie. no schemes or avatars)
|
||||
public UnOpenedProduct(SealedProduct.Template template) {
|
||||
tpl = template;
|
||||
|
||||
@@ -1080,7 +1080,7 @@ public class CombatUtil {
|
||||
return canAttackerBeBlockedWithAmount(attacker, amount, combat != null ? combat.getDefenderPlayerByAttacker(attacker) : null);
|
||||
}
|
||||
public static boolean canAttackerBeBlockedWithAmount(Card attacker, int amount, Player defender) {
|
||||
if(amount == 0 )
|
||||
if (amount == 0)
|
||||
return false; // no block
|
||||
|
||||
List<String> restrictions = Lists.newArrayList();
|
||||
@@ -1093,7 +1093,7 @@ public class CombatUtil {
|
||||
restrictions.add("LT2");
|
||||
}
|
||||
}
|
||||
for ( String res : restrictions ) {
|
||||
for (String res : restrictions) {
|
||||
int operand = Integer.parseInt(res.substring(2));
|
||||
String operator = res.substring(0,2);
|
||||
if (Expressions.compare(amount, operator, operand) )
|
||||
@@ -1118,7 +1118,7 @@ public class CombatUtil {
|
||||
}
|
||||
}
|
||||
int minBlockers = 1;
|
||||
for ( String res : restrictions ) {
|
||||
for (String res : restrictions) {
|
||||
int operand = Integer.parseInt(res.substring(2));
|
||||
String operator = res.substring(0, 2);
|
||||
if (operator.equals("LT") || operator.equals("GE")) {
|
||||
|
||||
@@ -211,7 +211,7 @@ public class CostPayment extends ManaConversionMatrix {
|
||||
return false;
|
||||
}
|
||||
// abilities care what was used to pay for them
|
||||
if( part instanceof CostPartWithList ) {
|
||||
if (part instanceof CostPartWithList) {
|
||||
((CostPartWithList) part).resetLists();
|
||||
}
|
||||
|
||||
|
||||
@@ -414,4 +414,3 @@ public enum FControl implements KeyEventDispatcher {
|
||||
return GamePlayerUtil.getGuiPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,6 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void buildAddFilterMenu(final JMenu menu) {
|
||||
GuiUtils.addSeparator(menu); //separate from current search item
|
||||
|
||||
@@ -228,7 +227,6 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
||||
}
|
||||
menu.add(fmt);
|
||||
|
||||
|
||||
GuiUtils.addMenuItem(menu, localizer.getMessage("lblFormats") + "...", null, new Runnable() {
|
||||
@Override public void run() {
|
||||
final DeckFormatFilter existingFilter = getFilter(DeckFormatFilter.class);
|
||||
|
||||
@@ -340,4 +340,3 @@ public enum CDeckEditorUI implements ICDoc {
|
||||
@Override
|
||||
public void update() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -294,8 +294,7 @@ public class DeckController<T extends DeckBase> {
|
||||
final String name = getModelName();
|
||||
if (name.isEmpty()) {
|
||||
newModel();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
load(name);
|
||||
}
|
||||
}
|
||||
@@ -303,8 +302,7 @@ public class DeckController<T extends DeckBase> {
|
||||
public void load(final String path, final String name) {
|
||||
if (StringUtils.isBlank(path)) {
|
||||
currentFolder = rootFolder;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
currentFolder = rootFolder.tryGetFolder(path);
|
||||
}
|
||||
modelPath = path;
|
||||
@@ -386,8 +384,7 @@ public class DeckController<T extends DeckBase> {
|
||||
public void refreshModel() {
|
||||
if (model == null) {
|
||||
newModel();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setModel(model, modelInStorage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ public final class CMatchUI
|
||||
|
||||
@Override
|
||||
public void hideZones(final PlayerView controller, final Iterable<PlayerZoneUpdate> zonesToUpdate) {
|
||||
if ( zonesToUpdate != null ) {
|
||||
if (zonesToUpdate != null) {
|
||||
for (final PlayerZoneUpdate update : zonesToUpdate) {
|
||||
final PlayerView player = update.getPlayer();
|
||||
for (final ZoneType zone : update.getZones()) {
|
||||
@@ -532,7 +532,6 @@ public final class CMatchUI
|
||||
for (final PlayerView p : manaPoolUpdate) {
|
||||
getFieldViewFor(p).updateManaPool();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Player's lives and poison counters
|
||||
@@ -575,15 +574,15 @@ public final class CMatchUI
|
||||
|
||||
@Override
|
||||
public void setSelectables(final Iterable<CardView> cards) {
|
||||
super.setSelectables(cards);
|
||||
// update zones on tabletop and floating zones - non-selectable cards may be rendered differently
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
super.setSelectables(cards);
|
||||
// update zones on tabletop and floating zones - non-selectable cards may be rendered differently
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override public final void run() {
|
||||
for (final PlayerView p : getGameView().getPlayers()) {
|
||||
if ( p.getCards(ZoneType.Battlefield) != null ) {
|
||||
if (p.getCards(ZoneType.Battlefield) != null) {
|
||||
updateCards(p.getCards(ZoneType.Battlefield));
|
||||
}
|
||||
if ( p.getCards(ZoneType.Hand) != null ) {
|
||||
if (p.getCards(ZoneType.Hand) != null) {
|
||||
updateCards(p.getCards(ZoneType.Hand));
|
||||
}
|
||||
}
|
||||
@@ -594,15 +593,15 @@ public final class CMatchUI
|
||||
|
||||
@Override
|
||||
public void clearSelectables() {
|
||||
super.clearSelectables();
|
||||
// update zones on tabletop and floating zones - non-selectable cards may be rendered differently
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
super.clearSelectables();
|
||||
// update zones on tabletop and floating zones - non-selectable cards may be rendered differently
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override public final void run() {
|
||||
for (final PlayerView p : getGameView().getPlayers()) {
|
||||
if ( p.getCards(ZoneType.Battlefield) != null ) {
|
||||
if (p.getCards(ZoneType.Battlefield) != null) {
|
||||
updateCards(p.getCards(ZoneType.Battlefield));
|
||||
}
|
||||
if ( p.getCards(ZoneType.Hand) != null ) {
|
||||
if (p.getCards(ZoneType.Hand) != null) {
|
||||
updateCards(p.getCards(ZoneType.Hand));
|
||||
}
|
||||
}
|
||||
@@ -617,7 +616,7 @@ public final class CMatchUI
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override public final void run() {
|
||||
for (final PlayerView p : getGameView().getPlayers()) {
|
||||
if ( p.getCards(ZoneType.Battlefield) != null ) {
|
||||
if (p.getCards(ZoneType.Battlefield) != null) {
|
||||
updateCards(p.getCards(ZoneType.Battlefield));
|
||||
}
|
||||
}
|
||||
@@ -787,7 +786,7 @@ public final class CMatchUI
|
||||
final PhaseType ph = getGameView().getPhase();
|
||||
// this should never happen, but I've seen it periodically... so, need to get to the bottom of it
|
||||
PhaseLabel lbl = null;
|
||||
if (ph != null ) {
|
||||
if (ph != null) {
|
||||
lbl = p == null ? null : getFieldViewFor(p).getPhaseIndicator().getLabelFor(ph);
|
||||
} else {
|
||||
// not sure what debugging information would help here, log for now
|
||||
@@ -1295,79 +1294,78 @@ public final class CMatchUI
|
||||
boolean isAi = sa.getActivatingPlayer().isAI();
|
||||
boolean isTrigger = sa.isTrigger();
|
||||
int stackIndex = event.stackIndex;
|
||||
if(stackIndex == nextNotifiableStackIndex) {
|
||||
if(ForgeConstants.STACK_EFFECT_NOTIFICATION_ALWAYS.equals(stackNotificationPolicy) || (ForgeConstants.STACK_EFFECT_NOTIFICATION_AI_AND_TRIGGERED.equals(stackNotificationPolicy) && (isAi || isTrigger))) {
|
||||
// We can go and show the modal
|
||||
SpellAbilityStackInstance si = event.si;
|
||||
if (stackIndex == nextNotifiableStackIndex) {
|
||||
if (ForgeConstants.STACK_EFFECT_NOTIFICATION_ALWAYS.equals(stackNotificationPolicy) || (ForgeConstants.STACK_EFFECT_NOTIFICATION_AI_AND_TRIGGERED.equals(stackNotificationPolicy) && (isAi || isTrigger))) {
|
||||
// We can go and show the modal
|
||||
SpellAbilityStackInstance si = event.si;
|
||||
|
||||
MigLayout migLayout = new MigLayout("insets 15, left, gap 30, fill");
|
||||
JPanel mainPanel = new JPanel(migLayout);
|
||||
final Dimension parentSize = JOptionPane.getRootFrame().getSize();
|
||||
Dimension maxSize = new Dimension(1400, parentSize.height - 100);
|
||||
mainPanel.setMaximumSize(maxSize);
|
||||
mainPanel.setOpaque(false);
|
||||
MigLayout migLayout = new MigLayout("insets 15, left, gap 30, fill");
|
||||
JPanel mainPanel = new JPanel(migLayout);
|
||||
final Dimension parentSize = JOptionPane.getRootFrame().getSize();
|
||||
Dimension maxSize = new Dimension(1400, parentSize.height - 100);
|
||||
mainPanel.setMaximumSize(maxSize);
|
||||
mainPanel.setOpaque(false);
|
||||
|
||||
// Big Image
|
||||
addBigImageToStackModalPanel(mainPanel, si);
|
||||
// Big Image
|
||||
addBigImageToStackModalPanel(mainPanel, si);
|
||||
|
||||
// Text
|
||||
addTextToStackModalPanel(mainPanel,sa,si);
|
||||
// Text
|
||||
addTextToStackModalPanel(mainPanel,sa,si);
|
||||
|
||||
// Small images
|
||||
int numSmallImages = 0;
|
||||
// Small images
|
||||
int numSmallImages = 0;
|
||||
|
||||
// If current effect is a triggered/activated ability of an enchantment card, I want to show the enchanted card
|
||||
GameEntityView enchantedEntityView = null;
|
||||
Card hostCard = sa.getHostCard();
|
||||
if(hostCard.isEnchantment()) {
|
||||
GameEntity enchantedEntity = hostCard.getEntityAttachedTo();
|
||||
if(enchantedEntity != null) {
|
||||
enchantedEntityView = enchantedEntity.getView();
|
||||
numSmallImages++;
|
||||
} else if ((sa.getRootAbility() != null)
|
||||
&& (sa.getRootAbility().getPaidList("Sacrificed") != null)
|
||||
&& !sa.getRootAbility().getPaidList("Sacrificed").isEmpty()) {
|
||||
// If the player activated its ability by sacrificing the enchantment, the enchantment has not anything attached anymore and the ex-enchanted card has to be searched in other ways.. for example, the green enchantment "Carapace"
|
||||
enchantedEntity = sa.getRootAbility().getPaidList("Sacrificed").get(0).getEnchantingCard();
|
||||
if(enchantedEntity != null) {
|
||||
// If current effect is a triggered/activated ability of an enchantment card, I want to show the enchanted card
|
||||
GameEntityView enchantedEntityView = null;
|
||||
Card hostCard = sa.getHostCard();
|
||||
if (hostCard.isEnchantment()) {
|
||||
GameEntity enchantedEntity = hostCard.getEntityAttachedTo();
|
||||
if (enchantedEntity != null) {
|
||||
enchantedEntityView = enchantedEntity.getView();
|
||||
numSmallImages++;
|
||||
} else if ((sa.getRootAbility() != null)
|
||||
&& (sa.getRootAbility().getPaidList("Sacrificed") != null)
|
||||
&& !sa.getRootAbility().getPaidList("Sacrificed").isEmpty()) {
|
||||
// If the player activated its ability by sacrificing the enchantment, the enchantment has not anything attached anymore and the ex-enchanted card has to be searched in other ways.. for example, the green enchantment "Carapace"
|
||||
enchantedEntity = sa.getRootAbility().getPaidList("Sacrificed").get(0).getEnchantingCard();
|
||||
if (enchantedEntity != null) {
|
||||
enchantedEntityView = enchantedEntity.getView();
|
||||
numSmallImages++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If current effect is a triggered ability, I want to show the triggering card if present
|
||||
SpellAbility sourceSA = (SpellAbility) si.getTriggeringObject(AbilityKey.SourceSA);
|
||||
CardView sourceCardView = null;
|
||||
if(sourceSA != null) {
|
||||
sourceCardView = sourceSA.getHostCard().getView();
|
||||
numSmallImages++;
|
||||
}
|
||||
// If current effect is a triggered ability, I want to show the triggering card if present
|
||||
SpellAbility sourceSA = (SpellAbility) si.getTriggeringObject(AbilityKey.SourceSA);
|
||||
CardView sourceCardView = null;
|
||||
if (sourceSA != null) {
|
||||
sourceCardView = sourceSA.getHostCard().getView();
|
||||
numSmallImages++;
|
||||
}
|
||||
|
||||
// I also want to show each type of targets (both cards and players)
|
||||
List<GameEntityView> targets = getTargets(si,new ArrayList<GameEntityView>());
|
||||
numSmallImages = numSmallImages + targets.size();
|
||||
// I also want to show each type of targets (both cards and players)
|
||||
List<GameEntityView> targets = getTargets(si,new ArrayList<GameEntityView>());
|
||||
numSmallImages = numSmallImages + targets.size();
|
||||
|
||||
// Now I know how many small images - on to render them
|
||||
if(enchantedEntityView != null) {
|
||||
addSmallImageToStackModalPanel(enchantedEntityView,mainPanel,numSmallImages);
|
||||
}
|
||||
if(sourceCardView != null) {
|
||||
addSmallImageToStackModalPanel(sourceCardView,mainPanel,numSmallImages);
|
||||
}
|
||||
for(GameEntityView gev : targets) {
|
||||
addSmallImageToStackModalPanel(gev, mainPanel, numSmallImages);
|
||||
}
|
||||
// Now I know how many small images - on to render them
|
||||
if (enchantedEntityView != null) {
|
||||
addSmallImageToStackModalPanel(enchantedEntityView,mainPanel,numSmallImages);
|
||||
}
|
||||
if (sourceCardView != null) {
|
||||
addSmallImageToStackModalPanel(sourceCardView,mainPanel,numSmallImages);
|
||||
}
|
||||
for (GameEntityView gev : targets) {
|
||||
addSmallImageToStackModalPanel(gev, mainPanel, numSmallImages);
|
||||
}
|
||||
|
||||
FOptionPane.showOptionDialog(null, "Forge", null, mainPanel, ImmutableList.of(Localizer.getInstance().getMessage("lblOK")));
|
||||
// here the user closed the modal - time to update the next notifiable stack index
|
||||
FOptionPane.showOptionDialog(null, "Forge", null, mainPanel, ImmutableList.of(Localizer.getInstance().getMessage("lblOK")));
|
||||
// here the user closed the modal - time to update the next notifiable stack index
|
||||
|
||||
}
|
||||
// In any case, I have to increase the counter
|
||||
nextNotifiableStackIndex++;
|
||||
|
||||
} else {
|
||||
|
||||
// Not yet time to show the modal - schedule the method again, and try again later
|
||||
Runnable tryAgainThread = new Runnable() {
|
||||
@Override
|
||||
@@ -1381,21 +1379,21 @@ public final class CMatchUI
|
||||
}
|
||||
|
||||
private List<GameEntityView> getTargets(SpellAbilityStackInstance si, List<GameEntityView> result){
|
||||
if(si == null) {
|
||||
if (si == null) {
|
||||
return result;
|
||||
}
|
||||
FCollectionView<CardView> targetCards = CardView.getCollection(si.getTargetChoices().getTargetCards());
|
||||
for(CardView currCardView: targetCards) {
|
||||
for (CardView currCardView: targetCards) {
|
||||
result.add(currCardView);
|
||||
}
|
||||
|
||||
for(SpellAbility currSA : si.getTargetChoices().getTargetSpells()) {
|
||||
for (SpellAbility currSA : si.getTargetChoices().getTargetSpells()) {
|
||||
CardView currCardView = currSA.getCardView();
|
||||
result.add(currCardView);
|
||||
}
|
||||
|
||||
FCollectionView<PlayerView> targetPlayers = PlayerView.getCollection(si.getTargetChoices().getTargetPlayers());
|
||||
for(PlayerView currPlayerView : targetPlayers) {
|
||||
for (PlayerView currPlayerView : targetPlayers) {
|
||||
result.add(currPlayerView);
|
||||
}
|
||||
|
||||
@@ -1443,7 +1441,7 @@ public final class CMatchUI
|
||||
}
|
||||
|
||||
private void addSmallImageToStackModalPanel(GameEntityView gameEntityView, JPanel mainPanel, int numTarget) {
|
||||
if(gameEntityView instanceof CardView) {
|
||||
if (gameEntityView instanceof CardView) {
|
||||
CardView cardView = (CardView) gameEntityView;
|
||||
int currRotation = getRotation(cardView);
|
||||
FImagePanel targetPanel = new FImagePanel();
|
||||
@@ -1454,7 +1452,7 @@ public final class CMatchUI
|
||||
Dimension targetPanelDimension = new Dimension(imageWidth,imageHeight);
|
||||
targetPanel.setMinimumSize(targetPanelDimension);
|
||||
mainPanel.add(targetPanel, "cell 1 1, split " + numTarget+ ", aligny bottom");
|
||||
} else if(gameEntityView instanceof PlayerView) {
|
||||
} else if (gameEntityView instanceof PlayerView) {
|
||||
PlayerView playerView = (PlayerView) gameEntityView;
|
||||
SkinImage playerAvatar = getPlayerAvatar(playerView, 0);
|
||||
final FLabel lblIcon = new FLabel.Builder().icon(playerAvatar).build();
|
||||
@@ -1499,11 +1497,10 @@ public final class CMatchUI
|
||||
}
|
||||
|
||||
private void createLandPopupPanel(Card land) {
|
||||
|
||||
String landPlayedNotificationPolicy = FModel.getPreferences().getPref(FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY);
|
||||
Player cardController = land.getController();
|
||||
boolean isAi = cardController.isAI();
|
||||
if(ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS.equals(landPlayedNotificationPolicy)
|
||||
if (ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS.equals(landPlayedNotificationPolicy)
|
||||
|| (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI.equals(landPlayedNotificationPolicy) && (isAi))
|
||||
|| (ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS_FOR_NONBASIC_LANDS.equals(landPlayedNotificationPolicy) && !land.isBasicLand())
|
||||
|| (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS.equals(landPlayedNotificationPolicy) && !land.isBasicLand()) && (isAi)) {
|
||||
|
||||
@@ -121,7 +121,6 @@ public class GameLogPanel extends JPanel {
|
||||
}
|
||||
|
||||
public void addLogEntry(final String text) {
|
||||
|
||||
final boolean useAlternateBackColor = (scrollablePanel.getComponents().length % 2 == 0);
|
||||
final JTextArea tar = createNewLogEntryJTextArea(text, useAlternateBackColor);
|
||||
|
||||
@@ -138,7 +137,6 @@ public class GameLogPanel extends JPanel {
|
||||
}
|
||||
|
||||
forceVerticalScrollbarToMax();
|
||||
|
||||
}
|
||||
|
||||
public void setTextFont(final SkinFont newFont) {
|
||||
|
||||
@@ -107,8 +107,8 @@ public class VAssignCombatDamage {
|
||||
|
||||
private boolean canAssignTo(final CardView card) {
|
||||
for (DamageTarget dt : defenders) {
|
||||
if (dt.card == card ) return true;
|
||||
if (getDamageToKill(dt.card) > dt.damage )
|
||||
if (dt.card == card) return true;
|
||||
if (getDamageToKill(dt.card) > dt.damage)
|
||||
return false;
|
||||
}
|
||||
throw new RuntimeException("Asking to assign damage to object which is not present in defenders list");
|
||||
@@ -145,7 +145,7 @@ public class VAssignCombatDamage {
|
||||
boolean isLMB = SwingUtilities.isLeftMouseButton(evt);
|
||||
boolean isRMB = SwingUtilities.isRightMouseButton(evt);
|
||||
|
||||
if ( isLMB || isRMB)
|
||||
if (isLMB || isRMB)
|
||||
assignDamageTo(source, meta, isLMB);
|
||||
}
|
||||
};
|
||||
@@ -305,7 +305,7 @@ public class VAssignCombatDamage {
|
||||
int leftToAssign = getRemainingDamage();
|
||||
// Left click adds damage, right click substracts damage.
|
||||
// Hold Ctrl to assign lethal damage, Ctrl-click again on a creature with lethal damage to assign all available damage to it
|
||||
if ( meta ) {
|
||||
if (meta) {
|
||||
if (isAdding) {
|
||||
damageToAdd = leftToKill > 0 ? leftToKill : leftToAssign;
|
||||
} else {
|
||||
@@ -313,7 +313,7 @@ public class VAssignCombatDamage {
|
||||
}
|
||||
}
|
||||
|
||||
if ( damageToAdd > leftToAssign )
|
||||
if (damageToAdd > leftToAssign)
|
||||
damageToAdd = leftToAssign;
|
||||
|
||||
// cannot assign first blocker less than lethal damage except when overriding order
|
||||
@@ -321,7 +321,7 @@ public class VAssignCombatDamage {
|
||||
if (!overrideCombatantOrder && isFirstBlocker && damageToAdd + damageItHad < lethalDamage )
|
||||
return;
|
||||
|
||||
if ( 0 == damageToAdd || damageToAdd + damageItHad < 0)
|
||||
if (0 == damageToAdd || damageToAdd + damageItHad < 0)
|
||||
return;
|
||||
|
||||
addDamage(source, damageToAdd);
|
||||
@@ -335,12 +335,12 @@ public class VAssignCombatDamage {
|
||||
}
|
||||
// Clear out any Damage that shouldn't be assigned to other combatants
|
||||
boolean hasAliveEnemy = false;
|
||||
for(DamageTarget dt : defenders) {
|
||||
for (DamageTarget dt : defenders) {
|
||||
int lethal = getDamageToKill(dt.card);
|
||||
int damage = dt.damage;
|
||||
// If overriding combatant order, make sure everything has lethal if defender has damage assigned to it
|
||||
// Otherwise, follow normal combatant order
|
||||
if ( hasAliveEnemy && (!overrideCombatantOrder || dt.card == null || dt.card == defender))
|
||||
if (hasAliveEnemy && (!overrideCombatantOrder || dt.card == null || dt.card == defender))
|
||||
dt.damage = 0;
|
||||
else
|
||||
hasAliveEnemy |= damage < lethal;
|
||||
@@ -357,15 +357,15 @@ public class VAssignCombatDamage {
|
||||
|
||||
int dmgLeft = totalDamageToAssign;
|
||||
DamageTarget dtLast = null;
|
||||
for(DamageTarget dt : defenders) { // MUST NOT RUN WITH EMPTY collection
|
||||
for (DamageTarget dt : defenders) { // MUST NOT RUN WITH EMPTY collection
|
||||
int lethal = getDamageToKill(dt.card);
|
||||
int damage = Math.min(lethal, dmgLeft);
|
||||
addDamage(dt.card, damage);
|
||||
dmgLeft -= damage;
|
||||
dtLast = dt;
|
||||
if ( dmgLeft <= 0 || !toAllBlockers ) break;
|
||||
if (dmgLeft <= 0 || !toAllBlockers) break;
|
||||
}
|
||||
if ( dmgLeft < 0 )
|
||||
if (dmgLeft < 0)
|
||||
throw new RuntimeException("initialAssignDamage managed to assign more damage than it could");
|
||||
if (toAllBlockers && dmgLeft > 0) {
|
||||
// flush the remaining damage into last defender if assigning all damage
|
||||
@@ -376,7 +376,7 @@ public class VAssignCombatDamage {
|
||||
|
||||
/** Reset Assign Damage back to how it was at the beginning. */
|
||||
private void resetAssignedDamage() {
|
||||
for(DamageTarget dt : defenders)
|
||||
for (DamageTarget dt : defenders)
|
||||
dt.damage = 0;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ public class VAssignCombatDamage {
|
||||
*/
|
||||
private int getRemainingDamage() {
|
||||
int spent = 0;
|
||||
for(DamageTarget dt : defenders) {
|
||||
for (DamageTarget dt : defenders) {
|
||||
spent += dt.damage;
|
||||
}
|
||||
return totalDamageToAssign - spent;
|
||||
@@ -407,11 +407,10 @@ public class VAssignCombatDamage {
|
||||
/** Updates labels and other UI elements.
|
||||
* @param index index of the last assigned damage*/
|
||||
private void updateLabels() {
|
||||
|
||||
int damageLeft = totalDamageToAssign;
|
||||
boolean allHaveLethal = true;
|
||||
|
||||
for ( DamageTarget dt : defenders )
|
||||
for (DamageTarget dt : defenders)
|
||||
{
|
||||
int dmg = dt.damage;
|
||||
damageLeft -= dmg;
|
||||
@@ -438,7 +437,7 @@ public class VAssignCombatDamage {
|
||||
// assigned dynamically, the cards die off and further damage to them can't
|
||||
// be modified.
|
||||
private void finish() {
|
||||
if ( getRemainingDamage() > 0 )
|
||||
if (getRemainingDamage() > 0)
|
||||
return;
|
||||
|
||||
dlg.dispose();
|
||||
@@ -456,8 +455,7 @@ public class VAssignCombatDamage {
|
||||
final CardView pw = (CardView)defender;
|
||||
lethalDamage = Integer.valueOf(pw.getCurrentState().getLoyalty());
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lethalDamage = Math.max(0, card.getLethalDamage());
|
||||
if (card.getCurrentState().getType().isPlaneswalker()) {
|
||||
lethalDamage = Integer.valueOf(card.getCurrentState().getLoyalty());
|
||||
|
||||
@@ -156,7 +156,7 @@ public class CCombat implements ICDoc {
|
||||
sb.append("( ").append(state.getPower()).append(" / ").append(state.getToughness()).append(" ) ... ");
|
||||
if (c.isFaceDown()) {
|
||||
sb.append("Morph");
|
||||
} else {
|
||||
} else {
|
||||
sb.append(name);
|
||||
}
|
||||
sb.append(" [").append(state.getDisplayId()).append("] ");
|
||||
|
||||
@@ -78,7 +78,6 @@ public class CDetail implements ICDoc {
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -269,7 +269,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
g2d.rotate(getTappedAngle(), cardXOffset + edgeOffset, (cardYOffset + cardHeight)
|
||||
- edgeOffset);
|
||||
}
|
||||
super.paint(g2d);
|
||||
super.paint(g2d);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,12 +284,12 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
final int cornerSize = noBorderPref && !cardImgHasAlpha ? 0 : Math.max(4, Math.round(cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||
final int offset = isTapped() && (!noBorderPref || cardImgHasAlpha) ? 1 : 0;
|
||||
|
||||
// Magenta outline for when card is chosen
|
||||
// Magenta outline for when card is chosen
|
||||
if (matchUI.isUsedToPay(getCard())) {
|
||||
g2d.setColor(Color.magenta);
|
||||
final int n2 = Math.max(1, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||
g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
||||
}
|
||||
}
|
||||
|
||||
// Green outline for hover
|
||||
if (isSelected) {
|
||||
@@ -318,17 +318,17 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
} else if (ed != null && state.getFoilIndex() == 0) {
|
||||
// Non-foil cards from white-bordered sets are drawn with white border
|
||||
switch (ed.getBorderColor()) {
|
||||
case WHITE:
|
||||
g2d.setColor(Color.WHITE);
|
||||
colorIsSet = true;
|
||||
break;
|
||||
case GOLD:
|
||||
g2d.setColor(Color.ORANGE);
|
||||
colorIsSet = true;
|
||||
break;
|
||||
case SILVER:
|
||||
g2d.setColor(Color.GRAY);
|
||||
colorIsSet = true;
|
||||
case WHITE:
|
||||
g2d.setColor(Color.WHITE);
|
||||
colorIsSet = true;
|
||||
break;
|
||||
case GOLD:
|
||||
g2d.setColor(Color.ORANGE);
|
||||
colorIsSet = true;
|
||||
break;
|
||||
case SILVER:
|
||||
g2d.setColor(Color.GRAY);
|
||||
colorIsSet = true;
|
||||
}
|
||||
}
|
||||
if (colorIsSet) {
|
||||
@@ -337,11 +337,11 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
}
|
||||
|
||||
if (matchUI.isSelectable(getCard())) { // White border for selectable cards to further highlight them
|
||||
g2d.setColor(Color.WHITE);
|
||||
final int ins = 1;
|
||||
g2d.fillRoundRect(cardXOffset+ins, cardYOffset+ins, cardWidth-ins*2, cardHeight-ins*2, cornerSize-ins, cornerSize-ins);
|
||||
}
|
||||
if (matchUI.isSelectable(getCard())) { // White border for selectable cards to further highlight them
|
||||
g2d.setColor(Color.WHITE);
|
||||
final int ins = 1;
|
||||
g2d.fillRoundRect(cardXOffset+ins, cardYOffset+ins, cardWidth-ins*2, cardHeight-ins*2, cornerSize-ins, cornerSize-ins);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawManaCost(final Graphics g, final ManaCost cost, final int deltaY) {
|
||||
@@ -366,16 +366,16 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
cardWidth, cardHeight, Math.round(cardWidth * BLACK_BORDER_SIZE));
|
||||
}
|
||||
|
||||
boolean nonselectable = matchUI.isSelecting() && !matchUI.isSelectable(getCard());
|
||||
// if selecting, darken non-selectable cards
|
||||
if ( nonselectable ) {
|
||||
boolean noBorderPref = !isPreferenceEnabled(FPref.UI_RENDER_BLACK_BORDERS);
|
||||
boolean cardImgHasAlpha = imagePanel != null && imagePanel.getSrcImage() != null && imagePanel.getSrcImage().getColorModel().hasAlpha();
|
||||
final int cornerSize = noBorderPref && !cardImgHasAlpha ? 0 : Math.max(4, Math.round(cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||
final int offset = isTapped() && (!noBorderPref || cardImgHasAlpha) ? 1 : 0;
|
||||
g.setColor(new Color(0.0f,0.0f,0.0f,0.6f));
|
||||
g.fillRoundRect(cardXOffset, cardYOffset + offset, cardWidth, cardHeight, cornerSize, cornerSize);
|
||||
}
|
||||
boolean nonselectable = matchUI.isSelecting() && !matchUI.isSelectable(getCard());
|
||||
// if selecting, darken non-selectable cards
|
||||
if (nonselectable) {
|
||||
boolean noBorderPref = !isPreferenceEnabled(FPref.UI_RENDER_BLACK_BORDERS);
|
||||
boolean cardImgHasAlpha = imagePanel != null && imagePanel.getSrcImage() != null && imagePanel.getSrcImage().getColorModel().hasAlpha();
|
||||
final int cornerSize = noBorderPref && !cardImgHasAlpha ? 0 : Math.max(4, Math.round(cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||
final int offset = isTapped() && (!noBorderPref || cardImgHasAlpha) ? 1 : 0;
|
||||
g.setColor(new Color(0.0f,0.0f,0.0f,0.6f));
|
||||
g.fillRoundRect(cardXOffset, cardYOffset + offset, cardWidth, cardHeight, cornerSize, cornerSize);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawFoilEffect(final Graphics g, final CardView card2, final int x, final int y, final int width, final int height, final int borderSize) {
|
||||
@@ -390,7 +390,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
|
||||
@Override
|
||||
public final void doLayout() {
|
||||
|
||||
int borderSize = calculateBorderSize();
|
||||
|
||||
final Point imgPos = new Point(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
@@ -408,7 +407,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private int calculateBorderSize() {
|
||||
|
||||
// Determine whether to render border from properties
|
||||
boolean noBorderPref = !isPreferenceEnabled(FPref.UI_RENDER_BLACK_BORDERS);
|
||||
|
||||
@@ -426,7 +424,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
private Dimension calculateImageSize() {
|
||||
@@ -491,7 +488,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
|
||||
|
||||
switch (CounterDisplayType.from(FModel.getPreferences().getPref(FPref.UI_CARD_COUNTER_DISPLAY_TYPE))) {
|
||||
@@ -734,8 +730,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
abiY += abiSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String keywordKey = card.getCurrentState().getKeywordKey();
|
||||
String abilityText = card.getCurrentState().getAbilityText();
|
||||
if (((keywordKey.indexOf("Flashback") == -1)
|
||||
@@ -752,7 +747,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private void drawCounterTabs(final Graphics g) {
|
||||
|
||||
final Dimension imgSize = calculateImageSize();
|
||||
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
|
||||
|
||||
@@ -767,7 +761,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
FontMetrics largeFontMetrics = g.getFontMetrics(largeCounterFont);
|
||||
|
||||
if (CounterDisplayType.from(FModel.getPreferences().getPref(FPref.UI_CARD_COUNTER_DISPLAY_TYPE)) == CounterDisplayType.OLD_WHEN_SMALL) {
|
||||
|
||||
int maxCounters = 0;
|
||||
for (Integer numberOfCounters : card.getCounters().values()) {
|
||||
maxCounters = Math.max(maxCounters, numberOfCounters);
|
||||
@@ -780,9 +773,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (Map.Entry<CounterType, Integer> counterEntry : card.getCounters().entrySet()) {
|
||||
|
||||
final CounterType counter = counterEntry.getKey();
|
||||
final int numberOfCounters = counterEntry.getValue();
|
||||
final int counterBoxRealWidth = counterBoxBaseWidth + largeFontMetrics.stringWidth(String.valueOf(numberOfCounters));
|
||||
@@ -827,7 +818,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private void drawCounterImage(final Graphics g) {
|
||||
|
||||
int counters = 0;
|
||||
for (final Integer i : card.getCounters().values()) {
|
||||
counters += i;
|
||||
@@ -848,7 +838,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private void drawMarkersTabs(final Graphics g, List<String> markers) {
|
||||
|
||||
final Dimension imgSize = calculateImageSize();
|
||||
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
|
||||
|
||||
@@ -862,7 +851,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
FontMetrics smallFontMetrics = g.getFontMetrics(smallCounterFont);
|
||||
|
||||
for (String marker : markers) {
|
||||
|
||||
final int markerBoxRealWidth = markerBoxBaseWidth + smallFontMetrics.stringWidth(marker);
|
||||
final int markerYOffset;
|
||||
|
||||
@@ -907,7 +895,6 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
* @param font The font to use to draw the text.
|
||||
*/
|
||||
private void drawVerticallyCenteredString(Graphics g, String text, Rectangle area, Font font, final FontMetrics fontMetrics) {
|
||||
|
||||
Font oldFont = g.getFont();
|
||||
|
||||
int x = area.x;
|
||||
@@ -1114,8 +1101,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
||||
}
|
||||
|
||||
private boolean showCardManaCostOverlay() {
|
||||
return isShowingOverlays() &&
|
||||
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST);
|
||||
return isShowingOverlays() && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST);
|
||||
}
|
||||
|
||||
private boolean showCardIdOverlay() {
|
||||
|
||||
@@ -183,7 +183,7 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
}
|
||||
|
||||
protected boolean cardPanelDraggable(final CardPanel panel) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private MouseMotionListener setupMotionMouseListener() {
|
||||
@@ -212,22 +212,22 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardPanelDraggable(panel)) { // allow for non-draggable cards
|
||||
if (intialMouseDragX == -1) {
|
||||
intialMouseDragX = x;
|
||||
intialMouseDragY = y;
|
||||
return;
|
||||
}
|
||||
if ((Math.abs(x - intialMouseDragX) < CardPanelContainer.DRAG_SMUDGE)
|
||||
&& (Math.abs(y - intialMouseDragY) < CardPanelContainer.DRAG_SMUDGE)) {
|
||||
return;
|
||||
}
|
||||
mouseDownPanel = null;
|
||||
setMouseDragPanel(panel);
|
||||
mouseDragOffsetX = panel.getX() - intialMouseDragX;
|
||||
mouseDragOffsetY = panel.getY() - intialMouseDragY;
|
||||
mouseDragStart(getMouseDragPanel(), evt);
|
||||
}
|
||||
if (cardPanelDraggable(panel)) { // allow for non-draggable cards
|
||||
if (intialMouseDragX == -1) {
|
||||
intialMouseDragX = x;
|
||||
intialMouseDragY = y;
|
||||
return;
|
||||
}
|
||||
if ((Math.abs(x - intialMouseDragX) < CardPanelContainer.DRAG_SMUDGE)
|
||||
&& (Math.abs(y - intialMouseDragY) < CardPanelContainer.DRAG_SMUDGE)) {
|
||||
return;
|
||||
}
|
||||
mouseDownPanel = null;
|
||||
setMouseDragPanel(panel);
|
||||
mouseDragOffsetX = panel.getX() - intialMouseDragX;
|
||||
mouseDragOffsetY = panel.getY() - intialMouseDragY;
|
||||
mouseDragStart(getMouseDragPanel(), evt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -291,7 +291,7 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
}
|
||||
|
||||
public final void removeCardPanel(final CardPanel fromPanel) {
|
||||
removeCardPanel(fromPanel,true);
|
||||
removeCardPanel(fromPanel,true);
|
||||
}
|
||||
|
||||
public final void removeCardPanel(final CardPanel fromPanel, final boolean repaint) {
|
||||
@@ -307,11 +307,11 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
fromPanel.dispose();
|
||||
getCardPanels().remove(fromPanel);
|
||||
remove(fromPanel);
|
||||
if ( repaint ) {
|
||||
invalidate();
|
||||
repaint();
|
||||
doingLayout();
|
||||
}
|
||||
if (repaint) {
|
||||
invalidate();
|
||||
repaint();
|
||||
doingLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public final void setCardPanels(final List<CardPanel> cardPanels) {
|
||||
@@ -331,14 +331,14 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
for (final CardPanel cardPanel : cardPanels) {
|
||||
this.add(cardPanel);
|
||||
}
|
||||
//pfps the validate just below will do the layout, so don't do it here this.doLayout();
|
||||
//pfps the validate just below will do the layout, so don't do it here this.doLayout();
|
||||
this.invalidate();
|
||||
this.getParent().validate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public final void clear() {
|
||||
clear(true);
|
||||
clear(true);
|
||||
}
|
||||
public final void clear(final boolean repaint) {
|
||||
FThreads.assertExecutedByEdt(true);
|
||||
@@ -347,12 +347,12 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
}
|
||||
getCardPanels().clear();
|
||||
removeAll();
|
||||
if ( repaint ) {
|
||||
setPreferredSize(new Dimension(0, 0));
|
||||
invalidate();
|
||||
getParent().validate();
|
||||
repaint();
|
||||
}
|
||||
if (repaint) {
|
||||
setPreferredSize(new Dimension(0, 0));
|
||||
invalidate();
|
||||
getParent().validate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public final FScrollPane getScrollPane() {
|
||||
|
||||
@@ -57,10 +57,10 @@ public abstract class FloatingCardArea extends CardArea {
|
||||
protected abstract Iterable<CardView> getCards();
|
||||
|
||||
protected FloatingCardArea(final CMatchUI matchUI) {
|
||||
this(matchUI, new FScrollPane(false, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
|
||||
this(matchUI, new FScrollPane(false, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
|
||||
}
|
||||
protected FloatingCardArea(final CMatchUI matchUI, final FScrollPane scrollPane) {
|
||||
super(matchUI, scrollPane);
|
||||
super(matchUI, scrollPane);
|
||||
}
|
||||
|
||||
protected void showWindow() {
|
||||
@@ -127,7 +127,7 @@ public abstract class FloatingCardArea extends CardArea {
|
||||
}
|
||||
|
||||
protected FDialog getWindow() {
|
||||
return window;
|
||||
return window;
|
||||
}
|
||||
|
||||
protected void loadLocation() {
|
||||
|
||||
@@ -624,8 +624,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
|
||||
if (toDelete.size() == getCardPanels().size()) {
|
||||
clear(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (final CardView card : toDelete) {
|
||||
removeCardPanel(getCardPanel(card.getId()),false);
|
||||
}
|
||||
@@ -649,9 +648,9 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
needLayoutRefresh = true;
|
||||
}
|
||||
}
|
||||
if (needLayoutRefresh) {
|
||||
doLayout();
|
||||
}
|
||||
if (needLayoutRefresh) {
|
||||
doLayout();
|
||||
}
|
||||
|
||||
invalidate(); //pfps do the extra invalidate before any scrolling
|
||||
if (!newPanels.isEmpty()) {
|
||||
@@ -681,8 +680,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
if (card.isTapped()) {
|
||||
toPanel.setTapped(true);
|
||||
toPanel.setTappedAngle(forge.view.arcane.CardPanel.TAPPED_ANGLE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
toPanel.setTapped(false);
|
||||
toPanel.setTappedAngle(0);
|
||||
}
|
||||
@@ -705,8 +703,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
CardPanel attachedToPanel;
|
||||
if (card.getAttachedTo() != null) {
|
||||
attachedToPanel = getCardPanel(card.getAttachedTo().getId());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
attachedToPanel = null;
|
||||
}
|
||||
if (toPanel.getAttachedToPanel() != attachedToPanel) {
|
||||
|
||||
@@ -104,18 +104,13 @@ public class ScaledImagePanel extends JPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println(sz + " -- " + src);
|
||||
|
||||
//ResampleOp resizer = new ResampleOp(DimensionConstrain.createMaxDimension(this.getWidth(), this.getHeight(), !scaleLarger));
|
||||
//resizer.setUnsharpenMask(UnsharpenMask.Soft);
|
||||
BufferedImage img = getSrcImage(); //resizer.filter(getSrcImage(), null);
|
||||
|
||||
boolean needsScale = img.getWidth() < sz.width;
|
||||
float scaleFactor = ((float)img.getWidth()) / sz.width;
|
||||
if ( needsScale && ( scaleFactor < 0.95 || scaleFactor > 1.05 ) ) { // This should very low-quality scaling to draw during animation
|
||||
|
||||
//System.out.println("Painting: " + img.getWidth() + " -> " + sz.width );
|
||||
|
||||
if (needsScale && ( scaleFactor < 0.95 || scaleFactor > 1.05 )) { // This should very low-quality scaling to draw during animation
|
||||
float maxZoomX = ((float)sz.width) / img.getWidth();
|
||||
float maxZoomY = ((float)sz.height) / img.getHeight();
|
||||
float zoom = Math.min(maxZoomX, maxZoomY);
|
||||
|
||||
@@ -4,6 +4,6 @@ Types:Artifact Creature Construct
|
||||
PT:5/6
|
||||
K:Flash
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPlay | TriggerDescription$ When CARDNAME enters the battlefield, you may cast target instant card from your graveyard without paying its mana cost. If that spell would be put into your graveyard this turn, exile it instead.
|
||||
SVar:TrigPlay:DB$ Play | TgtZone$ Graveyard | ValidTgts$ Instant.YouCtrl | TgtPrompt$ Choose target instant or sorcery card from your graveyard | WithoutManaCost$ True | Optional$ True | ReplaceGraveyard$ Exile | AILogic$ ReplaySpell
|
||||
SVar:TrigPlay:DB$ Play | TgtZone$ Graveyard | ValidTgts$ Instant.YouCtrl | TgtPrompt$ Choose target instant card from your graveyard | WithoutManaCost$ True | Optional$ True | ReplaceGraveyard$ Exile | AILogic$ ReplaySpell
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/torrential_gearhulk.jpg
|
||||
Oracle:Flash\nWhen Torrential Gearhulk enters the battlefield, you may cast target instant card from your graveyard without paying its mana cost. If that spell would be put into your graveyard this turn, exile it instead.
|
||||
|
||||
@@ -14,9 +14,9 @@ import forge.model.FModel;
|
||||
public class CardThemedDeckGenerator extends DeckProxy implements Comparable<CardThemedDeckGenerator> {
|
||||
public static List<DeckProxy> getMatrixDecks(GameFormat format, boolean isForAi){
|
||||
final List<DeckProxy> decks = new ArrayList<>();
|
||||
for(String card: CardArchetypeLDAGenerator.ldaPools.get(format.getName()).keySet()) {
|
||||
for (String card: CardArchetypeLDAGenerator.ldaPools.get(format.getName()).keySet()) {
|
||||
//exclude non AI playables as keycards for AI decks
|
||||
if(isForAi&&FModel.getMagicDb().getCommonCards().getUniqueByName(card).getRules().getAiHints().getRemAIDecks()){
|
||||
if (isForAi&&FModel.getMagicDb().getCommonCards().getUniqueByName(card).getRules().getAiHints().getRemAIDecks()) {
|
||||
continue;
|
||||
}
|
||||
decks.add(new CardThemedDeckGenerator(card, format, isForAi));
|
||||
@@ -42,7 +42,6 @@ public class CardThemedDeckGenerator extends DeckProxy implements Comparable<Car
|
||||
return CardEdition.UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
@@ -153,8 +153,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
setCurrentPlayer(Iterables.getFirst(gameControllers.keySet(), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gameControllers.put(player, gameController);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +269,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
|
||||
private final Set<CardView> selectableCards = Sets.newHashSet();
|
||||
public void setSelectables(final Iterable<CardView> cards) {
|
||||
for ( CardView cv : cards ) { selectableCards.add(cv); }
|
||||
for (CardView cv : cards) { selectableCards.add(cv); }
|
||||
}
|
||||
public void clearSelectables() {
|
||||
selectableCards.clear();
|
||||
@@ -285,12 +284,12 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
public void setgamePause(boolean pause) { gamePause = pause; }
|
||||
public void pauseMatch() {
|
||||
IGameController controller = spectator;
|
||||
if(controller != null && !isGamePaused())
|
||||
if (controller != null && !isGamePaused())
|
||||
controller.selectButtonOk();
|
||||
}
|
||||
public void resumeMatch() {
|
||||
IGameController controller = spectator;
|
||||
if(controller != null && isGamePaused())
|
||||
if (controller != null && isGamePaused())
|
||||
controller.selectButtonOk();
|
||||
}
|
||||
|
||||
@@ -315,12 +314,10 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
// Concede each player on this Gui (except mind-controlled players)
|
||||
c.concede();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return !ignoreConcedeChain;
|
||||
}
|
||||
if (gameView.isGameOver()) {
|
||||
|
||||
@@ -392,8 +392,8 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
getController().getGui().clearSelectables();
|
||||
super.onStop();
|
||||
getController().getGui().clearSelectables();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -200,8 +200,7 @@ public class CardDetailUtil {
|
||||
if (ptText.length() > 0) {
|
||||
ptText.insert(0, "P/T: ");
|
||||
ptText.append(" - ").append("Loy: ");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ptText.append("Loyalty: ");
|
||||
}
|
||||
|
||||
@@ -278,9 +277,9 @@ public class CardDetailUtil {
|
||||
area.append("Token");
|
||||
} else if (card.isTokenCard()) {
|
||||
area.append("Token card");
|
||||
} else if(card.isEmblem()) {
|
||||
} else if (card.isEmblem()) {
|
||||
area.append("Emblem");
|
||||
} else if(card.isImmutable()) {
|
||||
} else if (card.isImmutable()) {
|
||||
area.append("Effect");
|
||||
}
|
||||
// card text
|
||||
@@ -297,7 +296,6 @@ public class CardDetailUtil {
|
||||
card.getText(state, needTranslation ? CardTranslation.getTranslationTexts(state.getName(), "") : null) :
|
||||
card.getText(state, needTranslation ? CardTranslation.getTranslationTexts(card.getLeftSplitState().getName(), card.getRightSplitState().getName()) : null );
|
||||
|
||||
|
||||
// LEVEL [0-9]+-[0-9]+
|
||||
// LEVEL [0-9]+\+
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class CardScriptInfo {
|
||||
final String filename = name.toLowerCase().replaceAll("[^-a-z0-9\\s]","").replaceAll("[-\\s]","_").replaceAll("__","_") + ".txt";
|
||||
String[] folders = { String.valueOf(filename.charAt(0)), "upcoming"};
|
||||
|
||||
for(String folder : folders){
|
||||
for (String folder : folders) {
|
||||
final File file = new File(ForgeConstants.CARD_DATA_DIR + folder + File.separator + filename);
|
||||
if (file.exists()) {
|
||||
script = new CardScriptInfo(FileUtil.readFileToString(file), file);
|
||||
|
||||
@@ -104,7 +104,7 @@ public final class GamePlayerUtil {
|
||||
final String oldPlayerName = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
|
||||
|
||||
String newPlayerName;
|
||||
try{
|
||||
try {
|
||||
if (StringUtils.isBlank(oldPlayerName)) {
|
||||
newPlayerName = getVerifiedPlayerName(getPlayerNameUsingFirstTimePrompt(), oldPlayerName);
|
||||
} else {
|
||||
|
||||
@@ -277,8 +277,6 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
return exileFromSame(cost, list, c, payableZone);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Inputs
|
||||
|
||||
// Exile<Num/Type{/TypeDescription}>
|
||||
|
||||
@@ -334,7 +334,6 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
String errMsg;
|
||||
if (newMain.size() < deckMinSize) {
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooFewCardsMainDeck", String.valueOf(deckMinSize)));
|
||||
|
||||
} else {
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooManyCardsSideboard", String.valueOf(sbMax)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user