return result;\r
}\r
\r
- private void CalcDamage(dynamic json)\r
- {\r
- AirBattleResults.Clear();\r
- if (json.api_air_base_injection())\r
- {\r
- AddAirBattleResult(json.api_air_base_injection, "AB噴式");\r
- CalcKoukuDamage(json.api_air_base_injection);\r
- }\r
- if (json.api_injection_kouku())\r
- {\r
- AddAirBattleResult(json.api_injection_kouku, "噴式");\r
- CalcKoukuDamage(json.api_injection_kouku);\r
- }\r
- if (json.api_air_base_attack())\r
- CalcAirBaseAttackDamage(json.api_air_base_attack);\r
- if (json.api_kouku())\r
- {\r
- AddAirBattleResult(json.api_kouku, "航空戦");\r
- CalcKoukuDamage(json.api_kouku);\r
- }\r
- if (json.api_kouku2()) // 航空戦2回目\r
- {\r
- AddAirBattleResult(json.api_kouku2, "航空戦2");\r
- CalcKoukuDamage(json.api_kouku2);\r
- }\r
- CalcSurfaceBattleDamage(json);\r
- }\r
-\r
private enum CombatType\r
{\r
AtOnce,\r
ByTurn,\r
- Support\r
+ Support,\r
+ Aircraft,\r
+ AirBase\r
}\r
\r
private class Phase\r
{\r
public string Api { get; }\r
public CombatType Type { get; }\r
+ public string Name { get; }\r
\r
- public Phase(string api, CombatType type)\r
+ public Phase(string api, CombatType type, string name = "")\r
{\r
Api = api;\r
Type = type;\r
+ Name = name;\r
}\r
}\r
\r
- private void CalcSurfaceBattleDamage(dynamic json)\r
+ private void CalcDamage(dynamic json)\r
{\r
+ AirBattleResults.Clear();\r
var phases = new[]\r
{\r
- new Phase("support_info", CombatType.Support),\r
+ new Phase("air_base_injection", CombatType.Aircraft, "AB噴式"),\r
+ new Phase("injection_kouku", CombatType.Aircraft, "噴式"),\r
+ new Phase("air_base_attack", CombatType.AirBase),\r
new Phase("n_support_info", CombatType.Support),\r
+ new Phase("kouku", CombatType.Aircraft, "航空戦"),\r
+ new Phase("kouku2", CombatType.Aircraft, "航空戦2"),\r
+ new Phase("support_info", CombatType.Support),\r
new Phase("opening_taisen", CombatType.ByTurn),\r
new Phase("opening_atack", CombatType.AtOnce),\r
new Phase("hougeki", CombatType.ByTurn),\r
new Phase("raigeki", CombatType.AtOnce)\r
};\r
foreach (var phase in phases)\r
- CalcDamageByType(json, "api_" + phase.Api, phase.Type);\r
+ CalcDamageByType(json, phase);\r
}\r
\r
- private void CalcDamageByType(dynamic json, string api, CombatType type)\r
+ private void CalcDamageByType(dynamic json, Phase phase)\r
{\r
+ var api = "api_" + phase.Api;\r
if (!json.IsDefined(api) || json[api] == null)\r
return;\r
- switch (type)\r
+ switch (phase.Type)\r
{\r
case CombatType.AtOnce:\r
CalcDamageAtOnce(json[api]);\r
case CombatType.Support:\r
CalcSupportDamage(json[api]);\r
break;\r
+ case CombatType.Aircraft:\r
+ AddAirBattleResult(json[api], phase.Name);\r
+ CalcKoukuDamage(json[api]);\r
+ break;\r
+ case CombatType.AirBase:\r
+ CalcAirBaseAttackDamage(json[api]);\r
+ break;\r
}\r
}\r
\r