타입 정의 상세
This commit is contained in:
@@ -3,6 +3,7 @@ import type { BattlePhaseTrigger, CalcStat, CalcStatRange } from "../../IActionM
|
||||
import { WarUnitTriggerCaller } from "../../TriggerCaller/WarUnitTriggerCaller.js";
|
||||
import type { WarUnit } from "../../WarUnit.js";
|
||||
import { che_필살강화_회피불가 } from "../../WarUnitTrigger/che_필살강화_회피불가.js";
|
||||
import type { CalcStatName, CalcStatRangeName } from "@/defs.js";
|
||||
import { BaseSpecial } from "../BaseSpecial.js";
|
||||
import type { SpecialReqType, WeightNormal } from "../defs.js";
|
||||
|
||||
@@ -23,14 +24,14 @@ export class che_필살 extends BaseSpecial implements CalcStat, CalcStatRange,
|
||||
return "[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 향상";
|
||||
}
|
||||
|
||||
onCalcStat(general: General, statName: string, value: number, aux?: unknown[] | undefined): number {
|
||||
onCalcStat(general: General, statName: CalcStatName, value: number, aux?: unknown[] | undefined): number {
|
||||
if (statName == 'warCriticalRatio') {
|
||||
return value + 0.3;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
onCalcStatRange(general: General, statName: string, value: [number, number], aux?: unknown[] | undefined): [number, number] {
|
||||
onCalcStatRange(general: General, statName: CalcStatRangeName, value: [number, number], aux?: unknown[] | undefined): [number, number] {
|
||||
if (statName === 'criticalDamageRange'){
|
||||
const [rangeMin, rangeMax] = value;
|
||||
return [(rangeMin + rangeMax) / 2, rangeMax];
|
||||
|
||||
@@ -3,19 +3,20 @@ import type { WarUnitTriggerCaller } from "./TriggerCaller/WarUnitTriggerCaller.
|
||||
import type { GeneralTriggerCaller } from "./TriggerCaller/GeneralTriggerCaller.js";
|
||||
import type { General } from "./General.js";
|
||||
import type { WarUnit } from "./WarUnit.js";
|
||||
import type { ArbitraryActionType, CalcIncomeType, CalcStatName, CalcStatRangeName, CalcStrategicVarType, StrategicTurnType } from "./defs.js";
|
||||
|
||||
//TODO: turnType, varType이 string이면 안됨. enum에 가까워야함!
|
||||
type onCalcDomesticFunc = (turnType: string, varType: string, value: number, aux?: unknown[]) => number;
|
||||
|
||||
type onCalcStatFunc = (general: General, statName: string, value: number, aux?: unknown[]) => number;
|
||||
type onCalcStatRangeFunc = (general: General, statName: string, value: [number, number], aux?: unknown[]) => [number, number];
|
||||
type onCalcStrategicFunc = (turnType: string, varType: string, value: number) => number;
|
||||
type onCalcIncomeFunc = (type: string, value: number) => number;
|
||||
type onCalcStatFunc = (general: General, statName: CalcStatName, value: number, aux?: unknown[]) => number;
|
||||
type onCalcStatRangeFunc = (general: General, statName: CalcStatRangeName, value: [number, number], aux?: unknown[]) => [number, number];
|
||||
type onCalcStrategicFunc = (turnType: StrategicTurnType, varType: CalcStrategicVarType, value: number) => number;
|
||||
type onCalcIncomeFunc = (type: CalcIncomeType, value: number) => number;
|
||||
|
||||
type getWarPowerMultiplierFunc = (unit: WarUnit) => [number, number];
|
||||
type getWarUnitTriggerListFunc = (unit: WarUnit) => WarUnitTriggerCaller | undefined;
|
||||
|
||||
type onArbitraryActionFunc = (general: General, rng: RandUtil, actionType: string, phase?: string, aux?: unknown[]) => null | string[];
|
||||
type onArbitraryActionFunc = (general: General, rng: RandUtil, actionType: ArbitraryActionType, phase?: string, aux?: unknown[]) => null | string[];
|
||||
|
||||
export interface TurnExecuteTriggerList {
|
||||
getPreTurnExecuteTriggerList(general: General): GeneralTriggerCaller | undefined;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import type { WarSkillName } from "./defs.js";
|
||||
|
||||
export class WarUnitEnv {
|
||||
|
||||
}
|
||||
|
||||
export abstract class WarUnit{
|
||||
hasActivatedSkill(skillName: string): boolean {
|
||||
hasActivatedSkill(skillName: WarSkillName): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
activateSkill(skillName: string): void {
|
||||
activateSkill(skillName: WarSkillName): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,56 @@ export type NationID = number & { zz_t?: "NationID" };
|
||||
export type NationName = string & { zz_t?: "NationName" };
|
||||
|
||||
//TODO: 무언가의 keyof 로 바꿔야함
|
||||
export type NationType = string & { zz_t?: "NationType" };
|
||||
export type NationType = string & { zz_t?: "NationType" };
|
||||
export type StrategicTurnType = string & { zz_t?: "StrategicTurnType" };
|
||||
|
||||
/* 전용 stat이어서 확장하고자 하는경우 아래와 같이 확장 가능
|
||||
```ts
|
||||
declare module "@/defs.js" {
|
||||
export interface CalcStatNameBase {
|
||||
statName: unknown
|
||||
}
|
||||
|
||||
export interface CalcStatRangeNameBase {
|
||||
statName: unknown
|
||||
}
|
||||
}
|
||||
```
|
||||
*/
|
||||
|
||||
//필요할 때 확장
|
||||
export interface CalcStatNameBase {
|
||||
leadership: unknown,
|
||||
strength: unknown,
|
||||
intel: unknown,
|
||||
warCriticalRatio: unknown;
|
||||
}
|
||||
export type CalcStatName = keyof CalcStatNameBase;
|
||||
|
||||
//필요할 때 확장
|
||||
export interface CalcStatRangeNameBase {
|
||||
criticalDamageRange: unknown;
|
||||
}
|
||||
export type CalcStatRangeName = keyof CalcStatRangeNameBase;
|
||||
|
||||
export interface CalcStrategicVarTypeBase {
|
||||
globalDelay: unknown;
|
||||
}
|
||||
export type CalcStrategicVarType = keyof CalcStrategicVarTypeBase;
|
||||
|
||||
export interface CalcIncomeTypeBase {
|
||||
gold: unknown;
|
||||
rice: unknown;
|
||||
}
|
||||
export type CalcIncomeType = keyof CalcIncomeTypeBase;
|
||||
|
||||
export interface ArbitraryActionTypeBase {
|
||||
}
|
||||
export type ArbitraryActionType = keyof ArbitraryActionTypeBase;
|
||||
|
||||
export interface WarSkillNameBase {
|
||||
필살: unknown;
|
||||
회피불가: unknown;
|
||||
회피: unknown;
|
||||
}
|
||||
export type WarSkillName = keyof WarSkillNameBase;
|
||||
@@ -3,6 +3,9 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user