Skip to content

Commit 331ba91

Browse files
committed
Add disclaimer and improve mobile
1 parent db17118 commit 331ba91

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pages/tools/gachacalc.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export default function GachaCalc({ location }: { location: string }) {
117117
)
118118
const consts = []
119119
for (let i = current; i <= banner.maxConst; i++) consts.push(i)
120-
console.log(calculated)
121120

122121
const desc = "Gacha rate calculator for Genshin Impact."
123122
return (
@@ -139,6 +138,7 @@ export default function GachaCalc({ location }: { location: string }) {
139138
<h1 className="text-5xl font-bold pb-2">
140139
Gacha rate calculator
141140
</h1>
141+
142142
<SelectInput label="Banner type" set={(g) => {
143143
if (current == banner.minConst)
144144
setCurrent((Object.values(gachas).find(x => x.bannerName == g) ?? Object.values(gachas)[0]).minConst)
@@ -150,7 +150,7 @@ export default function GachaCalc({ location }: { location: string }) {
150150
<CheckboxInput label="Next is guaranteed" set={setGuaranteed} value={guaranteed} />
151151
{banner.guaranteedPity && <NumberInput label="Epitomized Path" set={setGuaranteedPity} value={guaranteedPity} min={0} max={banner.guaranteedPity - 1} />}
152152

153-
<h3 className="text-lg font-bold pt-1" id="resistance">Results:</h3>
153+
<h3 className="text-lg font-bold pt-1" id="results">Results</h3>
154154
<div className="columns-1 md:columns-2 mr-2 mb-2">
155155
<div className="w-full bg-slate-800 rounded-xl p-1 my-2 md:my-0 text-white col-start-1">
156156
<Bar data={({
@@ -220,8 +220,8 @@ export default function GachaCalc({ location }: { location: string }) {
220220
</div>
221221
<div className="w-full bg-slate-800 rounded-xl p-1 my-2 md:my-0 text-white col-start-2">
222222
<Line data={({
223-
labels: calculated.map((_, i) => i + pity),
224-
datasets: consts.filter(i => i > banner.minConst).map((i, x) => ({
223+
labels: calculated.map((_, i) => i),
224+
datasets: consts.filter(i => i > current).map((i, x) => ({
225225
label: getName(i, banner),
226226
backgroundColor: getColor(i, 1),
227227
borderColor: getColor(i, 1),
@@ -258,6 +258,7 @@ export default function GachaCalc({ location }: { location: string }) {
258258
}
259259
})} />
260260
</div>
261+
<h3 className="text-lg font-bold pt-1" id="table">Rate Table</h3>
261262
<table className={`table-auto w-80 ${styles.table} ${styles.stattable} my-2 sm:text-base text-sm`}>
262263
<thead>
263264
<tr className="divide-x divide-gray-200 dark:divide-gray-500">
@@ -275,6 +276,12 @@ export default function GachaCalc({ location }: { location: string }) {
275276
</tr>)}
276277
</tbody>
277278
</table>
279+
<h3 className="text-lg font-bold pt-1" id="disclaimer">Disclaimer</h3>
280+
<p>The calculator uses the statistical model for drop-rates of Cgg/<FormattedLink href="https://genshin-wishes.com/" target="_blank">genshin-wishes.com</FormattedLink>.
281+
For more information about drop rates, please refer to <FormattedLink href="https://www.hoyolab.com/article/497840" target="_blank"> their HoYoLAB post</FormattedLink>.</p>
282+
<p><i><b>NOTE</b>: To reduce the amount of calculations, the 4-star character banner calculator will assume there are no 5-stars being dropped.
283+
These can prevent a 4 star from dropping, but they still increase the pity counter. It is possible (in-game) to not get a 4-star within 10 pity,
284+
but the next pull is guaranteed to be a 4-star if it&apos;s not a 5-star.</i></p>
278285
</Main>
279286
)
280287
}
@@ -300,7 +307,7 @@ function NumberInput({ value, set, label, min, max }: { value: number, set: (new
300307
return <div><label>
301308
{label}
302309
<input
303-
className="bg-slate-200 w-32 dark:bg-slate-800 rounded-lg px-2 ml-2 mt-1 focus:ring-indigo-500 focus:border-indigo-500"
310+
className="bg-slate-200 sm:w-32 w-24 dark:bg-slate-800 rounded-lg px-2 ml-2 mt-1 focus:ring-indigo-500 focus:border-indigo-500"
304311
value={value}
305312
onChange={(e) => {
306313
const value = +e.target.value
@@ -310,6 +317,9 @@ function NumberInput({ value, set, label, min, max }: { value: number, set: (new
310317
max={max}
311318
type="number"
312319
/>
320+
<button className={`${value == min ? "bg-slate-800 text-slate-50": "bg-red-500 text-slate-50 cursor-pointer"} text-center rounded-lg px-1 inline-block ml-2 md:sr-only`} onClick={() => (min == undefined || value > min) ? set(value - 1) : void 0}>Subtract 1</button>
321+
<button className={`${value == max ? "bg-slate-800 text-slate-50": "bg-green-500 text-slate-50 cursor-pointer"} text-center rounded-lg px-1 inline-block ml-2 md:sr-only`} onClick={() => (max == undefined || value < max) ? set(value + 1) : void 0}>Add 1</button>
322+
313323
</label></div>
314324
}
315325

@@ -333,7 +343,7 @@ function SelectInput({ value, set, label, options }: { value: string, set: (newV
333343
<select
334344
value={value}
335345
onChange={e => set(e.target.value)}
336-
className="mt-1 ml-2 mb-2 py-0.5 px-2 border border-gray-300 bg-slate-200 dark:bg-slate-800 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
346+
className="mt-1 ml-2 mb-2 py-0.5 px-2 border border-gray-300 bg-slate-200 dark:bg-slate-800 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 text-sm"
337347
>
338348
{options.map(opt => <option key={opt}>{opt}</option>)}
339349
</select>

0 commit comments

Comments
 (0)