Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
駆逐艦専用カットインにおけるD型主砲搭載時の火力計算処理改善
Browse files Browse the repository at this point in the history
夜間瑞雲攻撃の火力計算対応
フレッチャー級専用対空カットインの表示文字列修正
  • Loading branch information
yosxpeee committed Mar 1, 2023
1 parent b769ffc commit 5d6cea7
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 23 deletions.
8 changes: 4 additions & 4 deletions ElectronicObserver/Data/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,13 @@ public static string GetAACutinKind(int id)
case 33:
return "高角砲/機銃(非集中)<Gotland>";
case 34:
return "Fletcher砲改+GFCSx2<Johnston>";
return "Fletcher砲改+GFCSx2<Fletcher級>";
case 35:
return "Fletcher砲改+GFCS/Fletcher砲改<Johnston>";
return "Fletcher砲改+GFCS/Fletcher砲改<Fletcher級>";
case 36:
return "Fletcher砲改x2/GFCS<Johnston>";
return "Fletcher砲改x2/GFCS<Fletcher級>";
case 37:
return "Fletcher砲改x2<Johnston>";
return "Fletcher砲改x2<Fletcher級>";
case 38:
return "Atlanta砲+GFCSx2<Atlanta>";
case 39:
Expand Down
3 changes: 3 additions & 0 deletions ElectronicObserver/Data/EquipmentDataMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ public bool IsAntiSubmarineAircraft
/// <summary> 夜間攻撃機かどうか </summary>
public bool IsNightAttacker => IconType == 46;

/// <summary> 夜間瑞雲かどうか </summary>
public bool IsNightZuiun => IconType == 51;

/// <summary> Swordfish 系艦上攻撃機かどうか </summary>
public bool IsSwordfish => CategoryType == EquipmentTypes.CarrierBasedTorpedo && Name.Contains("Swordfish");

Expand Down
98 changes: 80 additions & 18 deletions ElectronicObserver/Data/ShipData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1309,28 +1309,32 @@ private int CalculateNightBattlePower()
case NightAttackKind.CutinTorpedoRadar:
{
double baseModifier = 1.3;
int typeDmod2 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 267); // 12.7cm連装砲D型改二
int typeDmod3 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 366); // 12.7cm連装砲D型改三
var modifierTable = new double[] { 1, 1.25, 1.4 };

baseModifier *= modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)] * (1 + typeDmod3 * 0.05);

basepower *= baseModifier;
basepower = CalcTorpedoRaderPicket(basepower, baseModifier);
//int typeDmod2 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 267); // 12.7cm連装砲D型改二
//int typeDmod3 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 366); // 12.7cm連装砲D型改三
//var modifierTable = new double[] { 1, 1.25, 1.4 };
//
//baseModifier *= modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)] * (1 + typeDmod3 * 0.05);
//
//basepower *= baseModifier;
}

break;

//魚見電
case NightAttackKind.CutinTorpedoPicket:
{
double baseModifier = 1.25; // TODO: 処理の共通化
int typeDmod2 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 267); // 12.7cm連装砲D型改二
int typeDmod3 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 366); // 12.7cm連装砲D型改三
var modifierTable = new double[] { 1, 1.25, 1.4 };

baseModifier *= modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)] * (1 + typeDmod3 * 0.05);

basepower *= baseModifier;
double baseModifier = 1.25;

basepower = CalcTorpedoRaderPicket(basepower, baseModifier);
//int typeDmod2 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 267); // 12.7cm連装砲D型改二
//int typeDmod3 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 366); // 12.7cm連装砲D型改三
//var modifierTable = new double[] { 1, 1.25, 1.4 };
//
//baseModifier *= modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)] * (1 + typeDmod3 * 0.05);
//
//basepower *= baseModifier;
}
break;

Expand All @@ -1347,6 +1351,38 @@ private int CalculateNightBattlePower()
basepower *= 1.3;
}
break;

//夜間瑞雲攻撃
case NightAttackKind.SpecialNightZuiun:
{
double zuiunCountHosei = 0;
double raderHosei = 0;

int nightZuiunCount = AllSlotInstanceMaster.Count(eq => eq?.IsNightZuiun ?? false);
int surfaceRaderCount = AllSlotInstanceMaster.Count(eq => eq?.IsSurfaceRadar ?? false);

if (nightZuiunCount >= 2)
{
zuiunCountHosei += 0.12;
}
else if (nightZuiunCount >= 1)
{
zuiunCountHosei += 0.04;
}
else
{
//ここにきている時点で0はありえないのだが、一応…
zuiunCountHosei = 0;
}

if(surfaceRaderCount >= 1)
{
raderHosei += 0.04;
}

basepower *= (1.2 + zuiunCountHosei + raderHosei);
}
break;
}

