This commit is contained in:
aozhiwei 2021-05-07 19:41:57 +08:00
parent d40c8d5348
commit 52fb6567b2
4 changed files with 13 additions and 5 deletions

View File

@ -55,8 +55,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
case ET_Player:
{
Human* hum = (Human*)target;
if (hum->HasBuffEffect(kBET_Invincible) ||
hum->HasBuffEffect(kBET_AdPlaying)) {
if (hum->IsInvincible()) {
continue;
}
if (sender.Get()->room->GetRoomMode() == kZombieMode &&

View File

@ -1076,7 +1076,7 @@ bool Creature::IsProperTarget(Creature* target)
if (room->GetRoomMode() == kZombieMode && GetRace() == target->GetRace()) {
return false;
}
if (target->HasBuffEffect(kBET_Invincible)) {
if (target->IsInvincible()) {
return false;
}
if (target->HasBuffEffect(kBET_Hide)) {
@ -1580,3 +1580,12 @@ void Creature::RemoveMoreObstacle(int buff_id, int id, int num)
{
}
bool Creature::IsInvincible()
{
return HasBuffEffect(kBET_Invincible) ||
HasBuffEffect(kBET_AdPlaying) ||
HasBuffEffect(kBET_Driver) ||
HasBuffEffect(kBET_Passenger)
;
}

View File

@ -150,6 +150,7 @@ class Creature : public MoveableEntity
void UpdateSkill();
bool FreezeOperate();
void SlaveOnRemove(Entity* slave);
bool IsInvincible();
private:

View File

@ -51,8 +51,7 @@ void FragMiTask::Done()
);
for (auto& target : objects) {
if (target->HasBuffEffect(kBET_Invincible) ||
target->HasBuffEffect(kBET_AdPlaying)) {
if (target->IsInvincible()) {
continue;
}
if (sender.Get()->room->GetRoomMode() == kZombieMode &&