53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description: 恋自动移动技能
|
|
* @Date: 2026年03月09日
|
|
* @Modify:
|
|
*/
|
|
|
|
using System.Collections.Generic;
|
|
using Logic.Action;
|
|
using Logic.AI;
|
|
using RuntimeData;
|
|
using MemoryPack;
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class KoishiAutoMoveSkill : SkillBase
|
|
{
|
|
public KoishiAutoMoveSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 4;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.KoishiAutoMove;
|
|
}
|
|
|
|
public override void OnTurnEnd(IdentifierBase self, MapData mapData)
|
|
{
|
|
var unit = self as UnitData;
|
|
mapData.GetPlayerDataByUnitId(self.Id, out var player);
|
|
if (unit == null || player == null) return;
|
|
|
|
var data = new AICalculatorData();
|
|
data.Map = mapData;
|
|
data.Player = player;
|
|
data.TargetParam.MapData = mapData;
|
|
data.TargetParam.PlayerData = player;
|
|
data.TargetParam.UnitData = unit;
|
|
data.TargetParam.OnParamChanged();
|
|
AIActionGenerator.GeneratorActionIds(data, CommonActionType.UnitMove);
|
|
if (data.AIActions.Count == 0) return;
|
|
|
|
data.TargetParam.RefreshParams();
|
|
var index = mapData.Net.GetRandom(mapData).Next(0, data.AIActions.Count - 1); // 生成 index
|
|
data.AIActions[index].ActionLogic.CompleteExecute(data.AIActions[index].Param);
|
|
}
|
|
}
|
|
}
|
|
|