Наследование: NotificationObject
Пример #1
0
        public Battle(sortie_battle api, CombinedFleetType fleettype, MapNodeType battletype, BattleManager source)
        {
            FleetType = fleettype;
            BattleType = battletype;
            Fleet1 = (source.SortieFleet1?.Ships ?? Staff.Current.Homeport.Fleets[api.api_deck_id + api.api_dock_id].Ships)
                .Select(x => new ShipInBattle(x)).ToArray();
            Fleet2 = source.SortieFleet2?.Ships
                .Select(x => new ShipInBattle(x)).ToArray();
            if (source.SortieFleet1 == null)//演习
                Staff.Current.Homeport.Fleets[api.api_deck_id + api.api_dock_id].Ships.ForEach(x => x.IgnoreNextCondition());

            if (api.api_formation != null)
            {
                FriendFormation = (Formation)api.api_formation[0];
                EnemyFormation = (Formation)api.api_formation[1];
                Direction = (Direction)api.api_formation[2];
            }

            bool iscombined = fleettype != CombinedFleetType.None;
            bool isenemycombined = battletype == MapNodeType.Combined || battletype == MapNodeType.CombinedBOSS;

            EnemyFleet = api.api_ship_ke.Where(x => x != -1)
                .Select((x, i) => new ShipInBattle
                {
                    ShipInfo = Staff.Current.MasterData.ShipInfo[x],
                    Level = api.api_ship_lv[i + 1],
                    Equipments = api.api_eSlot[i].Select(y => Staff.Current.MasterData.EquipInfo[y]).Where(y => y != null).ToArray(),
                    Firepower = api.api_eParam[i][0],
                    Torpedo = api.api_eParam[i][1],
                    AA = api.api_eParam[i][2],
                    Armor = api.api_eParam[i][3]
                })
                .ToArray();
            EnemyFleet2 = api.api_ship_ke_combined?.Where(x => x != -1)
                .Select((x, i) => new ShipInBattle
                {
                    ShipInfo = Staff.Current.MasterData.ShipInfo[x],
                    Level = api.api_ship_lv_combined[i + 1],
                    Equipments = api.api_eSlot_combined[i].Select(y => Staff.Current.MasterData.EquipInfo[y]).Where(y => y != null).ToArray(),
                    Firepower = api.api_eParam_combined[i][0],
                    Torpedo = api.api_eParam_combined[i][1],
                    AA = api.api_eParam_combined[i][2],
                    Armor = api.api_eParam_combined[i][3]
                })
                .ToArray();

            EnemyShipIds = api.api_ship_ke.Skip(1).ConcatNotNull(api.api_ship_ke_combined?.Skip(1)).ToArray();

            Fleet1.ArrayZip(api.api_maxhps, 1, Delegates.SetMaxHP);
            Fleet2?.ArrayZip(api.api_maxhps_combined, 1, Delegates.SetMaxHP);
            EnemyFleet.ArrayZip(api.api_maxhps, 7, Delegates.SetMaxHP);
            EnemyFleet2?.ArrayZip(api.api_maxhps_combined, 7, Delegates.SetMaxHP);

            Fleet1.ArrayZip(api.api_nowhps, 1, Delegates.SetStartHP);
            Fleet2?.ArrayZip(api.api_nowhps_combined, 1, Delegates.SetStartHP);
            EnemyFleet.ArrayZip(api.api_nowhps, 7, Delegates.SetStartHP);
            EnemyFleet2?.ArrayZip(api.api_nowhps_combined, 7, Delegates.SetStartHP);

            api.api_escape_idx?.ForEach(x => Fleet1[x - 1].IsEscaped = true);
            api.api_escape_idx_combined?.ForEach(x => Fleet2[x - 1].IsEscaped = true);

            AirCombat1 = AirBattle(api.api_kouku, false);
            AirCombat2 = AirBattle(api.api_kouku2, false);
            AirBaseAttack(api.api_air_base_attack);
            SupportAttack(api.api_support_info);
            FireAttack(api.api_opening_taisen, NightOrTorpedo);
            if (isenemycombined)
                ECTorpedoAttack(api.api_opening_atack);
            else TorpedoAttack(api.api_opening_atack);
            if (isenemycombined)
            {
                ECFireAttack(api.api_hougeki1);
                ECFireAttack(api.api_hougeki2);
                ECFireAttack(api.api_hougeki3);
            }
            else switch (fleettype)
                {
                    case CombinedFleetType.None:
                        FireAttack(api.api_hougeki1, Fleet1);
                        FireAttack(api.api_hougeki2, Fleet1);
                        break;
                    case CombinedFleetType.Carrier:
                    case CombinedFleetType.Transport:
                        FireAttack(api.api_hougeki1, Fleet2);
                        FireAttack(api.api_hougeki2, Fleet1);
                        FireAttack(api.api_hougeki3, Fleet1);
                        break;
                    case CombinedFleetType.Surface:
                        FireAttack(api.api_hougeki1, Fleet1);
                        FireAttack(api.api_hougeki2, Fleet1);
                        FireAttack(api.api_hougeki3, Fleet2);
                        break;
                }
            if (isenemycombined)
                ECTorpedoAttack(api.api_raigeki);
            else TorpedoAttack(api.api_raigeki);
            NightBattle(api);
        }
Пример #2
0
 public BattleBase(BattleManager source)
 {
     Fleet1 = source.SortieFleet1.Ships
         .Select(x => new ShipInBattle(x)).ToArray();
     Fleet2 = source.SortieFleet2?.Ships
         .Select(x => new ShipInBattle(x)).ToArray();
 }