summaryrefslogtreecommitdiff
path: root/src/map/elemental.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/elemental.c')
-rw-r--r--src/map/elemental.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/map/elemental.c b/src/map/elemental.c
index a87deb7d7..ae1fda0a2 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -254,7 +254,8 @@ void elemental_summon_init(struct elemental_data *ed) {
ed->regen.state.block = 0;
}
-int elemental_data_received(struct s_elemental *ele, bool flag) {
+int elemental_data_received(const struct s_elemental *ele, bool flag)
+{
struct map_session_data *sd;
struct elemental_data *ed;
struct s_elemental_db *db;
@@ -544,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;
}
@@ -680,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);
@@ -692,7 +704,7 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s
if( DIFF_TICK(tick,ed->last_spdrain_time) >= 10000 ){// Drain SP every 10 seconds
int sp = 5;
- switch (ed->vd->class_) {
+ switch (ed->vd->class) {
case ELEID_EL_AGNI_M:
case ELEID_EL_AQUA_M:
case ELEID_EL_VENTUS_M:
@@ -759,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 )
@@ -852,7 +864,7 @@ int read_elementaldb(void) {
db->lv = atoi(str[3]);
estatus = &db->status;
- db->vd.class_ = db->class_;
+ db->vd.class = db->class_;
estatus->max_hp = atoi(str[4]);
estatus->max_sp = atoi(str[5]);