Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/KC3Kai/kancolle-replay in…
Browse files Browse the repository at this point in the history
…to gh-pages
  • Loading branch information
fourinone41 committed Aug 27, 2024
2 parents 4e0e1d9 + 230225e commit bd6612e
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 10 deletions.
15 changes: 9 additions & 6 deletions css/simulator-ui/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ div.bonusMarker.lbas {
.bonusMarker.fcf {
color: #C8AAFF;
}
.bonusMarker.chuuha {
color: orange;
}
.bonusMarker.plane {
color: green;
font-size: 14px;
Expand Down Expand Up @@ -455,25 +458,25 @@ div.kcnavImporterSettingsWrap select.suggestion {
margin-left: auto;
}

#divFCFSettingsMain {
#divFCFSettingsMain, #divRetreatSettingsMain {
background-color: #DDEEFF;
border: 1px solid transparent;
box-shadow: 0 0 5px black;
padding: 20px;
}
#divFCFSettingsMain > div:not(:first-child) {
#divFCFSettingsMain > div:not(:first-child), #divRetreatSettingsMain > div:not(:first-child) {
margin-top: 10px;
}
#divFCFSettingsMain span.header {
#divFCFSettingsMain span.header, #divRetreatSettingsMain span.header {
font-weight: bold;
}
#divFCFSettingsMain div.shipGroup {
#divFCFSettingsMain div.shipGroup, #divRetreatSettingsMain div.shipGroup {
display: flex;
}
#divFCFSettingsMain div.shipGroup img:hover {
#divFCFSettingsMain div.shipGroup img:hover, #divRetreatSettingsMain div.shipGroup img:hover {
cursor: pointer;
}
#divFCFSettingsMain div.shipGroup span.shipType {
#divFCFSettingsMain div.shipGroup span.shipType, #divRetreatSettingsMain div.shipGroup span.shipType {
padding: 1px;
font-size: 16px;
font-weight: bold;
Expand Down
2 changes: 2 additions & 0 deletions js/data/strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"retreat_on_taiha": "Retreat on {img_taiha} ?",
"retreat_on_taiha_even": "Retreat on {img_taiha} even if ship has {img_repair} if on Node {sel_node} or before",
"none_node": "None",
"retreat_on_chuuha": "Retreat on {img_chuuha}",
"fcf_settings": "FCF Settings",
"fcf_settings_set": "FCF Settings set",
"replace_formations": "Replace formation with {closest_alternative} if not enough ships",
Expand Down Expand Up @@ -346,6 +347,7 @@
"no_chuuha_after_battle": "No {img_chuuha} After Battle",
"moderate_damage": "Moderate Damage",
"all": "All",
"fcf_used": "{img_fcf}Used",
"avg_resupply": "Avg Resupply",
"avg_resupply_tooltip": "Includes Main Fleet + Support Fleets + LBAS",
"fuel": "Fuel",
Expand Down
2 changes: 2 additions & 0 deletions js/data/strings_ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"retreat_on_taiha": "{img_taiha}したら撤退する",
"retreat_on_taiha_even": "{img_taiha}したときに{img_repair}を積んでいてもNode: {sel_node} か、それより前なら撤退する",
"none_node": "None",
"retreat_on_chuuha": "{img_chuuha}したら撤退する",
"fcf_settings": "司令部設定",
"fcf_settings_set": "Active",
"replace_formations": "陣形に必要な隻数が足りない場合、{closest_alternative}で置き換える",
Expand Down Expand Up @@ -346,6 +347,7 @@
"no_chuuha_after_battle": "戦闘後に{img_chuuha}艦がいない割合",
"moderate_damage": "中破",
"all": "All",
"fcf_used": "{img_fcf}退避率",
"avg_resupply": "平均補給コスト",
"avg_resupply_tooltip": "出撃艦隊 + 支援艦隊 + 基地航空隊出撃&補充コスト",
"fuel": "燃料",
Expand Down
3 changes: 2 additions & 1 deletion js/simulator-ui/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var CONST = window.COMMON.getConst({});

