This commit is contained in:
aozhiwei 2024-02-02 10:50:31 +08:00
parent 71eb285168
commit 8bd4750ecb
5 changed files with 25 additions and 7 deletions

View File

@ -1129,7 +1129,7 @@ void Creature::Initialize()
[this] (int event, const a8::Args* args) mutable
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!dead && !poisoning && !downed) {
if (!dead && !poisoning && !downed && !HasBuffEffect(kBET_Dive)) {
if (GetHP() + 1 < GetMaxHP()) {
AddHp(GetMaxHP() * mt::Param::s().nature_recover_hp_rate);
TryAddBuff(this, kRecoverHpEffectBuffId);

View File

@ -196,7 +196,11 @@ void FrameMaker::SerializeNewObjects(cs::SMUpdate* msg, Room* room, Human* hum,
}
if (e != hum &&
e->GetEntityType() == ET_Player &&
((Human*)e)->HasBuffEffect(kBET_Fly)){
((Human*)e)->HasBuffEffect(kBET_Fly) &&
((Human*)e)->IsOb()){
continue;
}
if (e->IsCreature(room) && ((Creature*)e)->IsOb()) {
continue;
}
bool sync = false;

View File

@ -404,6 +404,7 @@ behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
if (!c->dead &&
!a8::HasBitFlag(c->status, CS_Disable) &&
!c->HasBuffEffect(kBET_Hide) &&
!c->HasBuffEffect(kBET_Dive) &&
!c->HasBuffEffect(kBET_Invincible) &&
c->team_id != myself->team_id &&
!c->IsCar() &&
@ -454,6 +455,7 @@ behaviac::EBTStatus HeroAgent::TrySearchEnemy(float range, int min_interval, int
if (!c->dead &&
!a8::HasBitFlag(c->status, CS_Disable) &&
!c->HasBuffEffect(kBET_Hide) &&
!c->HasBuffEffect(kBET_Dive) &&
!c->HasBuffEffect(kBET_Invincible) &&
c->team_id != myself->team_id &&
!c->IsCar() &&

View File

@ -131,7 +131,8 @@ static void Human_FillBodyState(Human* self, ::google::protobuf::RepeatedPtrFiel
static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
std::shared_ptr<CustomMember> m,
std::shared_ptr<Team> room_team,
cs::CMJoin& join_msg)
cs::CMJoin& join_msg,
std::function<void (Player*)> on_preadd = nullptr)
{
Player* hum = p->GetRoom()->NewPlayer();
//hum->ip_saddr = ip_saddr;
@ -174,6 +175,9 @@ static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
hum->GetNetData()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
hum->hero_uniid = hero_uniid;
}
if (on_preadd) {
on_preadd(hum);
}
p->GetRoom()->AddPlayer(hum, nullptr, true);
hum->ProcSkillList();
hum->SetHP(hum->GetNetData()->GetMaxHP());
@ -2638,9 +2642,12 @@ int Room::InitWithCustomBattle(long ip_saddr, int socket_handle, std::shared_ptr
(
[join_msg, p, new_team] (std::shared_ptr<CustomMember> m) mutable -> bool
{
Player* hum = InternalCreatePlayer(p, m, new_team, join_msg);
a8::SetBitFlag(hum->status, CS_IsOb);
p->GetRoom()->GetRoomOb()->AddOb(hum);
Player* hum = InternalCreatePlayer(p, m, new_team, join_msg,
[p] (Player* hum)
{
a8::SetBitFlag(hum->status, CS_IsOb);
p->GetRoom()->GetRoomOb()->AddOb(hum);
});
return true;
});
}

View File

@ -1019,7 +1019,12 @@ Human* Room::GetWatchWarTarget(Human* hum)
std::vector<Human*> players;
std::vector<Human*> humans;
for (auto& pair : human_hash_) {
if (pair.first != hum->GetUniId() && !pair.second->dead && !a8::HasBitFlag(pair.second->status, CS_Disable)) {
if (pair.first != hum->GetUniId() &&
!pair.second->dead &&
!a8::HasBitFlag(pair.second->status, CS_Disable)) {
if (pair.second->IsOb()) {
continue;
}
if (pair.second->IsPlayer()) {
players.push_back(pair.second);
} else {