Spawn and Free Cell Search Behavior (#8324)

- When searching for a map-wide free cell, the tiles 15 cells from the edge are no longer considered
  * Added a configuration to change the edge size to any value between 1 and 40
- When searching for a free cell, the tiles 4-5 cells from the edge are now considered invalid and trigger a retry
  * If you make the edge size smaller than this, it will use edge size instead
- Searching for a free cell now defaults to 50 tries, but if the "no spawn on player" option is active, those failed attempts are not counted towards the limit anymore
- When a monster spawns in a defined area there will now be 8 attempts to spawn it on a valid cell within the area and then one attempt on the center cell; if all 9 attempts fail, there will now be 50 tries to spawn it map-wide before it gives up
- When a monster has fixed spawn coordinates, but those coordinates are a wall, it will now spawn in a random location map-wide instead
  * This also applies to icewall blocking the cell unless the boss_monster command was used
- Each monster in an area spawn will now receive its own spawn center within the spawn area on server start
  * This results in the spawn area being larger but having a bias towards the center
  * Added a configuration to disable this behavior
- Fixed slave monsters always being active and constantly calling the "search freecell" function even though neither them nor their master have been spotted yet
- Fixed map server crash when setting no_spawn_on_player to 100 (follow-up to 33b2b02)
- Updated prontera field spawns to official episode 18+
- Updated all champion mob respawn times to 3 minutes and sorted them by map name
- Fixes #8300
This commit is contained in:
Playtester
2024-05-19 17:12:44 +02:00
committed by GitHub
parent 949a33081f
commit 5d232db89e
13 changed files with 472 additions and 396 deletions

View File

@@ -7037,7 +7037,7 @@ enum e_setpos pc_setpos_savepoint( map_session_data& sd, clr_type clrtype ){
*------------------------------------------*/
char pc_randomwarp(map_session_data *sd, clr_type type, bool ignore_mapflag)
{
int x,y,i=0;
int16 x,y,i=0;
nullpo_ret(sd);
@@ -7046,9 +7046,10 @@ char pc_randomwarp(map_session_data *sd, clr_type type, bool ignore_mapflag)
if (mapdata->getMapFlag(MF_NOTELEPORT) && !ignore_mapflag) //Teleport forbidden
return 3;
int edge = battle_config.map_edge_size;
do {
x = rnd()%(mapdata->xs-2)+1;
y = rnd()%(mapdata->ys-2)+1;
x = rnd_value<int16>(edge, mapdata->xs - edge - 1);
y = rnd_value<int16>(edge, mapdata->ys - edge - 1);
} while((map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1,sd->bl.m,x,y,1))) && (i++) < 1000);
if (i < 1000)