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
|
|
|
|
SelectTargetHelper.GetTarget(skillOption.selectTarget, skillSender, Action);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async ETTask Action(Unit target, ISkillSender skillSender)
|
|
|
|
|
{
|
|
|
|
|
if (skillSender is not ModifierSkillSender modifierSkillSender)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2023-09-07 00:06:37 +08:00
|
|
|
|
Log.Error($"skillSender is not modifierSkillSender");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//反击时施法者是攻击者
|
|
|
|
|
Unit attacker = skillSender.caster;
|
|
|
|
|
//反击 发起者
|
|
|
|
|
Unit beAtker = modifierSkillSender.target;
|
|
|
|
|
if (!beAtker)
|
|
|
|
|
return;
|
|
|
|
|
int skillId = SkillHotfixHelper.GetNomalSkillId(beAtker);
|
|
|
|
|
TargetableUnitComponent targetComponent = beAtker.GetComponent<TargetableUnitComponent>();
|
|
|
|
|
Unit oldTarget = targetComponent.currTarget;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
2023-09-07 00:06:37 +08:00
|
|
|
|
//临时改变;
|
|
|
|
|
targetComponent.currTarget = attacker;
|
|
|
|
|
SkillLogic skillLogic = beAtker.GetComponent<SkillMgrComponent>().GetSkill(skillId);
|
|
|
|
|
AttackComponent attackerComponent = beAtker.GetComponent<AttackComponent>();
|
|
|
|
|
attackerComponent.isFirstAtk = false;
|
|
|
|
|
if (skillLogic == null)
|
|
|
|
|
return;
|
|
|
|
|
skillLogic.HandleEvent(SkillEventCondition.当技能施法时, new SkillSender(beAtker,skillLogic.skillConfigId));
|
|
|
|
|
targetComponent.currTarget = oldTarget;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|