summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-25 23:58:19 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-25 23:58:19 +0000
commitc776066a6116c2e2bfcd73eab7bcf2c044442292 (patch)
tree006717c1b3f4dac8e8d96217d67fb0a503f13436 /src/map/skill.c
parent32a5e256118b92e2dd1b6e2ed0b7417e44f00e66 (diff)
downloadhercules-c776066a6116c2e2bfcd73eab7bcf2c044442292.tar.gz
hercules-c776066a6116c2e2bfcd73eab7bcf2c044442292.tar.bz2
hercules-c776066a6116c2e2bfcd73eab7bcf2c044442292.tar.xz
hercules-c776066a6116c2e2bfcd73eab7bcf2c044442292.zip
- Renamed skill_clear_element_field to skill_clear_group, it accepts a flag to determine what to erase. &1 for elemental fields, &2 for traps. Also rewrote how it works to prevent missing elements (since each time an element is erased, the array contents shift)
- Added battle config traps_setting to determine how traps should behave. With &1 traps are invisible if you didn't see them get set up. With &2 traps will be removed after changing maps. The default is 2. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6285 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index e1f5b52ac..e17af7e23 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6402,7 +6402,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
if (limit < 0) //This can happen...
limit = skill_get_time(skillid,skilllv);
}
- skill_clear_element_field(src);
+ skill_clear_group(src,1);
}
break;
}
@@ -8915,27 +8915,39 @@ int skill_attack_area(struct block_list *bl,va_list ap)
*
*------------------------------------------
*/
-int skill_clear_element_field(struct block_list *bl)
+int skill_clear_group(struct block_list *bl, int flag)
{
struct unit_data *ud = unit_bl2ud(bl);
- int i;
+ struct skill_unit_group *group[MAX_SKILLUNITGROUP];
+ int i, count=0;
nullpo_retr(0, bl);
if (!ud) return 0;
-
- for (i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++) {
+
+ //All groups to be deleted are first stored on an array since the array elements shift around when you delete them. [Skotlex]
+ for (i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++)
+ {
switch (ud->skillunit[i]->skill_id) {
case SA_DELUGE:
case SA_VOLCANO:
case SA_VIOLENTGALE:
case SA_LANDPROTECTOR:
case NJ_SUITON:
- skill_delunitgroup(bl, ud->skillunit[i]);
+ if (flag&1)
+ group[count++]= ud->skillunit[i];
+ break;
+ default:
+ if (flag&2 && skill_get_inf2(ud->skillunit[i]->skill_id)&INF2_TRAP)
+ group[count++]= ud->skillunit[i];
+ break;
}
+
}
- return 1;
+ for (i=0;i<count;i++);
+ skill_delunitgroup(bl, group[i]);
+ return count;
}
-
+
/*==========================================
* Returns the first element field found [Skotlex]
*------------------------------------------