diff options
author | rud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-11-30 16:41:54 +0000 |
---|---|---|
committer | rud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-11-30 16:41:54 +0000 |
commit | d8514a81bbd118303e62e109ca56950b50fa82f3 (patch) | |
tree | 326195de0fe591b629dbc71174641ef231673faf /src | |
parent | de3e9a7aea38e374a91d9f036da043f14e58b9f3 (diff) | |
download | hercules-d8514a81bbd118303e62e109ca56950b50fa82f3.tar.gz hercules-d8514a81bbd118303e62e109ca56950b50fa82f3.tar.bz2 hercules-d8514a81bbd118303e62e109ca56950b50fa82f3.tar.xz hercules-d8514a81bbd118303e62e109ca56950b50fa82f3.zip |
Follow up r16981:
- Where it causes nullpo_info warnings or even map crash(bugreport:6954)
- Fixed wrong display of info using HW_MAGICPOWER in pre-re/skill_cast_db.txt(bugreport:5663)
Synced 'skill_cast_db.txt'(new skills only) of RE with PRE RE
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16988 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 18 | ||||
-rw-r--r-- | src/map/pc.h | 14 | ||||
-rw-r--r-- | src/map/skill.c | 6 | ||||
-rw-r--r-- | src/map/status.c | 67 |
4 files changed, 80 insertions, 25 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 27f67ee3b..3bbdcc210 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -502,7 +502,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li } break; case BF_WEAPON: - if( sd && !(nk&NK_NO_CARDFIX_ATK) ) + if( sd && !(nk&NK_NO_CARDFIX_ATK) && (left&2) ) { short cardfix_ = 1000; if(sd->state.arrow_atk) @@ -550,7 +550,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( tstatus->race != RC_DEMIHUMAN ) cardfix=cardfix*(100+sd->right_weapon.addrace[RC_NONDEMIHUMAN])/100; - if( left ) + if( left&1 ) { cardfix_=cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; if (!(nk&NK_NO_ELEFIX)) { @@ -610,7 +610,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li } } - if( left ) + if( left&1 ) { for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ) { @@ -630,7 +630,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li cardfix_ = cardfix_ * (100 + sd->sc.data[SC_EDP]->val1 * 60 ) / 100; } #endif - if( left && cardfix_ != 1000 ) + if( (left&1) && cardfix_ != 1000 ) damage = damage * cardfix_ / 1000; else if( cardfix != 1000 ) damage = damage * cardfix / 1000; @@ -649,7 +649,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li ele_fix += tsd->subele2[i].rate; } cardfix=cardfix*(100-ele_fix)/100; - if( left && s_ele_ != s_ele ) + if( left&1 && s_ele_ != s_ele ) { int ele_fix_lh = tsd->subele[s_ele_]; for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) @@ -3311,9 +3311,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } //Card Fix, sd side - wd.damage = battle_calc_cardfix(BF_WEAPON, src, (tsd?NULL:target), nk, s_ele, s_ele_, wd.damage, 0, wd.flag); + wd.damage = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); if( flag.lh ) - wd.damage2 = battle_calc_cardfix(BF_WEAPON, src, (tsd?NULL:target), nk, s_ele, s_ele_, wd.damage2, 1, wd.flag); + wd.damage2 = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); if (skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN) { //Refine bonus applies after cards and elements. @@ -3323,9 +3323,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } } //if (sd) - //Card Fix, tsd sid + //Card Fix, tsd side if(tsd) - wd.damage = battle_calc_cardfix(BF_WEAPON, (sd?NULL:src), target, nk, s_ele, s_ele_, wd.damage, flag.lh, wd.flag); + wd.damage = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, flag.lh, wd.flag); if (flag.infdef) { //Plants receive 1 damage when hit diff --git a/src/map/pc.h b/src/map/pc.h index 8d74b8953..971fce1d2 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -654,8 +654,18 @@ enum equip_index { #define pc_rightside_def(sd) ((sd)->battle_status.def2) #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef) #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) ) -#define pc_leftside_matk(sd) ((sd)->battle_status.matk_min) -#define pc_rightside_matk(sd) ((sd)->battle_status.matk_max) +#define pc_leftside_matk(sd) \ + (\ + ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ + ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \ + :(sd)->battle_status.matk_min \ + ) +#define pc_rightside_matk(sd) \ + (\ + ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ + ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \ + :(sd)->battle_status.matk_max \ + ) #endif int pc_class2idx(int class_); diff --git a/src/map/skill.c b/src/map/skill.c index 2fe20e2ec..f599ed63d 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -16611,6 +16611,12 @@ static void skill_toggle_magicpower(struct block_list *bl, short skillid) } else { sc->data[SC_MAGICPOWER]->val4 = 1; status_calc_bl(bl, status_sc2scb_flag(SC_MAGICPOWER)); +#ifndef RENEWAL + if(bl->type == BL_PC){// update current display. + clif_updatestatus(((TBL_PC *)bl),SP_MATK1); + clif_updatestatus(((TBL_PC *)bl),SP_MATK2); + } +#endif } } } diff --git a/src/map/status.c b/src/map/status.c index fcefedbbe..c534233f8 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3296,6 +3296,9 @@ static unsigned int status_calc_maxsp(struct block_list *,struct status_change * static unsigned char status_calc_element(struct block_list *bl, struct status_change *sc, int element); static unsigned char status_calc_element_lv(struct block_list *bl, struct status_change *sc, int lv); static unsigned short status_calc_mode(struct block_list *bl, struct status_change *sc, int mode); +#ifdef RENEWAL +static unsigned short status_calc_ematk(struct block_list *,struct status_change *,int); +#endif //Calculates base regen values. void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen) @@ -3786,10 +3789,14 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) **/ status->matk_min = status->matk_max = status_base_matk(status, status_get_lv(bl)); if( bl->type&BL_PC ){ + // Any +MATK you get from skills and cards, including cards in weapon, is added here. if( sd->bonus.ematk > 0 ){ status->matk_max += sd->bonus.ematk; status->matk_min += sd->bonus.ematk; } + status->matk_min = status_calc_ematk(bl, sc, status->matk_min); + status->matk_max = status_calc_ematk(bl, sc, status->matk_max); + //This is the only portion in MATK that varies depending on the weapon level and refinement rate. if( status->rhw.matk > 0 ){ int wMatk = status->rhw.matk; int variance = wMatk * status->rhw.wlv / 10; @@ -3807,7 +3814,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) status->matk_max = status_calc_matk(bl, sc, status->matk_max); if ((bl->type&BL_HOM && battle_config.hom_setting&0x20) //Hom Min Matk is always the same as Max Matk - || ( sc && sc->data[SC_RECOGNIZEDSPELL] )) + || sc->data[SC_RECOGNIZEDSPELL]) status->matk_min = status->matk_max; #ifdef RENEWAL @@ -4540,28 +4547,44 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan return (unsigned short)cap_value(watk,0,USHRT_MAX); } +#ifdef RENEWAL +static unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) +{ + + if (!sc || !sc->count) + return cap_value(matk,0,USHRT_MAX); + if (sc->data[SC_MATKPOTION]) + matk += sc->data[SC_MATKPOTION]->val1; + if (sc->data[SC_MATKFOOD]) + matk += sc->data[SC_MATKFOOD]->val1; + if (sc->data[SC_MANA_PLUS]) + matk += sc->data[SC_MANA_PLUS]->val1; + if (sc->data[SC_AQUAPLAY_OPTION]) + matk += sc->data[SC_AQUAPLAY_OPTION]->val2; + if (sc->data[SC_CHILLY_AIR_OPTION]) + matk += sc->data[SC_CHILLY_AIR_OPTION]->val2; + if (sc->data[SC_WATER_BARRIER]) + matk -= sc->data[SC_WATER_BARRIER]->val3; + if (sc->data[SC_FIRE_INSIGNIA] && sc->data[SC_FIRE_INSIGNIA]->val1 == 3) + matk += 50; + if (sc->data[SC_ODINS_POWER]) + matk += 40 + 30 * sc->data[SC_ODINS_POWER]->val1; //70 lvl1, 100lvl2 + if (sc->data[SC_IZAYOI]) + matk += 50 * sc->data[SC_IZAYOI]->val1; + return (unsigned short)cap_value(matk,0,USHRT_MAX); +} +#endif static unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk) { if (!sc || !sc->count) return cap_value(matk,0,USHRT_MAX); - +#ifndef RENEWAL + // take note fixed value first before % modifiers if (sc->data[SC_MATKPOTION]) matk += sc->data[SC_MATKPOTION]->val1; if (sc->data[SC_MATKFOOD]) matk += sc->data[SC_MATKFOOD]->val1; - if (sc->data[SC_MAGICPOWER] && sc->data[SC_MAGICPOWER]->val4) - matk += matk * sc->data[SC_MAGICPOWER]->val3/100; - if (sc->data[SC_MINDBREAKER]) - matk += matk * sc->data[SC_MINDBREAKER]->val2/100; - if (sc->data[SC_INCMATKRATE]) - matk += matk * sc->data[SC_INCMATKRATE]->val1/100; - if (sc->data[SC_MOONLITSERENADE]) - matk += matk * sc->data[SC_MOONLITSERENADE]->val2/100; - if (sc->data[SC_MELODYOFSINK]) - matk += matk * sc->data[SC_MELODYOFSINK]->val3/100; - if (sc->data[SC_BEYONDOFWARCRY]) - matk -= matk * sc->data[SC_BEYONDOFWARCRY]->val3/100; if (sc->data[SC_MANA_PLUS]) matk += sc->data[SC_MANA_PLUS]->val1; if (sc->data[SC_AQUAPLAY_OPTION]) @@ -4576,6 +4599,19 @@ static unsigned short status_calc_matk(struct block_list *bl, struct status_chan matk += 40 + 30 * sc->data[SC_ODINS_POWER]->val1; //70 lvl1, 100lvl2 if (sc->data[SC_IZAYOI]) matk += 50 * sc->data[SC_IZAYOI]->val1; +#endif + if (sc->data[SC_MAGICPOWER]) + matk += matk * sc->data[SC_MAGICPOWER]->val3/100; + if (sc->data[SC_MINDBREAKER]) + matk += matk * sc->data[SC_MINDBREAKER]->val2/100; + if (sc->data[SC_INCMATKRATE]) + matk += matk * sc->data[SC_INCMATKRATE]->val1/100; + if (sc->data[SC_MOONLITSERENADE]) + matk += matk * sc->data[SC_MOONLITSERENADE]->val2/100; + if (sc->data[SC_MELODYOFSINK]) + matk += matk * sc->data[SC_MELODYOFSINK]->val3/100; + if (sc->data[SC_BEYONDOFWARCRY]) + matk -= matk * sc->data[SC_BEYONDOFWARCRY]->val3/100; if (sc->data[SC_ZANGETSU]) matk += matk * sc->data[SC_ZANGETSU]->val2 / 100; @@ -6988,6 +7024,9 @@ int status_change_start(struct block_list *bl,enum sc_type type,int rate,int val case SC_INVINCIBLEOFF: status_change_end(bl, SC_INVINCIBLE, INVALID_TIMER); break; + case SC_MAGICPOWER: + status_change_end(bl, type, INVALID_TIMER); + break; } //Check for overlapping fails |