summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-30 16:41:54 +0000
committerrud0lp20 <rud0lp20@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-30 16:41:54 +0000
commitd8514a81bbd118303e62e109ca56950b50fa82f3 (patch)
tree326195de0fe591b629dbc71174641ef231673faf /src/map/status.c
parentde3e9a7aea38e374a91d9f036da043f14e58b9f3 (diff)
downloadhercules-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/map/status.c')
-rw-r--r--src/map/status.c67
1 files changed, 53 insertions, 14 deletions
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