Skip to content

Commit

Permalink
Furthur tweak SR scorers
Browse files Browse the repository at this point in the history
  • Loading branch information
stdcall0 committed Mar 2, 2024
1 parent 8edcf18 commit 82c7d65
Show file tree
Hide file tree
Showing 41 changed files with 180 additions and 627 deletions.
1 change: 0 additions & 1 deletion model/starrail/relic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export class Piece extends Base.Piece<Set> {
};

export class Set extends Base.Set<Piece> {

constructor(
public name: string,
public displayName: string,
Expand Down
45 changes: 15 additions & 30 deletions model/starrail/scorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,36 @@ export const findRule = (stat: Stat, rule: StatWeightTable): number => {
return Base.findRule(stat, rule);
};

export class MainStatWeightRule extends ScoreRule {
export class MainStatRule extends ScoreRule {
constructor(
public pieceName: string[],
public scale: number
public targets: string[],
public stat: { [statName: string]: number },
public reward: number,
public punish: number
) { super(); }

override target(piece: Piece): boolean {
return this.pieceName.includes(piece.name);
return this.targets.includes(piece.name);
}

override add(piece: Piece, weight: StatWeightTable): number {
return this.scale * findRule(piece.mainStat, weight);
}
};

export interface StatMatchTable {
[ statName: string ]: number;
};
if (!(piece.mainStat.name in this.stat))
return 0;

export class MainStatMatchRule extends ScoreRule {
constructor(
public statMatch: StatMatchTable
) { super(); }
let score = (piece.level + 1) / 16 * this.stat[piece.mainStat.name];
score += this.reward * findRule(piece.mainStat, weight);

override target(piece: Piece): boolean {
return [
"Body", "Feet",
"Planar Sphere", "Link Rope"
].includes(piece.name);
return score;
}

override mul(piece: Piece, weight: StatWeightTable): number {
if (!(piece.mainStat.name in this.statMatch))
return 0.1;
override mul(piece: Piece): number {
if (!(piece.mainStat.name in this.stat))
return this.punish;
return 1;
}

override add(piece: Piece, weight: StatWeightTable): number {
if (!(piece.mainStat.name in this.statMatch))
return 0;
return piece.level / 15 * this.statMatch[piece.mainStat.name];
}
};

export class SubStatWeightRule extends ScoreRule {
export class SubStatRule extends ScoreRule {
constructor(
public multipler: StatWeightTable
) { super(); }
Expand Down
4 changes: 3 additions & 1 deletion resources/starrail/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
export * from './stat.js';
export * from './piece.js';
export * from './scorers/rule.js';
export * from './scorers/scorer.js';

import * as Scorer from './scorers/index.js';
export { Scorer };

import { Sets as sets } from './set.js';
import { Domains as domains } from './domain.js';
Expand Down
9 changes: 2 additions & 7 deletions resources/starrail/relics/Path of Gelid Wind.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AddOuterSet } from '../set.js';
import { AddDomain } from '../domain.js';

import { Scorer } from '../scorers/scorer.js';
import * as Scorer from '../scorers/index.js';

AddDomain(
"Path of Gelid Wind", "睿治之径",
Expand All @@ -11,9 +11,7 @@ AddDomain(
"Hunter of Glacial Forest", "密林卧雪的猎人",
["冰", "冰套"],
[
Scorer.YanqingScorer,
Scorer.JingliuScorer,
Scorer.HertaScorer,
Scorer.JingliuScorer
],
{
"Head": {
Expand Down Expand Up @@ -42,9 +40,6 @@ AddDomain(
"Eagle of Twilight Line", "晨昏交界的翔鹰",
["风", "风套"],
[
Scorer.DanHengScorer,
Scorer.SampoScorer,
Scorer.BronyaScorer,
],
{
"Head": {
Expand Down
5 changes: 1 addition & 4 deletions resources/starrail/relics/Path of Providence.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AddOuterSet } from '../set.js';
import { AddDomain } from '../domain.js';

import { Scorer } from '../scorers/scorer.js';
import * as Scorer from '../scorers/index.js';

AddDomain(
"Path of Providence", "睿治之径",
Expand All @@ -11,8 +11,6 @@ AddDomain(
"Genius of Brilliant Stars", "繁星璀璨的天才",
["量子", "量子套"],
[
// Scorer.JingYuanScorer,
Scorer.QingqueScorer,
Scorer.SeeleScorer
],
{
Expand Down Expand Up @@ -42,7 +40,6 @@ AddDomain(
"Guard of Wuthering Snow", "戍卫风雪的铁卫",
["铁卫", "铁卫套"],
[
// Scorer.TrailblazerFireScorer,
Scorer.FuXuanScorer,
],
{
Expand Down
5 changes: 1 addition & 4 deletions resources/starrail/relics/World 7.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AddInnerSet } from '../set.js';
import { AddDomain } from '../domain.js';

import { Scorer } from '../scorers/scorer.js';
import * as Scorer from '../scorers/index.js';

AddDomain(
"World 7", "第七世界",
Expand All @@ -11,8 +11,6 @@ AddDomain(
"Rutilant Arena", "繁星竞技场",
["繁星", "繁星套"],
[
Scorer.QingqueScorer,
Scorer.DanHengBigScorer,
Scorer.SeeleScorer,
Scorer.JingliuScorer
],
Expand All @@ -35,7 +33,6 @@ AddDomain(
[
Scorer.GepardScorer,
Scorer.LuochaScorer,
Scorer.BailuScorer,
Scorer.FuXuanScorer
],
{
Expand Down
25 changes: 25 additions & 0 deletions resources/starrail/scorers/FuXuan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { StarRail } from '#gc.model';
import { makeRules } from './rule.js';

export const FuXuanScorer = new StarRail.Scorer(
"Fu Xuan",
"符玄",
makeRules([
[["Body"], {"HP": 0, "DEF": 0, "CRIT DMG": 5}],
[["Feet"], {"SPD": 5}],
[["Planar Sphere"], {"HP": 3, "DEF": 3, "Quantum DMG Boost": 6}],
[["Link Rope"], {"Energy Regeneration Rate": 10}]
]),
{
"HP": 1,
"FlatHP": 1,
"DEF": 0.5,
"FlatDEF": 0.5,
"SPD": 1,
"CRIT Rate": 1,
"CRIT DMG": 1,
"Energy Regeneration Rate": 0.5,
"Effect RES": 0.5,
"Quantum DMG Boost": 1
}
);
23 changes: 23 additions & 0 deletions resources/starrail/scorers/Gepard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { StarRail } from '#gc.model';
import { makeRules } from './rule.js';

export const GepardScorer = new StarRail.Scorer(
"Gepard",
"杰帕德",
makeRules([
[["Body"], {"Effect Hit Rate": 5, "DEF": 0}],
[["Feet"], {"SPD": 5}],
[["Planar Sphere"], {"DEF": 3}],
[["Link Rope"], {"Energy Regeneration Rate": 10}],
]),
{
"HP": 0.5,
"FlatHP": 0.5,
"DEF": 1,
"FlatDEF": 1,
"SPD": 1,
"Energy Regeneration Rate": 1,
"Effect Hit Rate": 0.5,
"Effect RES": 0.5
}
);
22 changes: 22 additions & 0 deletions resources/starrail/scorers/Jingliu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { StarRail } from '#gc.model';
import { makeRules } from './rule.js';

export const JingliuScorer = new StarRail.Scorer(
"Jingliu",
"镜流",
makeRules([
[["Body"], {"CRIT DMG": 5}],
[["Feet"], {"SPD": 5}],
[["Planar Sphere"], {"Ice DMG Boost": 6}],
[["Link Rope"], {"ATK": 0, "Energy Regeneration Rate": 10}],
]),
{
"ATK": 0.75,
"FlatATK": 0.75,
"SPD": 1,
"CRIT Rate": 1,
"CRIT DMG": 1,
"Energy Regeneration Rate": 0.5,
"Ice DMG Boost": 1
}
);
File renamed without changes.
22 changes: 22 additions & 0 deletions resources/starrail/scorers/Seele.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { StarRail } from '#gc.model';
import { makeRules } from './rule.js';

export const SeeleScorer = new StarRail.Scorer(
"Seele",
"希儿",
makeRules([
[["Body"], {"CRIT Rate": 5, "CRIT DMG": 5}],
[["Feet"], {"ATK": 0}],
[["Planar Sphere"], {"Quantum DMG Boost": 6}],
[["Link Rope"], {"ATK": 0}]
]),
{
"ATK": 0.75,
"FlatATK": 0.75,
"SPD": 1,
"CRIT Rate": 1,
"CRIT DMG": 1,
"Energy Regeneration Rate": 0.5,
"Quantum DMG Boost": 1
}
);
22 changes: 22 additions & 0 deletions resources/starrail/scorers/Yinyue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { StarRail } from '#gc.model';
import { makeRules } from './rule.js';

export const YinyueScorer = new StarRail.Scorer(
"Dan Heng·Imbibitor Lunae",
"丹恒·饮月",
makeRules([
[["Body"], {"CRIT Rate": 5, "CRIT DMG": 5}],
[["Feet"], {"ATK": 0}],
[["Planar Sphere"], {"Imaginary DMG Boost": 6}],
[["Link Rope"], {"ATK": 0, "Energy Regeneration Rate": 10}]
]),
{
"ATK": 0.75,
"FlatATK": 0.75,
"SPD": 1,
"CRIT Rate": 1,
"CRIT DMG": 1,
"Energy Regeneration Rate": 0.50,
"Imaginary DMG Boost": 1
}
);
6 changes: 6 additions & 0 deletions resources/starrail/scorers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './FuXuan.js';
export * from './Gepard.js';
export * from './Jingliu.js';
export * from './Luocha.js';
export * from './Seele.js';
export * from './Yinyue.js';
40 changes: 38 additions & 2 deletions resources/starrail/scorers/rule.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
import * as Rule from "./rules/index.js";
export { Rule };
import { StarRail } from "#gc.model";

const subRule = new StarRail.SubStatRule({
"CRIT Rate": 2,
"CRIT DMG": 1,
"HP": 1.5,
"ATK": 1.5,
"DEF": 1.19,
"SPD": 2.53,
"Break Effect": 1,
"Effect Hit Rate": 1.49,
"Effect RES": 1.49,
"FlatATK": 0.3 * 0.5,
"FlatDEF": 0.3 * 0.5,
"FlatHP": 0.153 * 0.5,
});

type RuleArgs = [string[], { [ statName: string ]: number }, number?, number?];

export const makeRules = (mainRules: RuleArgs[]): StarRail.ScoreRule[] => {
let arr: StarRail.ScoreRule[] = [ subRule ];

for (let i = 0; i < mainRules.length; ++i) {
mainRules.push(null);
mainRules.push(null);

mainRules[i][2] ??= 5.83; // default reward
mainRules[i][3] ??= 0.25; // default punish
arr.push(new StarRail.MainStatRule(
mainRules[i][0],
mainRules[i][1],
mainRules[i][2],
mainRules[i][3],
));
}

return arr;
};
11 changes: 0 additions & 11 deletions resources/starrail/scorers/rules/MainStatWeight.ts

This file was deleted.

18 changes: 0 additions & 18 deletions resources/starrail/scorers/rules/SubStatWeight.ts

This file was deleted.

28 changes: 0 additions & 28 deletions resources/starrail/scorers/rules/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions resources/starrail/scorers/scorer.ts

This file was deleted.

Loading

0 comments on commit 82c7d65

Please sign in to comment.