1
This commit is contained in:
parent
93ae48e62f
commit
3bcfdc02f6
@ -1075,68 +1075,39 @@ void Bullet::Raycast()
|
||||
|
||||
void Bullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos)
|
||||
{
|
||||
#if 1
|
||||
if (room->IsGameOver()) {
|
||||
return;
|
||||
}
|
||||
if (room->OverBorder(GetPos().ToGlmVec3(), gun_meta->bullet_rad())) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetMutablePos().FromGlmVec3(pos);
|
||||
room->grid_service->MoveBullet(this);
|
||||
BulletCheckResult result;
|
||||
|
||||
if (trace_target_id) {
|
||||
if (trace_target_id == target_uniid) {
|
||||
Entity* entity = room->GetEntityByUniId(trace_target_id);
|
||||
if (entity && entity->IsCreature(room)) {
|
||||
Creature* c = (Creature*)entity;
|
||||
if (sender.Get() && sender.Get()->IsHuman()) {
|
||||
sender.Get()->AsHuman()->stats->IncWeaponUseTimes(gun_meta->id(), 1);
|
||||
}
|
||||
std::set<Entity*> objects;
|
||||
objects.insert(entity);
|
||||
OnHit(objects);
|
||||
AddGunBuff();
|
||||
if (c->HasBuffEffect(kBET_HoldShield)) {
|
||||
c->CheckBulletHitHoldShield(this, result.eat);
|
||||
if (result.eat) {
|
||||
}
|
||||
}
|
||||
if (!result.eat) {
|
||||
std::set<Entity*> objects;
|
||||
objects.insert(entity);
|
||||
OnHit(objects);
|
||||
AddGunBuff();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
#else
|
||||
Entity* entity = room->GetEntityByUniId(target_uniid);
|
||||
if (entity && entity->IsCreature(room) && entity != this && !entity->IsDead(room)) {
|
||||
Creature* c = (Creature*)entity;
|
||||
float dmg = c->GetBattleContext()->CalcDmg(c, bullet);
|
||||
if (msg.strengthen_wall_uniid()) {
|
||||
dmg *= 2;
|
||||
}
|
||||
bool shield = false;
|
||||
if (dmg > 0.00001f) {
|
||||
if (msg.shield_hit()) {
|
||||
Buff* hold_shield_buff = c->GetBuffByEffectId(kBET_HoldShield);
|
||||
if (hold_shield_buff) {
|
||||
c->shield_hp_ = std::max(0.0f, c->shield_hp_ - dmg);
|
||||
room->frame_event.AddPropChg(c->GetWeakPtrRef(),
|
||||
kPropShieldHp,
|
||||
c->shield_max_hp_,
|
||||
c->shield_hp_);
|
||||
if (c->shield_hp_ <= 0) {
|
||||
c->GetTrigger()->ShieldDestory();
|
||||
if (hold_shield_buff->meta->_buff_param1_int_list.size() > 0) {
|
||||
TryAddBuff(this, hold_shield_buff->meta->_buff_param1_int_list[0]);
|
||||
}
|
||||
c->RemoveBuffByUniId(hold_shield_buff->buff_uniid);
|
||||
}
|
||||
shield = true;
|
||||
}
|
||||
}
|
||||
if (!shield) {
|
||||
bullet->strengthen_wall = msg.strengthen_wall_uniid() ? 1 : 0;
|
||||
std::set<Entity*> objects;
|
||||
objects.insert(c);
|
||||
bullet->OnHit(objects);
|
||||
#if 0
|
||||
c->OnBulletHit(bullet);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("dmg:%f shield:%d\n",
|
||||
{
|
||||
dmg,
|
||||
shield ? 1 : 0
|
||||
});
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user