Skip to content

Commit

Permalink
Merge pull request #230 from hafuu/fix-air-superiority
Browse files Browse the repository at this point in the history
Fix air superiority
  • Loading branch information
Grabacr07 authored Mar 12, 2018
2 parents 72407ff + d53b5be commit 5938f2e
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum AirSuperiorityCalculationOptions
Default = Maximum,

Minimum = InternalProficiencyMinValue | Fighter,
Maximum = InternalProficiencyMaxValue | Fighter | Attacker | SeaplaneBomber,
Maximum = InternalProficiencyMaxValue | Fighter | Attacker | SeaplaneBomber | JetFightingBomber,

/// <summary>艦上戦闘機、水上戦闘機。</summary>
Fighter = 0x0001,
Expand All @@ -21,6 +21,9 @@ public enum AirSuperiorityCalculationOptions
/// <summary>水上爆撃機。</summary>
SeaplaneBomber = 0x0004,

/// <summary>噴式戦闘爆撃機。</summary>
JetFightingBomber = 0x0008,

/// <summary>内部熟練度最小値による計算。</summary>
InternalProficiencyMinValue = 0x0100,

Expand Down Expand Up @@ -66,6 +69,9 @@ private static AirSuperiorityCalculator GetCalculator(this SlotItem slotItem)
case SlotItemType.水上爆撃機:
return new SeaplaneBomberCalculator();

case SlotItemType.噴式戦闘爆撃機:
return new JetFightingBomberCaluculator();

default:
return EmptyCalculator.Instance;
}
Expand Down Expand Up @@ -117,6 +123,12 @@ private class AttackerCalculator : AirSuperiorityCalculator
{
public override AirSuperiorityCalculationOptions Options => AirSuperiorityCalculationOptions.Attacker;

protected override double GetAirSuperiority(SlotItem slotItem, int onslot)
{
// 爆戦の装備改修による対空値加算 (★ x 0.25)
return (slotItem.Info.AA + slotItem.Level * 0.25) * Math.Sqrt(onslot);
}

protected override double GetProficiencyBonus(SlotItem slotItem, AirSuperiorityCalculationOptions options)
{
var proficiency = slotItem.GetProficiency();
Expand All @@ -135,6 +147,18 @@ protected override double GetProficiencyBonus(SlotItem slotItem, AirSuperiorityC
}
}

private class JetFightingBomberCaluculator : AirSuperiorityCalculator
{
public override AirSuperiorityCalculationOptions Options => AirSuperiorityCalculationOptions.JetFightingBomber;

protected override double GetProficiencyBonus(SlotItem slotItem, AirSuperiorityCalculationOptions options)
{
var proficiency = slotItem.GetProficiency();
return Math.Sqrt(proficiency.GetInternalValue(options) / 10.0);
}
}


private class EmptyCalculator : AirSuperiorityCalculator
{
public static EmptyCalculator Instance { get; } = new EmptyCalculator();
Expand Down

0 comments on commit 5938f2e

Please sign in to comment.