CTT/Server/Hotfix/Game/SkillSystem/NewSkill/Component/SkillOptions/SkillOptionLogic_护盾.cs

67 lines
3.1 KiB
C#
Executable File

using System.Collections.Generic;
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_>();
SelectTargetHelper.GetTarget(skillOption.selectTarget, skillSender, Action);
}
private async ETTask Action(Unit target, ISkillSender skillSender)
{
if (!(skillSender is ModifierSkillSender modifierSkillSender))
return;
Unit owner = skillSender.caster;
ModifierContainerComponent modifierContainer = owner.GetComponent<ModifierContainerComponent>();
// ModifierId modifierId = modifierSkillSender.modifierId;
// ModifierLogic modifierLogic = modifierContainer.GetModifierLogic(modifierId);
ModifierLogic modifierLogic = modifierSkillSender.modifierLogic;
if (modifierLogic == null)
return;
BattleHelper.Calculate(SkillDamageType., skillSender, target, this.skillOption.treatCalculate_Self, this.skillOption.treatCalculate_Target, out BallisticData data);
float shieldMultipe = 1;
if (owner != null)
{
var copyBattle = BattleMgrCompnent.Instance.GetBattle(owner,false);
if (copyBattle == null)
{
Log.Info($"battle is null Id:{owner.Id} battleId:{owner.BattleId}");
}
else
{
if (copyBattle.battleType == BattleType.PersonalPvp)
{
shieldMultipe = 0.1f;
}
}
}
modifierLogic.shield = MathHelper.RoundToInt(data.value * shieldMultipe);
if (data.isCrit && this.skillOption.isCritEvent)
{
Dictionary<ModifierEventCondition, SkillOptionBase[]> dic = modifierLogic.modifierConfig.modifierEventDic;
if (dic != null && dic.TryGetValue(ModifierEventCondition.modifier, out SkillOptionBase[] optionBaseList1))
foreach (SkillOptionBase item in optionBaseList1)
{
SkillOptionLogicBase skillOptionLogicBase = SkillOptionFactory.AcquireSkillOptionLogic(item);
skillOptionLogicBase.HandleEvent(modifierSkillSender);
}
if (dic != null && dic.TryGetValue(ModifierEventCondition.modifier, out SkillOptionBase[] optionBaseList2))
foreach (SkillOptionBase item in optionBaseList2)
{
SkillOptionLogicBase skillOptionLogicBase = SkillOptionFactory.AcquireSkillOptionLogic(item);
skillOptionLogicBase.HandleEvent(modifierSkillSender);
}
}
}
}
}