basepower += GetLightCruiserDamageBonus() + GetItalianDamageBonus();
Expand All @@ -1357,10 +1393,36 @@ private int CalculateNightBattlePower()
return (int)(basepower * GetAmmoDamageRate());
}

/// <summary>
/// 威力系の計算をまとめて行い、プロパティを更新します。
/// </summary>
private void CalculatePowers()
/// <summary>
/// 主魚電/魚見電カットイン火力計算サブルーチン
/// </summary>
/// <param name="basepower"></param>
/// <param name="baseModifier"></param>
/// <returns></returns>
private double CalcTorpedoRaderPicket(double basepower, double baseModifier)
{
int typeDmod2 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 267); // 12.7cm連装砲D型改二
int typeDmod3 = AllSlotInstanceMaster.Count(eq => eq?.EquipmentID == 366); // 12.7cm連装砲D型改三
var modifierTable = new double[] { 1, 1.25, 1.4 };

//[Note]
//D2もD3もないならmodifierTableの0番目(すなわち1)が選ばれるように計算している
Console.WriteLine("CalcTorpedoRaderPicket: {0}x{1}x{2}",
baseModifier,
modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)],
1 + (typeDmod3 * 0.05)
);

//2023/02/28 D三2本積みでこれはどうかわるか?
// 単純に0.05+0.05ではなさそう
baseModifier *= modifierTable[Math.Min(typeDmod2 + typeDmod3, modifierTable.Length - 1)] * (1 + (typeDmod3 * 0.05));
return basepower *= baseModifier;
}

/// <summary>
/// 威力系の計算をまとめて行い、プロパティを更新します。
/// </summary>
private void CalculatePowers()
{

int form = Utility.Configuration.Config.Control.PowerEngagementForm;
Expand Down
12 changes: 12 additions & 0 deletions ElectronicObserver/Data/ShipDataMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,18 @@ public int RemodelTier
ShipID == 509 //熊野航改二
);

/// <summary>
/// 夜間瑞雲攻撃が可能な艦種であるか
/// (航空戦艦/航空巡洋艦/軽巡洋艦/水上機母艦)
/// </summary>
public bool CanNightZuiunAttack =>
(
ShipType == ShipTypes.AviationBattleship ||
ShipType == ShipTypes.AviationCruiser ||
ShipType == ShipTypes.LightCruiser ||
ShipType == ShipTypes.SeaplaneTender
);

/// <summary>
/// 自身のパラメータレコードを取得します。
/// </summary>
Expand Down
16 changes: 15 additions & 1 deletion ElectronicObserver/Utility/Data/Calculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ public static NightAttackKind GetNightAttackKind(int[] slot, int attackerShipID,
int picketCrewCount = 0;
int masterPicketCrewCount = 0;
int drumCount = 0;
int nightZuiunCount = 0;

if (slot == null)
return NightAttackKind.Unknown;
Expand Down Expand Up @@ -1025,6 +1026,12 @@ public static NightAttackKind GetNightAttackKind(int[] slot, int attackerShipID,
lateModelTorpedoCount++;
break;

// 夜間瑞雲
case EquipmentTypes.SeaplaneBomber:
if (eq.IsNightZuiun)
nightZuiunCount++;
break;

// 夜間戦闘機
case EquipmentTypes.CarrierBasedFighter:
if (eq.IsNightFighter)
Expand Down Expand Up @@ -1099,7 +1106,6 @@ public static NightAttackKind GetNightAttackKind(int[] slot, int attackerShipID,

if (includeSpecialAttack)
{

// 駆逐艦カットイン
if (attacker?.ShipType == ShipTypes.Destroyer)
{
Expand All @@ -1124,6 +1130,12 @@ public static NightAttackKind GetNightAttackKind(int[] slot, int attackerShipID,
if (torpedoCount >= 2 || (lateModelTorpedoCount >= 1 && submarineEquipmentCount >= 1))
return NightAttackKind.CutinTorpedoTorpedo;

//夜間瑞雲攻撃
if (nightZuiunCount >= 1 && mainGunCount >= 2 && attacker.CanNightZuiunAttack)
{
return NightAttackKind.SpecialNightZuiun;
}

// 汎用カットイン
else if (mainGunCount >= 3)
return NightAttackKind.CutinMainMain;
Expand Down Expand Up @@ -1219,6 +1231,8 @@ public static NightAttackKind GetNightAttackKind(int[] slot, int attackerShipID,
return NightAttackKind.Torpedo;
}
}


}

return NightAttackKind.Shelling;
Expand Down

0 comments on commit 5d6cea7

Please sign in to comment.