diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-17 21:33:54 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-17 21:33:54 +0000 |
commit | f06d3b26ad08bb054b6593fac39042cb20649c36 (patch) | |
tree | 53861eeb70d343a9d429f35d1cf29b1139c828b1 /src/map/battle.c | |
parent | ff4c178309e0e18939d4077283a689e356311ce8 (diff) | |
download | hercules-f06d3b26ad08bb054b6593fac39042cb20649c36.tar.gz hercules-f06d3b26ad08bb054b6593fac39042cb20649c36.tar.bz2 hercules-f06d3b26ad08bb054b6593fac39042cb20649c36.tar.xz hercules-f06d3b26ad08bb054b6593fac39042cb20649c36.zip |
- Added NK value 3: No damage + area of effect skill (NK_SPLASH_NO_DAMAGE)
- Removed the double-cast specific code and made it use skill_addtimerskill instead.
- Modified party_foreachsamemap so that it returns to addition of the return value of the functions invoked. Type has been changed for "range", when 0, it scans all party members in the map.
- Updated most skill/battle code to use map_foreachinrange rather than map_foreachinarea.
- map_foreachinrange does not performs an exact range check anymore. However the relevant code is commented and anyone can enable it.
- Updated most skills to use skill_get_splash instead of hardcoded ranges.
- Added function skill_get_casttype which returns the type of function that should be invoked for that skill: skill_castend_pos, skill_castend_nodamage_id or skill_castend_damage_id.
- self skills are sent to skill_castend_nodamage_id regardless of nk (nk should signal if the skill causes damage above everything, it is used on autospell/effects).
- Due to the previous change, self skills where the target and src are different, and don't have an nk of no damage, they are sent to castend_damage_id (assumed target auto-selected skills)
- Applied the relevant updates to db/skill_db.txt, db/skill_unit_db also got updated, as trap ranges should all be 1, the splash damage range is defined now in skill_db
- Cleaned up the implementation of the code related to Gangster's paradise and TK_HP/SPtime
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5313 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r-- | src/map/battle.c | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index cb878a1d2..f7965a5b7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -37,14 +37,13 @@ static struct eri *delay_damage_ers; //For battle delay damage structures. */
static int battle_counttargeted_sub(struct block_list *bl, va_list ap)
{
- int id, *c, target_lv;
+ int id, target_lv;
struct block_list *src;
nullpo_retr(0, bl);
nullpo_retr(0, ap);
id = va_arg(ap,int);
- nullpo_retr(0, c = va_arg(ap, int *));
src = va_arg(ap,struct block_list *);
target_lv = va_arg(ap,int);
@@ -53,18 +52,18 @@ static int battle_counttargeted_sub(struct block_list *bl, va_list ap) if (bl->type == BL_PC) {
struct map_session_data *sd = (struct map_session_data *)bl;
if (sd && sd->attacktarget == id && sd->attacktimer != -1 && sd->attacktarget_lv >= target_lv)
- (*c)++;
+ return 1;
}
else if (bl->type == BL_MOB) {
struct mob_data *md = (struct mob_data *)bl;
if (md && md->target_id == id && md->timer != -1 && md->state.state == MS_ATTACK && md->target_lv >= target_lv)
- (*c)++;
+ return 1;
//printf("md->target_lv:%d, target_lv:%d\n", md->target_lv, target_lv);
}
else if (bl->type == BL_PET) {
struct pet_data *pd = (struct pet_data *)bl;
if (pd && pd->target_id == id && pd->timer != -1 && pd->state.state == MS_ATTACK && pd->target_lv >= target_lv)
- (*c)++;
+ return 1;
}
return 0;
@@ -76,15 +75,9 @@ static int battle_counttargeted_sub(struct block_list *bl, va_list ap) */
int battle_counttargeted(struct block_list *bl,struct block_list *src,int target_lv)
{
- int c = 0;
nullpo_retr(0, bl);
-
- map_foreachinarea(battle_counttargeted_sub, bl->m,
- bl->x-AREA_SIZE, bl->y-AREA_SIZE,
- bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_CHAR,
- bl->id, &c, src, target_lv);
-
- return c;
+ return (map_foreachinrange(battle_counttargeted_sub, bl, AREA_SIZE, BL_CHAR,
+ bl->id, src, target_lv));
}
/*==========================================
@@ -124,7 +117,7 @@ static int battle_gettargeted_sub(struct block_list *bl, va_list ap) }
bl_list[(*c)++] = bl;
- return 0;
+ return 1;
}
int battle_getcurrentskill(struct block_list *bl)
@@ -171,10 +164,7 @@ struct block_list* battle_gettargeted(struct block_list *target) nullpo_retr(NULL, target);
memset(bl_list, 0, sizeof(bl_list));
- map_foreachinarea(battle_gettargeted_sub, target->m,
- target->x-AREA_SIZE, target->y-AREA_SIZE,
- target->x+AREA_SIZE, target->y+AREA_SIZE, BL_CHAR,
- bl_list, &c, target);
+ map_foreachinrange(battle_gettargeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target);
if (c == 0 || c > 24)
return NULL;
return bl_list[rand()%c];
@@ -1554,8 +1544,7 @@ static struct Damage battle_calc_weapon_attack( ATK_ADDRATE(sd->crit_atk_rate);
if(sd->status.party_id && (skill=pc_checkskill(sd,TK_POWER)) > 0){
- i = 0;
- party_foreachsamemap(party_sub_count, sd, 0, &i);
+ i = party_foreachsamemap(party_sub_count, sd, 0);
ATK_ADDRATE(2*skill*i);
}
}
@@ -3122,21 +3111,16 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, if (sd) sp = skill_get_sp(skillid,skilllv) * 2 / 3;
if ((sd && sd->status.sp >= sp) || !sd) {
- if (skill_get_inf(skillid) & INF_GROUND_SKILL)
- f = skill_castend_pos2(src, target->x, target->y, skillid, skilllv, tick, flag);
- else {
- switch(skill_get_nk(skillid)) {
- case NK_NO_DAMAGE:/* Žx‰‡Œn */
- if((skillid == AL_HEAL || (skillid == ALL_RESURRECTION && !tsd)) && battle_check_undead(race,ele))
- f = skill_castend_damage_id(src, target, skillid, skilllv, tick, flag);
- else
- f = skill_castend_nodamage_id(src, target, skillid, skilllv, tick, flag);
- break;
- case NK_SPLASH_DAMAGE:
- default:
- f = skill_castend_damage_id(src, target, skillid, skilllv, tick, flag);
- break;
- }
+ switch (skill_get_casttype(skillid)) {
+ case CAST_GROUND:
+ f = skill_castend_pos2(src, target->x, target->y, skillid, skilllv, tick, flag);
+ break;
+ case CAST_NODAMAGE:
+ f = skill_castend_nodamage_id(src, target, skillid, skilllv, tick, flag);
+ break;
+ case CAST_DAMAGE:
+ f = skill_castend_damage_id(src, target, skillid, skilllv, tick, flag);
+ break;
}
if (sd && !f) { pc_heal(sd, 0, -sp); }
}
|