1
This commit is contained in:
commit
89b01ba65f
@ -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()) {
|
||||
//穿人
|
||||
@ -1117,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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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,8 +1220,10 @@ bool Creature::IsProperTarget(Creature* target, bool no_teammate)
|
||||
if (target->IsInvincible()) {
|
||||
return false;
|
||||
}
|
||||
if (target->HasBuffEffect(kBET_Hide)) {
|
||||
return false;
|
||||
if (!a8::HasBitFlag(ignore_buff_effects, kBET_Hide)) {
|
||||
if (target->HasBuffEffect(kBET_Hide)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (target->HasBuffEffect(kBET_Driver)) {
|
||||
return false;
|
||||
@ -1992,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;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class Creature : public MoveableEntity
|
||||
void RemoveEffects(std::vector<int> 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,
|
||||
|
@ -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}));
|
||||
|
@ -2448,6 +2448,7 @@ void Human::OnExplosionHit(Explosion* e)
|
||||
}
|
||||
|
||||
RemoveBuffByEffectId(kBET_PeaceMode);
|
||||
RemoveBuffByEffectId(kBET_Hide);
|
||||
float finaly_dmg = GetBattleContext()->CalcDmg(e);
|
||||
#if 1
|
||||
{
|
||||
|
@ -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<struct AttrAdditionPtr> AttrAdditionHandle;
|
||||
|
@ -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()) {
|
||||
//穿人
|
||||
@ -304,3 +306,8 @@ void VirtualBullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool VirtualBullet::NoAdjustPos()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user