Skip to content

Commit 6edb5c6

Browse files
committed
AP 加分
1 parent ce3241f commit 6edb5c6

File tree

6 files changed

+46
-15
lines changed

6 files changed

+46
-15
lines changed

apps/web/src/routes/b50/components/B50.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const RatingTable = component$(({ rating, userMusic, title, ver }: { rating: Rat
4040
entries.push({ rating: ratingListEntry });
4141
continue;
4242
}
43-
const score = computeRa(chart.internalLevelValue, ratingListEntry.achievement);
43+
const score = computeRa(chart.internalLevelValue, ratingListEntry.achievement, userMusic.find(music => music.musicId === ratingListEntry.musicId && music.level === ratingListEntry.level)!.comboStatus);
4444
scores.push(score);
4545
entries.push({ rating: ratingListEntry, score, song, chart });
4646
}
@@ -60,13 +60,32 @@ const RatingTable = component$(({ rating, userMusic, title, ver }: { rating: Rat
6060
</div>
6161
</div>
6262
<div style={{ fontSize: '2em', margin: '0 15px' }}>
63-
<div>平均: {ratingAnalyse(averageMinMax[0])}</div>
64-
<div>最低: {ratingAnalyse(averageMinMax[1])}</div>
65-
<div>最高: {ratingAnalyse(averageMinMax[2])}</div>
63+
<div>平均: <RatingAnalyse rating={averageMinMax[0]} /></div>
64+
<div>最低: <RatingAnalyse rating={averageMinMax[1]} /></div>
65+
<div>最高: <RatingAnalyse rating={averageMinMax[2]} /></div>
6666
</div>
6767
</div>
6868
<div class={styles.b50Grid}>
6969
{entries.map(it => <B50Song entry={it.rating} song={it.song!} score={userMusic.find(music => music.musicId === it.rating.musicId && music.level === it.rating.level)!} key={it.rating.musicId} />)}
7070
</div>
7171
</div>;
7272
});
73+
74+
const RatingAnalyse = component$(({ rating }: { rating: number }) => {
75+
const ap = (rating - 1) / 22.4 / 1.005;
76+
const sssp = rating / 22.4 / 1.005;
77+
const sss = rating / 21.6;
78+
const ss = rating / 20.8 / 0.99;
79+
return <>
80+
<span class="font-600">{rating}</span>
81+
{' ≈ '}
82+
<span>{ap.toFixed(1)}</span>
83+
{' AP / '}
84+
<span>{sssp.toFixed(1)}</span>
85+
{' SSS+ / '}
86+
<span>{sss.toFixed(1)}</span>
87+
{' SSS / '}
88+
<span>{ss.toFixed(1)}</span>
89+
{' SS'}
90+
</>;
91+
});

apps/web/src/routes/b50/components/B50Song.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ const BORDER_SIZE = 3;
1212
const SIZE = 90;
1313

1414
export default ({ entry, score, song }: { entry: RatingListEntry, score: UserMusic, song: Song }) => {
15-
const href = song && `https://t.me/aquadxbot?start=song-${song.id}`;
16-
17-
return href ? <a href={href}><Component entry={entry} score={score} song={song} /></a> : <Component entry={entry} score={score} song={song} />;
15+
return <Component entry={entry} score={score} song={song} />;
1816
};
1917

2018
const Component = ({ entry, score, song }: { entry: RatingListEntry, score: UserMusic, song?: Song }) => {
@@ -47,7 +45,7 @@ const Component = ({ entry, score, song }: { entry: RatingListEntry, score: User
4745
{chart && chart.internalLevelValue && <div>
4846
{chart.internalLevelValue.toFixed(1)}
4947
<span style={{ margin: '0 .3em' }}></span>
50-
<span style={{ fontWeight: 700 }}>{computeRa(chart.internalLevelValue, entry.achievement)}</span>
48+
<span style={{ fontWeight: 700 }}>{computeRa(chart.internalLevelValue, entry.achievement, score.comboStatus)}</span>
5149
</div>}
5250
</div>
5351
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>

apps/web/vite.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ errorOnDuplicatesPkgDeps(devDependencies, dependencies);
2222
*/
2323
export default defineConfig(({ command, mode }): UserConfig => {
2424
return {
25-
plugins: [UnoCSS(), qwikCity(), qwikVite(), tsconfigPaths()],
25+
plugins: [
26+
UnoCSS(),
27+
qwikCity(),
28+
qwikVite({
29+
devTools: {
30+
imageDevTools: false,
31+
clickToSource: false,
32+
}
33+
}),
34+
tsconfigPaths()
35+
],
2636
// This tells Vite which dependencies to pre-build in dev mode.
2737
optimizeDeps: {
2838
exclude: []

packages/botcore/src/modules/scoreQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default <T extends BotTypes>({ bot, env, getContext, musicToFile }: Build
3636
for (const userScore of userScores) {
3737
const chart = song.getChart(userScore.level, userScore.musicId > 1e4);
3838
message.push(`${userScore.musicId > 1e4 ? 'DX' : 'STD'} ${LEVEL_EMOJI[userScore.level]} ${chart.internalLevelValue.toFixed(1)} ` +
39-
`${(userScore.achievement / 1e4).toFixed(4)}% = ${computeRa(chart.internalLevelValue, userScore.achievement)} ${FC[userScore.comboStatus]}`);
39+
`${(userScore.achievement / 1e4).toFixed(4)}% = ${computeRa(chart.internalLevelValue, userScore.achievement, userScore.comboStatus)} ${FC[userScore.comboStatus]}`);
4040
}
4141

4242
if (musicToFile[song.id]) {
@@ -86,7 +86,7 @@ export default <T extends BotTypes>({ bot, env, getContext, musicToFile }: Build
8686
for (const userScore of userScores) {
8787
const chart = song.getChart(userScore.level, userScore.musicId > 1e4);
8888
message.push(`${userScore.musicId > 1e4 ? 'DX' : 'STD'} ${LEVEL_EMOJI[userScore.level]} ${chart.internalLevelValue.toFixed(1)} ` +
89-
`${(userScore.achievement / 1e4).toFixed(4)}% = ${computeRa(chart.internalLevelValue, userScore.achievement)} ${FC[userScore.comboStatus]}`);
89+
`${(userScore.achievement / 1e4).toFixed(4)}% = ${computeRa(chart.internalLevelValue, userScore.achievement, userScore.comboStatus)} ${FC[userScore.comboStatus]}`);
9090
}
9191

9292
const reply = event.reply()

packages/botcore/src/modules/scoreQueryChu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22
import { CHU_LEVEL_EMOJI, FC, LEVEL_EMOJI, Song } from '@clansty/maibot-types/src';
3-
import { chusanRating, computeRa } from '@clansty/maibot-utils';
3+
import { chusanRating } from '@clansty/maibot-utils';
44
import { BotTypes, MessageButtonSwitchInline } from '@clansty/maibot-firm';
55
import { BuilderEnv } from '../botBuilder';
66
import { ChuniSong } from '@clansty/maibot-types';

packages/utils/src/computeRa.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const computeRa = (ds: number, achievement: number): number => {
1+
export const computeRa = (ds: number, achievement: number, combo: number): number => {
22
let baseRa: number = 22.4;
33
if (achievement < 50e4) {
44
baseRa = 0.0;
@@ -27,8 +27,12 @@ export const computeRa = (ds: number, achievement: number): number => {
2727
} else if (achievement < 1005e3) {
2828
baseRa = 21.6;
2929
}
30-
return Math.floor(ds * (Math.min(100.5, achievement / 1e4) / 100) * baseRa);
31-
};
30+
let res = Math.floor(ds * (Math.min(100.5, achievement / 1e4) / 100) * baseRa);
31+
if (combo >= 3) {
32+
res += 1;
33+
}
34+
return res;
35+
};
3236

3337
function _chusanRating(lv: number, score: number) {
3438
lv = lv * 100;

0 commit comments

Comments
 (0)