용어 재정의

This commit is contained in:
2024-03-11 16:53:44 +00:00
parent 21a9fc54f3
commit 28b78e0872
17 changed files with 100 additions and 95 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import type { IResourceController } from "@/IResourceController.js"; import type { IResourceController } from "@/IResourceController.js";
import type { CityID, GeneralID, NationID, TroopID } from "@/defs.js"; import type { CityID, GeneralID, NationID, SquadID } from "@/defs.js";
import { NotYetImplemented } from "@sammo/util"; import { NotYetImplemented } from "@sammo/util";
@@ -10,7 +10,7 @@ export function setDefenceTrained(invoker: QueueType, arg: { generalID: GeneralI
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
export function kickTroopMember(invoker: QueueType, arg: { nationID: NationID, troopID: TroopID, memberID: GeneralID }, rsc: IResourceController): void { export function kickSquadMember(invoker: QueueType, arg: { nationID: NationID, squadID: SquadID, memberID: GeneralID }, rsc: IResourceController): void {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
@@ -51,7 +51,7 @@ export type ActionPackDef = {
export const ActionRequestList = { export const ActionRequestList = {
setDefenceTrained, setDefenceTrained,
kickTroopMember, kickSquadMember,
blockAttackCommand, blockAttackCommand,
blockJoinNation, blockJoinNation,
createGeneral, createGeneral,
+10 -5
View File
@@ -1,4 +1,4 @@
import type { CityID, CityLevel, CityName, CityOfficerLevel, CityState, FrontStatus, NationID, RegionID } from "../defs.js"; import type { CityID, CityLevel, CityName, CityOfficerLevel, CityState, FrontStatus, NationID, FractionalRange, RegionID, RemainMonth } from "../defs.js";
export interface ICityEntity{ export interface ICityEntity{
@@ -9,7 +9,7 @@ export interface ICityEntity{
level: CityLevel; level: CityLevel;
//보급품 있음 //보급품 있음
hasSupply: boolean; isSupplied: boolean;
//도시 접경 상태 //도시 접경 상태
frontStatus: FrontStatus; frontStatus: FrontStatus;
@@ -60,15 +60,20 @@ export interface ICityEntity{
battleDeath: number; battleDeath: number;
//상인 존재 및 거래율, base 1 //상인 존재 및 거래율, base 1
trader?: number; traderStatus: {
exists: false;
} | {
exists: true;
rate: FractionalRange;
}
officerSet: Record<CityOfficerLevel, boolean>; officerAssignability: Record<CityOfficerLevel, boolean>;
regionID: RegionID; regionID: RegionID;
state: CityState; state: CityState;
//전투 잔여 개월 //전투 잔여 개월
remainWarMonth: number; remainWarMonth: RemainMonth;
//국가별 수비병 사살 수 //국가별 수비병 사살 수
conflict: Record<NationID, number>; conflict: Record<NationID, number>;
+2 -2
View File
@@ -21,8 +21,8 @@ export interface IDiplomaticLetter {
icon: string; icon: string;
}; };
textBrief: string; publicText: string;
textDetail: string; privateText: string;
createdAt: Date; createdAt: Date;
updatedAt: Date; updatedAt: Date;
@@ -13,7 +13,7 @@ export interface IGameEnvEntity {
year: number; year: number;
month: number; month: number;
turntermSec: number; secondsPerTurn: number;
refreshedKillTurn: number; refreshedKillTurn: number;
@@ -32,7 +32,7 @@ export interface IGameEnvEntity {
maxNationCnt: number; maxNationCnt: number;
remainGeniusCnt: number; remainGeniusCnt: number;
autorunUserPolicy: Record<string, unknown>; autoRunUserPolicy: Record<string, unknown>;
//게임 외부는 다른 엔티티로 분리 //게임 외부는 다른 엔티티로 분리
} }
@@ -1,4 +1,4 @@
import type { CityID, DiplomaticPermission, GeneralID, GeneralName, ItemID, ItemKeyType, NationID, NpcType, OfficerLevel, PersonalityType, SpecialityDomesticType, SpecialityWarType, TroopID, UserID, UserName } from "../defs.js"; import type { CityID, DiplomaticPermission, GeneralID, GeneralName, ItemID, ItemKeyType, NationID, NpcType, OfficerLevel, PersonalityType, SpecialityDomesticType, SpecialityWarType, SquadID, UserID, UserName } from "../defs.js";
export interface IGeneralEntity { export interface IGeneralEntity {
id: GeneralID; id: GeneralID;
@@ -10,7 +10,7 @@ export interface IGeneralEntity {
ownerName?: UserName; ownerName?: UserName;
nationID: NationID; nationID: NationID;
cityID: number; cityID: number;
troopID?: TroopID; squadID?: SquadID;
leadership: number; leadership: number;
leadershipExp: number; leadershipExp: number;
@@ -27,7 +27,7 @@ export interface IGeneralEntity {
experienceLevel: number; experienceLevel: number;
dedicationLevel: number; dedicationLevel: number;
dex: number[]; armyClassExperience: number[];
officerLevel: OfficerLevel; officerLevel: OfficerLevel;
officerCityID?: CityID; officerCityID?: CityID;
@@ -59,8 +59,8 @@ export interface IGeneralEntity {
defenceTrained: number; defenceTrained: number;
crewType: number; armyType: number;
crew: number; armyCount: number;
trained: number; trained: number;
morale: number; morale: number;
+3 -3
View File
@@ -1,4 +1,4 @@
import type { CityID, ColorType, IntYearMonth, NationCmdType, NationID, NationLevel, NationName, NationType, RemainMonth, ReservedTurn, StaffLevel, StrategicCmdType } from "../defs.js"; import type { CityID, ColorType, IntYearMonth, NationCmdType, NationID, NationLevel, NationName, NationType, FractionalRange, RemainMonth, ReservedTurn, StaffLevel, StrategicCmdType } from "../defs.js";
export interface INationEntity{ export interface INationEntity{
id: NationID; id: NationID;
@@ -20,9 +20,9 @@ export interface INationEntity{
strategicCmdLimit: Record<StrategicCmdType, IntYearMonth>; strategicCmdLimit: Record<StrategicCmdType, IntYearMonth>;
//세율 //세율
taxRate: number; taxRate: FractionalRange;
//지급율 //지급율
payRate: number; payRate: FractionalRange;
gold: number; gold: number;
rice: number; rice: number;
@@ -19,7 +19,7 @@ export interface IHistory {
cities: Map<CityID, { cities: Map<CityID, {
nationID: NationID; nationID: NationID;
name: string; name: string;
hasSupply: boolean; isSupplied: boolean;
level: CityLevel; level: CityLevel;
state: CityState; state: CityState;
@@ -16,7 +16,7 @@ export interface OldGeneral {
general: IGeneralEntity; general: IGeneralEntity;
rank: IGeneralRankEntity; rank: IGeneralRankEntity;
troopName?: string; squadName?: string;
cityBasic: { cityBasic: {
name: string; name: string;
level: CityLevel; level: CityLevel;
+3 -3
View File
@@ -1,7 +1,7 @@
import type { NationID, TroopID } from "../defs.js"; import type { NationID, SquadID } from "../defs.js";
export interface ITroopEntity { export interface ISquadEntity {
id: TroopID; id: SquadID;
nationID: NationID; nationID: NationID;
name: string; name: string;
} }
+3 -3
View File
@@ -2,19 +2,19 @@ import type { ValuesOf } from '@sammo/util';
import type { ICityEntity } from './CityEntity.js'; import type { ICityEntity } from './CityEntity.js';
import type { IGeneralEntity } from './GeneralEntity.js'; import type { IGeneralEntity } from './GeneralEntity.js';
import type { INationEntity } from './NationEntity.js'; import type { INationEntity } from './NationEntity.js';
import type { ITroopEntity } from './TroopEntity.js'; import type { ISquadEntity } from './SquadEntity.js';
import type { IGameEnvEntity } from './GameEnvEntity.js'; import type { IGameEnvEntity } from './GameEnvEntity.js';
export type { IGeneralEntity } from './GeneralEntity.js'; export type { IGeneralEntity } from './GeneralEntity.js';
export type { ICityEntity } from './CityEntity.js'; export type { ICityEntity } from './CityEntity.js';
export type { ITroopEntity } from './TroopEntity.js'; export type { ISquadEntity } from './SquadEntity.js';
export type { INationEntity } from './NationEntity.js'; export type { INationEntity } from './NationEntity.js';
export type ValidEntityList = { export type ValidEntityList = {
'Nation': INationEntity; 'Nation': INationEntity;
'City': ICityEntity; 'City': ICityEntity;
'Troop': ITroopEntity; 'Squad': ISquadEntity;
'General': IGeneralEntity; 'General': IGeneralEntity;
'GameEnv': IGameEnvEntity; 'GameEnv': IGameEnvEntity;
+31 -31
View File
@@ -2,23 +2,23 @@ import { InvalidArgument } from "@sammo/util";
import { City } from "./City.js"; import { City } from "./City.js";
import type { IGeneralEntity } from "./Entity/GeneralEntity.js"; import type { IGeneralEntity } from "./Entity/GeneralEntity.js";
import type { IResourceController } from "./IResourceController.js"; import type { IResourceController } from "./IResourceController.js";
import { DiplomaticPermission, type CityID, type GeneralID, type GeneralName, type NationID, OfficerLevel, type TroopID } from "./defs.js"; import { DiplomaticPermission, type CityID, type GeneralID, type GeneralName, type NationID, OfficerLevel, type SquadID } from "./defs.js";
import { must } from "@sammo/util"; import { must } from "@sammo/util";
import { Nation } from "./Nation.js"; import { Nation } from "./Nation.js";
import { Troop } from "./Troop.js"; import { Squad } from "./Squad.js";
import { LazyEntityUpdater } from "./LazyEntityUpdater.js"; import { LazyEntityUpdater } from "./LazyEntityUpdater.js";
import type { IAction, IActionKey } from "./IAction.js"; import type { IAction, IActionKey } from "./IAction.js";
import { addSeconds } from "date-fns"; import { addSeconds } from "date-fns";
export class General extends LazyEntityUpdater<IGeneralEntity> { export class General extends LazyEntityUpdater<IGeneralEntity> {
protected readonly _indirectNames: (keyof IGeneralEntity)[] = [ protected readonly _indirectNames: (keyof IGeneralEntity)[] = [
"id", "nationID", "troopID", "nationID", "turntime" "id", "nationID", "squadID", "nationID", "turntime"
]; ];
protected readonly _entityType = "General"; protected readonly _entityType = "General";
protected readonly _raw: IGeneralEntity; protected readonly _raw: IGeneralEntity;
protected _city: WeakRef<City>; protected _city: WeakRef<City>;
protected _troop: WeakRef<Troop> | undefined; protected _squad: WeakRef<Squad> | undefined;
protected _nation: WeakRef<Nation>; protected _nation: WeakRef<Nation>;
protected readonly iActionHandlers: Map<IActionKey, IAction>; protected readonly iActionHandlers: Map<IActionKey, IAction>;
@@ -32,8 +32,8 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
this._city = new WeakRef(must(rsc.city(raw.cityID))); this._city = new WeakRef(must(rsc.city(raw.cityID)));
this._nation = new WeakRef(must(rsc.nation(raw.nationID))); this._nation = new WeakRef(must(rsc.nation(raw.nationID)));
if(raw.troopID){ if(raw.squadID){
this._troop = new WeakRef(must(rsc.troop(raw.troopID, raw.nationID))); this._squad = new WeakRef(must(rsc.squad(raw.squadID, raw.nationID)));
} }
//TODO: iAction 처리해야함 //TODO: iAction 처리해야함
@@ -52,8 +52,8 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
return must(this._city.deref()); return must(this._city.deref());
} }
public get troop(): Troop | undefined { public get squad(): Squad | undefined {
return this._troop?.deref(); return this._squad?.deref();
} }
public get nation(): Nation { public get nation(): Nation {
@@ -79,43 +79,43 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
}); });
} }
public quitTroop(){ public quitSquad(){
if(!this._troop){ if(!this._squad){
return; return;
} }
const troop = must(this._troop.deref()); const squad = must(this._squad.deref());
if(troop.leader.id === this._raw.id){ if(squad.leader.id === this._raw.id){
troop.destructTroop(false); squad.destructSquad(false);
} }
else{ else{
troop.members.delete(this._raw.id); squad.members.delete(this._raw.id);
} }
this._troop = undefined; this._squad = undefined;
this.forceUpdate((raw) => { this.forceUpdate((raw) => {
raw.troopID = undefined; raw.squadID = undefined;
}); });
} }
public changeTroop(troop: TroopID | Troop){ public changeSquad(squad: SquadID | Squad){
this.quitTroop(); this.quitSquad();
const troopObj: Troop = (()=>{ const squadObj: Squad = (()=>{
if(troop instanceof Troop){ if(squad instanceof Squad){
return troop; return squad;
} }
const troopObj = this.rsc.troop(troop, this._raw.nationID); const squadObj = this.rsc.squad(squad, this._raw.nationID);
if(!troopObj){ if(!squadObj){
throw new InvalidArgument(`Troop not found: ${troop}`); throw new InvalidArgument(`Squad not found: ${squad}`);
} }
return troopObj; return squadObj;
})(); })();
troopObj.members.set(this._raw.id, new WeakRef(this)); squadObj.members.set(this._raw.id, new WeakRef(this));
this._troop = new WeakRef(troopObj); this._squad = new WeakRef(squadObj);
this.forceUpdate((raw) => { this.forceUpdate((raw) => {
raw.troopID = troopObj.id; raw.squadID = squadObj.id;
}); });
} }
@@ -131,7 +131,7 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
return nationObj; return nationObj;
})(); })();
this._nation = new WeakRef(nationObj); this._nation = new WeakRef(nationObj);
this.quitTroop(); this.quitSquad();
this.forceUpdate((raw) => { this.forceUpdate((raw) => {
raw.nationID = nationObj.id; raw.nationID = nationObj.id;
@@ -147,10 +147,10 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
} }
public updateTurntime(){ public updateTurntime(){
const turntermSec = this.rsc.gameEnv().raw.turntermSec; const secondsPerTurn = this.rsc.gameEnv().raw.secondsPerTurn;
this.forceUpdate((raw) => { this.forceUpdate((raw) => {
raw.turntime = addSeconds(raw.turntime, turntermSec); raw.turntime = addSeconds(raw.turntime, secondsPerTurn);
}); });
} }
+1 -1
View File
@@ -30,7 +30,7 @@ export const IActionOrder = [
'specialityDomestic', 'specialityDomestic',
'specialityWar', 'specialityWar',
'personlity', 'personlity',
'crewType', 'armyType',
'inheritBuff', 'inheritBuff',
'scenarioEffect', 'scenarioEffect',
'horse', 'horse',
+8 -8
View File
@@ -1,11 +1,11 @@
import type { General } from "./General.js"; import type { General } from "./General.js";
import type { City } from "./City.js"; import type { City } from "./City.js";
import type { Nation } from "./Nation.js"; import type { Nation } from "./Nation.js";
import type { CityID, GeneralID, NationID, ReservedTurn, TroopID } from "./defs.js"; import type { CityID, GeneralID, NationID, ReservedTurn, SquadID } from "./defs.js";
import type { GameEnv } from "./GameEnv.js"; import type { GameEnv } from "./GameEnv.js";
import type { IGeneralEntity } from "./Entity/GeneralEntity.js"; import type { IGeneralEntity } from "./Entity/GeneralEntity.js";
import type { Troop } from "./Troop.js"; import type { Squad } from "./Squad.js";
import type { ITroopEntity } from "./Entity/TroopEntity.js"; import type { ISquadEntity } from "./Entity/SquadEntity.js";
import type { LazyEntityUpdater } from "./LazyEntityUpdater.js"; import type { LazyEntityUpdater } from "./LazyEntityUpdater.js";
import type { ICityEntity } from "./Entity/CityEntity.js"; import type { ICityEntity } from "./Entity/CityEntity.js";
import type { INationEntity } from "./Entity/NationEntity.js"; import type { INationEntity } from "./Entity/NationEntity.js";
@@ -15,7 +15,7 @@ export interface IResourceController {
nation(id: NationID): Nation | undefined; nation(id: NationID): Nation | undefined;
city(id: CityID): City | undefined; city(id: CityID): City | undefined;
troop(id: TroopID, nation: NationID): Troop | undefined; squad(id: SquadID, nation: NationID): Squad | undefined;
general(id: GeneralID): General | undefined; general(id: GeneralID): General | undefined;
peekGeneralTurntimeQueue(): General | undefined; peekGeneralTurntimeQueue(): General | undefined;
@@ -27,16 +27,16 @@ export interface IResourceController {
allNations(): Map<NationID, Nation>; allNations(): Map<NationID, Nation>;
allCities(): Map<CityID, City>; allCities(): Map<CityID, City>;
allCitiesByNation(): Map<NationID, Map<CityID, City>>; allCitiesByNation(): Map<NationID, Map<CityID, City>>;
allTroops(): Map<NationID, Map<TroopID, Troop>>; allSquads(): Map<NationID, Map<SquadID, Squad>>;
allGenerals(): Map<GeneralID, General>; allGenerals(): Map<GeneralID, General>;
generalByNation(id: NationID): Map<GeneralID, General>; generalByNation(id: NationID): Map<GeneralID, General>;
generalByCity(id: CityID, nationID?: NationID): Map<GeneralID, General>; generalByCity(id: CityID, nationID?: NationID): Map<GeneralID, General>;
generalByTroop(id: TroopID): Map<GeneralID, General>; generalBySquad(id: SquadID): Map<GeneralID, General>;
cityByNation(id: NationID): Map<CityID, City>; cityByNation(id: NationID): Map<CityID, City>;
troopByNation(id: NationID): Map<TroopID, Troop>; squadByNation(id: NationID): Map<SquadID, Squad>;
//----Insert, Update, Delete //----Insert, Update, Delete
@@ -49,7 +49,7 @@ export interface IResourceController {
//TODO: reserveInsert와 구현 방식 비교 //TODO: reserveInsert와 구현 방식 비교
createGeneral(raw: IGeneralEntity): General; createGeneral(raw: IGeneralEntity): General;
createNation(raw: INationEntity): Nation; createNation(raw: INationEntity): Nation;
createTroop(raw: ITroopEntity): Troop; createSquad(raw: ISquadEntity): Squad;
_getAllChanges(): Record< _getAllChanges(): Record<
@@ -1,25 +1,25 @@
import { must } from "@sammo/util"; import { must } from "@sammo/util";
import type { General } from "./General.js"; import type { General } from "./General.js";
import type { IResourceController } from "./IResourceController.js"; import type { IResourceController } from "./IResourceController.js";
import type { ITroopEntity } from "./Entity/TroopEntity.js"; import type { ISquadEntity } from "./Entity/SquadEntity.js";
import type { GeneralID } from "./defs.js"; import type { GeneralID } from "./defs.js";
import { LazyEntityUpdater } from "./LazyEntityUpdater.js"; import { LazyEntityUpdater } from "./LazyEntityUpdater.js";
export class Troop extends LazyEntityUpdater<ITroopEntity> { export class Squad extends LazyEntityUpdater<ISquadEntity> {
protected readonly _indirectNames: (keyof ITroopEntity)[] = ["id"]; protected readonly _indirectNames: (keyof ISquadEntity)[] = ["id"];
protected readonly _entityType = "Troop"; protected readonly _entityType = "Squad";
protected readonly _raw: ITroopEntity; protected readonly _raw: ISquadEntity;
private _leader: WeakRef<General>; private _leader: WeakRef<General>;
private _members: Map<GeneralID, WeakRef<General>>; private _members: Map<GeneralID, WeakRef<General>>;
constructor( constructor(
raw: ITroopEntity, raw: ISquadEntity,
protected rsc: IResourceController protected rsc: IResourceController
){ ){
super(); super();
this._raw = raw; this._raw = raw;
const members = rsc.generalByTroop(raw.id); const members = rsc.generalBySquad(raw.id);
const leaderID: GeneralID = raw.id as GeneralID; const leaderID: GeneralID = raw.id as GeneralID;
this._leader = new WeakRef(must(members.get(leaderID))); this._leader = new WeakRef(must(members.get(leaderID)));
members.delete(leaderID); members.delete(leaderID);
@@ -38,13 +38,13 @@ export class Troop extends LazyEntityUpdater<ITroopEntity> {
return this._members; return this._members;
} }
public destructTroop(withLeader = true){ public destructSquad(withLeader = true){
this._members.forEach((member)=>{ this._members.forEach((member)=>{
const general = must(member.deref()); const general = must(member.deref());
general.quitTroop(); general.quitSquad();
}); });
if(withLeader){ if(withLeader){
this.leader.quitTroop(); this.leader.quitSquad();
} }
this.rsc.reserveDelete(this); this.rsc.reserveDelete(this);
@@ -56,6 +56,6 @@ export class Troop extends LazyEntityUpdater<ITroopEntity> {
}); });
} }
//joinTroop은 General에서 처리 //joinSquad은 General에서 처리
//quitTroop은 General에서 처리 //quitSquad은 General에서 처리
} }
+4 -4
View File
@@ -8,8 +8,8 @@ export type GeneralName = string & { zz_t?: "GeneralName" };
export type CityID = number & { zz_t?: "CityID" }; export type CityID = number & { zz_t?: "CityID" };
export type CityName = string & { zz_t?: "CityName" }; export type CityName = string & { zz_t?: "CityName" };
export type TroopID = number & { zz_t?: "TroopID" }; export type SquadID = number & { zz_t?: "SquadID" };
export type TroopName = string & { zz_t?: "TroopName" }; export type SquadName = string & { zz_t?: "SquadName" };
export type NationID = number & { zz_t?: "NationID" }; export type NationID = number & { zz_t?: "NationID" };
export type NationName = string & { zz_t?: "NationName" }; export type NationName = string & { zz_t?: "NationName" };
@@ -39,7 +39,7 @@ export const enum NpcType {
npc_scenario = 2, npc_scenario = 2,
npc_generated = 3, npc_generated = 3,
npc_strategic = 4, npc_strategic = 4,
npc_troop_leader = 5, npc_squad_leader = 5,
npc_unselectable = 6, npc_unselectable = 6,
npc_invader = 9, npc_invader = 9,
@@ -253,4 +253,4 @@ export interface ReservedTurn {
export type IntYearMonth = number & { zz_t?: "YearMonth" }; export type IntYearMonth = number & { zz_t?: "YearMonth" };
export type RemainMonth = number & { zz_t?: "RemainMonth" }; export type RemainMonth = number & { zz_t?: "RemainMonth" };
//1.0을 기준으로한 number 타입 //1.0을 기준으로한 number 타입
export type Ratio = number & { zz_t?: "Ratio" }; export type FractionalRange = number & { zz_t?: "FractionalRange" };
+1 -1
View File
@@ -1,7 +1,7 @@
import type { RPCLists } from "@sammo/server_util"; import type { RPCLists } from "@sammo/server_util";
import type { ActionRequest, ActionResult } from "./GameEngine.js"; import type { ActionRequest, ActionResult } from "./GameEngine.js";
import type { MessagePort } from "node:worker_threads"; import type { MessagePort } from "node:worker_threads";
import type { CityID, GeneralID, NationID, TroopID } from "@sammo/game_logic/src/defs.js"; import type { CityID, GeneralID, NationID, SquadID } from "@sammo/game_logic/src/defs.js";
import type { ActionPackDef } from "@sammo/game_logic"; import type { ActionPackDef } from "@sammo/game_logic";
import type { ActionRequestList, QueueType } from "@sammo/game_logic/src/ActionRequest/index.js"; import type { ActionRequestList, QueueType } from "@sammo/game_logic/src/ActionRequest/index.js";
//Remove Third argument. Use Infer //Remove Third argument. Use Infer
+10 -10
View File
@@ -1,16 +1,16 @@
import type { IResourceController } from "@sammo/game_logic"; import type { IResourceController } from "@sammo/game_logic";
import type { City } from "@sammo/game_logic/src/City.js"; import type { City } from "@sammo/game_logic/src/City.js";
import type { CityID, GeneralID, NationID, TroopID } from "@sammo/game_logic/src/defs.js"; import type { CityID, GeneralID, NationID, SquadID } from "@sammo/game_logic/src/defs.js";
import type { IGeneralEntity } from "@sammo/game_logic/src/Entity/GeneralEntity.js"; import type { IGeneralEntity } from "@sammo/game_logic/src/Entity/GeneralEntity.js";
import type { ICityEntity, ValidEntityType } from "@sammo/game_logic/src/Entity/index.js"; import type { ICityEntity, ValidEntityType } from "@sammo/game_logic/src/Entity/index.js";
import type { INationEntity } from "@sammo/game_logic/src/Entity/NationEntity.js"; import type { INationEntity } from "@sammo/game_logic/src/Entity/NationEntity.js";
import type { IReservedTurn } from "@sammo/game_logic/src/Entity/ReservedTurn.js"; import type { IReservedTurn } from "@sammo/game_logic/src/Entity/ReservedTurn.js";
import type { ITroopEntity } from "@sammo/game_logic/src/Entity/TroopEntity.js"; import type { ISquadEntity } from "@sammo/game_logic/src/Entity/SquadEntity.js";
import type { GameEnv } from "@sammo/game_logic/src/GameEnv.js"; import type { GameEnv } from "@sammo/game_logic/src/GameEnv.js";
import { General } from "@sammo/game_logic/src/General.js"; import { General } from "@sammo/game_logic/src/General.js";
import type { LazyEntityUpdater } from "@sammo/game_logic/src/LazyEntityUpdater.js"; import type { LazyEntityUpdater } from "@sammo/game_logic/src/LazyEntityUpdater.js";
import type { Nation } from "@sammo/game_logic/src/Nation.js"; import type { Nation } from "@sammo/game_logic/src/Nation.js";
import type { Troop } from "@sammo/game_logic/src/Troop.js"; import type { Squad } from "@sammo/game_logic/src/Squad.js";
import { insertItemAtArrayLike, NotYetImplemented } from "@sammo/util"; import { insertItemAtArrayLike, NotYetImplemented } from "@sammo/util";
import Denque from "denque"; import Denque from "denque";
import type { Mongoose } from "mongoose"; import type { Mongoose } from "mongoose";
@@ -27,7 +27,7 @@ export class ResourceController implements IResourceController{
private _nation: Map<number, Nation> = new Map(); private _nation: Map<number, Nation> = new Map();
private _city: Map<number, City> = new Map(); private _city: Map<number, City> = new Map();
private _troop: Map<number, Troop> = new Map(); private _squad: Map<number, Squad> = new Map();
private _general: Map<number, General> = new Map(); private _general: Map<number, General> = new Map();
//내부적으로 turntime asc, id asc로 동작하는 PriorityQueue //내부적으로 turntime asc, id asc로 동작하는 PriorityQueue
@@ -38,7 +38,7 @@ export class ResourceController implements IResourceController{
private changes = { private changes = {
Nation: new Map<number, [ChangeType, Nation]>(), Nation: new Map<number, [ChangeType, Nation]>(),
City: new Map<number, [ChangeType, City]>(), City: new Map<number, [ChangeType, City]>(),
Troop: new Map<number, [ChangeType, Troop]>(), Squad: new Map<number, [ChangeType, Squad]>(),
General: new Map<number, [ChangeType, General]>(), General: new Map<number, [ChangeType, General]>(),
GameEnv: new Map<number, [ChangeType, GameEnv]>(), GameEnv: new Map<number, [ChangeType, GameEnv]>(),
@@ -52,7 +52,7 @@ export class ResourceController implements IResourceController{
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
troop(id: TroopID, nation: NationID): Troop | undefined { squad(id: SquadID, nation: NationID): Squad | undefined {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
@@ -88,7 +88,7 @@ export class ResourceController implements IResourceController{
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
allTroops(): Map<NationID, Map<TroopID, Troop>> { allSquads(): Map<NationID, Map<SquadID, Squad>> {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
@@ -104,7 +104,7 @@ export class ResourceController implements IResourceController{
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
generalByTroop(id: TroopID): Map<GeneralID, General> { generalBySquad(id: SquadID): Map<GeneralID, General> {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
@@ -112,7 +112,7 @@ export class ResourceController implements IResourceController{
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
troopByNation(id: NationID): Map<TroopID, Troop> { squadByNation(id: NationID): Map<SquadID, Squad> {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
@@ -139,7 +139,7 @@ export class ResourceController implements IResourceController{
throw new NotYetImplemented(); throw new NotYetImplemented();
} }
createTroop(raw: ITroopEntity): Troop { createSquad(raw: ISquadEntity): Squad {
throw new NotYetImplemented(); throw new NotYetImplemented();
} }