88 lines
2.8 KiB
C#
88 lines
2.8 KiB
C#
/*
|
||
* @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 (mapData.IsLeagueOrJustBreakByUnit(self.Id, target.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();
|
||
}
|
||
}*/
|
||
}
|
||
}
|
||
|