From 1dc97e8a346414a600bedc25969d5ae21c28f401 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 30 Jul 2006 18:56:33 +0000 Subject: - 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 --- Changelog-Trunk.txt | 3 +++ db/const.txt | 1 + src/map/battle.c | 23 +++++++++++------------ src/map/map.h | 5 ++--- src/map/pc.c | 6 ++++++ src/map/status.c | 1 - src/map/status.h | 2 +- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index a0ea6075e..6ec978bbd 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/07/30 + * 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. [Skotlex] * GS skill updates/fixes [Vicious] * Force all users offline in sql when char-server starts [Toms] 2006/07/29 diff --git a/db/const.txt b/db/const.txt index d0fe27eee..8167f6960 100644 --- a/db/const.txt +++ b/db/const.txt @@ -283,6 +283,7 @@ bNoMagicDamage 2003 bNoWeaponDamage 2004 bNoGemStone 2005 bNoCastCancel2 2006 +bNoMiscDamage 2007 bUnbreakableWeapon 2008 bUnbreakableArmor 2009 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); diff --git a/src/map/map.h b/src/map/map.h index c6a7b168e..cdb91a0f1 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -544,7 +544,7 @@ struct map_session_data { struct guild *gmaster_flag; } state; struct { - unsigned char no_weapon_damage, no_magic_damage; + unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; unsigned killer : 1; unsigned killable : 1; unsigned restart_full_recover : 1; @@ -1152,7 +1152,7 @@ enum { SP_DELAYRATE,SP_HP_DRAIN_RATE_RACE,SP_SP_DRAIN_RATE_RACE, // 1083-1085 SP_RESTART_FULL_RECOVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 - SP_NO_CASTCANCEL2,SP_FREE1,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 + SP_NO_CASTCANCEL2,SP_NO_MISC_DAMAGE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 SP_UNBREAKABLE_SHIELD, SP_LONG_ATK_RATE, // 2011-2012 SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 @@ -1165,7 +1165,6 @@ enum { SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041 //Before adding another, note that //1077 (SP_FREE, previously disguise), - //2007 (SP_FREE2, previously Infinite Endure) //are available! }; diff --git a/src/map/pc.c b/src/map/pc.c index 15d2637ae..16828d87b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1625,6 +1625,12 @@ int pc_bonus(struct map_session_data *sd,int type,int val) val+= sd->special_state.no_weapon_damage; sd->special_state.no_weapon_damage = cap_value(val,0,100); break; + case SP_NO_MISC_DAMAGE: + if(sd->state.lr_flag == 2) + break; + val+= sd->special_state.no_misc_damage; + sd->special_state.no_misc_damage = cap_value(val,0,100); + break; case SP_NO_GEMSTONE: if(sd->state.lr_flag != 2) sd->special_state.no_gemstone = 1; diff --git a/src/map/status.c b/src/map/status.c index 5d5c0c6a4..b5298b92e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -246,7 +246,6 @@ void initChangeTables(void) { set_sc(SA_VOLCANO, SC_VOLCANO, SI_BLANK, SCB_WATK); set_sc(SA_DELUGE, SC_DELUGE, SI_BLANK, SCB_MAXHP); set_sc(SA_VIOLENTGALE, SC_VIOLENTGALE, SI_BLANK, SCB_FLEE); - add_sc(SA_LANDPROTECTOR, SC_LANDPROTECTOR); add_sc(SA_REVERSEORCISH, SC_ORCISH); add_sc(SA_COMA, SC_COMA); set_sc(BD_ENCORE, SC_DANCING, SI_BLANK, SCB_SPEED); diff --git a/src/map/status.h b/src/map/status.h index a15a6c0d7..06e1f3e22 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -112,7 +112,7 @@ enum { SC_DELUGE, SC_VIOLENTGALE, SC_WATK_ELEMENT, - SC_LANDPROTECTOR, + SC_LANDPROTECTOR, //Available SC_ARMOR_ELEMENT, SC_NOCHAT, SC_BABY, -- cgit v1.2.3-70-g09d2