Beispiel #1
0
        public PhaseNightBattle(BattleData data, string title, int phaseID, bool isEscort)
            : base(data, title)
        {
            PhaseID  = phaseID;
            IsEscort = isEscort;

            if (!IsAvailable)
            {
                return;
            }


            int[]      fleetflag           = (int[])ShellingData.api_at_eflag;
            int[]      attackers           = (int[])ShellingData.api_at_list;
            int[]      nightAirAttackFlags = (int[])ShellingData.api_n_mother_list;
            int[]      attackTypes         = (int[])ShellingData.api_sp_list;
            int[][]    defenders           = ((dynamic[])ShellingData.api_df_list).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            int[][]    attackEquipments    = ((dynamic[])ShellingData.api_si_list).Select(elem => ((dynamic[])elem).Select <dynamic, int>(ch => ch is string?int.Parse(ch) : (int)ch).ToArray()).ToArray();
            int[][]    criticals           = ((dynamic[])ShellingData.api_cl_list).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            double[][] rawDamages          = ((dynamic[])ShellingData.api_damage).Select(elem => ((double[])elem).Where(e => e != -1).ToArray()).ToArray();

            Attacks = new List <PhaseNightBattleAttack>();



            for (int i = 0; i < attackers.Length; i++)
            {
                var attack = new PhaseNightBattleAttack
                {
                    Attacker           = new BattleIndex(attackers[i] + (fleetflag[i] == 0 ? 0 : 12), Battle.IsFriendCombined, Battle.IsEnemyCombined),
                    NightAirAttackFlag = nightAirAttackFlags[i] == -1,
                    AttackType         = attackTypes[i],
                    EquipmentIDs       = attackEquipments[i],
                };
                for (int k = 0; k < defenders[i].Length; k++)
                {
                    var defender = new PhaseNightBattleDefender
                    {
                        Defender     = new BattleIndex(defenders[i][k] + (fleetflag[i] == 0 ? 12 : 0), Battle.IsFriendCombined, Battle.IsEnemyCombined),
                        CriticalFlag = criticals[i][k],
                        RawDamage    = rawDamages[i][k]
                    };
                    attack.Defenders.Add(defender);
                }

                Attacks.Add(attack);
            }
        }
        public PhaseNightBattle(BattleData data, string title, bool isEscort)
            : base(data, title)
        {
            this.isEscort = isEscort;

            if (!IsAvailable)
            {
                return;
            }


            int[]      attackers           = ((int[])ShellingData.api_at_list).Skip(1).ToArray();
            int[]      nightAirAttackFlags = ((int[])ShellingData.api_n_mother_list).Skip(1).ToArray();
            int[]      attackTypes         = ((int[])ShellingData.api_sp_list).Skip(1).ToArray();
            int[][]    defenders           = ((dynamic[])ShellingData.api_df_list).Skip(1).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            int[][]    attackEquipments    = ((dynamic[])ShellingData.api_si_list).Skip(1).Select(elem => ((dynamic[])elem).Select <dynamic, int>(ch => ch is string?int.Parse(ch) : (int)ch).ToArray()).ToArray();
            int[][]    criticals           = ((dynamic[])ShellingData.api_cl_list).Skip(1).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            double[][] rawDamages          = ((dynamic[])ShellingData.api_damage).Skip(1).Select(elem => ((double[])elem).Where(e => e != -1).ToArray()).ToArray();

            Attacks = new List <PhaseNightBattleAttack>();

            for (int i = 0; i < attackers.Length; i++)
            {
                var attack = new PhaseNightBattleAttack();

                attack.Attacker           = GetIndex(attackers[i]);
                attack.NightAirAttackFlag = nightAirAttackFlags[i] == -1;
                attack.AttackType         = attackTypes[i];
                attack.EquipmentIDs       = attackEquipments[i];

                attack.Defenders = new List <PhaseNightBattleDefender>();
                for (int k = 0; k < defenders[i].Length; k++)
                {
                    var defender = new PhaseNightBattleDefender();
                    defender.Defender     = GetIndex(defenders[i][k]);
                    defender.CriticalFlag = criticals[i][k];
                    defender.RawDamage    = rawDamages[i][k];
                    attack.Defenders.Add(defender);
                }

                Attacks.Add(attack);
            }
        }
        public PhaseNightBattle(BattleData data, string title, bool isEscort)
            : base(data, title)
        {
            this.isEscort = isEscort;

            if (!IsAvailable)
            {
                return;
            }


            int[]   attackers   = ((int[])ShellingData.api_at_list).Skip(1).ToArray();
            int[]   attackTypes = ((int[])ShellingData.api_sp_list).Skip(1).ToArray();
            int[][] defenders   = ((dynamic[])ShellingData.api_df_list).Skip(1).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            int[][] criticals   = ((dynamic[])ShellingData.api_cl_list).Skip(1).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();
            int[][] damages     = ((dynamic[])ShellingData.api_damage).Skip(1).Select(elem => ((int[])elem).Where(e => e != -1).ToArray()).ToArray();

            Attacks = new List <PhaseNightBattleAttack>();

            for (int i = 0; i < attackers.Length; i++)
            {
                var attack = new PhaseNightBattleAttack();

                attack.Attacker   = GetIndex(attackers[i]);
                attack.AttackType = attackTypes[i];

                attack.Defenders = new List <PhaseNightBattleDefender>();
                for (int k = 0; k < defenders[i].Length; k++)
                {
                    var defender = new PhaseNightBattleDefender();
                    defender.Defender     = GetIndex(defenders[i][k]);
                    defender.CriticalFlag = criticals[i][k];
                    defender.Damage       = damages[i][k];
                    attack.Defenders.Add(defender);
                }

                Attacks.Add(attack);
            }
        }