summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-30 18:56:33 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-30 18:56:33 +0000
commit1dc97e8a346414a600bedc25969d5ae21c28f401 (patch)
treed3143bd27af5046d7de7ddb96ebc47939b55f7b8 /src/map/battle.c
parent0cc1e7bfbd0d93024a12ee6f5d2aaf8f95b408d1 (diff)
downloadhercules-1dc97e8a346414a600bedc25969d5ae21c28f401.tar.gz
hercules-1dc97e8a346414a600bedc25969d5ae21c28f401.tar.bz2
hercules-1dc97e8a346414a600bedc25969d5ae21c28f401.tar.xz
hercules-1dc97e8a346414a600bedc25969d5ae21c28f401.zip
- Added bNoMiscDamage setting so you can specify misc-damage blocking from skills. Modified battle_calc_damage so that even Pressure and similar skills will be affected by this setting.
- Removed SC_LANDPROTECTOR as it wasn't being used by anything. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7982 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 27f926c33..f2613b98b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -226,7 +226,6 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
{
struct map_session_data *sd = NULL;
- struct mob_data *md = NULL;
struct status_change *sc;
struct status_change_entry *sci;
@@ -235,9 +234,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
if (!damage)
return 0;
- if (bl->type == BL_MOB) {
- md=(struct mob_data *)bl;
- } else if (bl->type == BL_PC) {
+ if (bl->type == BL_PC) {
sd=(struct map_session_data *)bl;
//Special no damage states
if(flag&BF_WEAPON && sd->special_state.no_weapon_damage)
@@ -246,8 +243,14 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
if(flag&BF_MAGIC && sd->special_state.no_magic_damage)
damage -= damage*sd->special_state.no_magic_damage/100;
+ if(flag&BF_MISC && sd->special_state.no_misc_damage)
+ damage -= damage*sd->special_state.no_misc_damage/100;
+
if(!damage) return 0;
}
+
+ if (skill_num == PA_PRESSURE || skill_num == NJ_ZENYNAGE)
+ return damage; //These two bypass everything else.
sc = status_get_sc(bl);
@@ -271,9 +274,6 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
status_change_end(bl,SC_SAFETYWALL,-1);
}
- if(sc->data[SC_LANDPROTECTOR].timer!=-1 && flag&BF_MAGIC)
- return 0;
-
if(sc->data[SC_AUTOGUARD].timer != -1 && flag&BF_WEAPON &&
rand()%100 < sc->data[SC_AUTOGUARD].val2) {
int delay;
@@ -438,11 +438,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
damage = div_;
}
- if( md && !status_isdead(bl) && src != bl) {
+ if( bl->type == BL_MOB && !status_isdead(bl) && src != bl) {
if (damage > 0 )
- mobskill_event(md,src,gettick(),flag);
+ mobskill_event((TBL_MOB*)bl,src,gettick(),flag);
if (skill_num)
- mobskill_event(md,src,gettick(),MSC_SKILLUSED|(skill_num<<16));
+ mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16));
}
return damage;
@@ -2691,8 +2691,7 @@ struct Damage battle_calc_misc_attack(
md.damage=battle_attr_fix(src, target, md.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
- if (skill_num != PA_PRESSURE && skill_num != NJ_ZENYNAGE) //Pressure ignores all these things... and Throw Money ?
- md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
+ md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
if (map_flag_gvg(target->m))
md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);