From e4431b959a94fa5866dd689cdd5bf3c82012e751 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 10:33:02 +0800 Subject: [PATCH 1/6] 1 --- server/gameserver/creature.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 7d99f39d..5dec515c 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1220,9 +1220,11 @@ bool Creature::IsProperTarget(Creature* target, bool no_teammate) if (target->IsInvincible()) { return false; } + #if 0 if (target->HasBuffEffect(kBET_Hide)) { return false; } + #endif if (target->HasBuffEffect(kBET_Driver)) { return false; } From 19de0307b2bdf8cb7ab6043dbb0e4c5cea0ec0e9 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 10:51:00 +0800 Subject: [PATCH 2/6] 1 --- server/gameserver/bullet.cc | 4 +++- server/gameserver/creature.cc | 10 +++++----- server/gameserver/creature.h | 2 +- server/gameserver/virtualbullet.cc | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/gameserver/bullet.cc b/server/gameserver/bullet.cc index 86ebd418..e053441c 100644 --- a/server/gameserver/bullet.cc +++ b/server/gameserver/bullet.cc @@ -878,7 +878,9 @@ void Bullet::GetHitCreatures(BulletCheckResult& result) [this, &result] (Creature* c, bool& stop) { bool no_teammate = IsFlyHook(); - if (sender.Get()->IsProperTarget(c, no_teammate)) { + long long ignore_buff_effects = 0; + a8::SetBitFlag(ignore_buff_effects, kBET_Hide); + if (sender.Get()->IsProperTarget(c, no_teammate, ignore_buff_effects)) { if (gun_meta->ispenetrate() && hit_objects_.find(c->GetUniId()) != hit_objects_.end()) { //穿人 diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 5dec515c..f1a6f6d1 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1206,7 +1206,7 @@ void Creature::ResetAction() } } -bool Creature::IsProperTarget(Creature* target, bool no_teammate) +bool Creature::IsProperTarget(Creature* target, bool no_teammate, long long ignore_buff_effects) { if (target->dead) { return false; @@ -1220,11 +1220,11 @@ bool Creature::IsProperTarget(Creature* target, bool no_teammate) if (target->IsInvincible()) { return false; } - #if 0 - if (target->HasBuffEffect(kBET_Hide)) { - return false; + if (!a8::HasBitFlag(ignore_buff_effects, kBET_Hide)) { + if (target->HasBuffEffect(kBET_Hide)) { + return false; + } } - #endif if (target->HasBuffEffect(kBET_Driver)) { return false; } diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 49b4e2a0..33a0e014 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -215,7 +215,7 @@ class Creature : public MoveableEntity void RemoveEffects(std::vector effect_uniids); void ClearEffect(); - bool IsProperTarget(Creature* target, bool no_teammate = false); + bool IsProperTarget(Creature* target, bool no_teammate = false, long long ignore_buff_effects = 0); bool IsEnemy(Creature* target); virtual void SelectSkillTargets(Skill* skill, const Position& target_pos, diff --git a/server/gameserver/virtualbullet.cc b/server/gameserver/virtualbullet.cc index 0102ad0e..5c2a1cba 100644 --- a/server/gameserver/virtualbullet.cc +++ b/server/gameserver/virtualbullet.cc @@ -257,7 +257,9 @@ void VirtualBullet::GetHitCreatures(BulletCheckResult& result) [this, &result] (Creature* c, bool& stop) { bool no_teammate = false; - if (sender.Get()->IsProperTarget(c, no_teammate)) { + long long ignore_buff_effects = 0; + a8::SetBitFlag(ignore_buff_effects, kBET_Hide); + if (sender.Get()->IsProperTarget(c, no_teammate, ignore_buff_effects)) { if (gun_meta->ispenetrate() && hit_objects_.find(c->GetUniId()) != hit_objects_.end()) { //穿人 From 291398cff4329efe7d7056aad4df330c76b28c4e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 11:24:38 +0800 Subject: [PATCH 3/6] 1 --- server/gameserver/explosion.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/gameserver/explosion.cc b/server/gameserver/explosion.cc index d88a82da..ea4d7654 100644 --- a/server/gameserver/explosion.cc +++ b/server/gameserver/explosion.cc @@ -85,7 +85,9 @@ void Explosion::ProcDamage() return; } if (type_ == kExplosionEnemyAndObstacle) { - if (sender_.Get() && sender_.Get()->IsProperTarget(c)) { + long long ignore_buff_effects = 0; + a8::SetBitFlag(ignore_buff_effects, kBET_Hide); + if (sender_.Get() && sender_.Get()->IsProperTarget(c, false, ignore_buff_effects)) { if (custom_check_cb_) { bool is_hit = false; custom_check_cb_(a8::Args({&is_hit, (Entity*)c})); From 6519f549f142fac14b8ca9148f30f50d5f9049fd Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 14:41:57 +0800 Subject: [PATCH 4/6] 1 --- server/gameserver/creature.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index f1a6f6d1..d396fb19 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1994,9 +1994,11 @@ bool Creature::Attackable(Room* room) if (IsInvincible()) { return false; } + #if 0 if (HasBuffEffect(kBET_Hide)) { return false; } + #endif if (HasBuffEffect(kBET_Driver)) { return false; } From 69b31ae9e03f6a216d7f231bb3a445ed8dbd77f7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 14:59:43 +0800 Subject: [PATCH 5/6] 1 --- server/gameserver/human.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 7285eda9..eec51f41 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -2444,6 +2444,7 @@ void Human::OnExplosionHit(Explosion* e) } RemoveBuffByEffectId(kBET_PeaceMode); + RemoveBuffByEffectId(kBET_Hide); float finaly_dmg = GetBattleContext()->CalcDmg(e); #if 1 { From 9a681007dcb9dc150a998387874b73a4613b4fcb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Sep 2023 17:34:37 +0800 Subject: [PATCH 6/6] 1 --- server/gameserver/bullet.cc | 18 ++++++++++++++++++ server/gameserver/bullet.h | 1 + server/gameserver/collision.cc | 3 +++ server/gameserver/types.h | 1 + server/gameserver/virtualbullet.cc | 5 +++++ server/gameserver/virtualbullet.h | 1 + 6 files changed, 29 insertions(+) diff --git a/server/gameserver/bullet.cc b/server/gameserver/bullet.cc index e053441c..dd559fa7 100644 --- a/server/gameserver/bullet.cc +++ b/server/gameserver/bullet.cc @@ -1119,3 +1119,21 @@ const mt::Skill* Bullet::GetSkillMeta() } return skill_meta; } + +bool Bullet::NoAdjustPos() +{ + switch (meta->_inventory_slot()) { + case IS_RPG: + { + if (reporter_list) { + return true; + } + } + break; + default: + { + } + break; + } + return false; +} diff --git a/server/gameserver/bullet.h b/server/gameserver/bullet.h index bd95fc54..89dce9ef 100644 --- a/server/gameserver/bullet.h +++ b/server/gameserver/bullet.h @@ -52,6 +52,7 @@ class Bullet : public MoveableEntity, public IBullet virtual const mt::Equip* GetGunMeta() override { return gun_meta; }; virtual const mt::Equip* GetBulletMeta() override { return meta; }; virtual CreatureWeakPtr GetSender() override { return sender; }; + virtual bool NoAdjustPos() override; virtual CreatureWeakPtr GetPassenger() { return passenger; }; virtual bool IsBomb(); virtual bool IsPreBattleBullet(); diff --git a/server/gameserver/collision.cc b/server/gameserver/collision.cc index 473c5a46..6eab81e2 100644 --- a/server/gameserver/collision.cc +++ b/server/gameserver/collision.cc @@ -19,6 +19,9 @@ static const float GUN_HEIGHT = 10.0f; bool Collision::CheckBullet(IBullet* bullet, Creature* c) { glm::vec3 bullet_real_pos = bullet->GetPos().ToGlmVec3() - bullet->GetDir() * bullet->GetHitRadius(); + if (bullet->NoAdjustPos()) { + bullet_real_pos = bullet->GetPos().ToGlmVec3(); + } float bullet_hit_radius = bullet->GetHitRadius(); if (c->room->IsNewBieRoom()) { bullet_hit_radius += 3; diff --git a/server/gameserver/types.h b/server/gameserver/types.h index 79f70dd4..182a60ec 100644 --- a/server/gameserver/types.h +++ b/server/gameserver/types.h @@ -94,6 +94,7 @@ class IBullet virtual Room* GetRoom() = 0; virtual float GetHitRadius() = 0; virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) = 0; + virtual bool NoAdjustPos() = 0; }; typedef std::weak_ptr AttrAdditionHandle; diff --git a/server/gameserver/virtualbullet.cc b/server/gameserver/virtualbullet.cc index 5c2a1cba..85f16f58 100644 --- a/server/gameserver/virtualbullet.cc +++ b/server/gameserver/virtualbullet.cc @@ -306,3 +306,8 @@ void VirtualBullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid { } + +bool VirtualBullet::NoAdjustPos() +{ + return false; +} diff --git a/server/gameserver/virtualbullet.h b/server/gameserver/virtualbullet.h index 98b573b9..7660b3f5 100644 --- a/server/gameserver/virtualbullet.h +++ b/server/gameserver/virtualbullet.h @@ -34,6 +34,7 @@ class VirtualBullet : public IBullet, public ITask virtual Room* GetRoom() override; virtual float GetHitRadius() override; virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override; + virtual bool NoAdjustPos() override; virtual void Update(int delta_time) override; virtual bool IsDone() override;