Files
core_ng/@sammo/game_logic/src/defs.ts
T
2024-03-11 15:36:58 +00:00

258 lines
5.5 KiB
TypeScript

//Type 정의
export type UserID = number & { zz_t?: "UserID" };
export type UserName = string & { zz_t?: "UserName" };
export type GeneralID = number & { zz_t?: "GeneralID" };
export type GeneralName = string & { zz_t?: "GeneralName" };
export type CityID = number & { zz_t?: "CityID" };
export type CityName = string & { zz_t?: "CityName" };
export type TroopID = number & { zz_t?: "TroopID" };
export type TroopName = string & { zz_t?: "TroopName" };
export type NationID = number & { zz_t?: "NationID" };
export type NationName = string & { zz_t?: "NationName" };
//지역 ID
export type RegionID = number & { zz_t?: "RegionID" };
//서버 ID
export type ServerID = number & { zz_t?: "ServerID" };
export type ScenarioID = number & { zz_t?: "ScenarioID" };
//TODO: 무언가의 keyof 로 바꿔야함
export type NationType = string & { zz_t?: "NationType" };
export type StrategicTurnType = string & { zz_t?: "StrategicTurnType" };
export type ItemKeyType = 'horse' | 'weapon' | 'book' | 'item';
export type ItemID = string & { zz_t?: "ItemID" };
export type PersonalityType = string & { zz_t?: "PersonalityType" };
export type SpecialityDomesticType = string & { zz_t?: "SpecialityDomesticType" };
export type SpecialityWarType = string & { zz_t?: "SpecialityWarType" };
export const enum NpcType {
user = 0,
user_borrowed_npc = 1,
npc_scenario = 2,
npc_generated = 3,
npc_strategic = 4,
npc_troop_leader = 5,
npc_unselectable = 6,
npc_invader = 9,
}
export const enum StaffLevel {
//지력관직
staffIntel3 = 5,
staffIntel2 = 7,
staffIntel1 = 9,
//무력관직
staffStrength3 = 6,
staffStrength2 = 8,
staffStrength1 = 10,
//참모
staffChief = 11,
//군주
lord = 12,
}
export const enum CityOfficerLevel {
cityLeadership = 2,
cityIntel = 3,
cityStrength = 4,
}
//XXX: const enum의 merge가 없어?
export const enum OfficerLevel {
//재야
none = 0,
//일반
normal = 1,
//도시관직
cityLeadership = CityOfficerLevel.cityLeadership,
cityIntel = CityOfficerLevel.cityIntel,
cityStrength = CityOfficerLevel.cityStrength,
//지력관직
staffIntel3 = StaffLevel.staffIntel3,
staffIntel2 = StaffLevel.staffIntel2,
staffIntel1 = StaffLevel.staffIntel1,
//무력관직
staffStrength3 = StaffLevel.staffStrength3,
staffStrength2 = StaffLevel.staffStrength2,
staffStrength1 = StaffLevel.staffStrength1,
//참모
staffChief = StaffLevel.staffChief,
//군주
lord = StaffLevel.lord,
}
export const enum DiplomaticPermission {
none = 0,
audit = 1,
ambassador = 2,
}
export const enum NationLevel {
방랑군 = 0,
호족 = 1,
군벌 = 2,
주자사 = 3,
주목 = 4,
= 5,
= 6,
황제 = 7,
}
export const enum CityLevel {
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7,
= 8,
}
export const enum FrontStatus {
//출병가능한 도시 없음. 중립.
Neutral = 0,
//전쟁 중인 국가가 인접함
NearWar = 1,
//선포 중인 국가가 인접함
NearDeclare = 2,
//공백지 있음
NearEmpty = 3,
}
export type NationCmdType = string & { zz_t?: "NationCmdType" };
export type StrategicCmdType = string & { zz_t?: "StrategicCmdType" };
//string? const or? Enum?
export type ColorType = string & { zz_t?: "ColorType" };
//XXX: 기존처럼 값 하나만 유지할 것인가?
export const enum CityState {
//일반
normal = 0,
//풍년
goodHarvest = 1,
//호황
commercialBoom = 2,
//혹한
coldWave = 3,
//역병
plague = 4,
//지진
earthquake = 5,
//태풍
typhoon = 6,
//홍수
flood = 7,
//메뚜기 떼
locust = 8,
//도적
thief = 9,
}
//NOTE: PHP버전과 수치가 다름
export const enum DiplomacyState{
//중립
neutral = 0,
//선포중
declare = 1,
//전쟁중
war = 2,
//불가침
inviolable = 7,
}
/* 전용 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;
export interface ReservedTurn {
action: string;
arg: Record<string, unknown>;
brief: string;
}
//특수 숫자 정의
//연 * 12 + 월
export type IntYearMonth = number & { zz_t?: "YearMonth" };
export type RemainMonth = number & { zz_t?: "RemainMonth" };
//1.0을 기준으로한 number 타입
export type Ratio = number & { zz_t?: "Ratio" };