This commit is contained in:
aozhiwei 2022-09-06 19:50:35 +08:00
parent 7e1b020510
commit d57f0681f2
2 changed files with 45 additions and 0 deletions

View File

@ -245,6 +245,21 @@ float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
float crit = IsCrit() ? GetCritRate() : 0;
float dodge = IsDodge() ? GetDodgeRuduce() : 0;
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
#ifdef DEBUG
if (owner_.Get()->IsPlayer()) {
std::string data = a8::Format
("数值: 子弹攻击怪物 total_atk:%f normal_dmg:%f crit:%f dodge:%f finaly_dmg:%f target_def:%f",
{
total_atk,
normal_dmg,
crit,
dodge,
finaly_dmg,
target->GetBattleContext()->GetDef()
});
owner_.Get()->SendDebugMsg(data);
}
#endif
return finaly_dmg;
}
@ -255,12 +270,38 @@ float BattleDataContext::CalcDmg(Obstacle* target, Bullet* bullet)
float crit = IsCrit() ? GetCritRate() : 0;
float dodge = IsDodge() ? GetDodgeRuduce() : 0;
float finaly_dmg = normal_dmg * (1.0f + crit + dodge);
#ifdef DEBUG
if (owner_.Get()->IsPlayer()) {
std::string data = a8::Format
("数值: 子弹攻击物件 total_atk:%f normal_dmg:%f crit:%f dodge:%f finaly_dmg:%f target_def:%f",
{
total_atk,
normal_dmg,
crit,
dodge,
finaly_dmg,
0
});
owner_.Get()->SendDebugMsg(data);
}
#endif
return finaly_dmg;
}
float BattleDataContext::CalcDmg(Explosion* e)
{
float finaly_dmg = (1 - GetDef() / 1000) / 2 * 100;
#ifdef DEBUG
if (owner_.Get()->IsPlayer()) {
std::string data = a8::Format
("数值: 爆炸伤害 finaly_dmg:%f def:%f",
{
finaly_dmg,
GetDef()
});
owner_.Get()->SendDebugMsg(data);
}
#endif
return finaly_dmg;
}

View File

@ -1821,7 +1821,11 @@ void Human::SendDebugMsg(const std::string& debug_msg)
{
#ifdef DEBUG
cs::SMDebugMsg notify_msg;
#if 1
notify_msg.set_debug_msg(debug_msg);
#else
notify_msg.set_debug_msg(a8::TimestampToDateTime(time(nullptr)) + " " + debug_msg);
#endif
SendNotifyMsg(notify_msg);
#endif
}