/// <summary> /// Расчитывает эффективность умения с учётом поглощения броней. /// </summary> /// <param name="targetActor"> Целевой актёр. </param> /// <param name="tacticalActRoll"> Результат броска исходной эфективности действия. </param> /// <returns> Возвращает числовое значение эффективности действия. </returns> private DamageEfficientCalc CalcEfficient(IActor targetActor, TacticalActRoll tacticalActRoll) { var damageEfficientCalcResult = new DamageEfficientCalc(); var actApRank = GetActApRank(tacticalActRoll.TacticalAct);; damageEfficientCalcResult.ActApRank = actApRank; var armorRank = GetArmorRank(targetActor, tacticalActRoll.TacticalAct); damageEfficientCalcResult.ArmorRank = armorRank; var actEfficientArmorBlocked = tacticalActRoll.Efficient; var rankDiff = actApRank - armorRank; if (armorRank != null && rankDiff < 10) { var factArmorSaveRoll = RollArmorSave(); damageEfficientCalcResult.FactArmorSaveRoll = factArmorSaveRoll; var successArmorSaveRoll = GetSuccessArmorSave(targetActor, tacticalActRoll.TacticalAct); damageEfficientCalcResult.SuccessArmorSaveRoll = successArmorSaveRoll; if (factArmorSaveRoll >= successArmorSaveRoll) { damageEfficientCalcResult.TargetSuccessfullUsedArmor = true; var armorAbsorbtion = GetArmorAbsorbtion(targetActor, tacticalActRoll.TacticalAct); damageEfficientCalcResult.ArmorAbsorbtion = armorAbsorbtion; actEfficientArmorBlocked = AbsorbActEfficient(actEfficientArmorBlocked, armorAbsorbtion); } } damageEfficientCalcResult.ActEfficientArmorBlocked = actEfficientArmorBlocked; return(damageEfficientCalcResult); }
private void ProcessSuccessfulAttackEvent( IActor actor, IActor targetActor, DamageEfficientCalc damageEfficientCalcResult, int successToHitRoll, int factToHitRoll) { if (ActorInteractionBus == null) { return; } var damageEvent = new DamageActorInteractionEvent(actor, targetActor, damageEfficientCalcResult) { SuccessToHitRoll = successToHitRoll, FactToHitRoll = factToHitRoll }; ActorInteractionBus.PushEvent(damageEvent); }