diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-03-11 23:16:29 +0100 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-03-14 22:35:09 +0100 |
commit | 12de22e7008081c94631c8730d05d487e7b0cfcc (patch) | |
tree | be98aae230d5d4e551640570d876db08949f3ae8 /src/map | |
parent | d92d1772e8dd2fc65fd009247b7009f26ae73b66 (diff) | |
download | hercules-12de22e7008081c94631c8730d05d487e7b0cfcc.tar.gz hercules-12de22e7008081c94631c8730d05d487e7b0cfcc.tar.bz2 hercules-12de22e7008081c94631c8730d05d487e7b0cfcc.tar.xz hercules-12de22e7008081c94631c8730d05d487e7b0cfcc.zip |
Remove map_session_data->state.itemskill_* and use map_session_data->autocast.itemskill_* instead
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 4 | ||||
-rw-r--r-- | src/map/pc.h | 4 | ||||
-rw-r--r-- | src/map/script.c | 7 | ||||
-rw-r--r-- | src/map/skill.c | 6 | ||||
-rw-r--r-- | src/map/unit.c | 4 |
6 files changed, 7 insertions, 20 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 1a99a07f3..6b5c57d46 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6766,7 +6766,7 @@ static void clif_item_skill(struct map_session_data *sd, uint16 skill_id, uint16 struct PACKET_ZC_AUTORUN_SKILL *p = WFIFOP(fd, 0); int type = skill->get_inf(skill_id); - if (sd->state.itemskill_castonself == 1 && sd->autocast.type == AUTOCAST_ITEM) + if (sd->autocast.itemskill_cast_on_self && sd->autocast.type == AUTOCAST_ITEM) type = INF_SELF_SKILL; p->packetType = HEADER_ZC_AUTORUN_SKILL; diff --git a/src/map/pc.c b/src/map/pc.c index 8586270b8..e181b5f89 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5354,10 +5354,6 @@ static int pc_autocast_clear(struct map_session_data *sd) sd->autocast.itemskill_check_conditions = false; sd->autocast.itemskill_instant_cast = false; sd->autocast.itemskill_cast_on_self = false; - sd->state.itemskill_conditions_checked = 0; - sd->state.itemskill_check_conditions = 0; - sd->state.itemskill_no_casttime = 0; - sd->state.itemskill_castonself = 0; return 1; } diff --git a/src/map/pc.h b/src/map/pc.h index 83b86b68b..2991bfc68 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -250,10 +250,6 @@ struct map_session_data { unsigned int refine_ui : 1; unsigned int npc_unloaded : 1; ///< The player is talking with an unloaded NPCs (respawned tombstones) unsigned int lapine_ui : 1; - unsigned int itemskill_conditions_checked : 1; // Used by itemskill() script command, to prevent second check of conditions after target was selected. - unsigned int itemskill_check_conditions : 1; // Used by itemskill() script command, to check skill conditions and consume them. - unsigned int itemskill_no_casttime : 1; // Used by itemskill() script command, to cast skill instantaneously. - unsigned int itemskill_castonself : 1; // Used by itemskill() script command, to forcefully cast skill on invoking character. } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; diff --git a/src/map/script.c b/src/map/script.c index b8f8d7638..6ed94bc92 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11007,26 +11007,21 @@ static BUILDIN(itemskill) sd->autocast.skill_lv = script_getnum(st, 3); sd->skillitem = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); sd->skillitemlv = script_getnum(st, 3); - sd->state.itemskill_conditions_checked = 0; // Skill casting items will check the conditions prior to the target selection in AEGIS. Thus we need a flag to prevent checking them twice. int flag = script_hasdata(st, 4) ? script_getnum(st, 4) : ISF_NONE; - sd->state.itemskill_check_conditions = ((flag & ISF_CHECKCONDITIONS) == ISF_CHECKCONDITIONS) ? 1 : 0; // Unset in pc_autocast_clear(). sd->autocast.itemskill_check_conditions = ((flag & ISF_CHECKCONDITIONS) == ISF_CHECKCONDITIONS); - if (sd->state.itemskill_check_conditions == 1) { + if (sd->autocast.itemskill_check_conditions) { if (skill->check_condition_castbegin(sd, sd->skillitem, sd->skillitemlv) == 0 || skill->check_condition_castend(sd, sd->skillitem, sd->skillitemlv) == 0) { pc->autocast_clear(sd); return true; } - sd->state.itemskill_conditions_checked = 1; // Unset in pc_autocast_clear(). sd->autocast.itemskill_conditions_checked = true; } - sd->state.itemskill_no_casttime = ((flag & ISF_INSTANTCAST) == ISF_INSTANTCAST) ? 1 : 0; // Unset in pc_autocast_clear(). - sd->state.itemskill_castonself = ((flag & ISF_CASTONSELF) == ISF_CASTONSELF) ? 1 : 0; // Unset in pc_autocast_clear(). sd->autocast.itemskill_instant_cast = ((flag & ISF_INSTANTCAST) == ISF_INSTANTCAST); sd->autocast.itemskill_cast_on_self = ((flag & ISF_CASTONSELF) == ISF_CASTONSELF); diff --git a/src/map/skill.c b/src/map/skill.c index 14bc9460e..001c11c36 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14062,7 +14062,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s if (sd->chat_id != 0) return 0; - if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_check_conditions == 0) + if ((sd->autocast.itemskill_conditions_checked || !sd->autocast.itemskill_check_conditions) && sd->autocast.type == AUTOCAST_ITEM) { return 1; } @@ -15051,7 +15051,7 @@ static int skill_check_condition_castend(struct map_session_data *sd, uint16 ski if (sd->chat_id != 0) return 0; - if ((sd->state.itemskill_conditions_checked == 1 || sd->state.itemskill_check_conditions == 0) + if ((sd->autocast.itemskill_conditions_checked || !sd->autocast.itemskill_check_conditions) && sd->autocast.type == AUTOCAST_ITEM) { return 1; } @@ -15257,7 +15257,7 @@ static int skill_consume_requirement(struct map_session_data *sd, uint16 skill_i nullpo_ret(sd); - if (sd->state.itemskill_check_conditions == 0 && sd->autocast.type == AUTOCAST_ITEM) + if (!sd->autocast.itemskill_check_conditions && sd->autocast.type == AUTOCAST_ITEM) return 1; req = skill->get_requirement(sd,skill_id,skill_lv); diff --git a/src/map/unit.c b/src/map/unit.c index ab6f345ed..ad4dc88b5 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1707,7 +1707,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->state.itemskill_no_casttime == 1 && sd->autocast.type == AUTOCAST_ITEM) + if (sd != NULL && sd->autocast.itemskill_instant_cast && sd->autocast.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. @@ -1915,7 +1915,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->state.itemskill_no_casttime == 1 && sd->autocast.type == AUTOCAST_ITEM) + if (sd != NULL && sd->autocast.itemskill_instant_cast && sd->autocast.type == AUTOCAST_ITEM) casttime = 0; // in official this is triggered even if no cast time. |