diff options
author | Haru <haru@dotalux.com> | 2020-05-31 23:33:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-31 23:33:55 +0200 |
commit | b3189b88eafd5a159780000845bacef79310a22c (patch) | |
tree | 6abf9ca36ce7c703c2735589e7f89cef6e5f698a /src/map/unit.c | |
parent | 1cccfca3dd708354bf808068c1210ce353957f2e (diff) | |
parent | 468c81a5367c444e2e678148d556df94eaa623af (diff) | |
download | hercules-b3189b88eafd5a159780000845bacef79310a22c.tar.gz hercules-b3189b88eafd5a159780000845bacef79310a22c.tar.bz2 hercules-b3189b88eafd5a159780000845bacef79310a22c.tar.xz hercules-b3189b88eafd5a159780000845bacef79310a22c.zip |
Merge pull request #2699 from Kenpachi2k13/multi_itemskill
Enable multiple itemskill() calls per item
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 19f09f83c..53e517045 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1156,10 +1156,9 @@ static int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_ int ret = unit->skilluse_id2(src, target_id, skill_id, skill_lv, casttime, castcancel); struct map_session_data *sd = BL_CAST(BL_PC, src); - if (sd != NULL && ret == 0) - pc->autocast_clear(sd); // Error in unit_skilluse_id2(). - else if (sd != NULL && ret != 0 && skill_id != SA_ABRACADABRA && skill_id != WM_RANDOMIZESPELL) - skill->validate_autocast_data(sd, skill_id, skill_lv); + if (sd != NULL) + pc->autocast_remove(sd, sd->auto_cast_current.type, sd->auto_cast_current.skill_id, + sd->auto_cast_current.skill_lv); return ret; } @@ -1718,7 +1717,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill if (!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026 unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS);// even though this is not how official works but this will do the trick. bugreport:6829 - if (sd != NULL && sd->autocast.itemskill_instant_cast && sd->autocast.type == AUTOCAST_ITEM) + if (sd != NULL && sd->auto_cast_current.itemskill_instant_cast && sd->auto_cast_current.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. @@ -1756,7 +1755,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill if( casttime <= 0 ) ud->state.skillcastcancel = 0; - if (sd == NULL || sd->autocast.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) + if (sd == NULL || sd->auto_cast_current.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) ud->canact_tick = tick + casttime + 100; if( sd ) { @@ -1795,10 +1794,9 @@ static int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_ int ret = unit->skilluse_pos2(src, skill_x, skill_y, skill_id, skill_lv, casttime, castcancel); struct map_session_data *sd = BL_CAST(BL_PC, src); - if (sd != NULL && ret == 0) - pc->autocast_clear(sd); // Error in unit_skilluse_pos2(). - else if (sd != NULL && ret != 0 && skill_id != SA_ABRACADABRA && skill_id != WM_RANDOMIZESPELL) - skill->validate_autocast_data(sd, skill_id, skill_lv); + if (sd != NULL) + pc->autocast_remove(sd, sd->auto_cast_current.type, sd->auto_cast_current.skill_id, + sd->auto_cast_current.skill_lv); return ret; } @@ -1895,7 +1893,7 @@ static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill } ud->state.skillcastcancel = castcancel&&casttime>0?1:0; - if (sd == NULL || sd->autocast.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) + if (sd == NULL || sd->auto_cast_current.type < AUTOCAST_ABRA || skill->get_cast(skill_id, skill_lv) != 0) ud->canact_tick = tick + casttime + 100; #if 0 if (sd) { @@ -1926,7 +1924,7 @@ static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill unit->stop_walking(src, STOPWALKING_FLAG_FIXPOS); - if (sd != NULL && sd->autocast.itemskill_instant_cast && sd->autocast.type == AUTOCAST_ITEM) + if (sd != NULL && sd->auto_cast_current.itemskill_instant_cast && sd->auto_cast_current.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. @@ -2889,6 +2887,8 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) aFree(sd->instance); sd->instance = NULL; } + + VECTOR_CLEAR(sd->auto_cast); // Clear auto-cast vector. VECTOR_CLEAR(sd->channels); VECTOR_CLEAR(sd->script_queues); VECTOR_CLEAR(sd->achievement); // Achievement [Smokexyz/Hercules] |