zenno: lint fixes
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import * as z from 'zod';
|
||||
|
||||
const Scenarios = z.array(z.object({
|
||||
const Scenarios = z.array(
|
||||
z.object({
|
||||
scenario_id: z.int32(),
|
||||
name: z.string(),
|
||||
title: z.string(),
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
export type Scenario = z.infer<typeof Scenarios>[number];
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ test.for([
|
||||
])('level($rarity, $exp) -> $level', ({ rarity, exp, level }) => expect(support.level(rarity, exp)).toBe(level));
|
||||
|
||||
describe('effects', () => {
|
||||
|
||||
describe('Bakushin R', () => {
|
||||
test('level 1', () => {
|
||||
const got = support.effects(bakushinR as support.SupportCard, 1);
|
||||
@@ -251,7 +250,7 @@ describe('effects', () => {
|
||||
} satisfies support.UniqueEffect,
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('Bakushin SSR', () => {
|
||||
test('level 1', () => {
|
||||
@@ -407,5 +406,4 @@ describe('effects', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -37,19 +37,7 @@ export interface SupportCard {
|
||||
/**
|
||||
* Support card effects per five level increment.
|
||||
*/
|
||||
effects: [
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
Effect[],
|
||||
];
|
||||
effects: [Effect[], Effect[], Effect[], Effect[], Effect[], Effect[], Effect[], Effect[], Effect[], Effect[], Effect[]];
|
||||
/**
|
||||
* Unique effect, for cards that have them.
|
||||
*/
|
||||
@@ -261,7 +249,7 @@ export function effects(card: SupportCard, level: number) {
|
||||
return { type: e.type, value };
|
||||
});
|
||||
if (card.unique_effect != null && level >= card.unique_effect.card_level) {
|
||||
return { effects, unique: card.unique_effect }
|
||||
return { effects, unique: card.unique_effect };
|
||||
}
|
||||
return { effects };
|
||||
}
|
||||
@@ -307,7 +295,10 @@ function singleUniqueEffects(type: EffectType, args: number[], deck: SupportCard
|
||||
return [{ type, value: args[0] }];
|
||||
|
||||
case EffectType.UniqueFriendshipThreshold:
|
||||
return [{ type: args[1], value: args[2] }, { type: args[3], value: args[4] }];
|
||||
return [
|
||||
{ type: args[1], value: args[2] },
|
||||
{ type: args[3], value: args[4] },
|
||||
];
|
||||
case EffectType.UniqueOffSpecialty:
|
||||
return [{ type: EffectType.TrainingEffectiveness, value: args[1] }];
|
||||
case EffectType.UniqueColorThresholdTrainingEffectiveness:
|
||||
@@ -316,7 +307,7 @@ function singleUniqueEffects(type: EffectType, args: number[], deck: SupportCard
|
||||
}
|
||||
return [{ type: EffectType.TrainingEffectiveness, value: args[1] }];
|
||||
case EffectType.UniqueFanScalingTrainingEffectiveness:
|
||||
return [{ type: EffectType.TrainingEffectiveness, value: args[1] }]
|
||||
return [{ type: EffectType.TrainingEffectiveness, value: args[1] }];
|
||||
case EffectType.UniqueColorInitialStats:
|
||||
return deck.flatMap((card) => {
|
||||
switch (card.specialty) {
|
||||
@@ -339,7 +330,7 @@ function singleUniqueEffects(type: EffectType, args: number[], deck: SupportCard
|
||||
{ type: EffectType.InitialWit, value: args[1] },
|
||||
];
|
||||
}
|
||||
})
|
||||
});
|
||||
case EffectType.UniqueRainbowStack:
|
||||
return [{ type: args[1], value: args[0] * args[2] }];
|
||||
case EffectType.UniqueLowEnergyScaling:
|
||||
|
||||
@@ -387,13 +387,9 @@
|
||||
"description": "Friendship Bonus and Specialty Priority",
|
||||
"card_level": 25,
|
||||
"type": 1,
|
||||
"args": [
|
||||
10
|
||||
],
|
||||
"args": [10],
|
||||
"type2": 19,
|
||||
"args2": [
|
||||
20
|
||||
],
|
||||
"args2": [20],
|
||||
"idle_mode_sub_rate": 0
|
||||
},
|
||||
"hints": [
|
||||
|
||||
@@ -431,10 +431,7 @@
|
||||
"description": "Increases Training Effectiveness when not on preferred training. (Friendship 80+)",
|
||||
"card_level": 30,
|
||||
"type": 102,
|
||||
"args": [
|
||||
80,
|
||||
20
|
||||
],
|
||||
"args": [80, 20],
|
||||
"idle_mode_sub_rate": 30
|
||||
},
|
||||
"hints": [
|
||||
|
||||
@@ -9,48 +9,48 @@ function gainTotalStats(gain: ism.GainInfo) {
|
||||
export const DEPENDENT = [
|
||||
{
|
||||
name: 'Total Stats',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gainTotalStats(gain),
|
||||
map: (gain: ism.GainInfo) => gainTotalStats(gain),
|
||||
},
|
||||
{
|
||||
name: 'Total Stats + SP',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gainTotalStats(gain) + gain.skill_point,
|
||||
map: (gain: ism.GainInfo) => gainTotalStats(gain) + gain.skill_point,
|
||||
},
|
||||
{
|
||||
name: 'Speed',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.speed.value,
|
||||
map: (gain: ism.GainInfo) => gain.speed.value,
|
||||
},
|
||||
{
|
||||
name: 'Stamina',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.stamina.value,
|
||||
map: (gain: ism.GainInfo) => gain.stamina.value,
|
||||
},
|
||||
{
|
||||
name: 'Power',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.power.value,
|
||||
map: (gain: ism.GainInfo) => gain.power.value,
|
||||
},
|
||||
{
|
||||
name: 'Guts',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.guts.value,
|
||||
map: (gain: ism.GainInfo) => gain.guts.value,
|
||||
},
|
||||
{
|
||||
name: 'Wit',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.wiz.value,
|
||||
map: (gain: ism.GainInfo) => gain.wiz.value,
|
||||
},
|
||||
{
|
||||
name: 'SP',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.skill_point,
|
||||
map: (gain: ism.GainInfo) => gain.skill_point,
|
||||
},
|
||||
{
|
||||
name: 'Skill Hints',
|
||||
map: (gain: ism.GainInfo, effects: support.Effect[]) => {
|
||||
// NOTE(zephyr): reduction starts with 1 because we want the value
|
||||
// of each hint, not just the bonus from effects
|
||||
const hintLevels = effects.reduce((l, e) => e.type === support.EffectType.HintLevels ? l + e.value : l, 1);
|
||||
const hintLevels = effects.reduce((l, e) => (e.type === support.EffectType.HintLevels ? l + e.value : l), 1);
|
||||
return gain.skill_tips_array.reduce((n, t) => n + Math.ceil(t.level / hintLevels), 0);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Skills',
|
||||
map: (gain: ism.GainInfo, _effects: support.Effect[]) => gain.skill_tips_array.length,
|
||||
map: (gain: ism.GainInfo) => gain.skill_tips_array.length,
|
||||
},
|
||||
] as const;
|
||||
|
||||
@@ -114,32 +114,45 @@ export const INDEPENDENT = [
|
||||
] as const;
|
||||
|
||||
export type SupportCardDatum = {
|
||||
'Career': string;
|
||||
'Scenario': string;
|
||||
'Source': string;
|
||||
Career: string;
|
||||
Scenario: string;
|
||||
Source: string;
|
||||
'Unique Effect': string;
|
||||
'Idle Mode Sub Rate': number;
|
||||
'Races': number;
|
||||
Races: number;
|
||||
'Race Wins': number;
|
||||
} & Record<typeof INDEPENDENT[number]['name'], number> & Record<typeof DEPENDENT[number]['name'], number>;
|
||||
} & Record<(typeof INDEPENDENT)[number]['name'], number> &
|
||||
Record<(typeof DEPENDENT)[number]['name'], number>;
|
||||
|
||||
export function supportVariables(career: ism.Career, lookupCard: (id: number) => support.SupportCard, lookupScenario: (id: number) => scenario.Scenario): SupportCardDatum[] {
|
||||
export function supportVariables(
|
||||
career: ism.Career,
|
||||
lookupCard: (id: number) => support.SupportCard,
|
||||
lookupScenario: (id: number) => scenario.Scenario,
|
||||
): SupportCardDatum[] {
|
||||
const deck = career.progress_log_info.support_card_gain_info_array.map((g) => lookupCard(g.support_card_id));
|
||||
const scen = lookupScenario(career.end_info.chara_info.scenario_id);
|
||||
return career.progress_log_info.support_card_gain_info_array.map((g, i) => {
|
||||
const card = deck[i];
|
||||
const level = support.level(card.rarity, career.end_info.chara_info.support_card_array[i].exp);
|
||||
const { effects, unique } = support.effects(lookupCard(g.support_card_id), level);
|
||||
const indep = Object.fromEntries(INDEPENDENT.map((t) => [t.name, effects.find((e) => e.type === t.effect)?.value ?? 0])) as Record<typeof INDEPENDENT[number]['name'], number>;
|
||||
const dep = Object.fromEntries(DEPENDENT.map((t) => [t.name, t.map(g.gain_info, effects)])) as Record<typeof DEPENDENT[number]['name'], number>;
|
||||
const indep = Object.fromEntries(
|
||||
INDEPENDENT.map((t) => [t.name, effects.find((e) => e.type === t.effect)?.value ?? 0]),
|
||||
) as Record<(typeof INDEPENDENT)[number]['name'], number>;
|
||||
const dep = Object.fromEntries(DEPENDENT.map((t) => [t.name, t.map(g.gain_info, effects)])) as Record<
|
||||
(typeof DEPENDENT)[number]['name'],
|
||||
number
|
||||
>;
|
||||
return {
|
||||
'Career': label(career),
|
||||
'Scenario': scen.name,
|
||||
'Source': card.name,
|
||||
Career: label(career),
|
||||
Scenario: scen.name,
|
||||
Source: card.name,
|
||||
'Unique Effect': unique?.description ?? 'None',
|
||||
'Idle Mode Sub Rate': unique?.idle_mode_sub_rate ?? 0,
|
||||
'Races': career.progress_log_info.race_history_array.length,
|
||||
'Race Wins': career.progress_log_info.race_history_array.reduce((w, r) => r.race_history.result_rank === 1 ? w + 1 : w, 0),
|
||||
Races: career.progress_log_info.race_history_array.length,
|
||||
'Race Wins': career.progress_log_info.race_history_array.reduce(
|
||||
(w, r) => (r.race_history.result_rank === 1 ? w + 1 : w),
|
||||
0,
|
||||
),
|
||||
...indep,
|
||||
...dep,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user