This commit is contained in:
aozhiwei 2023-01-01 16:00:02 +08:00
parent 00affa6a3c
commit f97c4ccc59

View File

@ -19,6 +19,7 @@
#include "battledatacontext.h" #include "battledatacontext.h"
#include "buff.h" #include "buff.h"
#include "mapinstance.h" #include "mapinstance.h"
#include "collision.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Hero.h" #include "mt/Hero.h"
@ -2923,46 +2924,42 @@ void Creature::CheckBulletHitHoldShield(IBullet* bullet, bool& eat)
{ {
Buff* hold_shield_buff = GetBuffByEffectId(kBET_HoldShield); Buff* hold_shield_buff = GetBuffByEffectId(kBET_HoldShield);
if (hold_shield_buff && !bullet->IsBomb() && !dead && this != bullet->GetSender().Get()) { if (hold_shield_buff && !bullet->IsBomb() && !dead && this != bullet->GetSender().Get()) {
// 999
#if 0
//param2是距离 param4是宽度 //param2是距离 param4是宽度
a8::Vec2 shield_pos = c->GetPos() + c->GetAttackDir() * hold_shield_buff->meta->param2; glm::vec3 shield_pos = GetPos().ToGlmVec3() + GetAttackDir() * hold_shield_buff->meta->_param2;
bool ret = Check2dRotationRectangle(GetPos().x, bool ret = Collision::Check2dRotationRectangle
GetPos().y, (GetPos().x,
//10, GetPos().y,
gun_meta->bullet_rad(), //10,
shield_pos.x, bullet->GetGunMeta()->bullet_rad(),
shield_pos.y, shield_pos.x,
hold_shield_buff->meta->param4, shield_pos.y,
MetaMgr::Instance()->bullet_planck_step_length, hold_shield_buff->meta->_param4,
c->GetAttackDirRotate() * 180.0f mt::Param::s().bullet_planck_step_length,
); GetAttackDirRotate() * 180.0f
);
if (ret) { if (ret) {
float finaly_dmg = c->GetBattleContext()->CalcDmg(c, this); float finaly_dmg = GetBattleContext()->CalcDmg(this, bullet);
c->shield_hp_ = std::max(0.0f, c->shield_hp_ - finaly_dmg); shield_hp_ = std::max(0.0f, shield_hp_ - finaly_dmg);
#ifdef DEBUG #ifdef DEBUG
a8::XPrintf("命中盾牌 finally_dmg:%f shield_hp:%f\n", a8::XPrintf("命中盾牌 finally_dmg:%f shield_hp:%f\n",
{ {
finaly_dmg, finaly_dmg,
c->shield_hp_ shield_hp_
}); });
#endif #endif
room->frame_event.AddPropChg(c->GetWeakPtrRef(), room->frame_event.AddPropChg(GetWeakPtrRef(),
kPropShieldHp, kPropShieldHp,
c->shield_max_hp_, shield_max_hp_,
c->shield_hp_); shield_hp_);
if (c->shield_hp_ <= 0) { if (shield_hp_ <= 0) {
#ifdef DEBUG #ifdef DEBUG
a8::XPrintf("shiled destory\n", {}); a8::XPrintf("shiled destory\n", {});
#endif #endif
c->GetTrigger()->ShieldDestory(); GetTrigger()->ShieldDestory();
c->RemoveBuffByUniId(hold_shield_buff->buff_uniid); RemoveBuffByUniId(hold_shield_buff->buff_uniid);
} }
eat = true; eat = true;
stop = true;
return; return;
} }
#endif
} }
} }