Fixes skill cooldown adjustment from items (#5950)

* Fixes #5934.
* Items that adjust cooldown will now not return 0 if no cooldown is defined for a skill.
Thanks to @Felleonel!
This commit is contained in:
Aleos 2021-05-19 12:50:59 -04:00 committed by GitHub
parent ec91884ca6
commit 202f37c2fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6354,20 +6354,17 @@ int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 sk
int cooldown = skill_get_cooldown(skill_id, skill_lv);
if (cooldown == 0)
return 0;
if (skill_id == SU_TUNABELLY && pc_checkskill(sd, SU_SPIRITOFSEA))
if (skill_id == SU_TUNABELLY && pc_checkskill(sd, SU_SPIRITOFSEA) > 0)
cooldown -= skill_get_time(SU_TUNABELLY, skill_lv);
for (auto &it : sd->skillcooldown) {
if (it.id == skill_id) {
cooldown += it.val;
cooldown = max(0, cooldown);
break;
}
}
return cooldown;
return max(0, cooldown);
}
/*==========================================