77 lines
3.6 KiB
C#
Executable File
77 lines
3.6 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)
|
|
{
|
|
Unit owner = skillSender.caster;
|
|
bool isCrit = false;
|
|
ModifierContainerComponent modifierContainer = owner.GetComponent<ModifierContainerComponent>();
|
|
AttackComponent attacker = owner.GetComponent<AttackComponent>();
|
|
ModifierSkillSender modifierSkillSender = default;
|
|
ModifierLogic modifierLogic = null;
|
|
BattleHelper.Calculate(SkillDamageType.护盾治疗, skillSender, target, this.skillOption.treatCalculate_Self, this.skillOption.treatCalculate_Target, out BallisticData data);
|
|
float finalValue = data.value;
|
|
float treatMultipe = 1;
|
|
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)
|
|
{
|
|
treatMultipe = 0.40f;
|
|
}
|
|
}
|
|
|
|
finalValue *= treatMultipe;
|
|
if (skillSender is ModifierSkillSender _modifierSkillSender)
|
|
{
|
|
// ModifierId modifierId = _modifierSkillSender.modifierId;
|
|
// modifierLogic = modifierContainer.GetModifierLogic(modifierId);
|
|
modifierLogic = _modifierSkillSender.modifierLogic;
|
|
if (modifierLogic != null)
|
|
{
|
|
finalValue *= modifierLogic.overlay;
|
|
isCrit = this.skillOption.isCritEvent && data.isCrit;
|
|
if (isCrit)
|
|
modifierSkillSender = _modifierSkillSender;
|
|
}
|
|
}
|
|
|
|
data.ChangeValue(finalValue);
|
|
attacker.TreatTarget(target, data, skillSender);
|
|
if (isCrit)
|
|
{
|
|
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);
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
} |