protected void ParseAttacks(OldBattle battle, sortie_battle_old.airbattle api, ShipInBattle friendtorpedo, ShipInBattle friendbomb, ShipInBattle enemytorpedo, ShipInBattle enemybomb) { var result = Enumerable.Empty <Attack>(); void ParseStage3(sortie_battle_old.airbattle.stage3 stage3, ShipInBattle[] friend, ShipInBattle[] enemy) { if (stage3 == null) { return; } if (stage3.api_fdam != null) { result = result.Concat(ParseAttack(stage3.api_fdam, stage3.api_frai_flag, stage3.api_fbak_flag, stage3.api_fcl_flag, false, friend, enemytorpedo, enemybomb)); } if (stage3.api_edam != null) { result = result.Concat(ParseAttack(stage3.api_edam, stage3.api_erai_flag, stage3.api_ebak_flag, stage3.api_ecl_flag, true, enemy, friendtorpedo, friendbomb)); } } ParseStage3(api.api_stage3, battle.Fleet1, battle.EnemyFleet); ParseStage3(api.api_stage3_combined, battle.Fleet2, battle.EnemyFleet2); ApplyAttacks(result, battle); }
protected AerialBase(sortie_battle_old.airbattle api) { if (api.api_stage1 != null) { FriendStage1 = new LimitedValue(api.api_stage1.api_f_count - api.api_stage1.api_f_lostcount, api.api_stage1.api_f_count); EnemyStage1 = new LimitedValue(api.api_stage1.api_e_count - api.api_stage1.api_e_lostcount, api.api_stage1.api_e_count); } if (api.api_stage2 != null) { FriendStage2 = new LimitedValue(api.api_stage2.api_f_count - api.api_stage2.api_f_lostcount, api.api_stage2.api_f_count); EnemyStage2 = new LimitedValue(api.api_stage2.api_e_count - api.api_stage2.api_e_lostcount, api.api_stage2.api_e_count); } }
public AirBaseAttack(OldBattle battle, sortie_battle_old.airbattle api) : base(api) { //SquadronList = api.api_squadron_plane.Select(x => new Squadron //{ // Plane = Staff.Current.MasterData.EquipInfo[x.api_mst_id], // Count = x.api_count //}).ToArray(); if (api.api_stage1 != null) { AirControl = (AirControl)api.api_stage1.api_disp_seiku; } ParseAttacks(battle, api, null, null, null, null); }
public AerialSupport(OldBattle battle, sortie_battle_old.airbattle api) : base(api) { if (api.api_stage1 != null) { AirControl = (AirControl)api.api_stage1.api_disp_seiku; } ShipInBattle enemytorpedo = null, enemybomb = null; enemytorpedo = battle.EnemyFleet.Where(x => x.CanAerialTorpedo).TakeIfSingle(); enemybomb = battle.EnemyFleet.Where(x => x.CanAerialBomb).TakeIfSingle(); ParseAttacks(battle, api, null, null, enemytorpedo, enemybomb); }
public JetPlaneAttack(OldBattle battle, sortie_battle_old.airbattle api, bool isSupport) : base(api) { ShipInBattle friendjet = null, enemyjet = null; if (!isSupport) { if (api.api_plane_from[0]?.Length == 1 && api.api_plane_from[0][0] > 0) { friendjet = battle.Fleet1[api.api_plane_from[0][0] - 1]; } if (api.api_plane_from.Length >= 2 && api.api_plane_from[1]?.Length == 1 && api.api_plane_from[1][0] > 0) { enemyjet = battle.EnemyFleet[api.api_plane_from[1][0] - 1]; } } ParseAttacks(battle, api, null, friendjet, null, enemyjet); }
public AerialCombat(OldBattle battle, sortie_battle_old.airbattle api) : base(api) { if (api.api_stage1 != null) { AirControl = (AirControl)api.api_stage1.api_disp_seiku; FriendTouch = Staff.Current.MasterData.EquipInfo[api.api_stage1.api_touch_plane[0]]; EnemyTouch = Staff.Current.MasterData.EquipInfo[api.api_stage1.api_touch_plane[1]]; } if (api.api_stage2?.api_air_fire != null) { AntiAir = new AntiAirCutin(battle, api.api_stage2.api_air_fire); } ShipInBattle friendtorpedo = null, friendbomb = null, enemytorpedo = null, enemybomb = null; friendtorpedo = battle.Fleet1.Where(x => x.CanAerialTorpedo).TakeIfSingle(); friendbomb = battle.Fleet1.Where(x => x.CanAerialBomb).TakeIfSingle(); enemytorpedo = battle.EnemyFleet.Where(x => x.CanAerialTorpedo).TakeIfSingle(); enemybomb = battle.EnemyFleet.Where(x => x.CanAerialBomb).TakeIfSingle(); ParseAttacks(battle, api, friendtorpedo, friendbomb, enemytorpedo, enemybomb); }