This commit is contained in:
aozhiwei 2023-03-28 12:27:15 +08:00
parent bcef94bd99
commit 68ddbb136c
5 changed files with 42 additions and 0 deletions

View File

@ -887,3 +887,8 @@ int BattleDataContext::GetLevel()
{
return std::max(level_, 1);
}
float BattleDataContext::GetBrainLifePct()
{
return hero_ability_->GetBrainLifePct();
}

View File

@ -61,6 +61,7 @@ struct BattleDataContext
int GetReloadTime(Creature* c, Weapon* weapon);
float GetHeroTotalAtk();
float GetExtRecoverHp();
float GetBrainLifePct();
void SetReviveCoin(int num);
int GetReviveCoin();

View File

@ -297,6 +297,15 @@ void Car::OnBulletHit(IBullet* bullet)
bullet->GetSender().Get()->GetUniId(),
bullet->GetSender().Get()->GetName(),
dmg_out);
if (bullet->GetSender().Get() &&
!bullet->GetSender().Get()->dead &&
dmg_out > 0.0f &&
!bullet->GetSkillMeta() &&
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct() > 0.0f) {
float recover_hp = dmg_out *
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct();
bullet->GetSender().Get()->AddHp(recover_hp);
}
}
if (bullet->GetBulletMeta()->_buff_meta) {
MustBeAddBuff(this, bullet->GetBulletMeta()->buffid());

View File

@ -179,6 +179,15 @@ void Hero::OnBulletHit(IBullet* bullet)
bullet->GetSender().Get()->GetUniId(),
bullet->GetSender().Get()->GetName(),
dmg_out);
if (bullet->GetSender().Get() &&
!bullet->GetSender().Get()->dead &&
dmg_out > 0.0f &&
!bullet->GetSkillMeta() &&
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct() > 0.0f) {
float recover_hp = dmg_out *
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct();
bullet->GetSender().Get()->AddHp(recover_hp);
}
}
}
}

View File

@ -2140,6 +2140,15 @@ void Human::OnBulletHit(IBullet* bullet)
bullet->GetPassenger().Get()->GetName(),
dmg_out);
bullet->GetSender().Get()->GetTrigger()->DmgOut(this, dmg_out);
if (bullet->GetSender().Get() &&
!bullet->GetSender().Get()->dead &&
dmg_out > 0.0f &&
!bullet->GetSkillMeta() &&
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct() > 0.0f) {
float recover_hp = dmg_out *
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct();
bullet->GetSender().Get()->AddHp(recover_hp);
}
}
} else {
if (!bullet->IsPreBattleBullet()) {
@ -2156,6 +2165,15 @@ void Human::OnBulletHit(IBullet* bullet)
bullet->GetSender().Get()->GetName(),
dmg_out);
bullet->GetSender().Get()->GetTrigger()->DmgOut(this, dmg_out);
if (bullet->GetSender().Get() &&
!bullet->GetSender().Get()->dead &&
dmg_out > 0.0f &&
!bullet->GetSkillMeta() &&
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct() > 0.0f) {
float recover_hp = dmg_out *
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct();
bullet->GetSender().Get()->AddHp(recover_hp);
}
}
}
}