diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-04-01 01:22:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-05-06 01:21:57 +0300 |
commit | b0e01cb8cf99f0017b620454c2ad2f813bd779b8 (patch) | |
tree | 0089ba6bec84d18cf83ace4528897546ce602f28 /src/map/status.c | |
parent | 9f7a47eb136c45adab54fa56517e5352cd801091 (diff) | |
download | hercules-b0e01cb8cf99f0017b620454c2ad2f813bd779b8.tar.gz hercules-b0e01cb8cf99f0017b620454c2ad2f813bd779b8.tar.bz2 hercules-b0e01cb8cf99f0017b620454c2ad2f813bd779b8.tar.xz hercules-b0e01cb8cf99f0017b620454c2ad2f813bd779b8.zip |
Change attack related status functions to return int variable
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/src/map/status.c b/src/map/status.c index 5300f65c4..f0f412375 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4449,7 +4449,7 @@ static int status_base_amotion_pc(struct map_session_data *sd, struct status_dat return amotion; } -static unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st) +static unsigned int status_base_atk(const struct block_list *bl, const struct status_data *st) { int flag = 0, str, dex, dstr; @@ -4509,39 +4509,43 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct return cap_value(str, 0, USHRT_MAX); } -static unsigned short status_base_matk_min(const struct status_data *st) +static unsigned int status_base_matk_min(const struct status_data *st) { nullpo_ret(st); #ifdef RENEWAL Assert_ret(0); return 0; #else // not RENEWAL - return st->int_ + (st->int_ / 7) * (st->int_ / 7); + int matk = st->int_ + (st->int_ / 7) * (st->int_ / 7) + return cap_value(matk, 0, USHRT_MAX); #endif // RENEWAL } -static unsigned short status_base_matk_max(const struct status_data *st) +static unsigned int status_base_matk_max(const struct status_data *st) { nullpo_ret(st); - return st->int_ + (st->int_ / 5)*(st->int_ / 5); + int matk = st->int_ + (st->int_ / 5) * (st->int_ / 5); + return cap_value(matk, 0, USHRT_MAX); } -static unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level) +static unsigned int status_base_matk(struct block_list *bl, const struct status_data *st, int level) { #ifdef RENEWAL nullpo_ret(bl); nullpo_ret(st); - switch ( bl->type ) { + int matk = 0; + switch (bl->type) { case BL_MOB: - return st->int_ + level; + matk = st->int_ + level; case BL_HOM: - return status_get_homint(st, BL_UCCAST(BL_HOM, bl)) + level; + matk = status_get_homint(st, BL_UCCAST(BL_HOM, bl)) + level; case BL_MER: - return st->int_ + st->int_ / 5 * st->int_ / 5; + matk = st->int_ + st->int_ / 5 * st->int_ / 5; case BL_PC: default: // temporary until all are formulated - return st->int_ + (st->int_ / 2) + (st->dex / 5) + (st->luk / 3) + (level / 4); + matk = st->int_ + (st->int_ / 2) + (st->dex / 5) + (st->luk / 3) + (level / 4); } + return cap_value(matk, 0, USHRT_MAX); #else Assert_ret(0); return 0; @@ -4995,7 +4999,7 @@ static unsigned short status_calc_luk(struct block_list *bl, struct status_chang return (unsigned short)cap_value(luk, 0, USHRT_MAX); } -static unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) +static unsigned int status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) { nullpo_ret(bl); if(!sc || !sc->count) @@ -5005,7 +5009,7 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan /* some statuses that are hidden in the status window */ if(sc->data[SC_PLUSATTACKPOWER]) batk += sc->data[SC_PLUSATTACKPOWER]->val1; - return (unsigned short)cap_value(batk,0,USHRT_MAX); + return (unsigned int)cap_value(batk, 0, USHRT_MAX); } #ifndef RENEWAL if(sc->data[SC_PLUSATTACKPOWER]) @@ -5088,14 +5092,14 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan if (sc->data[SC_SHRIMP]) batk += batk * sc->data[SC_SHRIMP]->val2 / 100; - return (unsigned short)cap_value(batk,0,USHRT_MAX); + return (unsigned int)cap_value(batk, 0, USHRT_MAX); } -static unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) +static unsigned int status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) { nullpo_ret(bl); if(!sc || !sc->count) - return cap_value(watk,0,USHRT_MAX); + return cap_value(watk, 0, USHRT_MAX); if( !viewable ){ /* some statuses that are hidden in the status window */ @@ -5103,7 +5107,7 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan watk -= sc->data[SC_WATER_BARRIER]->val3; if(sc->data[SC_GENTLETOUCH_CHANGE] && sc->data[SC_GENTLETOUCH_CHANGE]->val2) watk += sc->data[SC_GENTLETOUCH_CHANGE]->val2; - return (unsigned short)cap_value(watk,0,USHRT_MAX); + return (unsigned int)cap_value(watk, 0, USHRT_MAX); } #ifndef RENEWAL if(sc->data[SC_IMPOSITIO]) @@ -5181,14 +5185,14 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan if (sc->data[SC_CATNIPPOWDER]) watk -= watk * sc->data[SC_CATNIPPOWDER]->val2 / 100; - return (unsigned short)cap_value(watk,0,USHRT_MAX); + return (unsigned int)cap_value(watk, 0, USHRT_MAX); } -static unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) +static unsigned int status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) { #ifdef RENEWAL if (!sc || !sc->count) - return cap_value(matk,0,USHRT_MAX); + return (unsigned int)cap_value(matk, 0, USHRT_MAX); if (sc->data[SC_PLUSMAGICPOWER]) matk += sc->data[SC_PLUSMAGICPOWER]->val1; if (sc->data[SC_MATKFOOD]) @@ -5209,22 +5213,22 @@ static unsigned short status_calc_ematk(struct block_list *bl, struct status_cha matk += 25 * sc->data[SC_IZAYOI]->val1; if (sc->data[SC_SHRIMP]) matk += matk * sc->data[SC_SHRIMP]->val2 / 100; - return (unsigned short)cap_value(matk,0,USHRT_MAX); + return (unsigned int)cap_value(matk, 0, USHRT_MAX); #else return 0; #endif } -static unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) +static unsigned int status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) { if (!sc || !sc->count) - return cap_value(matk,0,USHRT_MAX); + return cap_value(matk, 0, USHRT_MAX); if (!viewable) { /* some statuses that are hidden in the status window */ if (sc->data[SC_MINDBREAKER]) matk += matk * sc->data[SC_MINDBREAKER]->val2 / 100; - return (unsigned short)cap_value(matk, 0, USHRT_MAX); + return (unsigned int)cap_value(matk, 0, USHRT_MAX); } #ifndef RENEWAL @@ -5282,10 +5286,10 @@ static unsigned short status_calc_matk(struct block_list *bl, struct status_chan if (sc->data[SC_MAGIC_CANDY]) matk += sc->data[SC_MAGIC_CANDY]->val1; - return (unsigned short)cap_value(matk, 0, USHRT_MAX); + return (unsigned int)cap_value(matk, 0, USHRT_MAX); } -static signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) +static signed int status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) { if (!sc || !sc->count) return cap_value(critical, 10, SHRT_MAX); @@ -5323,10 +5327,10 @@ static signed short status_calc_critical(struct block_list *bl, struct status_ch if (sc->data[SC_BUCHEDENOEL]) critical += sc->data[SC_BUCHEDENOEL]->val4 * 10; - return (short)cap_value(critical, 10, SHRT_MAX); + return (int)cap_value(critical, 10, SHRT_MAX); } -static signed short status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) +static signed int status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) { if (!sc || !sc->count) @@ -5336,7 +5340,7 @@ static signed short status_calc_hit(struct block_list *bl, struct status_change /* some statuses that are hidden in the status window */ if (sc->data[SC_MTF_ASPD]) hit += sc->data[SC_MTF_ASPD]->val2; - return (short)cap_value(hit, 1, SHRT_MAX); + return (signed int)cap_value(hit, 1, SHRT_MAX); } if (sc->data[SC_INCHIT]) @@ -5378,26 +5382,26 @@ static signed short status_calc_hit(struct block_list *bl, struct status_change if (sc->data[SC_BUCHEDENOEL]) hit += sc->data[SC_BUCHEDENOEL]->val3; - return (short)cap_value(hit, 1, SHRT_MAX); + return (signed int)cap_value(hit, 1, SHRT_MAX); } -static signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) +static signed int status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) { nullpo_retr(1, bl); if (bl->type == BL_PC) { if (map_flag_gvg2(bl->m)) flee -= flee * battle_config.gvg_flee_penalty / 100; - else if( map->list[bl->m].flag.battleground ) + else if (map->list[bl->m].flag.battleground) flee -= flee * battle_config.bg_flee_penalty / 100; } if (!sc || !sc->count) - return cap_value(flee, 1, SHRT_MAX); + return (signed int)cap_value(flee, 1, SHRT_MAX); if (!viewable) { /* some statuses that are hidden in the status window */ - return (short)cap_value(flee, 1, SHRT_MAX); + return (signed int)cap_value(flee, 1, SHRT_MAX); } if (sc->data[SC_INCFLEE]) @@ -5475,17 +5479,17 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change if (sc->data[SC_MYSTICPOWDER]) flee += sc->data[SC_MYSTICPOWDER]->val2; - return (short)cap_value(flee, 1, SHRT_MAX); + return (signed int)cap_value(flee, 1, SHRT_MAX); } -static signed short status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) +static signed int status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) { if(!sc || !sc->count) - return cap_value(flee2,10,SHRT_MAX); + return (signed int)cap_value(flee2, 10, SHRT_MAX); if( !viewable ){ /* some statuses that are hidden in the status window */ - return (short)cap_value(flee2,10,SHRT_MAX); + return (signed int)cap_value(flee2, 10, SHRT_MAX); } if(sc->data[SC_PLUSAVOIDVALUE]) @@ -5497,7 +5501,7 @@ static signed short status_calc_flee2(struct block_list *bl, struct status_chang if (sc->data[SC_FREYJASCROLL]) flee2 += sc->data[SC_FREYJASCROLL]->val2; - return (short)cap_value(flee2,10,SHRT_MAX); + return (signed int)cap_value(flee2, 10, SHRT_MAX); } static defType status_calc_def(struct block_list *bl, struct status_change *sc, int def, bool viewable) |