summaryrefslogtreecommitdiff
path: root/src/map/elemental.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-28 22:18:29 +0100
committerHaru <haru@dotalux.com>2016-02-28 22:22:31 +0100
commit905b59d85b790ea57198c47e249690094b296bda (patch)
treead415f95a8ef0bc71a8a0e4aebd7828fad52a87a /src/map/elemental.c
parent38df89621f9e5b4196a91f8361b4493247f41bd3 (diff)
downloadhercules-905b59d85b790ea57198c47e249690094b296bda.tar.gz
hercules-905b59d85b790ea57198c47e249690094b296bda.tar.bz2
hercules-905b59d85b790ea57198c47e249690094b296bda.tar.xz
hercules-905b59d85b790ea57198c47e249690094b296bda.zip
Changed mob mode field to 32 bit, for future expansion
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/elemental.c')
-rw-r--r--src/map/elemental.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/map/elemental.c b/src/map/elemental.c
index 0eed4e799..b6297c2cf 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -545,28 +545,38 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) {
return 1;
}
-/*===============================================================
- * Change elemental mode.
- *-------------------------------------------------------------*/
-int elemental_change_mode(struct elemental_data *ed, int mode) {
+/**
+ * Changes elemental mode.
+ *
+ * @param ed The elemental data.
+ * @param mode The new mode.
+ * @retval 1 in case of success.
+ */
+int elemental_change_mode(struct elemental_data *ed, uint32 mode)
+{
+ int skillmode = EL_SKILLMODE_PASIVE;
nullpo_ret(ed);
// Remove target
elemental->unlocktarget(ed);
// Removes the effects of the previous mode.
- if(ed->elemental.mode != mode ) elemental->clean_effect(ed);
+ if (ed->elemental.mode != mode)
+ elemental->clean_effect(ed);
ed->battle_status.mode = ed->elemental.mode = mode;
// Normalize elemental mode to elemental skill mode.
- if( mode == EL_MODE_AGGRESSIVE ) mode = EL_SKILLMODE_AGGRESSIVE; // Aggressive spirit mode -> Aggressive spirit skill.
- else if( mode == EL_MODE_ASSIST ) mode = EL_SKILLMODE_ASSIST; // Assist spirit mode -> Assist spirit skill.
- else mode = EL_SKILLMODE_PASIVE; // Passive spirit mode -> Passive spirit skill.
+ if (mode == EL_MODE_AGGRESSIVE)
+ skillmode = EL_SKILLMODE_AGGRESSIVE; // Aggressive spirit mode -> Aggressive spirit skill.
+ else if (mode == EL_MODE_ASSIST)
+ skillmode = EL_SKILLMODE_ASSIST; // Assist spirit mode -> Assist spirit skill.
+ else
+ skillmode = EL_SKILLMODE_PASIVE; // Passive spirit mode -> Passive spirit skill.
// Use a skill immediately after every change mode.
- if( mode != EL_SKILLMODE_AGGRESSIVE )
- elemental->change_mode_ack(ed,mode);
+ if (skillmode != EL_SKILLMODE_AGGRESSIVE)
+ elemental->change_mode_ack(ed, skillmode);
return 1;
}
@@ -681,7 +691,8 @@ int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap) {
int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, int64 tick) {
struct block_list *target = NULL;
- int master_dist, view_range, mode;
+ int master_dist, view_range;
+ uint32 mode;
nullpo_ret(ed);
nullpo_ret(sd);
@@ -760,7 +771,7 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s
return 0;
}
- if( mode == EL_MODE_AGGRESSIVE ) {
+ if (mode == EL_MODE_AGGRESSIVE) {
target = map->id2bl(ed->ud.target);
if( !target )