game, feat: 턴 시간 지정 방식을 30단계 중 선택하도록 변경

- 1분서버인 경우 120초 단위로
- 유산포인트 3000 -> 2500
This commit is contained in:
2024-02-24 11:21:04 +00:00
parent faff3f4e6a
commit a96c2312d0
4 changed files with 62 additions and 75 deletions
+10 -7
View File
@@ -54,7 +54,7 @@ class Join extends \sammo\BaseAPI
'leadership',
'strength',
'intel',
'inheritTurntime',
'inheritTurntimeZone',
])
->rule('boolean', [
'pic'
@@ -72,7 +72,8 @@ class Join extends \sammo\BaseAPI
], GameConst::$defaultStatMax)
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']))
->rule('in', 'inheritSpecial', GameConst::$availableSpecialWar)
->rule('min', 'inheritTurntime', 0)
->rule('min', 'inheritTurntimeZone', 0)
->rule('max', 'inheritTurntimeZone', 29)
->rule('in', 'inheritCity', array_keys(CityConst::all()))
->rule('integerArray', 'inheritBonusStat');
@@ -139,11 +140,11 @@ class Join extends \sammo\BaseAPI
$intel = $this->args['intel'];
$inheritSpecial = $this->args['inheritSpecial'] ?? null;
$inheritTurntime = $this->args['inheritTurntime'] ?? null;
$inheritTurntimeZone = $this->args['inheritTurntimeZone'] ?? null;
$inheritCity = $this->args['inheritCity'] ?? null;
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
if ($inheritTurntime !== null && $inheritCity !== null) {
if ($inheritTurntimeZone !== null && $inheritCity !== null) {
return '턴과 도시를 동시에 지정할 수 없습니다.';
}
@@ -235,7 +236,7 @@ class Join extends \sammo\BaseAPI
if ($inheritSpecial !== null) {
$inheritRequiredPoint += GameConst::$inheritBornSpecialPoint;
}
if ($inheritTurntime !== null) {
if ($inheritTurntimeZone !== null) {
$inheritRequiredPoint += GameConst::$inheritBornTurntimePoint;
}
@@ -350,12 +351,14 @@ class Join extends \sammo\BaseAPI
$experience *= 0.8;
}
if ($inheritTurntime !== null) {
$inheritTurntime = $inheritTurntime % ($admin['turnterm'] * 60);
if ($inheritTurntimeZone !== null) {
$inheritTurntime = $inheritTurntimeZone * ($admin['turnterm'] * 2);
$inheritTurntime += $rng->nextRangeInt(0, Util::clamp($admin['turnterm'] * 2 - 1, 0));
$userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime % 60), "inheritPoint");
$inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000;
$turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm']));
$turntime = $turntime->add(TimeUtil::secondsToDateInterval($inheritTurntime));
$turntime = TimeUtil::format($turntime, true);
+1 -1
View File
@@ -216,7 +216,7 @@ class GameConstBase
public static $minMonthToAllowInheritItem = 4;
public static $inheritBornSpecialPoint = 6000;
public static $inheritBornTurntimePoint = 3000;
public static $inheritBornTurntimePoint = 2500;
public static $inheritBornCityPoint = 1000;
public static $inheritBornStatPoint = 1000;
public static $inheritItemUniqueMinPoint = 5000;
+50 -66
View File
@@ -186,58 +186,45 @@
</div>
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
<div class="a-center">
<label> <input v-model="inheritTurnTimeSet" type="checkbox" /> 시간 </label>
</div>
<div class="row turn_time_pad">
<div class="col col-lg-4 offset-lg-3 col-4 offset-3">
<NumberInputWithInfo
v-model="inheritTurnTimeMinute"
:readonly="!inheritTurnTimeSet"
:min="0"
:max="turnterm - 1"
:right="true"
title="분"
/>
</div>
<div class="col col-lg-4 col-4">
<NumberInputWithInfo
v-model="inheritTurnTimeSecond"
:readonly="!inheritTurnTimeSet"
:min="0"
:max="60"
:right="true"
title="초"
/>
<div class="row">
<div class="col col-6 a-right align-self-center"> 시간 </div>
<div class="col col-6 align-self-center">
<select v-model.number="inheritTurnTimeZone" class="form-select form-inline" style="max-width: 24ch">
<option :value="undefined">사용안함</option>
<option v-for="(zone, idx) in turnTimeZoneList" :key="idx" :value="idx">
{{ zone }}
</option>
</select>
</div>
</div>
</div>
<div class="col col-lg-6 col-12 p-2">
<div class="a-center">추가 능력치 고정</div>
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
<div class="row">
<div class="col col-6 a-right align-self-center">추가 능력치 고정(//)</div>
<div class="col col-6 align-self-center">
<div class="row g-1">
<div class="col">
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]"
:max="stats.bonusMax"
title="통솔"
/>
</div>
<div class="col">
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]"
:max="stats.bonusMax"
title="무력"
/>
</div>
<div class="col">
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]"
:max="stats.bonusMax"
title="지력"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -284,7 +271,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
import { getIconPath } from "@util/getIconPath";
import { isBrightColor } from "@util/isBrightColor";
import { abilityLeadint, abilityLeadpow, abilityPowint, abilityRand } from "@util/generalStats";
import { shuffle, sum } from "lodash-es";
import { range, shuffle, sum } from "lodash-es";
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
import { SammoAPI } from "./SammoAPI";
import type { JoinArgs } from "./defs/API/General";
@@ -378,7 +365,7 @@ watch(gameConstStore, (gameConst) => {
inheritCity: undefined,
inheritBonusStat: [0, 0, 0],
inheritSpecial: undefined,
inheritTurntime: undefined,
inheritTurntimeZone: undefined,
};
});
@@ -462,7 +449,7 @@ const inheritRequiredPoint = computed(() => {
if (args.value.inheritSpecial !== undefined) {
inheritRequiredPoint += gameConst.inheritBornSpecialPoint;
}
if (args.value.inheritTurntime !== undefined) {
if (args.value.inheritTurntimeZone !== undefined) {
inheritRequiredPoint += gameConst.inheritBornTurntimePoint;
}
if (args.value.inheritBonusStat !== undefined && sum(args.value.inheritBonusStat) != 0) {
@@ -494,21 +481,41 @@ watch(inheritCity, (newValue: undefined | number) => {
args.value.inheritCity = inheritCity.value;
});
const inheritTurnTimeSet = ref(false);
watch(inheritTurnTimeSet, (newValue: boolean) => {
if (!args.value) throw "nyc";
if (!newValue) {
args.value.inheritTurntime = undefined;
return;
const inheritTurnTimeZone = ref<number>();
const turnTimeZoneList: string[] = (()=>{
const result: string[] = [];
const zoneSec = turnterm * (60 / 30); // 1 / 60
let zoneCur = 0;
for(const idx of range(30)){
const zoneNext = zoneCur + zoneSec;
const zoneCurMin = Math.floor(zoneCur / 60);
const zoneCurSec = zoneCur % 60;
const zoneCurText = `${zoneCurMin.toString().padStart(2, "0")}:${zoneCurSec.toString().padStart(2, "0")}.000`;
const zoneCurEnd = zoneCur + zoneSec - 1;
const zoneCurEndMin = Math.floor(zoneCurEnd / 60);
const zoneCurEndSec = zoneCurEnd % 60;
const zoneCurEndText = `${zoneCurEndMin.toString().padStart(2, "0")}:${zoneCurEndSec.toString().padStart(2, "0")}.999`;
// aa:bb.000 ~ cc:dd.999
const zoneStr = `${zoneCurText} ~ ${zoneCurEndText}`;
result.push(zoneStr);
zoneCur = zoneNext;
}
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + inheritTurnTimeSecond.value;
return result;
})();
watch(inheritTurnTimeZone, (newValue: undefined | number) => {
if (!args.value) throw "nyc";
args.value.inheritTurntimeZone = inheritTurnTimeZone.value;
});
watch(
[inheritCity, inheritTurnTimeSet],
([newInheritCity, newInheritTurnTimeSet], [oldInheritCity, oldInheritTurnTimeSet]) => {
if (newInheritCity === undefined || newInheritTurnTimeSet === false) {
[inheritCity, inheritTurnTimeZone],
([newInheritCity, newInheritTurnTimeZone], [oldInheritCity, oldInheritTurnTimeZone]) => {
if (newInheritCity === undefined || newInheritTurnTimeZone === undefined) {
return;
}
alert("도시와 턴 시간을 동시에 설정할 수 없습니다.");
@@ -516,33 +523,14 @@ watch(
if (newInheritCity !== oldInheritCity) {
inheritCity.value = undefined;
}
if (newInheritTurnTimeSet !== oldInheritTurnTimeSet) {
inheritTurnTimeSet.value = false;
if (newInheritTurnTimeZone !== oldInheritTurnTimeZone) {
inheritTurnTimeZone.value = undefined;
}
},
{ immediate: true }
);
const inheritTurnTimeMinute = ref(0);
watch(inheritTurnTimeMinute, (newValue: number) => {
if (!args.value) throw "nyc";
if (!inheritTurnTimeSet.value) {
args.value.inheritTurntime = undefined;
return;
}
args.value.inheritTurntime = newValue * 60 + inheritTurnTimeSecond.value;
});
const inheritTurnTimeSecond = ref(0);
watch(inheritTurnTimeSecond, (newValue: number) => {
if (!args.value) throw "nyc";
if (!inheritTurnTimeSet.value) {
args.value.inheritTurntime = undefined;
return;
}
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + newValue;
});
</script>
<style lang="scss">
@import "@scss/common/base.scss";
@@ -569,10 +557,6 @@ watch(inheritTurnTimeSecond, (newValue: number) => {
.col-form-label {
text-align: right;
}
.turn_time_pad .col-form-label {
text-align: left;
}
</style>
<style lang="scss" scoped>
+1 -1
View File
@@ -6,7 +6,7 @@ export type JoinArgs = {
pic: boolean;
character: string;
inheritSpecial?: string;
inheritTurntime?: number;
inheritTurntimeZone?: number;
inheritCity?: number;
inheritBonusStat?: [number, number, number];
};