Skip to content

Commit

Permalink
Fix Abracadabra / Improvise / itemskill validation
Browse files Browse the repository at this point in the history
This commit introduces various fixes to the Abracadabra / Improvise
skill validation:

- abracadabra/improvise is no longer purged immediately after cast, by
  calling autocast_clear_current in the proper manner
- the abracadabra/improvise skill requirement bypass that was removed in
  #2657 and related pull requests is re-implemented
- the condition that would get the character stuck and unable to cast
  other skills until teleporting or relogging when rolling AL_WARP from
  abracadabra (i.e. because AL_WARP lands in clif_parse_UseSkillMap in 2
  steps) is fixed, by not immediately clearing the data after the first
  one

All credits for the fix go to Heka of Origins

Related to #2859
Fixes #2823
Fixes #2824

Signed-off-by: Haru <[email protected]>
  • Loading branch information
MishimaHaruna committed Apr 6, 2021
1 parent dcef2c2 commit f6bd68d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -6704,6 +6704,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
VECTOR_ENSURE(sd->auto_cast, 1, 1);
VECTOR_PUSH(sd->auto_cast, sd->auto_cast_current);
clif->item_skill(sd, abra_skill_id, abra_skill_lv);
pc->autocast_clear_current(sd);
} else {
// mob-casted
struct unit_data *ud = unit->bl2ud(src);
Expand Down Expand Up @@ -10487,6 +10488,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
VECTOR_ENSURE(sd->auto_cast, 1, 1);
VECTOR_PUSH(sd->auto_cast, sd->auto_cast_current);
clif->item_skill(sd, improv_skill_id, improv_skill_lv);
pc->autocast_clear_current(sd);
} else {
struct unit_data *ud = unit->bl2ud(src);
int inf = skill->get_inf(improv_skill_id);
Expand Down Expand Up @@ -14625,6 +14627,9 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
return 1;
}

if ((sd->auto_cast_current.type == AUTOCAST_ABRA || sd->auto_cast_current.type == AUTOCAST_IMPROVISE) && sd->auto_cast_current.skill_id == skill_id)
return 1;

if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->auto_cast_current.type != AUTOCAST_ITEM) {
// GMs don't override the AUTOCAST_ITEM check, otherwise they can use items without them being consumed!
sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check.
Expand Down Expand Up @@ -15715,6 +15720,9 @@ static int skill_check_condition_castend(struct map_session_data *sd, uint16 ski
return 1;
}

if ((sd->auto_cast_current.type == AUTOCAST_ABRA || sd->auto_cast_current.type == AUTOCAST_IMPROVISE) && sd->auto_cast_current.skill_id == skill_id)
return 1;

if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->auto_cast_current.type != AUTOCAST_ITEM) {
// GMs don't override the AUTOCAST_ITEM check, otherwise they can use items without them being consumed!
sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check.
Expand Down
2 changes: 1 addition & 1 deletion src/map/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ 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)
if (sd != NULL && sd->auto_cast_current.skill_id != AL_WARP)
pc->autocast_remove(sd, sd->auto_cast_current.type, sd->auto_cast_current.skill_id,
sd->auto_cast_current.skill_lv);

Expand Down

0 comments on commit f6bd68d

Please sign in to comment.