Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified DependentAssemblies/KanColleWrapper.dll
Binary file not shown.
17 changes: 6 additions & 11 deletions LandBasedAirCorpsPlugin/Models/AirRegiment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,12 @@ public double AirSuperiority
{
get
{
if (this.Behavior == AirRegimentBehavior.Defense)
{
var bonus = this.Squadrons
.Where(x => x.State == SquadronState.Deployed)
.MaxByViewRange()
.GetSurveillanceBonus();

return Math.Floor(this.Squadrons.Select(x => x.AirSuperiorityAtDefense).Sum() * bonus);
}

return this.Squadrons.Select(x => x.AirSuperiorityAtSortie).Sum();
var bonus = this.Squadrons
.Where(x => x.State == SquadronState.Deployed)
.MaxByViewRange()
.GetSurveillanceBonus(this.Behavior);

return Math.Floor(this.Squadrons.Select(x => x.GetAirSuperiority(this.Behavior)).Sum() * bonus);
}
}

Expand Down
15 changes: 15 additions & 0 deletions LandBasedAirCorpsPlugin/Models/AirRegimentBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ namespace LandBasedAirCorpsPlugin.Models
{
public enum AirRegimentBehavior
{
/// <summary>
/// 待機。
/// </summary>
Standby,
/// <summary>
/// 出撃。
/// </summary>
Sortie,
/// <summary>
/// 防空。
/// </summary>
Defense,
/// <summary>
/// 退避。
/// </summary>
Retreat,
/// <summary>
/// 休息。
/// </summary>
Rest
}

Expand Down
32 changes: 21 additions & 11 deletions LandBasedAirCorpsPlugin/Models/Calculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,36 @@ public static Squadron MaxByViewRange(this IEnumerable<Squadron> source)
: null;
}

public static double GetSurveillanceBonus(this Squadron squadron)
public static double GetSurveillanceBonus(this Squadron squadron, AirRegimentBehavior behavior)
{
if (squadron == null) return 1;

var info = squadron.Plane.Info;
if (info.Type == SlotItemType.艦上偵察機)
if (behavior == AirRegimentBehavior.Defense)
{
return info.ViewRange <= 7 ? 1.2 : 1.3;
}
else if(info.Type == SlotItemType.大型飛行艇 || info.Type == SlotItemType.水上偵察機)
{
return info.ViewRange <= 7 ? 1.1
: info.ViewRange == 8 ? 1.13
: 1.16;
if (info.Type == SlotItemType.艦上偵察機)
{
return info.ViewRange <= 7 ? 1.2 : 1.3;
}
else if (info.Type == SlotItemType.大型飛行艇 || info.Type == SlotItemType.水上偵察機)
{
return info.ViewRange <= 7 ? 1.1
: info.ViewRange == 8 ? 1.13
: 1.16;
}
else
{
return info.ViewRange == 8 ? 1.18 : 1.23;
}
}
else
{
return 1.18;
if (info.Type == SlotItemType.陸上偵察機)
{
return info.ViewRange == 8 ? 1.15 : 1.18;
}
return 1;
}

}
}
}
35 changes: 10 additions & 25 deletions LandBasedAirCorpsPlugin/Models/Squadron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,19 @@ public SlotItem Plane
}
#endregion

public double AirSuperiorityAtSortie
public double GetAirSuperiority(AirRegimentBehavior behavior)
{
get
{
if (this.State != SquadronState.Deployed) return 0;

var info = this.Plane.Info;
var intercept = this.IsInterceptor ? info.Evade : 0;
var improvementBonus = this.GetImprovementBonus(this.Plane);

return Math.Floor((info.AA + (1.5 * intercept) + improvementBonus) * Math.Sqrt(this.WorkingCount) + this.Plane.GetBonus());
}
}
if (this.State != SquadronState.Deployed) return 0;

public double AirSuperiorityAtDefense
{
get
{
if (this.State != SquadronState.Deployed) return 0;

var info = this.Plane.Info;
var intercept = this.IsInterceptor ? info.Evade : 0;
var antiBomber = this.IsInterceptor ? info.Hit : 0;
var improvementBonus = this.GetImprovementBonus(this.Plane);
var info = this.Plane.Info;
var intercept = this.IsInterceptor ? info.Evade : 0;
var antiBomber = this.IsInterceptor ? info.Hit : 0;
var improvementBonus = this.GetImprovementBonus(this.Plane);


return Math.Floor((info.AA + intercept + (2 * antiBomber) + improvementBonus) * Math.Sqrt(this.WorkingCount) + this.Plane.GetBonus());
}
}
var correctAA = (behavior == AirRegimentBehavior.Defense) ? (info.AA + intercept + (2 * antiBomber)) : (info.AA + (1.5 * intercept));
return Math.Floor((correctAA + improvementBonus) * Math.Sqrt(this.WorkingCount) + this.Plane.GetBonus());
}

public bool IsInterceptor => this.Plane?.Info.Type == SlotItemType.局地戦闘機;

Expand Down
9 changes: 9 additions & 0 deletions LandBasedAirCorpsPlugin/Models/SquadronState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ namespace LandBasedAirCorpsPlugin.Models
{
public enum SquadronState
{
/// <summary>
/// 未配属。
/// </summary>
Undeployed,
/// <summary>
/// 配属済み。
/// </summary>
Deployed,
/// <summary>
/// 配置転換中。
/// </summary>
Relocating
}
}