@@ -8387,12 +8387,13 @@ void Game::checkImbuementsAndSereneStatus() {
83878387 }
83888388
83898389 const auto &party = mapPlayer->getParty ();
8390- if (party) {
8391- mapPlayer->setSerene (isPlayerNoBoxed (mapPlayer));
8392- continue ;
8393- }
8390+ bool hasNearbyPartyMembers = party ? hasPartyMembersNearby (mapPlayer) : false ;
8391+ bool hasLessThanSixMonsters = isPlayerNoBoxed (mapPlayer);
8392+
8393+ bool condition1 = !party || !hasNearbyPartyMembers;
8394+ bool condition2 = hasLessThanSixMonsters;
83948395
8395- mapPlayer->setSerene (true );
8396+ mapPlayer->setSerene (condition1 && condition2 );
83968397 }
83978398}
83988399
@@ -11731,6 +11732,45 @@ void Game::createIllusion(const std::shared_ptr<Player> &player, const Outfit_t
1173111732 player->addCondition (outfitCondition);
1173211733}
1173311734
11735+ bool Game::hasPartyMembersNearby (const std::shared_ptr<Player> &player) {
11736+ if (!player) {
11737+ return false ;
11738+ }
11739+
11740+ const auto &party = player->getParty ();
11741+ if (!party) {
11742+ return false ;
11743+ }
11744+
11745+ const Position ¢erPos = player->getPosition ();
11746+ for (int offsetX = -3 ; offsetX <= 3 ; ++offsetX) {
11747+ for (int offsetY = -3 ; offsetY <= 3 ; ++offsetY) {
11748+ if (offsetX == 0 && offsetY == 0 ) {
11749+ continue ;
11750+ }
11751+
11752+ const auto &tile = g_game ().map .getTile (static_cast <uint16_t >(centerPos.x + offsetX), static_cast <uint16_t >(centerPos.y + offsetY), centerPos.z );
11753+ if (!tile) {
11754+ continue ;
11755+ }
11756+
11757+ const auto &topCreature = tile->getTopCreature ();
11758+ if (!topCreature) {
11759+ continue ;
11760+ }
11761+
11762+ const auto &nearbyPlayer = topCreature->getPlayer ();
11763+ if (nearbyPlayer && nearbyPlayer != player) {
11764+ if (nearbyPlayer->getParty () == party) {
11765+ return true ;
11766+ }
11767+ }
11768+ }
11769+ }
11770+
11771+ return false ;
11772+ }
11773+
1173411774bool Game::isPlayerNoBoxed (const std::shared_ptr<Player> &player) {
1173511775 if (!player) {
1173611776 return true ;
@@ -11759,6 +11799,11 @@ bool Game::isPlayerNoBoxed(const std::shared_ptr<Player> &player) {
1175911799 continue ;
1176011800 }
1176111801
11802+ // Ignore other players (including party members)
11803+ if (topCreature->getPlayer ()) {
11804+ continue ;
11805+ }
11806+
1176211807 if (++monsterCount >= 6 ) {
1176311808 return false ;
1176411809 }
0 commit comments