From c35a262f37226395099c9bf08f6a9bdcb230a3a2 Mon Sep 17 00:00:00 2001 From: aleos Date: Thu, 19 Oct 2023 09:20:30 -0400 Subject: [PATCH] Clean up clone checks * Default clone monster mode to MONSTER_TYPE_20. This resolves issues with clones receiving more modes than they should resulting in static behavior. See doc/mob_db_mode_list.txt for more types. * Fixes atcommand clone not sending the correct flag value during the clone spawning process. * Update documentation. --- doc/script_commands.txt | 7 ++++--- src/map/atcommand.cpp | 2 +- src/map/status.cpp | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 69fe95550c..dcd6b0d62f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -6836,9 +6836,10 @@ The mode can be specified to determine the behavior of the clone. Its values are the same as the ones used for the mode field in the mob_db. The default mode is aggressive, assists, can move, can attack. -Flag can be either zero or one currently. If zero, the clone is a normal -monster that'll target players, if one, it is considered a summoned monster, -and as such, it'll target other monsters. Defaults to zero. +Flag options: +0 - The clone is a normal monster that will target players (default). +1 - The clone is considered a summoned monster that will target other monsters. +2 - The clone is a slave and will support the master. The duration specifies how long the clone will live before it is auto-removed. Specified in seconds, defaults to no limit (zero). diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index ff5f07be77..bb682f3ade 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -9086,7 +9086,7 @@ ACMD_FUNC(clone) y = sd->bl.y; } - if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, MD_NONE, flag?1:0, 0)) > 0) { + if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, MD_NONE, flag, 0)) > 0) { clif_displaymessage(fd, msg_txt(sd,128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. return 0; } diff --git a/src/map/status.cpp b/src/map/status.cpp index 67cce83741..b80553377c 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -3665,9 +3665,8 @@ int status_calc_pc_sub(map_session_data* sd, uint8 opt) base_status->speed = pSpeed; } - // !FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex] - // Give them all modes except these (useful for clones) - base_status->mode = static_cast(MD_MASK&~(MD_STATUSIMMUNE|MD_IGNOREMELEE|MD_IGNOREMAGIC|MD_IGNORERANGED|MD_IGNOREMISC|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK|MD_NOCAST|MD_NORANDOMWALK)); + // Default clone mode (see mob_db_mode_list doc for more types) + base_status->mode = MONSTER_TYPE_20; base_status->size = (sd->class_&JOBL_BABY) ? SZ_SMALL : (((sd->class_&MAPID_BASEMASK) == MAPID_SUMMONER) ? battle_config.summoner_size : SZ_MEDIUM); if (battle_config.character_size && pc_isriding(sd)) { // [Lupus]