AI调整
This commit is contained in:
parent
52110f5f08
commit
22f374e3a5
@ -6,9 +6,7 @@
|
||||
*/
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Logic.Action;
|
||||
using RuntimeData;
|
||||
|
||||
|
||||
namespace Logic.AI
|
||||
|
||||
@ -32,6 +32,9 @@ namespace Logic.AI
|
||||
_waitUnits ??= new List<UnitData>();
|
||||
_waitGrids ??= new List<GridData>();
|
||||
_waitCity ??= new List<CityData>();
|
||||
_waitUnits.Clear();
|
||||
_waitGrids.Clear();
|
||||
_waitCity.Clear();
|
||||
|
||||
var gridSet = map.GetPlayerTerritoryGridIdSet(player.Id);
|
||||
var unitList = new List<UnitData>();
|
||||
|
||||
@ -95,11 +95,11 @@ namespace Logic.AI
|
||||
|
||||
private bool IsTrueAction(AIActionBase aiAction)
|
||||
{
|
||||
if (aiAction.ActionLogic is UnitAttackAction && UnitOnCity.Contains(aiAction.Param.TargetUnitData)) return true;
|
||||
if (aiAction.ActionLogic.ActionId == null) return false;
|
||||
if (aiAction.ActionLogic.ActionId.UnitActionType == UnitActionType.Capture) return true;
|
||||
if (aiAction.ActionLogic.ActionId.UnitActionType == UnitActionType.Gather) return true;
|
||||
if (aiAction.ActionLogic.ActionId.UnitActionType == UnitActionType.Examine) return true;
|
||||
if (aiAction.ActionLogic is UnitAttackAction && UnitOnCity.Contains(aiAction.Param.TargetUnitData)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -128,7 +128,6 @@ namespace Logic.AI
|
||||
}
|
||||
|
||||
var scoreOffset = aiAction.Result.GetAllScore() - startResult.GetAllScore();
|
||||
if (scoreOffset < 0) continue;
|
||||
if (maxAction == null || scoreOffset > maxScoreOffset)
|
||||
{
|
||||
maxAction = aiAction;
|
||||
|
||||
@ -257,7 +257,8 @@ namespace Logic.Editor
|
||||
if (owner != _curPlayerId) continue;
|
||||
var target = _calculator.UnitTargetMap.GetUnitTargetByUnitId(kv.Key.Id);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
InspectorUtils.InspectorTextWidthRich($"小兵{kv.Key.Id}评分: {kv.Value}");
|
||||
var pos = _main.MapData.GetGridDataByUnitId(kv.Key.Id, out var grid);
|
||||
InspectorUtils.InspectorTextWidthRich($"小兵{kv.Key.Id}评分: {kv.Value}, 位置为 {grid.Pos.X}, {grid.Pos.Y}");
|
||||
if (target != null) InspectorUtils.InspectorTextWidthRich($" 目标为:{target.TargetType}, 位置为:{target.Grid.Pos.X}, {target.Grid.Pos.Y}");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user