55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年06月06日 星期五 19:06:16
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using Logic.AI;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using RuntimeData;
|
|
using TH1_Logic.Action;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Name("筛选联盟请求")]
|
|
[Category("AI节点")]
|
|
[Serializable]
|
|
public class AIParamHandleLeagueRequest : BaseActionTask
|
|
{
|
|
protected override string desc => string.Format($"筛选联盟请求");
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value?.TargetParam == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
for (int i = data.value.AIActions.Count - 1; i >= 0; i--)
|
|
{
|
|
var self = data.value.AIActions[i].Param.PlayerData;
|
|
var target = data.value.AIActions[i].Param.TargetPlayerData;
|
|
if (self != null && target != null)
|
|
{
|
|
self.GetCountryDiplomacyInfo(target.Id, out var selfToTarget);
|
|
if (data.value.AIActions[i].ActionLogic.ActionId.PlayerActionType == PlayerActionType.AcceptAlly &&
|
|
selfToTarget.FeelingValue >= 90) continue;
|
|
if (data.value.AIActions[i].ActionLogic.ActionId.PlayerActionType == PlayerActionType.RefuseAlly &&
|
|
selfToTarget.FeelingValue < 90) continue;
|
|
}
|
|
data.value.AIActions.RemoveAt(i);
|
|
}
|
|
|
|
EndAction(data.value.AIActions.Count > 0);
|
|
}
|
|
}
|
|
} |