diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-18 14:37:48 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-18 14:37:48 +0000 |
commit | 1f82fb3ed60e57b7fecc18cd871747af3dca461b (patch) | |
tree | e3c52ad8c9495ce0875ac76cdef127d3cb7bcae8 /src/map/skill.c | |
parent | 8597fdb2662c21b535f089e28821d624dd0414e4 (diff) | |
download | hercules-1f82fb3ed60e57b7fecc18cd871747af3dca461b.tar.gz hercules-1f82fb3ed60e57b7fecc18cd871747af3dca461b.tar.bz2 hercules-1f82fb3ed60e57b7fecc18cd871747af3dca461b.tar.xz hercules-1f82fb3ed60e57b7fecc18cd871747af3dca461b.zip |
- Some code cleaning of the skill reiteration/nofootset code.
- skill reiteration code now does not checks for the trigger-area of the skill in the case of non-players, which means mobs can now place traps in cells adjacent to each other.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6640 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index c88647e8e..39ab93ad2 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2148,31 +2148,25 @@ static int skill_check_unit_range_sub( struct block_list *bl,va_list ap ) return 1;
}
-int skill_check_unit_range(int m,int x,int y,int skillid,int skilllv)
+static int skill_check_unit_range(struct block_list *bl,int x,int y,int skillid,int skilllv)
{
- int range = skill_get_unit_range(skillid, skilllv);
+ //Non players do not check for the skill's splash-trigger area.
+ int range = bl->type==BL_PC?skill_get_unit_range(skillid, skilllv):0;
int layout_type = skill_get_unit_layout_type(skillid,skilllv);
if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) {
ShowError("skill_check_unit_range: unsupported layout type %d for skill %d\n",layout_type,skillid);
return 0;
}
- // ‚Æ‚è‚ ‚¦‚¸?³•ûŒ`‚̃†ƒjƒbƒgƒŒƒCƒAƒEƒg‚̂ݑΉž
range += layout_type;
- return map_foreachinarea(skill_check_unit_range_sub,m,
+ return map_foreachinarea(skill_check_unit_range_sub,bl->m,
x-range,y-range,x+range,y+range,BL_SKILL,skillid);
}
static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
{
- int *c;
int skillid;
-
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
- nullpo_retr(0, c = va_arg(ap,int *));
-
if(bl->prev == NULL)
return 0;
@@ -2183,17 +2177,14 @@ static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap ) if (skillid==HP_BASILICA && bl->type==BL_PC)
return 0;
- if (skillid==AM_DEMONSTRATION && bl->type==BL_MOB && ((struct mob_data*)bl)->class_ == MOBID_EMPERIUM)
+ if (skillid==AM_DEMONSTRATION && bl->type==BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM)
return 0; //Allow casting Bomb/Demonstration Right under emperium [Skotlex]
-
- (*c)++;
-
return 1;
}
-int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid, int skilllv)
+static int skill_check_unit_range2(struct block_list *bl, int x,int y,int skillid, int skilllv)
{
- int c = 0, range, type;
+ int range, type;
switch (skillid) { // to be expanded later
case WZ_ICEWALL:
@@ -2206,7 +2197,6 @@ int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid ShowError("skill_check_unit_range2: unsupported layout type %d for skill %d\n",layout_type,skillid);
return 0;
}
- // ‚Æ‚è‚ ‚¦‚¸?³•ûŒ`‚̃†ƒjƒbƒgƒŒƒCƒAƒEƒg‚̂ݑΉž
range = skill_get_unit_range(skillid,skilllv) + layout_type;
}
break;
@@ -2219,11 +2209,9 @@ int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid else
type = BL_PC;
- map_foreachinarea(skill_check_unit_range2_sub, m,
+ return map_foreachinarea(skill_check_unit_range2_sub, bl->m,
x - range, y - range, x + range, y + range,
- type, &c, skillid);
-
- return c;
+ type, skillid);
}
int skill_guildaura_sub (struct block_list *bl,va_list ap)
@@ -5760,13 +5748,13 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data ) if (!(battle_config.skill_reiteration && src->type&battle_config.skill_reiteration) &&
skill_get_unit_flag(ud->skillid)&UF_NOREITERATION &&
- skill_check_unit_range(src->m,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
+ skill_check_unit_range(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
)
break;
if (battle_config.skill_nofootset && src->type&battle_config.skill_nofootset &&
skill_get_unit_flag(ud->skillid)&UF_NOFOOTSET &&
- skill_check_unit_range2(src, src->m,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
+ skill_check_unit_range2(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
)
break;
@@ -6253,7 +6241,7 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma return 0;
}
- if(skill_check_unit_range2(&sd->bl,sd->bl.m,wx,wy,skill_num,lv) > 0) {
+ if(skill_check_unit_range2(&sd->bl,wx,wy,skill_num,lv) > 0) {
clif_skill_fail(sd,0,0,0);
skill_failed(sd);
return 0;
|