Skip to content
Permalink
Browse files

Mixed overlay mode

Does not work in Arena Tile mode!
  • Loading branch information...
Manuel-777 committed Jul 4, 2019
1 parent 6a29e31 commit 97cbe69d8ccc7915842c87f5dc7a432f674bfa2e
Showing with 78 additions and 14 deletions.
  1. +1 −0 shared/constants.js
  2. +24 −2 shared/deck-drawer.js
  3. +19 −1 shared/shared.css
  4. +16 −4 window_main/settings.js
  5. +18 −7 window_overlay/overlay.js
@@ -626,6 +626,7 @@ exports.OVERLAY_SEEN = 3;
exports.OVERLAY_LOG = 4;
exports.OVERLAY_DRAFT = 5;
exports.OVERLAY_DRAFT_BREW = 6;
exports.OVERLAY_MIXED = 7;
exports.OVERLAY_DRAFT_MODES = [
exports.OVERLAY_DRAFT,
exports.OVERLAY_DRAFT_BREW
@@ -120,7 +120,16 @@ function drawCardTileArena(

let ww, ll;

if (!isNumber(quantity)) {
if (typeof quantity === "object") {
ww = 64;
ll = 48;

//
const col = rankingClassName(quantity.quantity);
cont.appendChild(
createDiv(["card_tile_odds", col], `<span>${quantity.quantity}</span>`)
);
} else if (!isNumber(quantity)) {
ww = 64;
ll = 48;

@@ -242,7 +251,20 @@ function drawCardTileFlat(
cont.dataset["id"] = indent;
cont.dataset["quantity"] = quantity;

if (!isNumber(quantity)) {
if (typeof quantity === "object") {
// Mixed quantity (odds and quantity)
const quantityDiv = createDiv(["card_tile_odds_flat"]);

const numberDiv = createDiv(
["card_tile_odds_flat_half"],
quantity.quantity
);
const oddsDiv = createDiv(["card_tile_odds_flat_half_dark"], quantity.odds);

quantityDiv.appendChild(numberDiv);
quantityDiv.appendChild(oddsDiv);
cont.appendChild(quantityDiv);
} else if (!isNumber(quantity)) {
// Text quantity
const col = rankingClassName(quantity);
const quantityDiv = createDiv(["card_tile_odds_flat", col], quantity);

Some generated files are not rendered by default. Learn more.

@@ -6,6 +6,7 @@ const {
OVERLAY_FULL,
OVERLAY_LEFT,
OVERLAY_ODDS,
OVERLAY_MIXED,
OVERLAY_SEEN,
OVERLAY_DRAFT,
OVERLAY_DRAFT_BREW,
@@ -369,6 +370,7 @@ function appendOverlay(section) {
modeOptions[OVERLAY_FULL] = "Full Deck";
modeOptions[OVERLAY_LEFT] = "Library";
modeOptions[OVERLAY_ODDS] = "Next Draw";
modeOptions[OVERLAY_MIXED] = "Library and Odds";
modeOptions[OVERLAY_SEEN] = "Opponent";
modeOptions[OVERLAY_DRAFT] = "Draft Pick";
modeOptions[OVERLAY_LOG] = "Action Log";
@@ -403,6 +405,8 @@ function appendOverlay(section) {
"Shows your remaining library. Usually only shown during a match.";
modeHelp[OVERLAY_ODDS] =
"Shows probabilities for your next draw. Usually only shown during a match.";
modeHelp[OVERLAY_MIXED] =
"Shows probabilities for your next draw and your remaining library. Usually only shown during a match.";
modeHelp[OVERLAY_SEEN] =
"Shows your Opponent's cards that you have seen. Usually only shown during a match.";
modeHelp[OVERLAY_DRAFT] =
@@ -468,15 +472,19 @@ function appendOverlay(section) {
`overlay_${index}_sideboard`,
settings.sideboard,
updateUserSettings,
![OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS].includes(settings.mode)
![OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS, OVERLAY_MIXED].includes(
settings.mode
)
);
addCheckbox(
overlaySection,
"Compact lands",
`overlay_${index}_lands`,
settings.lands,
updateUserSettings,
![OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS].includes(settings.mode)
![OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS, OVERLAY_MIXED].includes(
settings.mode
)
);
addCheckbox(
overlaySection,
@@ -492,15 +500,19 @@ function appendOverlay(section) {
`overlay_${index}_type_counts`,
settings.type_counts,
updateUserSettings,
[OVERLAY_LOG, OVERLAY_ODDS, OVERLAY_DRAFT].includes(settings.mode)
[OVERLAY_LOG, OVERLAY_ODDS, OVERLAY_MIXED, OVERLAY_DRAFT].includes(
settings.mode
)
);
addCheckbox(
overlaySection,
"Show mana curve",
`overlay_${index}_mana_curve`,
settings.mana_curve,
updateUserSettings,
[OVERLAY_LOG, OVERLAY_ODDS, OVERLAY_DRAFT].includes(settings.mode)
[OVERLAY_LOG, OVERLAY_ODDS, OVERLAY_MIXED, OVERLAY_DRAFT].includes(
settings.mode
)
);

const sliderOpacity = createDiv(["slidecontainer_settings"]);
@@ -47,6 +47,7 @@ const {
OVERLAY_FULL,
OVERLAY_LEFT,
OVERLAY_ODDS,
OVERLAY_MIXED,
OVERLAY_SEEN,
OVERLAY_DRAFT,
OVERLAY_LOG,
@@ -468,7 +469,7 @@ function updateMatchView() {
createDiv(["decklist_title"], "Library: " + cardsLeft + " cards")
);
deckToDraw = currentMatch.playerCardsLeft;
} else if (overlayMode === OVERLAY_ODDS) {
} else if (overlayMode === OVERLAY_ODDS || overlayMode === OVERLAY_MIXED) {
// Next Draw Odds Mode
let cardsLeft = currentMatch.playerCardsLeft.mainboard.count();
deckListDiv.appendChild(
@@ -501,7 +502,7 @@ function updateMatchView() {
if (!deckToDraw) return;

// Deck colors
if ([OVERLAY_ODDS, OVERLAY_FULL, OVERLAY_LEFT].includes(overlayMode)) {
if ([OVERLAY_ODDS, OVERLAY_MIXED, OVERLAY_FULL, OVERLAY_LEFT].includes(overlayMode)) {
$$(".overlay_deckname")[0].innerHTML = deckToDraw.name;
deckToDraw.colors
.get()
@@ -513,7 +514,7 @@ function updateMatchView() {
}

let sortFunc = compare_cards;
if (overlayMode === OVERLAY_ODDS) {
if (overlayMode === OVERLAY_ODDS || overlayMode == OVERLAY_MIXED) {
sortFunc = compare_chances;
}

@@ -522,7 +523,7 @@ function updateMatchView() {
// group lands
if (
settings.lands &&
[OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS].includes(overlayMode)
[OVERLAY_FULL, OVERLAY_LEFT, OVERLAY_ODDS, OVERLAY_MIXED].includes(overlayMode)
) {
let landsNumber = 0;
let landsChance = 0;
@@ -550,7 +551,17 @@ function updateMatchView() {
mainCards.get().sort(sortFunc);
mainCards.get().forEach(card => {
let tile;
if (overlayMode === OVERLAY_ODDS) {
if (overlayMode === OVERLAY_MIXED) {
let odds = (card.chance !== undefined ? card.chance : "0") + "%";
let q = card.quantity;

if (!settings.lands || (settings.lands && odds !== "0%")) {
tile = deckDrawer.cardTile(pd.settings.card_tile_style, card.id, "a", {
quantity: q,
odds: odds
});
}
} else if (overlayMode === OVERLAY_ODDS) {
let quantity = (card.chance !== undefined ? card.chance : "0") + "%";
if (!settings.lands || (settings.lands && quantity !== "0%")) {
tile = deckDrawer.cardTile(
@@ -584,7 +595,7 @@ function updateMatchView() {
sideCards.get().sort(sortFunc);

sideCards.get().forEach(function(card) {
if (overlayMode === OVERLAY_ODDS) {
if (overlayMode === OVERLAY_ODDS || overlayMode === OVERLAY_MIXED) {
const tile = deckDrawer.cardTile(
pd.settings.card_tile_style,
card.id,
@@ -604,7 +615,7 @@ function updateMatchView() {
});
}

if (overlayMode === OVERLAY_ODDS) {
if (overlayMode === OVERLAY_ODDS || overlayMode === OVERLAY_MIXED) {
drawDeckOdds();
return;
}

0 comments on commit 97cbe69

Please sign in to comment.
You can’t perform that action at this time.