56 lines
1.6 KiB
C#
56 lines
1.6 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;
|
|
|
|
|
|
namespace NodeCanvas.Tasks.Actions
|
|
{
|
|
[Category("AIAction")]
|
|
[Serializable]
|
|
public class AIParamLeagueRupture : BaseActionTask
|
|
{
|
|
public float Value;
|
|
|
|
protected override string desc => string.Format($"好感度 <= {Value} 就破裂联盟");
|
|
|
|
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
// 直接从Blackboard获取AICalculatorData
|
|
var data = blackboard.GetVariable<AICalculatorData>("Data");
|
|
if (data?.value == null)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
foreach (var info in data.value.Player.DiplomacyData.Info)
|
|
{
|
|
if (info.FeelingValue > Value) continue;
|
|
if (info.DiplomacyState != DiplomacyState.League) continue;
|
|
if (!data.value.Map.PlayerMap.GetPlayerDataByPlayerID(info.PlayerId, out var target)) continue;
|
|
|
|
target.DiplomacyData.GetCountryDiplomacyInfo(data.value.Player.Id, out var playerToSelf);
|
|
info.DiplomacyState = DiplomacyState.LeagueRupture;
|
|
playerToSelf.DiplomacyState = DiplomacyState.LeagueRupture;
|
|
info.IsLeagueRequest = false;
|
|
playerToSelf.IsLeagueRequest = false;
|
|
EndAction(true);
|
|
return;
|
|
}
|
|
|
|
EndAction(false);
|
|
}
|
|
}
|
|
} |