1
This commit is contained in:
parent
3a46347a11
commit
d647878dde
@ -504,13 +504,14 @@ void BattleDataContext::CalcBattleStat(struct PlayerStats* stats)
|
|||||||
float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||||
{
|
{
|
||||||
g_calc_dmg_context = {0};
|
g_calc_dmg_context = {0};
|
||||||
|
g_calc_dmg_context.is_crit = IsCrit(bullet) ? 1 : 0;
|
||||||
|
|
||||||
float total_atk = GetTotalAtk(bullet);
|
float total_atk = GetTotalAtk(bullet);
|
||||||
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
|
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
|
||||||
if (bullet->GetStrengthenWall()) {
|
if (bullet->GetStrengthenWall()) {
|
||||||
normal_dmg *= 1.2f;
|
normal_dmg *= 1.2f;
|
||||||
}
|
}
|
||||||
float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0;
|
float crit = g_calc_dmg_context.is_crit ? GetCritRate(bullet) : 0;
|
||||||
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
|
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
|
||||||
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
|
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
|
||||||
finaly_dmg *= (1 + target->GetAbility()->GetDmgAddition());
|
finaly_dmg *= (1 + target->GetAbility()->GetDmgAddition());
|
||||||
@ -534,16 +535,20 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
finaly_dmg = std::max(1.0f, finaly_dmg);
|
finaly_dmg = std::max(1.0f, finaly_dmg);
|
||||||
|
if (g_calc_dmg_context.is_crit) {
|
||||||
|
g_calc_dmg_context.crit_dmg = finaly_dmg;
|
||||||
|
}
|
||||||
return finaly_dmg;
|
return finaly_dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
|
float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
|
||||||
{
|
{
|
||||||
g_calc_dmg_context = {0};
|
g_calc_dmg_context = {0};
|
||||||
|
g_calc_dmg_context.is_crit = IsCrit(bullet) ? 1 : 0;
|
||||||
|
|
||||||
float total_atk = GetTotalAtk(bullet);
|
float total_atk = GetTotalAtk(bullet);
|
||||||
float normal_dmg = total_atk * (1 - 0 / 1000);
|
float normal_dmg = total_atk * (1 - 0 / 1000);
|
||||||
float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0;
|
float crit = g_calc_dmg_context.is_crit ? GetCritRate(bullet) : 0;
|
||||||
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
|
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
|
||||||
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
|
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -561,6 +566,9 @@ float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
|
|||||||
owner_.Get()->SendDebugMsg(data);
|
owner_.Get()->SendDebugMsg(data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (g_calc_dmg_context.is_crit) {
|
||||||
|
g_calc_dmg_context.crit_dmg = finaly_dmg;
|
||||||
|
}
|
||||||
return finaly_dmg;
|
return finaly_dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3808,6 +3808,15 @@ void Human::OnBulletHit(IBullet* bullet)
|
|||||||
if (bullet->GetBulletMeta()->buff_meta) {
|
if (bullet->GetBulletMeta()->buff_meta) {
|
||||||
MustBeAddBuff(bullet->GetSender().Get(), bullet->GetBulletMeta()->i->buffid());
|
MustBeAddBuff(bullet->GetSender().Get(), bullet->GetBulletMeta()->i->buffid());
|
||||||
}
|
}
|
||||||
|
if (bullet->GetSender().Get()->GetBattleContext()->IsCrit()) {
|
||||||
|
room->frame_event.AddPropChg
|
||||||
|
(
|
||||||
|
GetWeakPtrRef(),
|
||||||
|
kPropCritDmg,
|
||||||
|
0,
|
||||||
|
bullet->GetSender().Get()->GetBattleContext()->GetCritDmg()
|
||||||
|
);
|
||||||
|
}
|
||||||
if (bullet->GetSender().Get() && bullet->GetSender().Get()->IsCar() && bullet->GetPassenger().Get()) {
|
if (bullet->GetSender().Get() && bullet->GetSender().Get()->IsCar() && bullet->GetPassenger().Get()) {
|
||||||
if (!bullet->IsPreBattleBullet()) {
|
if (!bullet->IsPreBattleBullet()) {
|
||||||
DecHP(finaly_dmg,
|
DecHP(finaly_dmg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user