frontend: 기술 제한 표기 수정
This commit is contained in:
@@ -170,7 +170,7 @@ import { joinYearMonth } from "@/util/joinYearMonth";
|
||||
import { parseYearMonth } from "@/util/parseYearMonth";
|
||||
import type { GameConstStore } from "@/GameConstStore";
|
||||
import { unwrap_err } from "@/util/unwrap_err";
|
||||
import { getMaxRelativeTechLevel, TECH_LEVEL_YEAR_GAP } from "@/utilGame/techLevel";
|
||||
import { getMaxRelativeTechLevel } from "@/utilGame/techLevel";
|
||||
import { deviceType } from "detect-it";
|
||||
import MapCityBasic from "./MapCityBasic.vue";
|
||||
import MapCityDetail from "./MapCityDetail.vue";
|
||||
@@ -289,12 +289,14 @@ const titleTooltip = computed(()=>{
|
||||
const { startYear, year } = mapData.value;
|
||||
|
||||
const maxTechLevel = gameConstStore.value.gameConst.maxTechLevel;
|
||||
const currentTechLimit = getMaxRelativeTechLevel(startYear, year, maxTechLevel);
|
||||
const initialAllowedTechLevel = gameConstStore.value.gameConst.initialAllowedTechLevel;
|
||||
const techLevelIncYear = gameConstStore.value.gameConst.techLevelIncYear;
|
||||
const currentTechLimit = getMaxRelativeTechLevel(startYear, year, maxTechLevel, initialAllowedTechLevel, techLevelIncYear);
|
||||
|
||||
if (currentTechLimit == maxTechLevel) {
|
||||
result.push(`기술등급 제한 : ${currentTechLimit}등급 (최종)`);
|
||||
} else {
|
||||
const nextTechLimitYear = currentTechLimit * TECH_LEVEL_YEAR_GAP + startYear;
|
||||
const nextTechLimitYear = currentTechLimit * techLevelIncYear + startYear;
|
||||
result.push(`기술등급 제한 : ${currentTechLimit}등급 (${nextTechLimitYear}년 해제)`);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,9 +124,12 @@ watch(
|
||||
(nation) => {
|
||||
const { startyear, year } = global.value;
|
||||
console.log(gameConstStore);
|
||||
maxTechLevel.value = getMaxRelativeTechLevel(startyear, year, gameConstStore.value.gameConst.maxTechLevel);
|
||||
|
||||
const initialAllowedTechLevel = gameConstStore.value.gameConst.initialAllowedTechLevel;
|
||||
const techLevelIncYear = gameConstStore.value.gameConst.techLevelIncYear;
|
||||
maxTechLevel.value = getMaxRelativeTechLevel(startyear, year, gameConstStore.value.gameConst.maxTechLevel, initialAllowedTechLevel, techLevelIncYear);
|
||||
currentTechLevel.value = convTechLevel(nation.tech, maxTechLevel.value);
|
||||
onTechLimit.value = isTechLimited(startyear, year, nation.tech, gameConstStore.value.gameConst.maxTechLevel);
|
||||
onTechLimit.value = isTechLimited(startyear, year, nation.tech, gameConstStore.value.gameConst.maxTechLevel, initialAllowedTechLevel, techLevelIncYear);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
@@ -57,6 +57,9 @@ export type GameConstType = {
|
||||
maxTechLevel: number;
|
||||
maxBetrayCnt: number;
|
||||
|
||||
techLevelIncYear: number;
|
||||
initialAllowedTechLevel: number;
|
||||
|
||||
basePopIncreaseAmount: number;
|
||||
expandCityPopIncreaseAmount: number;
|
||||
expandCityDevelIncreaseAmount: number;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
|
||||
import { clamp } from "lodash-es";
|
||||
|
||||
export const TECH_LEVEL_YEAR_GAP = 5;
|
||||
export const TECH_LEVEL_STEP = 1000;
|
||||
|
||||
export function isTechLimited(startYear: number, year: number, tech: number, maxTechLevel: number): boolean {
|
||||
const relMaxTech = getMaxRelativeTechLevel(startYear, year, maxTechLevel);
|
||||
export function isTechLimited(startYear: number, year: number, tech: number, maxTechLevel: number, initialAllowedTechLevel: number, techLevelIncYear: number): boolean {
|
||||
const relMaxTech = getMaxRelativeTechLevel(startYear, year, maxTechLevel, initialAllowedTechLevel, techLevelIncYear);
|
||||
const techLevel = convTechLevel(tech, maxTechLevel);
|
||||
|
||||
return techLevel >= relMaxTech;
|
||||
@@ -16,7 +15,7 @@ export function convTechLevel(tech: number, maxTechLevel: number): number{
|
||||
}
|
||||
|
||||
|
||||
export function getMaxRelativeTechLevel(startYear: number, year: number, maxTechLevel: number): number {
|
||||
export function getMaxRelativeTechLevel(startYear: number, year: number, maxTechLevel: number, initialAllowedTechLevel: number, techLevelIncYear: number): number {
|
||||
const relYear = year - startYear;
|
||||
return clamp(Math.floor(relYear / TECH_LEVEL_YEAR_GAP) + 1, 1, maxTechLevel);
|
||||
return clamp(Math.floor(relYear / techLevelIncYear) + initialAllowedTechLevel, 1, maxTechLevel);
|
||||
}
|
||||
Reference in New Issue
Block a user