2021-04-08 20:09:59 +08:00
|
|
|
|
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_根据人数改变伤害>();
|
2023-09-07 00:06:37 +08:00
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Unit owner = skillSender.caster;
|
|
|
|
|
TargetableUnitComponent targetComponent = owner.GetComponent<TargetableUnitComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int aliveCount = targetComponent.GetTagetAliveCount();
|
|
|
|
|
if (aliveCount >= 4) return;
|
2023-09-07 00:06:37 +08:00
|
|
|
|
if (!SkillHelper.GetParam(skillOption.param, skillSender.skillConfigId, out float value))
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
2021-04-18 15:54:51 +08:00
|
|
|
|
if (skillSender is not ModifierSkillSender modifierSkillSender)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
Log.Error($"skillSender = {skillSender} is not ModifierSkillSender");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-09-07 00:06:37 +08:00
|
|
|
|
AttackComponent attacker = owner.GetComponent<AttackComponent>();
|
|
|
|
|
// ModifierContainerComponent modifierContainerComponent = owner.GetComponent<ModifierContainerComponent>();
|
|
|
|
|
// ModifierLogic modifierLogic =modifierContainerComponent.GetModifierLogic(modifierSkillSender.modifierId);
|
2021-04-11 19:50:39 +08:00
|
|
|
|
ModifierLogic modifierLogic = modifierSkillSender.modifierLogic;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (modifierLogic == null)
|
|
|
|
|
return;
|
|
|
|
|
float valueInt = 1 + (value - 1) / (aliveCount + 0.01f);
|
2023-09-07 00:06:37 +08:00
|
|
|
|
modifierLogic.multiDamageX10000 = valueInt - attacker.multipleDamageX10000;
|
|
|
|
|
attacker.multipleDamageX10000 =( valueInt);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|