Skip to content

Commit

Permalink
Add tier text back to behold.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Moschkin committed Oct 5, 2024
1 parent 47ccfd7 commit 2f2a96b
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/utils/beholdcalc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ function recommendations(crew: CrewFromBehold[], openCols?: string[]) {

let title = '';

const cbsbr = (starBest: CrewFromBehold, colBest: CrewFromBehold) => {
let r = 0;
const weightBest = (starBest: CrewFromBehold, colBest: CrewFromBehold) => {
let ac = cols(starBest);
let bc = cols(colBest);
let as = starBest.stars;
Expand All @@ -124,18 +123,17 @@ function recommendations(crew: CrewFromBehold[], openCols?: string[]) {
ac = ac / bc;
if (as === 0 || bs === 0) return ac > 1 ? starBest : colBest;
as = as / bs;
if (ac < as) return colBest;
return starBest;
if (as / ac > 1) return starBest;
return colBest;
}

const printPickCols = (colBest: CrewFromBehold[], actualBest?: CrewFromBehold) => {
let bc = cols(colBest[0]);
starBest.sort((a, b) => b.stars - a.stars);
if (colBest.length > 2 && colBest.every(c => cols(c) === bc)) {
if (starBest.length) {
let cbr = cbsbr(starBest[0], colBest[0]);
title = `Pick ${cbr.crew.name} for collections`;
bestCrew = cbr.crew;
title = `Pick ${starBest[0].crew.name} for collections`;
bestCrew = starBest[0].crew;
}
else {
title = `Pick anyone for collections`
Expand All @@ -148,15 +146,26 @@ function recommendations(crew: CrewFromBehold[], openCols?: string[]) {
bestCrew = colBest[0].crew;
}
else {
title = `Pick ${starBest[0].crew.name} for collections`;
bestCrew = starBest[0].crew;
let sbc = weightBest(starBest[0], colBest[0]);
title = `Pick ${sbc.crew.name} for collections`;
bestCrew = sbc.crew;
// title = `Pick ${starBest[0].crew.name} for collections`;
// bestCrew = starBest[0].crew;
}
}
else {
title = `Pick ${colBest[0].crew.name} for collections`;
bestCrew = colBest[0].crew;
if (starBest.length > 0) {
starBest.sort((a, b) => b.stars - a.stars);
let sbc = weightBest(starBest[0], colBest[0]);
title = `Pick ${sbc.crew.name} for collections`;
bestCrew = sbc.crew;
}
else {
title = `Pick ${colBest[0].crew.name} for collections`;
bestCrew = colBest[0].crew;
}
}
if (actualBest) {
if (actualBest && actualBest.crew !== bestCrew) {
title += `, but ${actualBest.crew.name} is the best crew in this behold`
}
}
Expand Down Expand Up @@ -208,7 +217,7 @@ function recommendations(crew: CrewFromBehold[], openCols?: string[]) {
}

let suffix = ".";
if (!title.includes("collections") && Math.abs(best[0].crew.bigbook_tier - best[1].crew.bigbook_tier) <= 1 &&
if (Math.abs(best[0].crew.bigbook_tier - best[1].crew.bigbook_tier) <= 1 &&
Math.abs(best[0].crew.bigbook_tier - best[2].crew.bigbook_tier) <= 1 &&
Math.abs(best[1].crew.bigbook_tier - best[2].crew.bigbook_tier) <= 1) {
suffix = " but check their links as tiers are similar."
Expand Down

0 comments on commit 2f2a96b

Please sign in to comment.