86 lines
3.0 KiB
C#
86 lines
3.0 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年04月23日 星期三 21:04:18
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System.Collections.Generic;
|
|
using RuntimeData;
|
|
using System;
|
|
using Logic.CrashSight;
|
|
using TH1_Logic.Core;
|
|
using TH1Renderer;
|
|
using MemoryPack;
|
|
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public partial class SplashSkill : SkillBase
|
|
{
|
|
public SplashSkill()
|
|
{
|
|
IsPermanent = true;
|
|
TurnsLimit = 0;
|
|
Score = 4;
|
|
}
|
|
|
|
public override SkillType GetSkillType()
|
|
{
|
|
return SkillType.SPLASH;
|
|
}
|
|
|
|
public override void OnDamageOther(MapData mapData, SettlementInfo info)
|
|
{
|
|
if (info == null) return;
|
|
if (info.DamageType != DamageType.ActiveAttack) return;
|
|
if (info.DamageOrigin == null )return;//|| info.DamageTarget == null) return;
|
|
|
|
if (!mapData.GetPlayerDataByUnitId(info.DamageOrigin.Id, out var player)) return;
|
|
var selfUnitList = new HashSet<UnitData>();
|
|
mapData.GetUnitDataListByPlayerId(player.Id, selfUnitList);
|
|
|
|
if (info.DamageTargetGrid == null)
|
|
{
|
|
LogSystem.LogError($"SplashSkill info.DamageTarget is null");
|
|
return;
|
|
}
|
|
var roundGrid = mapData.GridMap.GetAroundGridData(1, 1, info.DamageTargetGrid);
|
|
foreach (var grid in roundGrid)
|
|
{
|
|
|
|
if (!mapData.GetUnitDataByGid(grid.Id, out var unit)) continue;
|
|
if (unit == info.DamageTarget) continue;
|
|
if (selfUnitList.Contains(unit)) continue;
|
|
if (mapData.IsLeagueUnitByUnit(unit.Id, info.DamageOrigin.Id)) continue;
|
|
// 计算攻击伤害
|
|
var damage = Table.Instance.CalcDamage(mapData, info.DamageOrigin, unit, damagePara:0.5f);
|
|
unit.Renderer(mapData)?.InstantUpdateUnit(true);
|
|
Main.UnitLogic.DamageSettlement(mapData, info.DamageOrigin, unit, damage, DamageType.Splash);
|
|
|
|
//TODO 动画系统要接管
|
|
if (grid.InMainSight())
|
|
{
|
|
var g = grid;
|
|
var u = unit;
|
|
float tm = Table.Instance.ProjectileTypeDataAssets.GetProjectileTypeInfo(ProjectileType.Bomb,
|
|
out var pinfo)
|
|
? pinfo.AnimTime
|
|
: 0.5f;
|
|
Timer.Instance.TimerRegister(this, () =>
|
|
{
|
|
u.Renderer(mapData)?.InstantUpdateUnit(true);
|
|
u.Renderer(mapData)?.InstantUpdateTryDie();
|
|
g.Renderer(mapData)?.SetBounceAnim(NeedRandomWait:true);
|
|
g.Renderer(mapData)?.PlayVFX(new GridVFXParams(GridVFXType.Hurt));
|
|
g.Renderer(mapData)?.PlayVFX(new GridVFXParams(GridVFXType.Damage,damage));
|
|
},tm , "SPLASHANIM TMP");
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
} |