36 lines
1.8 KiB
C#
Executable File
36 lines
1.8 KiB
C#
Executable File
using Cal;
|
|
namespace ET
|
|
{
|
|
public class SkillOptionLogic_根据人数改变伤害 : SkillOptionLogicBase
|
|
{
|
|
public override SkillOptionType skillOptionType => SkillOptionType.根据人数改变伤害;
|
|
public override SkillOptionBase skillOptionBase { get; set; }
|
|
|
|
SkillOption_根据人数改变伤害 skillOption;
|
|
public override void HandleEvent(ISkillSender skillSender)
|
|
{
|
|
skillOption = skillOptionBase.As<SkillOption_根据人数改变伤害>();
|
|
|
|
Unit owner = skillSender.caster;
|
|
TargetableUnitComponent targetComponent = owner.GetComponent<TargetableUnitComponent>();
|
|
int aliveCount = targetComponent.GetTagetAliveCount();
|
|
if (aliveCount >= 4) return;
|
|
if (!SkillHelper.GetParam(skillOption.param, skillSender.skillConfigId, out float value))
|
|
return;
|
|
if (skillSender is not ModifierSkillSender modifierSkillSender)
|
|
{
|
|
Log.Error($"skillSender = {skillSender} is not ModifierSkillSender");
|
|
return;
|
|
}
|
|
AttackComponent attacker = owner.GetComponent<AttackComponent>();
|
|
// ModifierContainerComponent modifierContainerComponent = owner.GetComponent<ModifierContainerComponent>();
|
|
// ModifierLogic modifierLogic =modifierContainerComponent.GetModifierLogic(modifierSkillSender.modifierId);
|
|
ModifierLogic modifierLogic = modifierSkillSender.modifierLogic;
|
|
if (modifierLogic == null)
|
|
return;
|
|
float valueInt = 1 + (value - 1) / (aliveCount + 0.01f);
|
|
modifierLogic.multiDamageX10000 = valueInt - attacker.multipleDamageX10000;
|
|
attacker.multipleDamageX10000 =( valueInt);
|
|
}
|
|
}
|
|
} |