From 310b7dd9b8d2e862657d84cc72bb156e0d2ad226 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 25 Aug 2019 19:37:22 +0200 Subject: Fix an issue that prevents homunculus auto-vaporize on death or skill reset The >80% HP condition is now ignored in the cases the vaporization is forced by the server Signed-off-by: Haru --- src/map/homunculus.c | 6 +++--- src/map/homunculus.h | 2 +- src/map/pc.c | 6 +++--- src/map/script.c | 2 +- src/map/skill.c | 2 +- src/map/status.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 31744f479..aed853313 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -172,7 +172,7 @@ static int homunculus_dead(struct homun_data *hd) } //Vaporize a character's homun. If flag, HP needs to be 80% or above. -static int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) +static int homunculus_vaporize(struct map_session_data *sd, enum homun_state state, bool force) { struct homun_data *hd; @@ -185,13 +185,13 @@ static int homunculus_vaporize(struct map_session_data *sd, enum homun_state fla if (status->isdead(&hd->bl)) return 0; //Can't vaporize a dead homun. - if (flag == HOM_ST_REST && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80) + if (!force && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80) return 0; hd->regen.state.block = 3; //Block regen while vaporized. //Delete timers when vaporized. homun->hunger_timer_delete(hd); - hd->homunculus.vaporize = flag; + hd->homunculus.vaporize = state; if(battle_config.hom_setting&0x40) memset(hd->blockskill, 0, sizeof(hd->blockskill)); clif->hominfo(sd, sd->hd, 0); diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 745c7cd84..b1c21e546 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -167,7 +167,7 @@ struct homunculus_interface { enum homun_type (*class2type) (int class_); void (*damaged) (struct homun_data *hd); int (*dead) (struct homun_data *hd); - int (*vaporize) (struct map_session_data *sd, enum homun_state flag); + int (*vaporize) (struct map_session_data *sd, enum homun_state state, bool force); int (*delete) (struct homun_data *hd, int emote); int (*checkskill) (struct homun_data *hd, uint16 skill_id); int (*calc_skilltree) (struct homun_data *hd, int flag_evolve); diff --git a/src/map/pc.c b/src/map/pc.c index 1e7ac5817..b0c77049c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7765,7 +7765,7 @@ static int pc_resetskill(struct map_session_data *sd, int flag) pc->setoption(sd, i); if( homun_alive(sd->hd) && pc->checkskill(sd, AM_CALLHOMUN) ) - homun->vaporize(sd, HOM_ST_REST); + homun->vaporize(sd, HOM_ST_REST, true); if ((sd->sc.data[SC_SPRITEMABLE] && pc->checkskill(sd, SU_SPRITEMABLE))) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); @@ -8054,7 +8054,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) if (sd->status.hom_id > 0){ if(battle_config.homunculus_auto_vapor && sd->hd) - homun->vaporize(sd, HOM_ST_REST); + homun->vaporize(sd, HOM_ST_REST, true); } if( sd->md ) @@ -9069,7 +9069,7 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) pc->setoption(sd, i); if(homun_alive(sd->hd) && !pc->checkskill(sd, AM_CALLHOMUN)) - homun->vaporize(sd, HOM_ST_REST); + homun->vaporize(sd, HOM_ST_REST, true); if ((sd->sc.data[SC_SPRITEMABLE] && pc->checkskill(sd, SU_SPRITEMABLE))) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); diff --git a/src/map/script.c b/src/map/script.c index 51cf29816..04c985ea4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12633,7 +12633,7 @@ static BUILDIN(homunculus_morphembryo) clif->additem(sd, 0, 0, i); clif->emotion(&sd->hd->bl, E_SWT); } else { - homun->vaporize(sd, HOM_ST_MORPH); + homun->vaporize(sd, HOM_ST_MORPH, true); success = true; } } else { diff --git a/src/map/skill.c b/src/map/skill.c index af61c887c..4b6ab7d0d 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8710,7 +8710,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * case AM_REST: if (sd) { - if (homun->vaporize(sd,HOM_ST_REST)) + if (homun->vaporize(sd, HOM_ST_REST, false)) clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); else clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0, 0); diff --git a/src/map/status.c b/src/map/status.c index 63e71c9dc..e9636e214 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -9070,7 +9070,7 @@ static int status_change_start(struct block_list *src, struct block_list *bl, en if (sd->status.pet_id > 0) pet->menu(sd, 3); if (homun_alive(sd->hd)) - homun->vaporize(sd,HOM_ST_REST); + homun->vaporize(sd, HOM_ST_REST, true); if (sd->md) mercenary->delete(sd->md,3); } -- cgit v1.2.3-60-g2f50