UPDATE: New monster data
All checks were successful
Gitea Auto Deploy / Deploy-Container (push) Successful in 1m20s
All checks were successful
Gitea Auto Deploy / Deploy-Container (push) Successful in 1m20s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { mappingStats, ratioStats } from "@/constant/constant"
|
||||
import { AffixDetail } from "@/types"
|
||||
import { EliteData, HardLevelData, MainAffixData, MonsterDetail, SubAffixData} from "@/types"
|
||||
|
||||
export function calcPromotion(level: number) {
|
||||
if (level < 20) {
|
||||
@@ -37,29 +37,29 @@ export function calcRarity(rarity: string) {
|
||||
return 1
|
||||
}
|
||||
|
||||
export function calcMainAffixBonus(affix?: AffixDetail, level?: number) {
|
||||
export function calcMainAffixBonus(affix?: MainAffixData, level?: number) {
|
||||
if (!affix || typeof level !== "number") return "0"
|
||||
const value = affix.base + affix.step * level;
|
||||
const value = affix.BaseValue + affix.LevelAdd * level;
|
||||
|
||||
if (mappingStats?.[affix.property].unit === "%") {
|
||||
if (mappingStats?.[affix.Property].unit === "%") {
|
||||
return (value * 100).toFixed(1);
|
||||
}
|
||||
if (mappingStats?.[affix.property].name === "SPD") {
|
||||
if (mappingStats?.[affix.Property].name === "SPD") {
|
||||
return value.toFixed(1);
|
||||
}
|
||||
|
||||
return value.toFixed(0);
|
||||
}
|
||||
|
||||
export const calcAffixBonus = (affix?: AffixDetail, stepCount?: number, rollCount?: number) => {
|
||||
export const calcAffixBonus = (affix?: SubAffixData, stepCount?: number, rollCount?: number) => {
|
||||
if (!affix || typeof stepCount !== "number" || typeof rollCount !== "number") return "0"
|
||||
if (mappingStats?.[affix.property].unit === "%") {
|
||||
return ((affix.base * rollCount + affix.step * stepCount) * 100).toFixed(1);
|
||||
if (mappingStats?.[affix.Property].unit === "%") {
|
||||
return ((affix.BaseValue * rollCount + affix.StepValue * stepCount) * 100).toFixed(1);
|
||||
}
|
||||
if (mappingStats?.[affix.property].name === "SPD") {
|
||||
return (affix.base * rollCount + affix.step * stepCount).toFixed(1);
|
||||
if (mappingStats?.[affix.Property].name === "SPD") {
|
||||
return (affix.BaseValue * rollCount + affix.StepValue * stepCount).toFixed(1);
|
||||
}
|
||||
return (affix.base * rollCount + affix.step * stepCount).toFixed(0);
|
||||
return (affix.BaseValue * rollCount + affix.StepValue * stepCount).toFixed(0);
|
||||
}
|
||||
|
||||
export const calcBaseStat = (baseStat: number, stepStat: number, roundFixed: number, level: number) => {
|
||||
@@ -72,19 +72,19 @@ export const calcBaseStatRaw = (baseStat?: number, stepStat?: number, level?: nu
|
||||
return baseStat + stepStat * (level-1);
|
||||
}
|
||||
|
||||
export const calcSubAffixBonusRaw = (affix?: AffixDetail, stepCount?: number, rollCount?: number, baseStat?: number) => {
|
||||
export const calcSubAffixBonusRaw = (affix?: SubAffixData, stepCount?: number, rollCount?: number, baseStat?: number) => {
|
||||
if (!affix || typeof stepCount !== "number" || typeof rollCount !== "number" || typeof baseStat !== "number") return 0
|
||||
if (ratioStats.includes(affix.property)) {
|
||||
return (affix.base * rollCount + affix.step * stepCount) * baseStat;
|
||||
if (ratioStats.includes(affix.Property)) {
|
||||
return (affix.BaseValue * rollCount + affix.StepValue * stepCount) * baseStat;
|
||||
}
|
||||
return affix.base * rollCount + affix.step * stepCount;
|
||||
return affix.BaseValue * rollCount + affix.StepValue * stepCount;
|
||||
}
|
||||
|
||||
export const calcMainAffixBonusRaw = (affix?: AffixDetail, level?: number, baseStat?: number) => {
|
||||
export const calcMainAffixBonusRaw = (affix?: MainAffixData, level?: number, baseStat?: number) => {
|
||||
if (!affix || typeof level !== "number" || typeof baseStat !== "number") return 0
|
||||
const value = affix.base + affix.step * level;
|
||||
const value = affix.BaseValue + affix.LevelAdd * level;
|
||||
|
||||
if (ratioStats.includes(affix.property)) {
|
||||
if (ratioStats.includes(affix.Property)) {
|
||||
return baseStat * value
|
||||
}
|
||||
|
||||
@@ -97,4 +97,42 @@ export const calcBonusStatRaw = (affix?: string, baseStat?: number, bonusValue?:
|
||||
return baseStat * bonusValue
|
||||
}
|
||||
return bonusValue
|
||||
}
|
||||
|
||||
export const calcMonsterStats = (
|
||||
monster: MonsterDetail,
|
||||
eliteGroup: number,
|
||||
hardLevelGroup: number,
|
||||
level: number,
|
||||
hardLevelConfig: Record<string, Record<string, HardLevelData>>,
|
||||
eliteConfig: Record<string, EliteData>
|
||||
) => {
|
||||
let hardLevelRatio = {
|
||||
AttackRatio: 1,
|
||||
DefenceRatio:1,
|
||||
HPRatio: 1,
|
||||
SpeedRatio: 1,
|
||||
StanceRatio: 1
|
||||
}
|
||||
if (hardLevelConfig?.[hardLevelGroup.toString()]?.[level.toString()]) {
|
||||
hardLevelRatio = hardLevelConfig?.[hardLevelGroup.toString()]?.[level.toString()]
|
||||
}
|
||||
let eliteRatio = {
|
||||
AttackRatio: 1,
|
||||
DefenceRatio:1,
|
||||
HPRatio: 1,
|
||||
SpeedRatio: 1,
|
||||
StanceRatio: 1
|
||||
}
|
||||
if (eliteConfig?.[eliteGroup.toString()]) {
|
||||
eliteRatio = eliteConfig?.[eliteGroup.toString()]
|
||||
}
|
||||
|
||||
return {
|
||||
atk: monster.Base.AttackBase * monster.Modify.AttackModifyRatio * hardLevelRatio.AttackRatio * eliteRatio.AttackRatio,
|
||||
def: monster.Base.DefenceBase * monster.Modify.DefenceModifyRatio * hardLevelRatio.DefenceRatio * eliteRatio.DefenceRatio,
|
||||
hp: monster.Base.HPBase * monster.Modify.HPModifyRatio * hardLevelRatio.HPRatio * eliteRatio.HPRatio,
|
||||
spd: monster.Base.SpeedBase * monster.Modify.SpeedModifyRatio * hardLevelRatio.SpeedRatio * eliteRatio.SpeedRatio,
|
||||
stance: (monster.Base.StanceBase * monster.Modify.StanceModifyRatio * hardLevelRatio.StanceRatio * eliteRatio.StanceRatio) / 3,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user