2026-04-19 16:02:59 +08:00

87 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: 白哉
* @Description: 恋自动技能
* @Date: 2026年03月06日
* @Modify:
*/
using RuntimeData;
using System;
using System.Collections.Generic;
using System.Linq;
using Logic.Action;
using MemoryPack;
using TH1Renderer;
using UnityEngine;
namespace Logic.Skill
{
public partial class KoishiAutoSkill : SkillBase
{
public KoishiAutoSkill()
{
IsPermanent = true;
TurnsLimit = 0;
Score = 4;
}
public override SkillType GetSkillType()
{
return SkillType.KoishiAuto;
}
// 移动后为周围1格内所有单位赋予1层KomeijiFear
public override void OnMove(UnitData self, GridData grid, MapData mapData, MoveType moveType, List<Vector2Int> path = null)
{
if (self == null || grid == null || mapData == null) return;
var aroundBuf = RentAroundBuf();
mapData.GridMap.GetAroundGridData(1, 1, grid, aroundBuf);
foreach (var around in aroundBuf)
{
if (!around.RealUnit(mapData, out var target)) continue;
if (target.Id == self.Id) continue;
if (target.GetSkill(SkillType.KomeijiFearImmune, out _)) continue;
target.AddOrOverrideSkill(SkillType.KomeijiFear, mapData, self.Id);
if (MapRenderer.Instance != null &&
MapRenderer.Instance.ROUnitMap.TryGetValue(target.Id, out var unitRenderer))
{
unitRenderer.RenderUpdateUnitImage();
around.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.KomeijiFear));
}
}
ReturnAroundBuf();
}
/*
public override void OnMove(UnitData self, GridData grid, MapData mapData, MoveType moveType, List<Vector2Int> path = null)
{
RefreshKoishiAuto(self, mapData);
}
public override void AfterActiveAttackOther(MapData mapData, AttackInfo info)
{
RefreshKoishiAuto(info.DamageOrigin, mapData);
}
public override void OnActionExecuted(ActionLogicBase logic, CommonActionParams param, UnitData self)
{
if (logic.ActionId.ActionType != CommonActionType.UnitAction) return;
RefreshKoishiAuto(self, param.MapData);
}
private void RefreshKoishiAuto(UnitData self, MapData mapData)
{
foreach (var unit in mapData.UnitMap.UnitList)
{
if (unit == self) continue;
if (!unit.GetSkill(SkillType.KoishiAuto, out _)) continue;
unit.ClearActionPoint();
}
}*/
}
}