From ef49bfc4445d464f19f84d78a2e6a1a5a3d9f0ac Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 14 Feb 2013 23:12:19 -0200 Subject: New Mapflag adjust_skill_damage Made as a improvement of the original ADJUST_SKILL_DAMAGE -- special thanks to Muad_Dib! . This mapflag allows you to modify the damage of any skill in any map, for example "prontera mapflag adjust_skill_damage MG_FIREBOLT 200" doubles the damage of Firebolt in prontera Another Example: "prontera mapflag adjust_skill_damage MG_FIREBOLT 50" Halves the damage of Firebolt in prontera. Signed-off-by: shennetsind --- src/map/battle.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index 2ad066d33..5bc3df6f8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1606,7 +1606,20 @@ static int battle_range_type( return BF_SHORT; return BF_LONG; } +static inline int battle_adjust_skill_damage(int m, unsigned short skill_id) { + if( map[m].skill_count ) { + int i; + ARR_FIND(0, map[m].skill_count, i, map[m].skills[i]->skill_id == skill_id ); + + if( i < map[m].skill_count ) { + return map[m].skills[i]->modifier; + } + + } + + return 0; +} static int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) { int i; @@ -3094,6 +3107,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (skill_id && (i = pc_skillatk_bonus(sd, skill_id))) ATK_ADDRATE(i); + if( (i = battle_adjust_skill_damage(sd->bl.m,skill_id)) ) + ATK_RATE(i); + if( skill_id != PA_SACRIFICE && skill_id != MO_INVESTIGATE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && !flag.cri ) { //Elemental/Racial adjustments if( sd->right_weapon.def_ratio_atk_ele & (1<def_ele) || @@ -4075,6 +4091,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Damage bonuses if ((i = pc_skillatk_bonus(sd, skill_id))) ad.damage += ad.damage*i/100; + + if( (i = battle_adjust_skill_damage(sd->bl.m,skill_id)) ) + MATK_RATE(i); //Ignore Defense? if (!flag.imdef && ( @@ -4456,6 +4475,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if (sd && (i = pc_skillatk_bonus(sd, skill_id))) md.damage += md.damage*i/100; + if( (i = battle_adjust_skill_damage(sd->bl.m,skill_id)) ) + md.damage = md.damage * i / 100; + if(md.damage < 0) md.damage = 0; else if(md.damage && tstatus->mode&MD_PLANT){ -- cgit v1.2.3-60-g2f50