Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Commit

Permalink
增加建筑扩建AI
Browse files Browse the repository at this point in the history
  • Loading branch information
k45399735 committed Aug 4, 2013
1 parent 4b2b071 commit 28ec28f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
30 changes: 30 additions & 0 deletions GameObjects/GameObjects/Architecture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,18 @@ public void AI()
this.AIWork(false);
this.AITransfer();
this.InsideTacticsAI();
this.AIExpand();
ExtensionInterface.call("AIArchitecture", new Object[] { this.Scenario, this });
}

private void AIExpand()
{
if (this.ExpandAvail())
{
this.Expand();
}
}

private void AIExecute()
{
if (base.Scenario.IsPlayer(this.BelongedFaction)) return;
Expand Down Expand Up @@ -13429,6 +13438,27 @@ public bool ExpandAvail()
return true;
}

public void Expand()
{
this.Fund -= this.ExpandFund();
foreach (Point point in this.ExpandPoint())
{
this.ArchitectureArea.AddPoint(point);
}


this.ContactArea = this.ArchitectureArea.GetContactArea(false);
this.ViewArea = GameArea.GetAreaFromArea(this.ArchitectureArea, this.ViewDistance, this.Kind.HasObliqueView, base.Scenario, this.BelongedFaction);
this.LongViewArea = GameArea.GetAreaFromArea(this.ArchitectureArea, this.LongViewDistance, this.Kind.HasObliqueView, base.Scenario, this.BelongedFaction);
this.BaseFoodSurplyArea = this.LongViewArea;

foreach (Point point in this.ArchitectureArea.Area)
{
base.Scenario.MapTileData[point.X, point.Y].TileArchitecture = this;
}

base.Scenario.SetMapTileArchitecture(this);
}

public PersonList meifaxianhuaiyundefeiziliebiao()
{
Expand Down
19 changes: 1 addition & 18 deletions WorldOfTheThreeKingdoms/YouxiPingmu/ScreenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,24 +1094,7 @@ public void SetCreatingTroopPosition(Point position)

internal void ArchitectureExpand()
{
this.CurrentArchitecture.Fund -= this.CurrentArchitecture.ExpandFund();
foreach (Point point in this.CurrentArchitecture.ExpandPoint())
{
this.CurrentArchitecture.ArchitectureArea.AddPoint(point);
}


this.CurrentArchitecture.ContactArea = this.CurrentArchitecture.ArchitectureArea.GetContactArea(false);
this.CurrentArchitecture.ViewArea = GameArea.GetAreaFromArea(this.CurrentArchitecture.ArchitectureArea, this.CurrentArchitecture.ViewDistance, this.CurrentArchitecture.Kind.HasObliqueView, this.gameScenario, this.CurrentArchitecture.BelongedFaction);
this.CurrentArchitecture.LongViewArea = GameArea.GetAreaFromArea(this.CurrentArchitecture.ArchitectureArea, this.CurrentArchitecture.LongViewDistance, this.CurrentArchitecture.Kind.HasObliqueView, this.gameScenario, this.CurrentArchitecture.BelongedFaction);
this.CurrentArchitecture.BaseFoodSurplyArea = this.CurrentArchitecture.LongViewArea;

foreach (Point point in this.CurrentArchitecture.ArchitectureArea.Area)
{
this.gameScenario.MapTileData[point.X, point.Y].TileArchitecture = this.CurrentArchitecture;
}

this.gameScenario.SetMapTileArchitecture(this.CurrentArchitecture);
this.CurrentArchitecture.Expand();
}
}

Expand Down

0 comments on commit 28ec28f

Please sign in to comment.