2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public static class SpiBuffDamageCalculate
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
//攻击数值 = 攻击*技能百分比+技能数值威力
|
|
|
|
|
//基础伤害=攻击数值*攻击数值/(攻击数值+对方防御)
|
2021-04-11 19:50:39 +08:00
|
|
|
|
float def = numTarget.Get(NumericType.SpiDef) + 0.01f;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
float mineLevel = numTarget.Get(NumericType.Level);
|
|
|
|
|
if (valueCalculate_Self != null)
|
|
|
|
|
{
|
|
|
|
|
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
float attackValue1 = num1.Get(numericType1) * percValue1 / 100 + ConstDefine.DamageStrTimes * num.Get(NumericType.Wim);
|
|
|
|
|
//减伤百分比=自身防御/(攻击方等级X200+自身防御);
|
|
|
|
|
//最终伤害=对方基础攻击X(1-减伤百分比)*(1-自身减伤百分比)-体力*14-耐力*48
|
|
|
|
|
float reduce = def / (num.Get(NumericType.Level) * ConstDefine.DamageLevelTimes + def);
|
|
|
|
|
baseHurt1 = attackValue1 * (1 - reduce) * (1 +num.Get( NumericType.MicDA) - numTarget.Get(NumericType.Nmeni)) - 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))
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
float attackValue2 = num2.Get(numericType2) * percValue2 / 100 + ConstDefine.DamageStrTimes * num.Get(NumericType.Wim);
|
|
|
|
|
float reduce = def / (num.Get(NumericType.Level) * ConstDefine.DamageLevelTimes + def);
|
|
|
|
|
baseHurt2 = attackValue2 * (1 - reduce) * (1 +num.Get( NumericType.MicDA) - numTarget.Get(NumericType.Nmeni)) - numTarget.Get(NumericType.Phy) *mineLevel/ ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) * mineLevel/ConstDefine.DamageStaTimes;
|
|
|
|
|
if (baseHurt2 <= 0) baseHurt2 = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-11 19:50:39 +08:00
|
|
|
|
float baseHurt = baseHurt1 + baseHurt2;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (num.Parent.GetComponent<ModifierContainerComponent>().HasState(ModifierStateType.必定暴击))
|
|
|
|
|
{
|
|
|
|
|
data.isCrit = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//暴击概率=0.05f+0.6f*(暴击率/(爆击率+对方暴击率抵抗))
|
|
|
|
|
float crirBase = num.Get(NumericType.Mcrir);
|
|
|
|
|
float cri = 0.05f + 0.6f * (crirBase * crirBase / (crirBase + numTarget.Get(NumericType.Rmcrir) + 0.01f));
|
|
|
|
|
|
|
|
|
|
//暴击概率 = 暴击概率>0.8f ? 0.8f:暴击概率
|
|
|
|
|
cri = cri > ConstDefine.MaxCritRate ? ConstDefine.MaxCritRate : cri;
|
|
|
|
|
|
|
|
|
|
//是否暴击 = 0-1 的随机数 <= 暴击概率
|
|
|
|
|
data.isCrit = RandomHelper.RandomFloat() <= cri;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//暴击伤害倍率 = 有暴击? (暴击伤害*2 + FirstCritDamage)/(暴击伤害*0.6f +暴击伤害抵抗 + 1):1f
|
|
|
|
|
float criBase = num.Get(NumericType.Mcri);
|
|
|
|
|
float criHurt = data.isCrit ? ((criBase * 2 +ConstDefine. BaseCritDamage) / (criBase * 0.6f + numTarget.Get(NumericType.Rmcri) + 1)) : 1;
|
|
|
|
|
|
|
|
|
|
data.value = baseHurt * criHurt * RandomHelper.RandomFloat(0.9f, 1.1f);
|
|
|
|
|
if (data.value <= 0) data.value = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|