hkuno9000 / KanColle-YPS

艦これ余所見プレイ支援 Google Chrome拡張
https://hkuno9000.github.io/KanColle-YPS
17 stars 5 forks source link

連合艦隊航空戦について自軍ダメージ集計のミス #79

Closed SkyRavenHK closed 7 years ago

SkyRavenHK commented 7 years ago

function calc_damage(): if (battle.api_fdam) 連合艦隊対敵連合艦隊の場合(hc.length == 13)、もし自軍第二艦隊への航空戦攻撃が命中だったら、"hc.length == 7"が満足されてないため、"hc[i] -= dam”の代わりに"hp[i] -= dam"が発動したので、ダメージが第一艦隊に加われた。

hkuno9000 commented 7 years ago

@SkyRavenHK Do you have the battle JSON data of the problem? What a value is "api_fdam.length" on air-attck and torpedo-attack?

That code runs on both air-attack and torpedo-attack, both 12vs12 and 12vs6. Try this patch, but I do not know that is collect to work for all cases.

diff --git a/devtools.js b/devtools.js
index 5adcddd..4f418b0 100644
--- a/devtools.js
+++ b/devtools.js
@@ -1868,7 +1868,7 @@ function calc_damage(result, title, battle, hp, hc, active_deck) {
                        if (dam > 0) {
                                if (i > 6)
                                        hc[i-6] -= dam;
-                               else if (hc && hc.length == 7 && battle.api_fdam.length == 7)
+                               else if (hc && hc.has2nd && battle.api_fdam.length == 7)
                                        hc[i] -= dam;   // #75 自軍連合vs敵通常の場合、雷撃対象は第二艦隊のみ.
                                else
                                        hp[i] -= dam;
hkuno9000 commented 7 years ago

@SkyRavenHK I have committed the patch and some refactoring, then released as v1.5.8. I have checked battle JSON data on #75. they are pass at all. If you find a NG case, please report with JSON data to here, as like as #75.

SkyRavenHK commented 7 years ago

@hkuno9000 I am sorry for the late comment since I couldn't confirm on current event E3 boss yet... I was struggling getting into boss node :( for 12v12, api_frai.length for both api_kouku.api_stage3 and api_kouku.api_stage3_combined are both 7, and that of api_opening_atack and api_raigeki are both 13. for 12v6, all api_frai.length (api_kouku.api_stage3, api_kouku.api_stage3_combined, api_opening_atack and api_raigeki) are 7

SkyRavenHK commented 7 years ago

here is the json for 12v6 (for 12v12 i got error-cat-ted right before night battle so i forgot to copy the json :(

svdata={"api_result":1,"api_result_msg":"\u6210\u529f","api_data":{"api_deck_id":"1","api_ship_ke":[-1,618,618,595,592,623,623],"api_ship_lv":[-1,1,1,1,1,1,1],"api_nowhps":[-1,57,96,92,92,26,58,160,160,88,66,46,46],"api_maxhps":[-1,57,96,92,92,58,58,160,160,88,66,46,46],"api_nowhps_combined":[-1,40,57,43,38,30,37],"api_maxhps_combined":[-1,45,57,43,43,32,37],"api_midnight_flag":1,"api_eSlot":[[556,557,558,558,-1],[556,557,558,558,-1],[505,505,515,525,-1],[550,550,545,525,-1],[502,559,544,-1,-1],[502,559,544,-1,-1]],"api_eKyouka":[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],"api_fParam":[[77,84,106,78],[99,36,70,95],[102,0,90,92],[105,0,94,90],[34,0,72,65],[34,0,72,65]],"api_eParam":[[40,0,90,120],[40,0,90,120],[79,74,79,89],[64,92,96,68],[58,76,48,36],[58,76,48,36]],"api_fParam_combined":[[56,94,78,68],[85,86,70,78],[63,139,49,63],[63,139,49,63],[59,89,59,59],[57,54,116,53]],"api_search":[1,1],"api_formation":["14",1,1],"api_stage_flag":[1,1,1],"api_kouku":{"api_plane_from":[[5,6],[1,2]],"api_stage1":{"api_f_count":105,"api_f_lostcount":9,"api_e_count":288,"api_e_lostcount":137,"api_disp_seiku":2,"api_touch_plane":[59,-1]},"api_stage2":{"api_f_count":0,"api_f_lostcount":0,"api_e_count":103,"api_e_lostcount":20},"api_stage3":{"api_frai_flag":[-1,0,1,0,0,0,0],"api_erai_flag":[-1,0,0,0,0,0,0],"api_fbak_flag":[-1,0,0,1,1,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_fcl_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,6,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]},"api_stage3_combined":{"api_frai_flag":[-1,0,0,1,1,0,0],"api_fbak_flag":[-1,0,0,0,0,0,0],"api_fcl_flag":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,0,0]}},"api_support_flag":0,"api_support_info":null,"api_opening_taisen_flag":0,"api_opening_taisen":null,"api_opening_flag":1,"api_opening_atack":{"api_frai":[-1,0,0,0,5,0,0],"api_erai":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,115,0],"api_fydam":[-1,0,0,0,115,0,0],"api_eydam":[-1,0,0,0,0,0,0],"api_fcl":[-1,0,0,0,1,0,0],"api_ecl":[-1,0,0,0,0,0,0]},"api_hourai_flag":[1,1,1,1],"api_hougeki1":{"api_at_list":[-1,3,10,4,9,2,1,8],"api_at_type":[-1,6,0,2,0,2,4,0],"api_df_list":[-1,[7],[5],[12,12],[5],[10,10],[10],[6]],"api_si_list":[-1,["59","137","137"],[550],["137","137"],[505],["161","161"],["59","124","50"],[-1]],"api_cl_list":[-1,[1],[0],[1,1],[0],[1,1],[1],[0]],"api_damage":[-1,[153],[0],[3,141],[0],[7,4],[85],[0]]},"api_hougeki2":{"api_at_list":[-1,1,2,8,3,4],"api_at_type":[-1,4,6,0,6,0],"api_df_list":[-1,[8],[9],[6],[8],[8]],"api_si_list":[-1,["59","124","50"],["59","161","161"],[-1],["59","137","137"],[137]],"api_cl_list":[-1,[1],[1],[0],[1],[0]],"api_damage":[-1,[13],[138],[0],[16],[0]]},"api_hougeki3":{"api_at_list":[-1,4,1,8,3,2,5,6],"api_at_type":[-1,0,0,0,0,2,0,0],"api_df_list":[-1,[7],[8],[2],[8],[8,8],[7],[8]],"api_si_list":[-1,[134],[134],[-1],[123],["123","123"],[-1],[122]],"api_cl_list":[-1,[0],[2],[0],[2],[1,1],[0],[1]],"api_damage":[-1,[0],[9.1],[0],[7],[46,7],[0],[4]]},"api_raigeki":{"api_frai":[-1,1,1,2,1,2,1],"api_erai":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,0,0],"api_edam":[-1,41,23,0,0,0,0],"api_fydam":[-1,0,0,20,41,3,0],"api_eydam":[-1,0,0,0,0,0,0],"api_fcl":[-1,1,1,1,1,1,1],"api_ecl":[-1,0,0,0,0,0,0]}}}
SkyRavenHK commented 7 years ago

and here is the json for 12v12

svdata={"api_result":1,"api_result_msg":"\u6210\u529f","api_data":{"api_deck_id":1,"api_ship_ke":[-1,721,620,620,543,543,624],"api_ship_ke_combined":[-1,555,592,624,624,624,624],"api_ship_lv":[-1,1,1,1,1,1,1],"api_ship_lv_combined":[-1,1,1,1,1,1,1],"api_nowhps":[-1,57,87,49,92,58,24,660,350,350,90,90,49],"api_maxhps":[-1,57,96,92,92,58,58,660,350,350,90,90,49],"api_nowhps_combined":[-1,40,57,38,43,30,30,57,66,49,49,49,49],"api_maxhps_combined":[-1,45,57,43,43,32,37,57,66,49,49,49,49],"api_eSlot":[[509,509,570,573,-1],[556,557,558,532,-1],[556,557,558,532,-1],[509,509,525,529,-1],[509,509,525,529,-1],[502,502,559,-1,-1]],"api_eSlot_combined":[[506,525,542,543,-1],[550,550,545,525,-1],[502,502,559,-1,-1],[502,502,559,-1,-1],[502,502,559,-1,-1],[502,502,559,-1,-1]],"api_fParam":[[77,84,106,78],[99,36,70,95],[102,0,90,92],[105,0,94,90],[34,0,72,65],[34,0,72,65]],"api_fParam_combined":[[56,94,78,68],[85,86,70,78],[63,139,49,63],[63,139,49,63],[59,89,59,59],[57,54,116,53]],"api_eParam":[[240,180,150,239],[180,0,130,150],[180,0,130,150],[85,0,70,96],[85,0,70,96],[64,98,48,48]],"api_eParam_combined":[[48,80,30,39],[64,92,96,68],[64,98,48,48],[64,98,48,48],[64,98,48,48],[64,98,48,48]],"api_midnight_flag":1,"api_xal01":1,"api_combat_ration":[2511],"api_combat_ration_combined":[204],"api_search":[1,1],"api_formation":["14",13,2],"api_air_base_attack":[{"api_base_id":1,"api_stage_flag":[1,1,1],"api_plane_from":[[1,2,3,4,5,7,8]],"api_squadron_plane":[{"api_mst_id":152,"api_count":18},{"api_mst_id":152,"api_count":18},{"api_mst_id":180,"api_count":18},{"api_mst_id":186,"api_count":18}],"api_stage1":{"api_f_count":72,"api_f_lostcount":19,"api_e_count":557,"api_e_lostcount":117,"api_disp_seiku":3,"api_touch_plane":[-1,558]},"api_stage2":{"api_f_count":27,"api_f_lostcount":19,"api_e_count":0,"api_e_lostcount":0},"api_stage3":{"api_erai_flag":[-1,1,0,0,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]},"api_stage3_combined":{"api_erai_flag":[-1,0,0,0,1,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,41,0,0]}},{"api_base_id":1,"api_stage_flag":[1,1,1],"api_plane_from":[[1,2,3,4,5,7,8]],"api_squadron_plane":[{"api_mst_id":152,"api_count":18},{"api_mst_id":152,"api_count":18},{"api_mst_id":180,"api_count":18},{"api_mst_id":186,"api_count":18}],"api_stage1":{"api_f_count":72,"api_f_lostcount":22,"api_e_count":440,"api_e_lostcount":76,"api_disp_seiku":3,"api_touch_plane":[-1,-1]},"api_stage2":{"api_f_count":26,"api_f_lostcount":14,"api_e_count":0,"api_e_lostcount":0},"api_stage3":{"api_erai_flag":[-1,0,0,1,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,144,0,0,0]},"api_stage3_combined":{"api_erai_flag":[-1,0,0,1,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,60,0,0,0]}},{"api_base_id":2,"api_stage_flag":[1,1,1],"api_plane_from":[[1,2,3,4,5,7,8]],"api_squadron_plane":[{"api_mst_id":152,"api_count":18},{"api_mst_id":180,"api_count":18},{"api_mst_id":170,"api_count":18},{"api_mst_id":187,"api_count":18}],"api_stage1":{"api_f_count":72,"api_f_lostcount":19,"api_e_count":364,"api_e_lostcount":79,"api_disp_seiku":3,"api_touch_plane":[-1,-1]},"api_stage2":{"api_f_count":41,"api_f_lostcount":10,"api_e_count":0,"api_e_lostcount":0},"api_stage3":{"api_erai_flag":[-1,0,0,0,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]},"api_stage3_combined":{"api_erai_flag":[-1,0,1,0,0,0,1],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,61]}},{"api_base_id":2,"api_stage_flag":[1,1,1],"api_plane_from":[[1,2,3,4,5,7,8]],"api_squadron_plane":[{"api_mst_id":152,"api_count":18},{"api_mst_id":180,"api_count":18},{"api_mst_id":170,"api_count":18},{"api_mst_id":187,"api_count":18}],"api_stage1":{"api_f_count":72,"api_f_lostcount":20,"api_e_count":285,"api_e_lostcount":61,"api_disp_seiku":3,"api_touch_plane":[-1,558]},"api_stage2":{"api_f_count":39,"api_f_lostcount":14,"api_e_count":0,"api_e_lostcount":0},"api_stage3":{"api_erai_flag":[-1,0,0,0,0,1,1],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]},"api_stage3_combined":{"api_erai_flag":[-1,0,0,0,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]}}],"api_stage_flag":[1,1,1],"api_kouku":{"api_plane_from":[[5,6],[1,2,3]],"api_stage1":{"api_f_count":79,"api_f_lostcount":5,"api_e_count":213,"api_e_lostcount":93,"api_disp_seiku":2,"api_touch_plane":[102,525]},"api_stage2":{"api_f_count":0,"api_f_lostcount":0,"api_e_count":91,"api_e_lostcount":70,"api_air_fire":{"api_idx":0,"api_kind":10,"api_use_items":[172,173,124]}},"api_stage3":{"api_frai_flag":[-1,0,0,0,0,0,0],"api_erai_flag":[-1,0,0,0,0,0,0],"api_fbak_flag":[-1,0,0,0,0,0,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_fcl_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,0,0],"api_edam":[-1,0,0,0,0,0,0]},"api_stage3_combined":{"api_frai_flag":[-1,0,0,0,0,0,0],"api_erai_flag":[-1,0,0,0,0,0,0],"api_fbak_flag":[-1,0,1,0,0,1,0],"api_ebak_flag":[-1,0,0,0,0,0,0],"api_fcl_flag":[-1,0,0,0,0,0,0],"api_ecl_flag":[-1,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,3,0],"api_edam":[-1,0,0,0,0,0,0]}},"api_support_flag":2,"api_support_info":{"api_support_airatack":null,"api_support_hourai":{"api_deck_id":4,"api_ship_id":[2233,8205,1376,94,771,10433],"api_undressing_flag":[0,0,0,0,0,0],"api_cl_list":[-1,0,0,0,0,2,0,1,0,0,0,0,0],"api_damage":[-1,0,0,0,0,212,0,127,0,0,0,0,0]}},"api_opening_taisen_flag":0,"api_opening_taisen":null,"api_opening_flag":1,"api_opening_atack":{"api_frai":[-1,0,0,0,0,0,0,0,0,0,3,0,0],"api_erai":[-1,0,0,0,0,0,0,0,0,0,0,0,0],"api_fdam":[-1,0,0,0,0,0,0,0,0,0,0,0,0],"api_edam":[-1,0,0,18,0,0,0,0,0,0,0,0,0],"api_fydam":[-1,0,0,0,0,0,0,0,0,0,18,0,0],"api_eydam":[-1,0,0,0,0,0,0,0,0,0,0,0,0],"api_fcl":[-1,0,0,0,0,0,0,0,0,0,1,0,0],"api_ecl":[-1,0,0,0,0,0,0,0,0,0,0,0,0]},"api_hourai_flag":[1,1,1,1],"api_hougeki1":{"api_at_eflag":[-1,0,1,0,0,0,1],"api_at_list":[-1,3,1,4,2,1,6],"api_at_type":[-1,6,0,6,6,4,0],"api_df_list":[-1,[3],[6],[2],[4],[2],[5]],"api_si_list":[-1,["59","137","137"],[509],["59","137","137"],["59","161","161"],["59","124","50"],[502]],"api_cl_list":[-1,[1],[1],[1],[1],[2],[0]],"api_damage":[-1,[134],[15],[66],[124],[49],[0]]},"api_hougeki2":{"api_at_eflag":[-1,0,1,0,0,0],"api_at_list":[-1,1,1,2,3,4],"api_at_type":[-1,3,0,2,0,6],"api_df_list":[-1,[3],[3],[6,6],[1],[2]],"api_si_list":[-1,["59","50","172"],[509],["161","161"],[137],["59","137","137"]],"api_cl_list":[-1,[1],[1],[1,1],[1],[1]],"api_damage":[-1,[5],[29],[128,136],[82],[101]]},"api_hougeki3":{"api_at_eflag":[-1,0,1,0,1,0,1,0,0,0],"api_at_list":[-1,10,8,7,10,8,11,9,12,11],"api_at_type":[-1,0,0,0,0,0,0,0,0,0],"api_df_list":[-1,[11],[9],[8],[8],[10],[8],[11],[11],[8]],"api_si_list":[-1,[134],[550],[134],[502],[123],[502],[123],[122],[-1]],"api_cl_list":[-1,[0],[0],[1],[1],[1],[0],[0],[1],[1]],"api_damage":[-1,[0],[0],[7],[5],[37],[0],[0],[1],[7]]},"api_raigeki":{"api_frai":[-1,0,0,0,0,0,0,3,11,11,11,2,8],"api_erai":[-1,0,0,0,0,0,0,0,7,0,0,12,0],"api_fdam":[-1,0,0,0,0,0,0,0,0,0,0,0,0],"api_edam":[-1,0,12,6,0,0,0,0,3,0,0,194,0],"api_fydam":[-1,0,0,0,0,0,0,6,40,154,0,12,3],"api_eydam":[-1,0,0,0,0,0,0,0,0,0,0,0,0],"api_fcl":[-1,0,0,0,0,0,0,1,1,2,0,1,1],"api_ecl":[-1,0,0,0,0,0,0,0,0,0,0,0,0]}}}