fix: 본인이 아닌 수뇌자리에도 부대장 발령 표기

This commit is contained in:
2022-07-10 21:27:34 +09:00
parent 94bb96d208
commit 50b1db75f0
5 changed files with 75 additions and 42 deletions
@@ -0,0 +1,30 @@
import type { GameConstStore } from "@/GameConstStore";
import { unwrap } from "@/util/unwrap";
import { pick as josaPick } from "@/util/JosaUtil";
import type { TurnObj } from "@/defs";
export function postFilterNationCommandGen<T extends TurnObj>(troopList: Record<number, string>, gameConst: GameConstStore){
return function(turnObj: T): T{
if(turnObj.action != 'che_발령'){
return turnObj;
}
const destGeneralID = unwrap(turnObj.arg.destGeneralID);
if(!(destGeneralID in troopList)){
return turnObj;
}
const troopName = troopList[destGeneralID];
const destCityID = unwrap(turnObj.arg.destCityID);
const destCityName = gameConst.cityConst[destCityID].name;
const josaRo = josaPick(destCityName, "로");
const brief = `${troopName}》【${destCityName}${josaRo} 발령`;
const tooltip = `${troopName}${turnObj.brief}`;
return {
...turnObj,
brief,
tooltip,
}
}
}