diff options
author | Haru <haru@dotalux.com> | 2019-08-25 19:38:52 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2019-08-26 01:22:10 +0200 |
commit | 29d5ccb4f6f5d94b2991bae6eeb3bf86987bf21c (patch) | |
tree | 7f3697ed7c2ee25a94b85174093b8d0958f60dad /src/map/homunculus.c | |
parent | 2d1b14d4b4315bb8705d9c1977343615c708a514 (diff) | |
download | hercules-29d5ccb4f6f5d94b2991bae6eeb3bf86987bf21c.tar.gz hercules-29d5ccb4f6f5d94b2991bae6eeb3bf86987bf21c.tar.bz2 hercules-29d5ccb4f6f5d94b2991bae6eeb3bf86987bf21c.tar.xz hercules-29d5ccb4f6f5d94b2991bae6eeb3bf86987bf21c.zip |
Fix a bug that caused homunculi's HP and SP to be refilled on login
They're now only refilled on homunculus creation
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/homunculus.c')
-rw-r--r-- | src/map/homunculus.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c index aed853313..9f7ae0bac 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -826,7 +826,7 @@ static int homunculus_db_search(int key, int type) * @param hom The homunculus source data. * @retval false in case of errors. */ -static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom) +static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom, bool is_new) { struct homun_data *hd; int i = 0; @@ -870,7 +870,9 @@ static bool homunculus_create(struct map_session_data *sd, const struct s_homunc map->addiddb(&hd->bl); status_calc_homunculus(hd,SCO_FIRST); - status_percent_heal(&hd->bl, 100, 100); + if (is_new) { + status_percent_heal(&hd->bl, 100, 100); + } hd->hungry_timer = INVALID_TIMER; return true; @@ -927,6 +929,7 @@ static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, { struct map_session_data *sd; struct homun_data *hd; + bool is_new = false; nullpo_retr(false, sh); @@ -942,15 +945,17 @@ static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, if (sd->status.char_id != sh->char_id && sd->status.hom_id != sh->hom_id) return false; - if (sd->status.hom_id == 0) //Hom just created. + if (sd->status.hom_id == 0) { // Hom just created. sd->status.hom_id = sh->hom_id; + is_new = true; + } if (sd->hd != NULL) { //uh? Overwrite the data. memcpy(&sd->hd->homunculus, sh, sizeof sd->hd->homunculus); sd->hd->homunculus.char_id = sd->status.char_id; // Correct char id if necessary. } else { - homun->create(sd, sh); + homun->create(sd, sh, is_new); } hd = sd->hd; |