This commit is contained in:
aozhiwei 2022-09-06 17:28:59 +08:00
parent da19616e66
commit 8a7fe19d4b
4 changed files with 9 additions and 4 deletions

View File

@ -348,6 +348,11 @@ float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
return finaly_dmg; return finaly_dmg;
} }
float BattleDataContext::CalcDmg(Obstacle* target, Bullet* bullet)
{
}
float BattleDataContext::GetTotalAtk(Bullet* bullet) float BattleDataContext::GetTotalAtk(Bullet* bullet)
{ {
float total_atk = (GetHeroTotalAtk() / 100 + 1) * GetWeaponAtk(bullet); float total_atk = (GetHeroTotalAtk() / 100 + 1) * GetWeaponAtk(bullet);

View File

@ -22,6 +22,7 @@ namespace MetaData
class Creature; class Creature;
class Bullet; class Bullet;
class Obstacle;
struct PlayerStats; struct PlayerStats;
class HeroAbility; class HeroAbility;
class WeaponAbility; class WeaponAbility;
@ -53,6 +54,7 @@ struct BattleDataContext
void CalcBattleStat(struct PlayerStats* stats); void CalcBattleStat(struct PlayerStats* stats);
float CalcDmg(Creature* target, Bullet* bullet); float CalcDmg(Creature* target, Bullet* bullet);
float CalcDmg(Obstacle* target, Bullet* bullet);
float GetDef(); float GetDef();

View File

@ -1819,9 +1819,11 @@ void Human::FollowTarget(Human* target)
void Human::SendDebugMsg(const std::string& debug_msg) void Human::SendDebugMsg(const std::string& debug_msg)
{ {
#ifdef DEBUG
cs::SMDebugMsg notify_msg; cs::SMDebugMsg notify_msg;
notify_msg.set_debug_msg(a8::TimestampToDateTime(time(nullptr)) + " " + debug_msg); notify_msg.set_debug_msg(a8::TimestampToDateTime(time(nullptr)) + " " + debug_msg);
SendNotifyMsg(notify_msg); SendNotifyMsg(notify_msg);
#endif
} }
void Human::UpdateAction() void Human::UpdateAction()

View File

@ -509,10 +509,6 @@ void Obstacle::OnBulletHit(Bullet* bullet)
float atk_rate = 0; float atk_rate = 0;
float def_rate = 0; float def_rate = 0;
bullet->CalcDmg(this, finaly_dmg, atk_rate, def_rate); bullet->CalcDmg(this, finaly_dmg, atk_rate, def_rate);
#else
float dmg = bullet->GetAtk();
float def = 0;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
#endif #endif
SetHealth(bullet->room, std::max(0.0f, GetHealth(bullet->room) - finaly_dmg)); SetHealth(bullet->room, std::max(0.0f, GetHealth(bullet->room) - finaly_dmg));
if (GetHealth(bullet->room) <= 0.01f) { if (GetHealth(bullet->room) <= 0.01f) {