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)); } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } int[] friendhps = FriendlyInitialHPs; foreach (var attack in Attacks) { foreach (var defs in attack.Defenders.GroupBy(d => d.Defender)) { BattleDetails.Add(new BattleFriendlySupportDetail( (BattleNight)Battle, attack.Attacker, defs.Key, defs.Select(d => d.RawDamage).ToArray(), defs.Select(d => d.CriticalFlag).ToArray(), attack.AttackType, attack.EquipmentIDs, attack.NightAirAttackFlag, defs.Key.IsFriend ? friendhps[defs.Key] : hps[defs.Key])); if (defs.Key.IsFriend) { friendhps[defs.Key] -= Math.Max(defs.Sum(d => d.Damage), 0); } else { AddDamage(hps, defs.Key, defs.Sum(d => d.Damage)); } } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } for (int i = 0; i < 6; i++) { if (_battleData.Initial.EnemyMembers[i] > 0) { BattleDetails.Add(new BattleSupportDetail(_battleData, i + 6, Damages[i], Criticals[i], SupportFlag, hps[i + 6])); AddDamage(hps, i + 6, (int)Damages[i]); } } if ((_battleData.BattleType & BattleData.BattleTypeFlag.EnemyCombined) != 0) { for (int i = 0; i < 6; i++) { if (_battleData.Initial.EnemyMembersEscort[i] > 0) { BattleDetails.Add(new BattleSupportDetail(_battleData, i + 18, Damages[i + 6], Criticals[i + 6], SupportFlag, hps[i + 18])); AddDamage(hps, i + 18, (int)Damages[i + 6]); } } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } for (int i = 0; i < Battle.Initial.EnemyMembers.Length; i++) { if (Battle.Initial.EnemyMembers[i] > 0) { var index = new BattleIndex(BattleSides.EnemyMain, i); BattleDetails.Add(new BattleSupportDetail(Battle, index, Damages[i], Criticals[i], SupportFlag, hps[index])); AddDamage(hps, index, (int)Damages[i]); } } if (Battle.IsEnemyCombined) { for (int i = 0; i < Battle.Initial.EnemyMembersEscort.Length; i++) { if (Battle.Initial.EnemyMembersEscort[i] > 0) { var index = new BattleIndex(BattleSides.EnemyEscort, i); BattleDetails.Add(new BattleSupportDetail(Battle, index, Damages[i + 6], Criticals[i + 6], SupportFlag, hps[index])); AddDamage(hps, index, (int)Damages[i + 6]); } } } }
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) { BattleIndex attacker = new BattleIndex(i, Battle.IsFriendCombined, Battle.IsEnemyCombined); BattleIndex defender = new BattleIndex(Targets[i] + (i < 12 ? 12 : 0), Battle.IsFriendCombined, Battle.IsEnemyCombined); BattleDetails.Add(new BattleDayDetail(Battle, attacker, defender, new double[] { AttackDamages[i] + Damages[defender] - Math.Floor(Damages[defender]) }, //propagates "guards flagship" flag new int[] { CriticalFlags[i] }, -1, null, currentHP[defender])); currentHP[defender] -= 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; } var friendHps = Battle.FriendlySupportInfo.FriendlyInitialHPs.ToArray(); for (int i = 0; i < TorpedoFlags.Length; i++) { int attackType = (TorpedoFlags[i] > 0 ? 1 : 0) | (BomberFlags[i] > 0 ? 2 : 0); if (attackType > 0) { bool isEnemy = new BattleIndex(i, false, Battle.IsEnemyCombined).IsEnemy; // 航空戦は miss/hit=0, critical=1 のため +1 する(通常は miss=0, hit=1, critical=2) BattleDetails.Add(new BattleFriendlyAirDetail( Battle, new BattleIndex(i, Battle.IsFriendCombined, Battle.IsEnemyCombined), Damages[i], Criticals[i] + 1, attackType, isEnemy ? hps[i] : friendHps[i])); if (isEnemy) { AddDamage(hps, i, (int)Damages[i]); } } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } foreach (var attack in Attacks) { int[] tempdmg = new int[24]; foreach (var def in attack.Defenders) { tempdmg[def.Defender] += def.Damage; } for (int i = 0; i < tempdmg.Length; i++) { AddDamage(hps, i, tempdmg[i]); } damages[attack.Attacker] += tempdmg.Sum(); foreach (var def in attack.Defenders.GroupBy(d => d.Defender)) { BattleDetails.Add(new BattleDayDetail(_battleData, attack.Attacker, def.Key, def.Select(d => d.Damage).ToArray(), def.Select(d => d.CriticalFlag).ToArray(), attack.AttackType)); } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } foreach (var atk in Attacks) { switch (atk.AttackType) { case 100: // nelson touch for (int i = 0; i < atk.Defenders.Count; i++) { var comboatk = new BattleIndex(atk.Attacker.Side, i * 2); // #1, #3, #5 BattleDetails.Add(new BattleNightDetail(Battle, comboatk, atk.Defenders[i].Defender, new[] { atk.Defenders[i].RawDamage }, new[] { atk.Defenders[i].CriticalFlag }, atk.AttackType, atk.EquipmentIDs, atk.NightAirAttackFlag, hps[atk.Defenders[i].Defender])); AddDamage(hps, atk.Defenders[i].Defender, atk.Defenders[i].Damage); damages[comboatk] += atk.Defenders[i].Damage; } break; case 101: case 102: // nagato/mutsu touch for (int i = 0; i < atk.Defenders.Count; i++) { var comboatk = new BattleIndex(atk.Attacker.Side, i / 2); // #1, #1, #2 BattleDetails.Add(new BattleNightDetail(Battle, comboatk, atk.Defenders[i].Defender, new[] { atk.Defenders[i].RawDamage }, new[] { atk.Defenders[i].CriticalFlag }, atk.AttackType, atk.EquipmentIDs, atk.NightAirAttackFlag, hps[atk.Defenders[i].Defender])); AddDamage(hps, atk.Defenders[i].Defender, atk.Defenders[i].Damage); damages[comboatk] += atk.Defenders[i].Damage; } break; case 103: case 104: // colorado touch / kongo-class night attack for (int i = 0; i < atk.Defenders.Count; i++) { var comboatk = new BattleIndex(atk.Attacker.Side, i); // #1, #2 (, #3) BattleDetails.Add(new BattleNightDetail(Battle, comboatk, atk.Defenders[i].Defender, new[] { atk.Defenders[i].RawDamage }, new[] { atk.Defenders[i].CriticalFlag }, atk.AttackType, atk.EquipmentIDs, atk.NightAirAttackFlag, hps[atk.Defenders[i].Defender])); AddDamage(hps, atk.Defenders[i].Defender, atk.Defenders[i].Damage); damages[comboatk] += atk.Defenders[i].Damage; } break; default: foreach (var defs in atk.Defenders.GroupBy(d => d.Defender)) { BattleDetails.Add(new BattleNightDetail(Battle, atk.Attacker, defs.Key, defs.Select(d => d.RawDamage).ToArray(), defs.Select(d => d.CriticalFlag).ToArray(), atk.AttackType, atk.EquipmentIDs, atk.NightAirAttackFlag, hps[defs.Key])); AddDamage(hps, defs.Key, defs.Sum(d => d.Damage)); } damages[atk.Attacker] += atk.Defenders.Sum(d => d.Damage); break; } } }
/// <summary> /// 被ダメージ処理を行います。 /// </summary> /// <param name="waveIndex">(基地航空隊の場合)現在の攻撃ウェーブのインデックス。それ以外の場合は 0</param> /// <param name="hps">現在のHPリスト。</param> protected void CalculateAttack(int waveIndex, int[] hps) { for (int i = 0; i < hps.Length; i++) { int attackType = (TorpedoFlags[i] > 0 ? 1 : 0) | (BomberFlags[i] > 0 ? 2 : 0); if (attackType > 0) { // 航空戦は miss/hit=0, critical=1 のため +1 する(通常は miss=0, hit=1, critical=2) BattleDetails.Add(new BattleAirDetail(Battle, waveIndex, new BattleIndex(i, Battle.IsFriendCombined, Battle.IsEnemyCombined), Damages[i], Criticals[i] + 1, attackType, hps[i])); AddDamage(hps, i, (int)Damages[i]); } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } // note: HP計算が正しくできない - 送られてくるHPにはすでに友軍支援のダメージが適用済みであるため、昼戦終了時のHPを参照しなければならない foreach (var attack in Attacks) { foreach (var defs in attack.Defenders.GroupBy(d => d.Defender)) { BattleDetails.Add(new BattleFriendlySupportDetail((BattleNight)Battle, attack.Attacker, defs.Key, defs.Select(d => d.RawDamage).ToArray(), defs.Select(d => d.CriticalFlag).ToArray(), attack.AttackType, attack.EquipmentIDs, attack.NightAirAttackFlag, 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]); if (TorpedoFlags[i] > 0 || BomberFlags[i] > 0) { BattleDetails.Add(new BattleAirDetail(_battleData, AirAttackIndex + 1, i, Damages[i], Criticals[i] + 1, (TorpedoFlags[i] > 0 ? 1 : 0) | (BomberFlags[i] > 0 ? 2 : 0))); } } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } foreach (var attack in Attacks) { foreach (var defs in attack.Defenders.GroupBy(d => d.Defender)) { BattleDetails.Add(new BattleNightDetail(Battle, attack.Attacker, defs.Key, defs.Select(d => d.RawDamage).ToArray(), defs.Select(d => d.CriticalFlag).ToArray(), attack.AttackType, attack.EquipmentIDs, attack.NightAirAttackFlag, hps[defs.Key])); AddDamage(hps, defs.Key, defs.Sum(d => d.Damage)); } damages[attack.Attacker] += attack.Defenders.Sum(d => d.Damage); } }
public override void EmulateBattle(int[] hps, int[] damages) { if (!IsAvailable) { return; } for (int i = 0; i < 6; i++) { AddDamage(hps, i + 6, Damages[i]); BattleDetails.Add(new BattleSupportDetail(_battleData, i + 6, Damages[i], Criticals[i], SupportFlag)); if ((_battleData.BattleType & BattleData.BattleTypeFlag.EnemyCombined) != 0) { AddDamage(hps, i + 18, Damages[i + 6]); BattleDetails.Add(new BattleSupportDetail(_battleData, i + 18, Damages[i + 6], Criticals[i + 6], SupportFlag)); } } }
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; } for (int i = 0; i < hps.Length; i++) { AddDamage(hps, i, Damages[i]); if (TorpedoFlags[i] > 0 || BomberFlags[i] > 0) { // 航空戦は miss/hit=0, critical=1 のため +1 する(通常は miss=0, hit=1, critical=2) BattleDetails.Add(new BattleAirDetail(_battleData, 0, i, Damages[i], Criticals[i] + 1, (TorpedoFlags[i] > 0 ? 1 : 0) | (BomberFlags[i] > 0 ? 2 : 0))); } } CalculateAttackDamage(damages); }
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]; } }