CTT/Server/Hotfix/Game/SkillSystem/NewSkill/Component/SkillOptions/SkillOptionLogic_额外攻击目标.cs

41 lines
1.8 KiB
C#
Executable File

using Cal;
using System;
namespace ET
{
public class SkillOptionLogic_ : SkillOptionLogicBase
{
public override SkillOptionType skillOptionType => SkillOptionType.;
public override SkillOptionBase skillOptionBase { get; set; }
SkillOption_ skillOption;
//!递减系数
const float ReduceCoefficent = 0.75f;
public override void HandleEvent(ISkillSender skillSender)
{
skillOption = skillOptionBase.As<SkillOption_>();
AttackComponent attacker = skillSender.caster.GetComponent<AttackComponent>();
TargetableUnitComponent targetUnits = skillSender.caster.GetComponent<TargetableUnitComponent>();
Unit currTarget = targetUnits.currTarget;
if (targetUnits.targetList.Count <= 1)
return;
int index = 0;
int skillid = skillSender.skillConfigId;
int count = SkillHotfixHelper.RandomNumber(skillid,skillOption. minCount,skillOption. maxCount, skillOption.isRndom);
foreach (Unit target in targetUnits.targetList)
{
if (target == currTarget)
continue;
if (!SkillHelper.GetParam(skillOption.valueParam, skillid, out float coefficent))
{
Log.Error($"the data is wrong where skillid is {skillid}");
coefficent = 1;
}
BallisticData attackData = attacker.GetAttackData();
attackData.ChangeValue(MathHelper.RoundToInt(coefficent * attackData.value * MathF.Pow(ReduceCoefficent, ++index)));
attacker.AttackTarget(target, attackData, skillSender, false);
if (index >= count)
break;
}
}
}
}