戦闘フェーズの基底クラスです。
Exemplo n.º 1
0
        public override void EmulateBattle(int[] hps, int[] damages)
        {
            if (!IsAvailable)
            {
                return;
            }

            for (int i = 0; i < hps.Length; i++)
            {
                AddDamage(hps, i, Damages[i]);
            }

            for (int i = 0; i < damages.Length; i++)
            {
                damages[i] += AttackDamages[i];
            }

            for (int i = 0; i < Targets.Length; i++)
            {
                if (Targets[i] > 0)
                {
                    int target = Targets[i] - 1;
                    if (target >= 6)
                    {
                        target += 6;
                    }
                    if (PhaseBase.IsIndexFriend(i))
                    {
                        target += 6;
                    }

                    BattleDetails.Add(new BattleDayDetail(_battleData, i, target, new int[] { AttackDamages[i] }, new int[] { CriticalFlags[i] }, -1));
                }
            }
        }
Exemplo n.º 2
0
        public override void EmulateBattle(int[] hps, int[] damages)
        {
            if (!IsAvailable)
            {
                return;
            }

            // 表示上は逐次ダメージ反映のほうが都合がいいが、AddDamage を逐次的にやるとダメコン判定を誤るため
            int[] currentHP = new int[hps.Length];
            Array.Copy(hps, currentHP, currentHP.Length);

            for (int i = 0; i < Targets.Length; i++)
            {
                if (Targets[i] > 0)
                {
                    int target = Targets[i] - 1;
                    if (target >= 6)
                    {
                        target += 6;
                    }
                    if (PhaseBase.IsIndexFriend(i))
                    {
                        target += 6;
                    }
                    if (PhaseBase.IsIndexEnemy(i) && IsShortFormat && IsCombined)
                    {
                        target += 12;
                    }

                    BattleDetails.Add(new BattleDayDetail(_battleData, i, target, new double[] { AttackDamages[i] + Damages[target] - Math.Floor(Damages[target]) },                            //propagates "guards flagship" flag
                                                          new int[] { CriticalFlags[i] }, -1, null, currentHP[target]));
                    currentHP[target] -= Math.Max(AttackDamages[i], 0);
                }
            }

            for (int i = 0; i < hps.Length; i++)
            {
                AddDamage(hps, i, (int)Damages[i]);
                damages[i] += AttackDamages[i];
            }
        }
        public override void EmulateBattle(int[] hps, int[] damages)
        {
            if (!IsAvailable)
            {
                return;
            }

            // 表示上は逐次ダメージ反映のほうが都合がいいが、AddDamage を逐次的にやるとダメコン判定を誤るため
            int[] currentHP = new int[hps.Length];
            Array.Copy(hps, currentHP, currentHP.Length);

            for (int i = 0; i < Targets.Length; i++)
            {
                if (Targets[i] > 0)
                {
                    int target = Targets[i] - 1;
                    if (target >= 6)
                    {
                        target += 6;
                    }
                    if (PhaseBase.IsIndexFriend(i))
                    {
                        target += 6;
                    }

                    BattleDetails.Add(new BattleDayDetail(_battleData, i, target, new int[] { AttackDamages[i] }, new int[] { CriticalFlags[i] }, -1, currentHP[target]));
                    currentHP[target] -= Math.Max(AttackDamages[i], 0);
                }
            }

            for (int i = 0; i < hps.Length; i++)
            {
                AddDamage(hps, i, Damages[i]);
                damages[i] += AttackDamages[i];
            }
        }
Exemplo n.º 4
0
        public PhaseShelling(BattleData data, string title, int phaseID, string suffix, bool isEscort, bool isEnemyEscort = false)
            : base(data, title)
        {
            this.phaseID       = phaseID;
            this.suffix        = suffix;
            this.isEscort      = isEscort;
            this.isEnemyEscort = isEnemyEscort;

            if (!IsAvailable)
            {
                return;
            }

            // "translate"

            int[]   fleetflag     = !ShellingData.api_at_eflag() ? null : ((int[])ShellingData.api_at_eflag).Skip(1).ToArray();
            int[]   attackers     = ((int[])ShellingData.api_at_list).Skip(1).ToArray();
            int[]   attackTypes   = ((int[])ShellingData.api_at_type).Skip(1).ToArray();
            int[][] defenders     = ((dynamic[])ShellingData.api_df_list).Skip(1).Select(elem => (int[])elem).ToArray();
            int[][] criticalFlags = ((dynamic[])ShellingData.api_cl_list).Skip(1).Select(elem => (int[])elem).ToArray();
            int[][] damages       = ((dynamic[])ShellingData.api_damage).Skip(1).Select(elem => ((int[])elem).Select(p => Math.Max(p, 0)).ToArray()).ToArray();


            Attacks = new List <PhaseShellingAttack>();

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

                attack.Attacker  = attackers[i] - 1;
                attack.Defenders = new List <PhaseShellingDefender>();


                if (fleetflag != null)
                {
                    if (fleetflag[i] == 1)                              // enemy
                    {
                        attack.Attacker += 6;
                        if (isEnemyEscort)
                        {
                            attack.Attacker += 6;
                        }
                    }
                    else if (isEscort)                                  // friend escort
                    {
                        attack.Attacker += 6;
                    }

                    for (int k = 0; k < defenders[i].Length; k++)
                    {
                        var defender = new PhaseShellingDefender();
                        defender.Defender = defenders[i][k] - 1;

                        if (defender.Defender >= 6)                           // escort
                        {
                            defender.Defender += 6;
                        }
                        if (fleetflag[i] == 0)                           // friend -> *enemy*
                        {
                            defender.Defender += 6;
                        }

                        defender.CriticalFlag = criticalFlags[i][k];
                        defender.Damage       = damages[i][k];

                        attack.Defenders.Add(defender);
                    }
                }
                else if (isEscort)
                {
                    if (attack.Attacker < 6)                            // friend
                    {
                        attack.Attacker += 12;
                    }

                    for (int k = 0; k < defenders[i].Length; k++)
                    {
                        var defender = new PhaseShellingDefender();
                        defender.Defender = defenders[i][k] - 1;

                        if (PhaseBase.IsIndexEnemy(attack.Attacker))                                    // enemy -> *friend escort*
                        {
                            defender.Defender += 12;
                        }

                        defender.CriticalFlag = criticalFlags[i][k];
                        defender.Damage       = damages[i][k];

                        attack.Defenders.Add(defender);
                    }
                }
                else
                {
                    for (int k = 0; k < defenders[i].Length; k++)
                    {
                        var defender = new PhaseShellingDefender();

                        defender.Defender     = defenders[i][k] - 1;
                        defender.CriticalFlag = criticalFlags[i][k];
                        defender.Damage       = damages[i][k];

                        attack.Defenders.Add(defender);
                    }
                }

                attack.AttackType = attackTypes[i];

                Attacks.Add(attack);
            }
        }