Skip to content

Commit 92c8de6

Browse files
committed
Add cumulative rate column
1 parent d1eea27 commit 92c8de6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pages/tools/gachacalc.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,20 @@ export default function GachaCalc({ location }: { location: string }) {
125125
{banner.guaranteedPity && <NumberInput label="Epitomized Path" set={setGuaranteedPity} value={guaranteedPity} min={0} max={banner.guaranteedPity - 1} />}
126126

127127
<h3 className="text-lg font-bold pt-1" id="resistance">Results:</h3>
128-
<table className={`table-auto w-64 ${styles.table} ${styles.stattable} mb-2 sm:text-base text-sm`}>
128+
<table className={`table-auto w-80 ${styles.table} ${styles.stattable} mb-2 sm:text-base text-sm`}>
129129
<thead>
130130
<tr className="divide-x divide-gray-200 dark:divide-gray-500">
131131
<th>{banner.constName}</th>
132132
<th>Rate</th>
133+
<th>Cumulative rate</th>
133134
</tr>
134135
</thead>
135136
<tbody className="divide-y divide-gray-200 dark:divide-gray-500">
136137
{calculated
137-
.map((c) => <tr className={`pr-1 divide-x divide-gray-200 dark:divide-gray-500 ${c.rate < 0.0005 ? "opacity-60" : ""}`} key={c.const}>
138+
.map((c, i, a) => <tr className={`pr-1 divide-x divide-gray-200 dark:divide-gray-500 ${c.rate < 0.0005 ? "opacity-60" : ""}`} key={c.const}>
138139
<td>{c.const == banner.minConst ? "Not owned" : `${banner.constFormat}${c.const}`}</td>
139140
<td>{(c.rate * 100).toFixed(3)}%</td>
141+
<td>{(a.slice(i, a.length).reduce((p, c) => p + c.rate, 0) * 100).toFixed(2)}%</td>
140142
</tr>)}
141143
</tbody>
142144
</table>

0 commit comments

Comments
 (0)