Skip to content

Commit 7753020

Browse files
committed
Add cumulative rate to gc
1 parent d9a8b2b commit 7753020

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/commands/misc/gachacalc.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import memoize from "memoizee"
33

44
import Command from "../../utils/Command"
55
import config from "../../data/config.json"
6-
import { createTable, sendMessage } from "../../utils/Utils"
6+
import { createTable, PAD_END, PAD_START, sendMessage } from "../../utils/Utils"
77
import log4js from "log4js"
88
import { CommandSource, SendMessage } from "../../utils/Types"
99

@@ -192,10 +192,15 @@ Example with 70 pulls, 10 pity and guaranteed for 5 star weapon banner: \`${conf
192192
return sendMessage(source, `**${banner.bannerName}** in **${pulls}** pulls, starting from **${pity}** pity and **${guaranteed ? "guaranteed" : `${banner.banner * 100}/${(1 - banner.banner) * 100}`}** banner:
193193
\`\`\`
194194
${createTable(
195-
[banner.constName, "Rate"],
195+
[banner.constName, "Rate", "Cumulative Rate"],
196196
sims
197197
.sort((a, b) => a.const - b.const)
198-
.map(k => [k.const == banner.minConst ? "/" : `${banner.constFormat}${k.const}`, `${(k.rate * 100).toFixed(2)}%`])
198+
.map((k, i, a) => [
199+
k.const == banner.minConst ? "/" : `${banner.constFormat}${k.const}`,
200+
`${(k.rate * 100).toFixed(2)}%`,
201+
`${(a.slice(i, a.length).reduce((p, c) => p + c.rate, 0) * 100).toFixed(2)}%`
202+
]),
203+
[PAD_END, PAD_START, PAD_START]
199204
)}
200205
\`\`\``)
201206
}

0 commit comments

Comments
 (0)