Skip to content

Commit

Permalink
Merge pull request #1 from teshiba/develop
Browse files Browse the repository at this point in the history
Add source files
  • Loading branch information
teshiba authored Mar 22, 2020
2 parents bf7340d + bef7ca2 commit 7caaf70
Show file tree
Hide file tree
Showing 226 changed files with 13,930 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,9 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/

#OpenCover coverage result
coverage.xml

#ReportGenerator result
Coverage/
31 changes: 31 additions & 0 deletions LibAoe2AISharp.sln
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
35 changes: 35 additions & 0 deletions LibAoe2AISharp/.editorconfig
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
36 changes: 36 additions & 0 deletions LibAoe2AISharp/Framework/Actions/Build/Build.cs
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));
}
}
}
30 changes: 30 additions & 0 deletions LibAoe2AISharp/Framework/Actions/Build/BuildHouse.cs
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));
}
}
}
51 changes: 51 additions & 0 deletions LibAoe2AISharp/Framework/Actions/Build/BuildLumberCamp.cs
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 LibAoe2AISharp/Framework/Actions/Build/BuildMarketCondition.cs
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();
}
}
}
50 changes: 50 additions & 0 deletions LibAoe2AISharp/Framework/Actions/Build/BuildMill.cs
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();
}
}
}
52 changes: 52 additions & 0 deletions LibAoe2AISharp/Framework/Actions/Build/BuildMiningCamp.cs
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();
}
}
}
Loading

0 comments on commit 7caaf70

Please sign in to comment.