feat: process 징병 페이지

This commit is contained in:
2021-12-21 03:04:44 +09:00
parent b54bf240a0
commit 6003c19b32
10 changed files with 681 additions and 99 deletions
@@ -218,44 +218,4 @@ class che_등용수락 extends Command\GeneralCommand{
return true;
}
public function getForm(): string
{
$db = DB::db();
$destGenerals = [];
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND officer_level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
foreach($destRawGenerals as $destGeneral){
$destNationID = $destGeneral['nation'];
if(!key_exists($destNationID, $destGenerals)){
$destGenerals[$destNationID] = [];
}
$destGenerals[$destNationID] = [$destGeneral];
}
$nationList = array_merge([0=>getNationStaticInfo(0)], getAllNationStaticInfo());
ob_start();
?>
재야나 타국의 장수를 등용합니다.<br>
서신은 개인 메세지로 전달됩니다.<br>
등용할 장수를 목록에서 선택하세요.<br>
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
<?php foreach($nationList as $destNation): ?>
<optgroup style='color:<?=$destNation['color']?>'>【<?=$destNation['name']?>】
<?php foreach($destGenerals[$destNation['nation']]??[] as $destGeneral):
$nameColor = \sammo\getNameColor($destGeneral['npc']);
if($nameColor){
$nameColor = " style='color:{$nameColor}'";
}
?>
<option value='<?=$destGeneral['no']?>' <?=$nameColor?>><?=$destGeneral['name']?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
<?php
return ob_get_clean();
}
}
+102 -3
View File
@@ -18,6 +18,7 @@ use \sammo\ServConfig;
use function \sammo\getTechCall;
use function \sammo\tryUniqueItemLottery;
use function \sammo\getTechAbil;
use function sammo\getTechLevel;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
@@ -231,6 +232,107 @@ class che_징병 extends Command\GeneralCommand
return true;
}
public function exportJSVars(): array
{
$general = $this->generalObj;
$db = DB::db();
[$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $general->getNationID());
if (!$nationLevel) {
$nationLevel = 0;
}
if (!$tech) {
$tech = 0;
}
$year = $this->env['year'];
$startyear = $this->env['startyear'];
$relativeYear = $year - $startyear;
$ownCities = [];
$ownRegions = [];
foreach (DB::db()->query('SELECT city, region from city where nation = %i', $general->getNationID()) as $city) {
$ownCities[$city['city']] = 1;
$ownRegions[$city['region']] = 1;
}
$leadership = $general->getLeadership();
$fullLeadership = $general->getLeadership(false);
$abil = getTechAbil($tech);
$armCrewTypes = [];
foreach (GameUnitConst::allType() as $armType => $armName) {
$armCrewType = [
'armType' => $armType,
'armName' => $armName,
'values' => [],
];
$crewTypes = [];
foreach (GameUnitConst::byType($armType) as $unit) {
$crewObj = new \stdClass;
$crewObj->id = $unit->id;
$crewObj->reqTech = $unit->reqTech;
$crewObj->reqYear = $unit->reqYear;
/*
if ($unit->reqTech == 0) {
$crewObj->bgcolor = 'green';
} else {
$crewObj->bgcolor = 'limegreen';
}
*/
$crewObj->notAvailable = !$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech);
$crewObj->baseRice = $general->onCalcDomestic($this->getName(), 'rice', $unit->riceWithTech($tech), ['armType' => $unit->armType]);
$crewObj->baseCost = $general->onCalcDomestic($this->getName(), 'cost', $unit->costWithTech($tech), ['armType' => $unit->armType]);
$crewObj->name = $unit->name;
$crewObj->attack = $unit->attack + $abil;
$crewObj->defence = $unit->defence + $abil;
$crewObj->speed = $unit->speed;
$crewObj->avoid = $unit->avoid;
if ($this->env['show_img_level'] < 2) {
$crewObj->img = ServConfig::$sharedIconPath . "/default.jpg";
} else {
$crewObj->img = ServConfig::$gameImagePath . "/crewtype" . $unit->id . ".png";
}
$crewObj->info = $unit->info;
$armCrewType['values'][] = $crewObj;
}
$armCrewTypes[] = $armCrewType;
}
$crew = $general->getVar('crew');
$gold = $general->getVar('gold');
$crewTypeObj = $general->getCrewTypeObj();
return [
'procRes' => [
'relYear' => $relativeYear,
'year' => $year,
'tech' => $tech,
'techLevel' => getTechLevel($tech),
'startYear' => $startyear,
'goldCoeff' => static::$costOffset,
'leadership' => $leadership,
'fullLeadership' => $fullLeadership,
'armCrewTypes' => $armCrewTypes,
'currentCrewType' => $crewTypeObj->id,
'crew' => $crew,
'gold' => $gold,
]
];
}
public function getJSPlugins(): array
{
return [
@@ -305,9 +407,6 @@ class che_징병 extends Command\GeneralCommand
$crewObj->img = ServConfig::$gameImagePath . "/crewtype" . $unit->id . ".png";
}
$crewObj->baseRiceShort = round($crewObj->baseRice, 1);
$crewObj->baseCostShort = round($crewObj->baseCost, 1);
$crewObj->info = join('<br>', $unit->info);
+1 -1
View File
@@ -50,7 +50,7 @@ class GameUnitConstBase{
0, null, null, 0,
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8, self::T_SIEGE=>1.2],
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2, self::T_SIEGE=>0.8],
['표준적인 보병입니다.','보병은 방어특화이며, 상대가 회피하기 어렵습니다.'],
['표준적인 보병입니다.','보병은 방어특화이며,','상대가 회피하기 어렵습니다.'],
null, ['che_방어력증가5p']
],
[
+23 -23
View File
@@ -8,8 +8,8 @@ class GameUnitConst extends GameUnitConstBase
protected static $_buildData = [
[
1000, self::T_CASTLE, '성벽',
100, 100, 7, 0, 0, 99, 9,
999999, null, null, 999999,
100, 100, 7, 0, 0, 99, 9,
999999, null, null, 999999,
[],//성벽은 공격할 수 없다.
[self::T_FOOTMAN=>1.2],
['성벽입니다.','생성할 수 없습니다.'],
@@ -18,18 +18,18 @@ class GameUnitConst extends GameUnitConstBase
[
1100, self::T_FOOTMAN, '보병',
100, 150, 7, 10, 0, 9, 9,
0, null, null, 0,
100, 150, 7, 10, 0, 9, 9,
0, null, null, 0,
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8, self::T_SIEGE=>1.2],
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2, self::T_SIEGE=>0.8],
['표준적인 보병입니다.','보병은 방어특화이며, 상대가 회피하기 어렵습니다.'],
['표준적인 보병입니다.','보병은 방어특화이며,','상대가 회피하기 어렵습니다.'],
null, null
],
[
1200, self::T_ARCHER, '궁병',
100, 100, 7, 20, 0, 10, 10,
0, null, null, 0,
1200, self::T_ARCHER, '궁병',
100, 100, 7, 20, 0, 10, 10,
0, null, null, 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['표준적인 궁병입니다.','궁병은 회피특화입니다.'],
@@ -37,9 +37,9 @@ class GameUnitConst extends GameUnitConstBase
],
[
1300, self::T_CAVALRY, '기병',
150, 100, 7, 5, 0, 11, 11,
0, null, null, 0,
1300, self::T_CAVALRY, '기병',
150, 100, 7, 5, 0, 11, 11,
0, null, null, 0,
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>0.8, self::T_SIEGE=>1.2],
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>1.2, self::T_SIEGE=>0.8],
['표준적인 기병입니다.','기병은 공격특화입니다.'],
@@ -47,18 +47,18 @@ class GameUnitConst extends GameUnitConstBase
],
[
1400, self::T_WIZARD, '귀병',
80, 80, 7, 5, 0.5, 9, 9,
0, null, null, 0,
1400, self::T_WIZARD, '귀병',
80, 80, 7, 5, 0.5, 9, 9,
0, null, null, 0,
[self::T_SIEGE=>1.2],
[self::T_SIEGE=>0.8],
['계략을 사용하는 병종입니다.'],
null, null
],
[
1405, self::T_WIZARD, '남귀병',
60, 60, 7, 10, 0.8, 8, 8,
1000, null, null, 0,
1405, self::T_WIZARD, '남귀병',
60, 60, 7, 10, 0.8, 8, 8,
1000, null, null, 0,
[self::T_SIEGE=>1.2],
[self::T_SIEGE=>0.8],
['전투를 포기하고 계략에 몰두합니다.'],
@@ -66,18 +66,18 @@ class GameUnitConst extends GameUnitConstBase
],
[
1500, self::T_SIEGE, '정란',
100, 100, 6, 0, 0, 15, 5,
0, null, null, 3,
1500, self::T_SIEGE, '정란',
100, 100, 6, 0, 0, 15, 5,
0, null, null, 3,
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8, self::T_CASTLE=>1.8],
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
['높은 구조물 위에서 공격합니다.'],
['che_성벽부상무효'], null
],
[
1501, self::T_SIEGE, '충차',
150, 100, 6, 0, 0, 20, 5,
1000, null, null, 3,
1501, self::T_SIEGE, '충차',
150, 100, 6, 0, 0, 20, 5,
1000, null, null, 3,
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8, self::T_CASTLE=>2.4],
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
['엄청난 위력으로 성벽을 부수어버립니다.'],
+29 -29
View File
@@ -8,8 +8,8 @@ class GameUnitConst extends GameUnitConstBase
protected static $_buildData = [
[
1000, self::T_CASTLE, '성벽',
100, 100, 7, 0, 0, 99, 9,
999999, null, null, 999999,
100, 100, 7, 0, 0, 99, 9,
999999, null, null, 999999,
[],//성벽은 공격할 수 없다.
[self::T_FOOTMAN=>1.2],
['성벽입니다.','생성할 수 없습니다.'],
@@ -17,18 +17,18 @@ class GameUnitConst extends GameUnitConstBase
],
[
1100, self::T_FOOTMAN, '보병',
100, 150, 7, 10, 0, 18, 18,
0, null, null, 0,
100, 150, 7, 10, 0, 18, 18,
0, null, null, 0,
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8],
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2],
['표준적인 보병입니다.','보병은 방어특화이며, 상대가 회피하기 어렵습니다.'],
['표준적인 보병입니다.','보병은 방어특화이며,','상대가 회피하기 어렵습니다.'],
null, null
],
[
1200, self::T_ARCHER, '궁병',
100, 100, 7, 20, 0, 20, 20,
0, null, null, 0,
1200, self::T_ARCHER, '궁병',
100, 100, 7, 20, 0, 20, 20,
0, null, null, 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2],
['표준적인 궁병입니다.','궁병은 회피특화입니다.'],
@@ -36,9 +36,9 @@ class GameUnitConst extends GameUnitConstBase
],
[
1300, self::T_CAVALRY, '기병',
150, 100, 7, 5, 0, 22, 22,
0, null, null, 0,
1300, self::T_CAVALRY, '기병',
150, 100, 7, 5, 0, 22, 22,
0, null, null, 0,
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>0.8],
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>1.2],
['표준적인 기병입니다.','기병은 공격특화입니다.'],
@@ -46,18 +46,18 @@ class GameUnitConst extends GameUnitConstBase
],
[
1400, self::T_WIZARD, '귀병',
80, 80, 7, 5, 0.5, 18, 18,
0, null, null, 0,
1400, self::T_WIZARD, '귀병',
80, 80, 7, 5, 0.5, 18, 18,
0, null, null, 0,
[],
[],
['계략을 사용하는 병종입니다.'],
null, null
],
[
1405, self::T_WIZARD, '남귀병',
60, 60, 7, 10, 0.8, 16, 16,
1000, null, null, 0,
1405, self::T_WIZARD, '남귀병',
60, 60, 7, 10, 0.8, 16, 16,
1000, null, null, 0,
[],
[],
['전투를 포기하고 계략에 몰두합니다.'],
@@ -65,36 +65,36 @@ class GameUnitConst extends GameUnitConstBase
],
[
1500, self::T_SIEGE, '정란',
100, 100, 6, 0, 0, 7, 3,
0, null, null, 0,
1500, self::T_SIEGE, '정란',
100, 100, 6, 0, 0, 7, 3,
0, null, null, 0,
[self::T_CASTLE=>1.8],
[],
['높은 구조물 위에서 공격합니다.'],
['che_성벽부상무효'], null
],
[
1501, self::T_SIEGE, '충차',
150, 100, 6, 0, 0, 10, 3,
1000, null, null, 3,
1501, self::T_SIEGE, '충차',
150, 100, 6, 0, 0, 10, 3,
1000, null, null, 3,
[self::T_CASTLE=>2.4],
[],
['엄청난 위력으로 성벽을 부수어버립니다.'],
['che_성벽부상무효'], null
],
[
1502, self::T_SIEGE, '벽력거',
200, 100, 6, 0, 0, 20, 4,
3000, ['업'], null, 0,
1502, self::T_SIEGE, '벽력거',
200, 100, 6, 0, 0, 20, 4,
3000, ['업'], null, 0,
[self::T_CASTLE=>1.8],
[],
['상대에게 돌덩이를 날립니다.'],
['che_성벽부상무효'], null
],
[
1503, self::T_SIEGE, '목우',
50, 200, 5, 0, 0, 15, 3,
3000, ['성도'], null, 0,
1503, self::T_SIEGE, '목우',
50, 200, 5, 0, 0, 15, 3,
3000, ['성도'], null, 0,
[],
[],
['상대를 저지하는 특수병기입니다.'],
+129
View File
@@ -0,0 +1,129 @@
<template>
<div
class="crewTypeItem crewTypeSubGrid text-center s-border-b"
:style="{
backgroundColor: crewType.notAvailable
? 'red'
: crewType.reqTech == 0
? 'green'
: 'limegreen',
}"
>
<div
class="crewTypeImg"
:style="{
background: '#222222 no-repeat center',
backgroundImage: `url('${crewType.img}')`,
backgroundSize: '64px',
outline: 'solid 1px gray',
}"
></div>
<div class="crewTypeName">{{ crewType.name }}</div>
<div>{{ crewType.attack }}</div>
<div>{{ crewType.defence }}</div>
<div>{{ crewType.speed }}</div>
<div>{{ crewType.baseCost.toFixed(1) }}</div>
<div>{{ crewType.baseRice.toFixed(1) }}</div>
<div>{{ crewType.avoid }}</div>
<div class="crewTypePanel">
<b-button-group
><b-button class="py-1" variant="dark" @click="beHalf">절반</b-button
><b-button class="py-1" variant="dark" @click="beFilled"
>채우기</b-button
><b-button class="py-1" variant="dark" @click="beFull"
>가득</b-button
></b-button-group
>
<div class="row">
<div class="col mx-2">
<div class="input-group my-0">
<span class="input-group-text py-1">병력</span>
<input
type="number"
class="form-control py-1 f_tnum px-0 text-end"
v-model="amount"
min="1"
/>
<span class="input-group-text py-1 f_tnum">00</span>
<span
class="input-group-text py-1 f_tnum"
style="
text-align: right;
min-width: 10ch;
color: #303030;
background-color: #ddd;
"
><div style="margin-left: auto">
{{ Math.ceil(amount * crewType.baseCost).toLocaleString() }}
</div></span
>
</div>
</div>
</div>
</div>
<div class="crewTypeBtn d-grid">
<b-button variant="primary" @click="doSubmit">{{ commandName }}</b-button>
</div>
<div
class="crewTypeInfo text-start"
v-html="crewType.info.join('<br>')"
></div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import VueTypes from "vue-types";
export default defineComponent({
props: {
crewType: VueTypes.object.isRequired,
leadership: VueTypes.number.isRequired,
commandName: VueTypes.string.isRequired,
currentCrewType: VueTypes.number.def(-1),
crew: VueTypes.number.def(0),
},
emits: ["submitOutput", "update:amount"],
watch: {
amount(val: number) {
this.$emit("update:amount", val);
},
},
setup(props, { emit }) {
const amount = ref(0);
function beHalf() {
amount.value = Math.ceil(props.leadership * 0.5);
}
function beFilled() {
if (props.crewType.id == props.currentCrewType) {
amount.value = Math.max(
1,
props.leadership - Math.floor(props.crew / 100)
);
} else {
amount.value = props.leadership;
}
}
function beFull() {
amount.value = Math.floor(props.leadership * 1.2);
}
function doSubmit(e: Event) {
console.log(e);
emit("submitOutput", e, amount.value, props.crewType.id);
}
beFilled();
return {
amount,
beHalf,
beFilled,
beFull,
doSubmit,
};
},
});
</script>
+344
View File
@@ -0,0 +1,344 @@
<template>
<TopBackBar :title="commandName" />
<div class="bg0">
<div>
병사를 모집합니다.
<template v-if="commandName == '징병'">
훈련과 사기치는 낮지만 가격이 저렴합니다.<br />
</template>
<template v-else-if="commandName == '모병'">
훈련과 사기치는 높지만 자금이 많이 듭니다.<br />
</template>
가능한 수보다 많게 입력하면 가능한 최대 병사를 모집합니다.<br />
이미 병사가 있는 경우 추가 {{ commandName }}되며, 병종이 다를경우는 기존의
병사는 소집해제됩니다. <br />
현재 {{ commandName }} 가능한 병종은
<span style="color: green">녹색</span>으로 표시되며, 현재
{{ commandName }} 가능한 특수병종은
<span style="color: limegreen">초록색</span>으로 표시됩니다.
</div>
<div class="crewTypeList" ref="defaultTarget">
<div class="listFront">
<div class="row gx-0 bg0">
<div class="col-6 col-md-9 d-flex align-items-center">
<div v-if="commandName == '모병'" class="text-center w-100">
모병은 가격 2배의 자금이 소요됩니다.<br />
</div>
</div>
<div class="col-6 col-md-3 d-grid">
<b-button
:variant="showNotAvailable ? 'warning' : 'secondary'"
:pressed="showNotAvailable"
@click="showNotAvailable = !showNotAvailable"
>{{
showNotAvailable
? "선택 할 수 있는 병종만 보기"
: "선택 할 수 없는 병종도 보기"
}}</b-button
>
</div>
</div>
<div class="row text-center bg2 gx-0">
<div class="col-4 col-md-2">현재 기술력 : {{ techLevel }}등급</div>
<div class="col-4 col-md-2">
현재 통솔 :
<span
:style="{
color: leadership < fullLeadership ? 'red' : undefined,
}"
>{{ leadership }}</span
>
</div>
<div class="col-4 col-md-2">최대 통솔 : {{ fullLeadership }}</div>
<div class="col-4 col-md-2">
현재 병종 : {{ crewTypeMap.get(currentCrewType).name }}
</div>
<div class="col-4 col-md-2">
현재 병사 : {{ crew.toLocaleString() }}
</div>
<div class="col-4 col-md-2">
현재 자금 : {{ gold.toLocaleString() }}
</div>
</div>
<div
class="miniCrewPanel center"
:style="{
backgroundColor: destCrewType.notAvailable
? 'red'
: destCrewType.reqTech == 0
? 'green'
: 'limegreen',
}"
>
<div
class="crewTypeImg"
:style="{
background: '#222222 no-repeat center',
backgroundImage: `url('${destCrewType.img}')`,
backgroundSize: '64px',
outline: 'solid 1px gray',
height: '64px',
}"
></div>
<div>{{ destCrewType.name }}</div>
<div>{{ destCrewType.baseCost.toFixed(1) }}</div>
<div class="crewTypePanel">
<b-button-group
><b-button class="py-1" variant="dark" @click="beHalf"
>절반</b-button
><b-button class="py-1" variant="dark" @click="beFilled"
>채우기</b-button
><b-button class="py-1" variant="dark" @click="beFull"
>가득</b-button
></b-button-group
>
<div class="row">
<div class="col mx-2">
<div class="input-group my-0">
<span class="input-group-text py-1">병력</span>
<input
type="number"
class="form-control py-1 f_tnum px-0 text-end"
v-model="amount"
min="1"
/>
<span class="input-group-text py-1 f_tnum">00</span>
<span
class="input-group-text py-1 f_tnum"
style="
text-align: right;
min-width: 10ch;
color: #303030;
background-color: #ddd;
"
><div style="margin-left: auto">
{{ Math.ceil(amount * destCrewType.baseCost).toLocaleString() }}
</div></span
>
</div>
</div>
</div>
</div>
<b-button variant="primary" @click="submit">{{
commandName
}}</b-button>
</div>
<div class="listHeader crewTypeSubGrid text-center bg1">
<div class="crewTypeImg">사진</div>
<div class="crewTypeName">병종</div>
<div>공격</div>
<div>방어</div>
<div>기동</div>
<div>가격</div>
<div>군량</div>
<div>회피</div>
<div class="crewTypePanel">병사 </div>
<div class="crewTypeBtn">행동</div>
<div class="crewTypeInfo">특징</div>
</div>
</div>
<div class="listMain">
<template
v-for="armCrewType in armCrewTypes"
:key="armCrewType.armType"
>
<div class="s-border-b">{{ armCrewType.armName }} 계열</div>
<CrewTypeItem
v-for="crewType in armCrewType.values"
:key="crewType.id"
:crewType="crewType"
:leadership="fullLeadership"
:commandName="commandName"
:currentCrewType="currentCrewType"
:crew="crew"
@submitOutput="trySubmit"
@click="destCrewType = crewTypeMap.get(crewType.id);beFilled()"
/>
</template>
</div>
</div>
</div>
<BottomBar :title="commandName" />
</template>
<script lang="ts">
import CrewTypeItem from "@/processing/CrewTypeItem.vue";
import { defineComponent, ref } from "vue";
import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procArmTypeItem, procCrewTypeItem } from "../processingRes";
declare const commandName: string;
declare const procRes: {
relYear: number;
year: number;
tech: number;
techLevel: number;
startYear: number;
goldCoeff: number;
leadership: number;
fullLeadership: number;
armCrewTypes: procArmTypeItem[];
currentCrewType: number;
crew: number;
gold: number;
};
export default defineComponent({
components: {
CrewTypeItem,
TopBackBar,
BottomBar,
},
setup() {
const amount = ref(procRes.fullLeadership - Math.floor(procRes.crew / 100));
async function submit(e: Event) {
const event = new CustomEvent<Args>("customSubmit", {
detail: {
amount: amount.value * 100,
crewType: destCrewType.value.id,
},
});
unwrap(e.target).dispatchEvent(event);
}
const crewTypeMap = new Map<number, procCrewTypeItem>();
for (const armType of procRes.armCrewTypes) {
for (const crewType of armType.values) {
crewTypeMap.set(crewType.id, crewType);
}
}
const showNotAvailable = ref(false);
const destCrewType = ref(unwrap(crewTypeMap.get(procRes.currentCrewType)));
function beHalf() {
amount.value = Math.ceil(procRes.fullLeadership * 0.5);
}
function beFilled() {
if (destCrewType.value.id == procRes.currentCrewType) {
amount.value = Math.max(
1,
procRes.fullLeadership - Math.floor(procRes.crew / 100)
);
} else {
amount.value = procRes.fullLeadership;
}
}
function beFull() {
amount.value = Math.floor(procRes.fullLeadership * 1.2);
}
function trySubmit(e: Event, inAmount: number, inCrewType: number) {
e.preventDefault();
amount.value = inAmount;
destCrewType.value = unwrap(crewTypeMap.get(inCrewType));
void submit(e);
}
return {
destCrewType,
amount,
showNotAvailable,
relYear: procRes.relYear,
year: procRes.year,
tech: procRes.tech,
techLevel: procRes.techLevel,
startYear: procRes.startYear,
goldCoeff: procRes.goldCoeff,
leadership: procRes.leadership,
fullLeadership: procRes.fullLeadership,
armCrewTypes: procRes.armCrewTypes,
currentCrewType: procRes.currentCrewType,
crew: procRes.crew,
gold: procRes.gold,
crewTypeMap,
commandName,
beHalf,
beFilled,
beFull,
submit,
trySubmit,
};
},
});
</script>
<style lang="scss">
@import "@scss/common/break_500px.scss";
.crewTypeSubGrid {
display: grid;
align-items: center;
}
.crewTypeItem .crewTypeImg {
height: 64px;
}
.crewTypeInfo {
padding-left: 0.5em;
padding-right: 0.5em;
}
@include media-1000px {
.crewTypeSubGrid {
grid-template-columns: 64px 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 250px 1.5fr 270px;
}
.miniCrewPanel {
display: none;
}
}
@include media-500px {
.listFront {
position: sticky;
top: 0px;
}
.crewTypeSubGrid {
grid-template-columns: 64px 1.5fr 1fr 1fr 1fr 270px;
grid-template-rows: 1fr 1fr;
}
.crewTypeImg {
grid-column: 1 / 2;
grid-row: 1 / 3;
}
.crewTypeName {
grid-row: 1/ 3;
}
.crewTypeInfo {
grid-column: -2 / -1;
grid-row: 1 / 3;
}
.crewTypePanel {
display: none;
}
.crewTypeBtn {
display: none;
}
.crewTypeBtn > button {
display: none;
}
.miniCrewPanel .crewTypePanel {
display: block;
}
.miniCrewPanel {
display: grid;
grid-template-columns: 64px 1.5fr 1fr 270px 2fr;
grid-template-rows: 64px;
align-items: center;
}
}
</style>
<style scoped>
</style>
+19 -1
View File
@@ -2,6 +2,7 @@ import { default as che_건국} from "./che_건국.vue";
import { default as che_군량매매} from "./che_군량매매.vue";
import { default as che_등용} from "./che_등용.vue";
import { default as CityProcess} from "./che_이동.vue";
import { default as che_징병} from "./che_징병.vue";
export const commandMap: Record<string, typeof CityProcess> = {
che_강행: CityProcess,
@@ -10,4 +11,21 @@ export const commandMap: Record<string, typeof CityProcess> = {
che_등용,
che_이동: CityProcess,
che_출병: CityProcess,
}
che_징병,
che_모병: che_징병,
}
/*
- 항목들
장수 - 선양,
장수+ - 장수대상임관
국가+ - 임관
장수/금쌀/분량 - 증여(포상 이식)
금쌀/분량 - 헌납(군량매매 또는 포상 수정)
도시 - 첩보, 계략(화계 등)
고유 양식 - 숙련전환, 장비매매, 징병
*/
+10 -1
View File
@@ -11,4 +11,13 @@ export const commandMap: Record<string, typeof NationProcess> = {
che_몰수: GeneralAmountProcess,
che_포상: GeneralAmountProcess,
che_발령: GeneralCityProcess,
}
}
/*
- 항목들
국가/금쌀/분량 - 물자원조
도시 - 백성동원, 수몰, 천도, 초토화,
국가 - 불가침파기제의, 선전포고, 이호경식, 종전제의, 피장파장, 허보
고유 양식 - 불가침제의
*/
+24 -1
View File
@@ -56,4 +56,27 @@ export type procNationTypeItem = {
cons: string,
}
export type procNationTypeList = Record<string, procNationTypeItem>;
export type procNationTypeList = Record<string, procNationTypeItem>;
export type procArmTypeItem = {
armType: number,
armName: string,
values: procCrewTypeItem[],
}
export type procCrewTypeItem = {
id: number,
reqTech: number,
reqYear: number,
notAvailable?: boolean,
baseRice: number,
baseCost: number,
name: string,
attack: number,
defence: number,
speed: number,
avoid: number,
img: string,
info: string[],
}