AI调整
This commit is contained in:
parent
4f005eba94
commit
8009c298ae
@ -24,7 +24,7 @@ MonoBehaviour:
|
||||
_version: 3.33
|
||||
_category:
|
||||
_comments:
|
||||
_translation: {x: 633, y: 56}
|
||||
_translation: {x: 504, y: 112}
|
||||
_zoomFactor: 1
|
||||
_haltSerialization: 0
|
||||
_externalSerializationFile: {fileID: 0}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -579,7 +579,7 @@ MonoBehaviour:
|
||||
Defense: 1
|
||||
AttackRange: 1
|
||||
MoveRange: 2
|
||||
Cost: 0
|
||||
Cost: 2
|
||||
Skills: 0b000000070000000d000000
|
||||
Sprite: {fileID: 0}
|
||||
SpriteGlow: {fileID: 0}
|
||||
|
||||
@ -107872,10 +107872,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NoAI: 0
|
||||
FullSight: 0
|
||||
FullSight: 1
|
||||
AIActionTime: 0.5
|
||||
AIAllTech: 1
|
||||
AIMoreMoney: 1
|
||||
AIMoreMoney: 0
|
||||
LandThreshold: 0.3
|
||||
AnimationSpeed: 1
|
||||
DebugMode: 1
|
||||
|
||||
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using Logic.AI;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
@ -35,6 +36,10 @@ namespace NodeCanvas.Tasks.Actions
|
||||
return;
|
||||
}
|
||||
|
||||
if (CalculateTypes[0] == CalculateType.UnitMoveToTargetGrid)
|
||||
{
|
||||
Debug.Log(111);
|
||||
}
|
||||
data.value.MaxAiAction = AIActionScoreCalculator.CalculateAIActionScore(data.value, CalculateTypes);
|
||||
if (data.value.MaxAiAction == null)
|
||||
{
|
||||
|
||||
@ -91,7 +91,7 @@ namespace Logic.AI
|
||||
public Dictionary<uint, int> DevelopmentScore;
|
||||
// 玩家对我的威胁分
|
||||
public Dictionary<uint, int> ThreatScore;
|
||||
// 玩家对我的军事差距
|
||||
// 我减去其他玩家的军事差距
|
||||
public Dictionary<uint, int> MilitaryGapScore;
|
||||
// 玩家对我的地缘距离
|
||||
public Dictionary<uint, int> GeographicalDistance;
|
||||
@ -786,7 +786,7 @@ namespace Logic.AI
|
||||
return score;
|
||||
}
|
||||
|
||||
// 计算两个小兵的克制分
|
||||
// 计算两个小兵的克制分 克制分表 克制表
|
||||
public int CalUnitCounterScore(UnitData self, UnitData target)
|
||||
{
|
||||
if (self.UnitType == UnitType.Archer && target.UnitType == UnitType.Warrior) return 1;
|
||||
@ -870,8 +870,8 @@ namespace Logic.AI
|
||||
foreach (var target in Map.PlayerMap.PlayerDataList)
|
||||
{
|
||||
if (target == Player) continue;
|
||||
if (ThreatScore[target.Id] < 10) continue;
|
||||
if (MilitaryGapScore[target.Id] > -2) continue;
|
||||
if (ThreatScore[target.Id] < 2) continue;
|
||||
if (MilitaryGapScore[target.Id] < -5) continue;
|
||||
CountryStrategy = Strategy.Attack;
|
||||
AttackPlayer = target;
|
||||
return;
|
||||
@ -880,7 +880,7 @@ namespace Logic.AI
|
||||
foreach (var target in Map.PlayerMap.PlayerDataList)
|
||||
{
|
||||
if (target == Player) continue;
|
||||
if (MilitaryGapScore[target.Id] > -8) continue;
|
||||
if (MilitaryGapScore[target.Id] < 0) continue;
|
||||
CountryStrategy = Strategy.Attack;
|
||||
AttackPlayer = target;
|
||||
return;
|
||||
|
||||
@ -891,7 +891,7 @@ namespace Logic.AI
|
||||
foreach (var unit in param.MapData.UnitMap.UnitList)
|
||||
{
|
||||
if (!param.MapData.GetGridDataByUnitId(unit.Id, out var unitGrid)) continue;
|
||||
if (param.MapData.GridMap.CalcDistance(cityGrid, unitGrid) > 3) continue;
|
||||
if (param.MapData.GridMap.CalcDistance(cityGrid, unitGrid) > 8) continue;
|
||||
if (!Table.Instance.UnitTypeDataAssets.GetUnitTypeInfo(unit.UnitType, unit.GiantType, out var info))
|
||||
continue;
|
||||
if (selfUnits.Contains(unit))
|
||||
@ -911,7 +911,7 @@ namespace Logic.AI
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
score += data.CalUnitCounterScore(selfUnit, target);
|
||||
score += data.CalUnitCounterScore(selfUnit, target) * 2;
|
||||
score -= data.CalUnitCounterScore(target, selfUnit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -791,7 +791,7 @@ namespace Logic.Action
|
||||
public override bool CheckCan(CommonActionParams actionParam)
|
||||
{
|
||||
//如果是unit或者city来执行gain操作,直接return false
|
||||
if (actionParam.UnitData != null || actionParam.CityData != null)
|
||||
if (actionParam.MainObjectType != MainObjectType.Grid)
|
||||
return false;
|
||||
if (actionParam.GridData == null)
|
||||
return false;
|
||||
@ -815,7 +815,7 @@ namespace Logic.Action
|
||||
public override bool CheckShow(CommonActionParams actionParam)
|
||||
{
|
||||
//如果是unit或者city来执行gain操作,直接return false
|
||||
if (actionParam.UnitData != null || actionParam.CityData != null)
|
||||
if (actionParam.MainObjectType != MainObjectType.Grid)
|
||||
return false;
|
||||
if (actionParam.GridData == null)
|
||||
return false;
|
||||
@ -973,7 +973,9 @@ namespace Logic.Action
|
||||
public override bool CheckCan(CommonActionParams actionParam)
|
||||
{
|
||||
//如果是unit或者city来执行build操作,直接return false
|
||||
if (actionParam.UnitData != null || actionParam.CityData != null || actionParam.GridData == null)
|
||||
if (actionParam.MainObjectType != MainObjectType.Grid)
|
||||
return false;
|
||||
if (actionParam.GridData == null)
|
||||
return false;
|
||||
//如果没有对应科技,return false
|
||||
if (!actionParam.PlayerData.TechTree.CheckActionCan(_actionId))
|
||||
@ -1130,7 +1132,9 @@ namespace Logic.Action
|
||||
public override bool CheckShow(CommonActionParams actionParam)
|
||||
{
|
||||
//如果是unit或者city来执行build操作,直接return false
|
||||
if (actionParam.UnitData != null || actionParam.CityData != null || actionParam.GridData == null)
|
||||
if (actionParam.MainObjectType != MainObjectType.Grid)
|
||||
return false;
|
||||
if (actionParam.GridData == null)
|
||||
return false;
|
||||
//如果没有对应科技,return false
|
||||
if (!actionParam.PlayerData.TechTree.CheckActionCan(_actionId))
|
||||
@ -2125,7 +2129,7 @@ namespace Logic.Action
|
||||
public override bool CheckCan(CommonActionParams actionParams)
|
||||
{
|
||||
//如果是unit或者city来执行gridMisc操作,直接return false
|
||||
if (actionParams.UnitData != null || actionParams.CityData != null)
|
||||
if (actionParams.MainObjectType != MainObjectType.Grid)
|
||||
return false;
|
||||
if (actionParams.GridData == null)
|
||||
return false;
|
||||
|
||||
@ -480,6 +480,15 @@ namespace Logic
|
||||
playerData.TechTree.LearnTech(TechType.Mining);
|
||||
playerData.TechTree.LearnTech(TechType.Forestry);
|
||||
playerData.TechTree.LearnTech(TechType.Hunting);
|
||||
playerData.TechTree.LearnTech(TechType.Smithery);
|
||||
playerData.TechTree.LearnTech(TechType.Mathematics);
|
||||
playerData.TechTree.LearnTech(TechType.FreeSpirit);
|
||||
playerData.TechTree.LearnTech(TechType.Chivalry);
|
||||
playerData.TechTree.LearnTech(TechType.Sailing);
|
||||
playerData.TechTree.LearnTech(TechType.Navigation);
|
||||
playerData.TechTree.LearnTech(TechType.Ramming);
|
||||
playerData.TechTree.LearnTech(TechType.Riding);
|
||||
playerData.TechTree.LearnTech(TechType.Archery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,12 @@ public class DebugUI
|
||||
TextMeshProUGUI tmp = textObj.AddComponent<TextMeshProUGUI>();
|
||||
tmp.text = $"-------- ID={player.Id}, Civ={player.PlayerCivId}, Force={player.PlayerForceId} --------\n";
|
||||
tmp.text += $"Money = {player.PlayerWealth}, Stratery = ???\n";
|
||||
tmp.text += " --- \n";
|
||||
tmp.text += $"Tech:";
|
||||
foreach (var tech in player.TechTree.TechList)
|
||||
{
|
||||
tmp.text += tech + " ";
|
||||
}
|
||||
tmp.text += "\n --- \n";
|
||||
tmp.fontSize = 24;
|
||||
tmp.alignment = TextAlignmentOptions.Center;
|
||||
tmp.color = Color.white;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user