window.CONVERT = {
_fleetPropsSaved: ['type','formation'],
_shipPropsSaved: ['mstId','level','hp','hpInit','morale','fuelInit','ammoInit','statsBase','slots','bonusDmg','bonusAcc','bonusEva','bonusDmgDebuff','isFaraway','neverFCF'],
_shipPropsSaved: ['mstId','level','hp','hpInit','morale','fuelInit','ammoInit','statsBase','slots','bonusDmg','bonusAcc','bonusEva','bonusDmgDebuff','isFaraway','neverFCF','retreatOnChuuha'],
_equipPropsSaved: ['mstId','level','rank','bonusDmg','bonusAcc','bonusGroups'],

_UI_MAIN: null,
Expand Down Expand Up @@ -737,6 +737,7 @@ window.CONVERT = {
if (Object.keys(bonusesByNode).length) shipInput.bonusesByNode = bonusesByNode;
}
if (shipUI.neverFCF) shipInput.neverFCF = 1;
if (shipUI.retreatOnChuuha) shipInput.retreatOnChuuha = 1;

shipsInput.push(shipInput);
}
Expand Down
1 change: 1 addition & 0 deletions js/simulator-ui/fleet-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ var FLEET_MODEL = {
bonusByNode: {},

neverFCF: false,
retreatOnChuuha: false,

isFaraway: false,
};
Expand Down
6 changes: 6 additions & 0 deletions js/simulator-ui/sim-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ var SIM = {
totalEmptiedPlanes: 0,
totalEmptiedLBAS: 0,
totalTransport: 0,
totalFCFUsed: 0,
nodes: [],
};
for (let n=0; n<numNodes; n++) {
Expand Down Expand Up @@ -144,6 +145,7 @@ var SIM = {
},
_updateResultsTotal: function(dataInput) {
this._results.totalnum++;
let foundRetreated = false;
for (let fleet of FLEETS1) {
if (!fleet) continue;
for (let ship of fleet.ships) {
Expand Down Expand Up @@ -171,8 +173,10 @@ var SIM = {
}
this._results.totalSteelR += ship.jetSteelCost || 0;
if (ship.repairs) this._results.totalDamecon += ship.repairsOrig.length - ship.repairs.length;
if (ship.retreated) foundRetreated = true;
}
}
if (foundRetreated) this._results.totalFCFUsed++;
for (let fleet of [FLEETS1S[0],FLEETS1S[1]]) {
if (!fleet) continue;
for (let ship of fleet.ships) {
Expand Down Expand Up @@ -893,8 +897,10 @@ var SIM = {
this._updateResultsNode(result,battleInd);
}

if (isBossNode) break;
let ignoreDamecon = dataInput.settingsFCF && dataInput.settingsFCF.dameconNode && battleInd+1 <= dataInput.settingsFCF.dameconNode;
let isRetreat = fleetF.combinedWith ? !canContinue(fleetF.ships,fleetF.combinedWith.ships,false,ignoreDamecon) : !canContinue(fleetF.ships,null,false,ignoreDamecon);
isRetreat = isRetreat || !!shipsAll.find(ship => ship._dataOrig.retreatOnChuuha && ship.HP/ship.maxHP <= .5);
if (!isRetreat) {
let undoFCF = false;
if (dataInput.settingsFCF && battleInd < dataInput.nodes.length-1) {
Expand Down
32 changes: 29 additions & 3 deletions js/simulator-ui/ui-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ var UI_MAIN = Vue.createApp({
fuelS: 0, ammoS: 0, steelS: 0, bauxS: 0, bucketS: 0, dameconS: 0,
fuelSunk: 0, ammoSunk: 0, steelSunk: 0, bauxSunk: 0, bucketSunk: 0, dameconSunk: 0,
emptiedPlane: 0, emptiedLBAS: 0,
fcfUsed: 0,
showMore: false,
fuelA: 0, ammoA: 0, steelA: 0, bauxA: 0, bucketA: 0, dameconA: 0,
fuelB: 0, ammoB: 0, steelB: 0, bauxB: 0, bucketB: 0, dameconB: 0,
Expand Down Expand Up @@ -347,6 +348,9 @@ var UI_MAIN = Vue.createApp({
|| (this.fleetFMain.shipsEscort && this.fleetFMain.shipsEscort.find(s => s.neverFCF))
);
},
hasChuuhaSettings: function() {
return !!((this.fleetFMain.ships && this.fleetFMain.ships.find(s => s.retreatOnChuuha)) || (this.fleetFMain.shipsEscort && this.fleetFMain.shipsEscort.find(s => s.retreatOnChuuha)));
},

autoBonusStatus: function() {
return !this.autoBonus ? this.$i18n.t('autobonus_off') : this.$i18n.t('autobonus_active');
Expand Down Expand Up @@ -540,6 +544,7 @@ var UI_MAIN = Vue.createApp({
this.results.bucketTP = (resultSim.totalBuckets) / resultSim.totalTransport;
this.results.dameconTP = (resultSim.totalDamecon) / resultSim.totalTransport;

this.results.fcfUsed = formatNum(resultSim.totalFCFUsed / totalNum);
this.results.emptiedPlane = formatNum(resultSim.totalEmptiedPlanes / totalNum);
this.results.emptiedLBAS = formatNum(resultSim.totalEmptiedLBAS / totalNum);

Expand Down Expand Up @@ -857,6 +862,9 @@ ${t('results.buckets')}: ${this.resultsBucketTPPer}`;
onclickSetFCF: function() {
UI_FCFSETTINGS.doOpen(this.settingsFCF);
},
onclickSetRetreat: function() {
UI_RETREATSETTINGS.doOpen();
},

onclickNavButton: function(ref,idx) {
let e = this.$refs[ref];
Expand Down Expand Up @@ -1844,9 +1852,27 @@ var UI_FCFSETTINGS = Vue.createApp({
},
}).component('vmodal',COMMON.CMP_MODAL).use(COMMON.i18n).mount('#divFCFSettings');;




var UI_RETREATSETTINGS = Vue.createApp({
data: () => ({
active: false,
canClose: true,

shipGroups: [],
}),
methods: {
doOpen: function() {
this.active = true;
this.shipGroups = [];
this.shipGroups.push(UI_MAIN.fleetFMain.ships.filter(ship => !FLEET_MODEL.shipIsEmpty(ship)));
if (UI_MAIN.fleetFMain.shipsEscort && UI_MAIN.fleetFMain.combined) this.shipGroups.push(UI_MAIN.fleetFMain.shipsEscort.filter(ship => !FLEET_MODEL.shipIsEmpty(ship)));
},

onclickShip: function(ship) {
ship.retreatOnChuuha = !ship.retreatOnChuuha;
},
},
}).component('vmodal',COMMON.CMP_MODAL).use(COMMON.i18n).mount('#divRetreatSettings');;


var UI_AUTOBONUS = Vue.createApp({
data: () => ({
Expand Down
1 change: 1 addition & 0 deletions simulator-import-help.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
bonusDmg: &lt;float&gt;
},
neverFCF: &lt;bool&gt; if 1, never use FCF to retreat this ship (default 0)
retreatOnChuuha: &lt;bool&gt; if 1, end sortie if this ship becomes medium damaged or more (default 0)
}],
combineType: &lt;int&gt; 1=CTF, 2=STF, 3=TCF (optional),
shipsC: [&lt;same as ships&gt;] (optional),
Expand Down
20 changes: 20 additions & 0 deletions simulator.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ <h2>{{$t('settings')}}</h2>
<template v-slot:img_repair><img src="assets/items/14.png"/></template>
<template v-slot:sel_node><select v-model="settingsFCF.dameconNode"><option value="0">{{$t('none_node')}}</option><option v-for="(battle,i) in battles" :value="battle.id">{{i+1}}</option></select></template>
</i18n-t></div>
<div style="margin-left:10px"><i18n-t keypath="retreat_on_chuuha" scope="global"><template v-slot:img_chuuha><img src="assets/stats/chuuha.png"/></template></i18n-t>: <input type="button" :value="$t('settings')" @click="onclickSetRetreat"/> <span v-show="hasChuuhaSettings" class="bonusMarker chuuha">&#11044;</span></div>
<div><img src="assets/items/28.png"/><input type="button" :value="$t('fcf_settings')" @click="onclickSetFCF"/> <span v-show="hasFCFSettings" class="bonusMarker fcf" :title="$t('fcf_settings_set')">&#11044;</span></div>
<div><label><input type="checkbox" v-model="settings.replaceImpossibleFormations"/> <i18n-t keypath="replace_formations" scope="global">
<template v-slot:closest_alternative><span class="tooltip" :title="$t('closest_alternative_tooltip')">{{$t('closest_alternative')}}</span></template>
Expand Down Expand Up @@ -575,6 +576,9 @@ <h3>
<tr><th>{{$t('all')}}</th><td v-for="stat in results.noChuuha">{{stat}}</td></tr>
</table>
</div>
<div v-show="results.fcfUsed">
<div><i18n-t keypath="fcf_used" scope="global"><template v-slot:img_fcf><img src="assets/items/28.png"/></template></i18n-t>: {{results.fcfUsed}}</div>
</div>
</div>
<div class="resultCol">
<div>
Expand Down Expand Up @@ -1636,6 +1640,22 @@ <h3>
</vmodal>
</div></div>

<div id="divRetreatSettings"><div v-show="active">
<vmodal :active="active" @vclose="canClose&&(active=false)">
<div id="divRetreatSettingsMain">
<div>
<span class="header"><i18n-t keypath="retreat_on_chuuha" scope="global"><template v-slot:img_chuuha><img src="assets/stats/chuuha.png" style="vertical-align:middle"/></template></i18n-t>:</span>
<div v-for="ships in shipGroups" class="shipGroup">
<div v-for="ship in ships" style="position:relative">
<img :src="'assets/icons/' + ship.imgName" :style="{'opacity':ship.retreatOnChuuha?1:.35}" @click="onclickShip(ship)"/>
<span class="shipType">{{ship.type}}</span>
</div>
</div>
</div>
</div>
</vmodal>
</div></div>

<div id="divAutoBonus"><div v-show="active">
<vmodal :active="active" @vclose="canClose&&(active=false)">
<div class="autoBonusMain" v-show="!isPreloader">
Expand Down

0 comments on commit bd6612e

Please sign in to comment.