summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 6f0cb424b..a8dbefbd7 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -13994,6 +13994,22 @@ static bool skill_is_combo(int skill_id)
return false;
}
+/**
+ * Checks if a skill is casted by an item (itemskill() script command).
+ *
+ * @param sd The charcater's session data.
+ * @param skill_id The skill's ID.
+ * @param skill_lv The skill's level.
+ * @return true if skill is casted by an item, otherwise false.
+ */
+static bool skill_is_item_skill(struct map_session_data *sd, int skill_id, int skill_lv)
+{
+ nullpo_retr(false, sd);
+
+ return (sd->skillitem == skill_id && sd->skillitemlv == skill_lv
+ && sd->itemskill_id == skill_id && sd->itemskill_lv == skill_lv);
+}
+
static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv)
{
struct status_data *st;
@@ -14009,7 +14025,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
return 0;
if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_no_conditions == 1)
- && sd->itemskill_id == sd->skillitem && sd->itemskill_lv == sd->skillitemlv) {
+ && skill->is_item_skill(sd, skill_id, skill_lv)) {
return 1;
}
@@ -14998,7 +15014,7 @@ static int skill_check_condition_castend(struct map_session_data *sd, uint16 ski
return 0;
if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_no_conditions == 1)
- && sd->itemskill_id == sd->skillitem && sd->itemskill_lv == sd->skillitemlv) {
+ && skill->is_item_skill(sd, skill_id, skill_lv)) {
return 1;
}
@@ -15203,7 +15219,7 @@ static int skill_consume_requirement(struct map_session_data *sd, uint16 skill_i
nullpo_ret(sd);
- if (sd->state.itemskill_no_conditions == 1 && sd->itemskill_id == sd->skillitem && sd->itemskill_lv == sd->skillitemlv)
+ if (sd->state.itemskill_no_conditions == 1 && skill->is_item_skill(sd, skill_id, skill_lv))
return 1;
req = skill->get_requirement(sd,skill_id,skill_lv);
@@ -21611,6 +21627,7 @@ void skill_defaults(void)
skill->cast_fix_sc = skill_castfix_sc;
skill->vf_cast_fix = skill_vfcastfix;
skill->delay_fix = skill_delay_fix;
+ skill->is_item_skill = skill_is_item_skill;
skill->check_condition_castbegin = skill_check_condition_castbegin;
skill->check_condition_castend = skill_check_condition_castend;
skill->consume_requirement = skill_consume_requirement;