Unlock target when setunitdata TARGETID 0 (#5578)

Fixes #5577
This commit is contained in:
javirst 2020-11-30 03:37:28 +07:00 committed by GitHub
parent 4bbd755f2a
commit f74915193d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -8337,6 +8337,7 @@ Parameter (indexes) for NPCs are:
- *_ADELAY: see doc/mob_db.txt
- *_DMOTION: see doc/mob_db.txt
- *_BODY2: enable (1) the alternate display, or disable (0)
- *_TARGETID: when set to 0 the unit will release the target and stop attacking
- UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
- UMOB_SCOPTION: see the 'Variables' section at the top of this document

View File

@ -18326,6 +18326,10 @@ BUILDIN_FUNC(setunitdata)
case UMOB_ADELAY: md->base_status->adelay = (short)value; calc_status = true; break;
case UMOB_DMOTION: md->base_status->dmotion = (short)value; calc_status = true; break;
case UMOB_TARGETID: {
if (value==0) {
mob_unlocktarget(md,gettick());
break;
}
struct block_list* target = map_id2bl(value);
if (!target) {
ShowWarning("buildin_setunitdata: Error in finding target for BL_MOB!\n");
@ -18391,6 +18395,10 @@ BUILDIN_FUNC(setunitdata)
case UHOM_ADELAY: hd->base_status.adelay = (short)value; calc_status = true; break;
case UHOM_DMOTION: hd->base_status.dmotion = (short)value; calc_status = true; break;
case UHOM_TARGETID: {
if (value==0) {
unit_stop_attack(&hd->bl);
break;
}
struct block_list* target = map_id2bl(value);
if (!target) {
ShowWarning("buildin_setunitdata: Error in finding target for BL_HOM!\n");
@ -18501,6 +18509,10 @@ BUILDIN_FUNC(setunitdata)
case UMER_ADELAY: mc->base_status.adelay = (short)value; calc_status = true; break;
case UMER_DMOTION: mc->base_status.dmotion = (short)value; calc_status = true; break;
case UMER_TARGETID: {
if (value==0) {
unit_stop_attack(&mc->bl);
break;
}
struct block_list* target = map_id2bl(value);
if (!target) {
ShowWarning("buildin_setunitdata: Error in finding target for BL_MER!\n");
@ -18563,6 +18575,10 @@ BUILDIN_FUNC(setunitdata)
case UELE_ADELAY: ed->base_status.adelay = (short)value; calc_status = true; break;
case UELE_DMOTION: ed->base_status.dmotion = (short)value; calc_status = true; break;
case UELE_TARGETID: {
if (value==0) {
unit_stop_attack(&ed->bl);
break;
}
struct block_list* target = map_id2bl(value);
if (!target) {
ShowWarning("buildin_setunitdata: Error in finding target for BL_ELEM!\n");