CTT/Server/Hotfix/Game/Common/BuffDamageCalculate/RealBuffDamageCalculate.cs

47 lines
2.3 KiB
C#

using Cal;
using System;
using System.Collections.Generic;
namespace ET
{
public static class RealBuffDamageCalculate
{
public static void Calculate(NumericComponent num, NumericComponent numTarget, ValueCalculate valueCalculate_Self, ValueCalculate valueCalculate_Target, int skillId, out BallisticData data)
{
data = new BallisticData();
float baseHurt1 = 0, baseHurt2 = 0;
float mineLevel = numTarget.Get(NumericType.Level);
//攻击数值 = 攻击*技能百分比+技能数值威力
//基础伤害=攻击数值*攻击数值/(攻击数值+对方防御)
if (valueCalculate_Self != null)
{
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
{
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
float attackValue1 = num1.Get(numericType1) * percValue1 / 100;
baseHurt1 = attackValue1 - numTarget.Get(NumericType.Phy) *mineLevel /ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) *mineLevel/ ConstDefine.DamageStaTimes;
if (baseHurt1 <= 0) baseHurt1 = 0;
}
}
if (valueCalculate_Target != null)
{
if (SkillHelper.GetParam(valueCalculate_Target.param, skillId, out float percValue2))
{
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
float attackValue2 = num2.Get(numericType2) * percValue2 / 100 ;
baseHurt2 = attackValue2 - numTarget.Get(NumericType.Phy) *mineLevel/ ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) *mineLevel/ ConstDefine.DamageStaTimes;
if (baseHurt2 <= 0) baseHurt2 = 0;
}
}
float baseHurt = baseHurt1 + baseHurt2;
data.isCrit = false;
float criHurt = 1f;
data.value = baseHurt * criHurt * RandomHelper.RandomFloat(0.9f, 1.1f);
if (data.value <= 0) data.value = 1;
}
}
}