-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from teshiba/develop
Add source files
- Loading branch information
Showing
226 changed files
with
13,930 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29123.88 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAoe2AISharp", "LibAoe2AISharp\LibAoe2AISharp.csproj", "{71670EB3-3935-4D32-BB3A-97A1D2E80C63}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAoe2AISharpTests", "LibAoe2AISharpTests\LibAoe2AISharpTests.csproj", "{74FC6397-A2D8-43C5-9659-CA7A89E97182}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{71670EB3-3935-4D32-BB3A-97A1D2E80C63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{71670EB3-3935-4D32-BB3A-97A1D2E80C63}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{71670EB3-3935-4D32-BB3A-97A1D2E80C63}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{71670EB3-3935-4D32-BB3A-97A1D2E80C63}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{74FC6397-A2D8-43C5-9659-CA7A89E97182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{74FC6397-A2D8-43C5-9659-CA7A89E97182}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{74FC6397-A2D8-43C5-9659-CA7A89E97182}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{74FC6397-A2D8-43C5-9659-CA7A89E97182}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {408354B6-2C8D-4D49-BF78-1DF4F9DEC6E3} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# NOTE: Requires **VS2019 16.3** or later | ||
|
||
# Microsoft All Rules | ||
# Description: This rule set contains all rules. Running this rule set may result in a large number of warnings being reported. Use this rule set to get a comprehensive picture of all issues in your code. This can help you decide which of the more focused rule sets are most appropriate to run for your projects. | ||
|
||
# Code files | ||
[*.{cs,vb}] | ||
|
||
|
||
# Default severity for analyzer diagnostics - Requires **VS2019 16.5** or later | ||
dotnet_analyzer_diagnostic.severity = warning | ||
|
||
dotnet_diagnostic.CA1707.severity = none | ||
|
||
dotnet_diagnostic.SA1101.severity = none | ||
|
||
dotnet_diagnostic.SA1200.severity = none | ||
|
||
dotnet_diagnostic.SA1300.severity = none | ||
|
||
dotnet_diagnostic.SA1500.severity = none | ||
|
||
dotnet_diagnostic.SA1633.severity = none | ||
|
||
# IDE0008: Use explicit type | ||
csharp_style_var_elsewhere = false:none | ||
|
||
# IDE0008: Use explicit type | ||
csharp_style_var_for_built_in_types = false:none | ||
|
||
# IDE0008: Use explicit type | ||
csharp_style_var_when_type_is_apparent = false:none | ||
|
||
# IDE1006: Naming Styles | ||
dotnet_diagnostic.IDE1006.severity = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using LibAoe2AISharp.Utilty; | ||
using static LibAoe2AISharp.Specifications.Ope; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Confirm that the building can be built with "can_build" then build the building with "build". | ||
/// <para>(<see cref="defrule"/> (<see cref="can_build"/>(<see cref="building"/>)) => (<see cref="build"/>(<see cref="building"/>))).</para> | ||
/// </summary> | ||
public class Build : defrule | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Build"/> class. | ||
/// </summary> | ||
/// <param name="building">Type of building.</param> | ||
public Build(building building) | ||
{ | ||
Comment = "Build " + building.ToLocalLang(); | ||
Facts.Add(new can_build(building)); | ||
Actions.Add(new build(building)); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Build"/> class. | ||
/// </summary> | ||
/// <param name="building">Type of building.</param> | ||
/// <param name="count">Max number.</param> | ||
public Build(building building, int count) | ||
: this(building) | ||
{ | ||
Comment += " up to " + count + "."; | ||
Facts.Add(new building_type_count_total(building, relop.lt, count)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using static LibAoe2AISharp.Specifications.Ope; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Building house. | ||
/// </summary> | ||
public class BuildHouse : Build | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildHouse"/> class. | ||
/// </summary> | ||
public BuildHouse() | ||
: base(building.house) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildHouse"/> class. | ||
/// </summary> | ||
/// <param name="remain">remaining capacity of populations.</param> | ||
public BuildHouse(int remain) | ||
: base(building.house) | ||
{ | ||
Comment += $" remaining capacity less than {remain}"; | ||
Facts.Add(new housing_headroom(relop.le, remain)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using static LibAoe2AISharp.Specifications.Ope; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Build Lumber camp. | ||
/// </summary> | ||
public class BuildLumberCamp : Build | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildLumberCamp"/> class. | ||
/// </summary> | ||
public BuildLumberCamp() | ||
: base(building.lumber_camp) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildLumberCamp"/> class. | ||
/// </summary> | ||
/// <param name="count">building count.</param> | ||
public BuildLumberCamp(int count) | ||
: base(building.lumber_camp, count) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets Distance between resource and Lumber camp. | ||
/// <para> | ||
/// 0 : Build ignore distance. | ||
/// </para> | ||
/// <para> | ||
/// greater than 0: Build if distance between resource and Lumber camp become the property. | ||
/// </para> | ||
/// </summary> | ||
public int Distance { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override string ToScript() | ||
{ | ||
if (Distance > 0) { | ||
Comment += $" Distance more than {Distance}"; | ||
Facts.Add( | ||
new dropsite_min_distance(resource_type.wood, relop.ge, Distance)); | ||
} | ||
|
||
return base.ToScript(); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
LibAoe2AISharp/Framework/Actions/Build/BuildMarketCondition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using static LibAoe2AISharp.Framework.ComplexConditions; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Build market according to ally conditions. | ||
/// </summary> | ||
public class BuildMarketCondition : Build | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildMarketCondition"/> class. | ||
/// </summary> | ||
/// <param name="count">build count.</param> | ||
public BuildMarketCondition(short count) | ||
: base(building.market, count) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets condition for ally in game. | ||
/// </summary> | ||
public Conditions AllyInGame { get; set; } = new Conditions(true); | ||
|
||
/// <summary> | ||
/// Gets or sets condition for ally has market. | ||
/// </summary> | ||
public Conditions AllyHasMarket { get; set; } = new Conditions(true); | ||
|
||
/// <summary> | ||
/// Gets or sets condition for no ally in game. | ||
/// </summary> | ||
public Conditions NoAllyInGame { get; set; } = new Conditions(true); | ||
|
||
/// <inheritdoc/> | ||
public override string ToScript() | ||
{ | ||
Facts.Add( | ||
(AllyInGame & new player_in_game(player_number.any_ally)) | ||
| (AnyAllyHasMarket() & AllyHasMarket) | ||
| NoAllyInGame); | ||
return base.ToScript(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using static LibAoe2AISharp.Specifications.Ope; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Build Mill. | ||
/// </summary> | ||
public class BuildMill : Build | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildMill"/> class. | ||
/// </summary> | ||
public BuildMill() | ||
: base(building.mill) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildMill"/> class. | ||
/// </summary> | ||
/// <param name="count">Max count of buildings.</param> | ||
public BuildMill(int count) | ||
: base(building.mill, count) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets Distance between resource and Mill. | ||
/// <para> | ||
/// 0 : Build ignore distance. | ||
/// </para> | ||
/// <para> | ||
/// greater than 0: Build if distance between resource and Mill become the property. | ||
/// </para> | ||
/// </summary> | ||
public int Distance { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override string ToScript() | ||
{ | ||
if (Distance > 0) { | ||
Comment += $" Distance more than {Distance}"; | ||
Facts.Add(new dropsite_min_distance(resource_type.food, relop.ge, Distance)); | ||
} | ||
|
||
return base.ToScript(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using LibAoe2AISharp.Specifications; | ||
using static LibAoe2AISharp.Specifications.Ope; | ||
|
||
namespace LibAoe2AISharp.Framework | ||
{ | ||
/// <summary> | ||
/// Build Mining camp. | ||
/// </summary> | ||
public class BuildMiningCamp : Build | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildMiningCamp"/> class. | ||
/// </summary> | ||
public BuildMiningCamp() | ||
: base(building.mining_camp) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildMiningCamp"/> class. | ||
/// </summary> | ||
/// <param name="count">Max count of buildings.</param> | ||
public BuildMiningCamp(int count) | ||
: base(building.mining_camp, count) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets Distance between resource and Mining camp. | ||
/// <para> | ||
/// 0 : Build ignore distance. | ||
/// </para> | ||
/// <para> | ||
/// greater than 0: Build if distance between resource and Mining camp become the property. | ||
/// </para> | ||
/// </summary> | ||
public int Distance { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override string ToScript() | ||
{ | ||
if (Distance > 0) { | ||
Comment += $" Distance more than {Distance}"; | ||
Facts.Add( | ||
new dropsite_min_distance(resource_type.gold, relop.ge, Distance) | ||
| new dropsite_min_distance(resource_type.stone, relop.ge, Distance)); | ||
} | ||
|
||
return base.ToScript(); | ||
} | ||
} | ||
} |
Oops, something went wrong.