summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c7
-rw-r--r--src/map/status.c33
-rw-r--r--src/map/status.h4
3 files changed, 32 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 23423502a..9fa4224f5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1183,8 +1183,8 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li
* def1 = equip def
* def2 = status def
**/
- defType def1 = status_get_def(target), def2 = tstatus->def2; //Don't use tstatus->def1 due to skill timer reductions.
- short vit_def;
+ defType def1 = status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
+ short def2 = tstatus->def2, vit_def;
def1 = status_calc_def2(target, tsc, def1, false); // equip def(RE)
def2 = status_calc_def(target, tsc, def2, false); // status def(RE)
@@ -1289,7 +1289,8 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li
case BF_MAGIC:
{
- defType mdef = tstatus->mdef, mdef2 = tstatus->mdef2;
+ defType mdef = tstatus->mdef;
+ short mdef2= tstatus->mdef2;
mdef2 = status_calc_mdef(target, tsc, mdef2, false); // status mdef(RE)
mdef = status_calc_mdef2(target, tsc, mdef, false); // equip mde(RE)
diff --git a/src/map/status.c b/src/map/status.c
index 57858a493..096e673c2 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4913,10 +4913,14 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def
return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX);
}
-defType status_calc_def2(struct block_list *bl, struct status_change *sc, int def2, bool viewable)
+signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2, bool viewable)
{
if(!sc || !sc->count)
- return (defType)cap_value(def2,DEFTYPE_MIN,DEFTYPE_MAX);
+#ifdef RENEWAL
+ return (short)cap_value(def2,SHRT_MIN,SHRT_MAX);
+#else
+ return (short)cap_value(def2,1,SHRT_MAX);
+#endif
if( !viewable ){
/* some statuses that are hidden in the status window */
@@ -4976,7 +4980,11 @@ defType status_calc_def2(struct block_list *bl, struct status_change *sc, int de
if (sc->data[SC_NEEDLE_OF_PARALYZE])
def2 -= def2 * sc->data[SC_NEEDLE_OF_PARALYZE]->val2 / 100;
- return (defType)cap_value(def2,DEFTYPE_MIN,DEFTYPE_MAX);
+#ifdef RENEWAL
+ return (short)cap_value(def2,SHRT_MIN,SHRT_MAX);
+#else
+ return (short)cap_value(def2,1,SHRT_MAX);
+#endif
}
@@ -5028,17 +5036,24 @@ defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int md
return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX);
}
-defType status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2, bool viewable) {
+signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2, bool viewable)
+{
if(!sc || !sc->count)
- return (defType)cap_value(mdef2,DEFTYPE_MIN,DEFTYPE_MAX);
+#ifdef RENEWAL
+ return (short)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
+#else
+ return (short)cap_value(mdef2,1,SHRT_MAX);
+#endif
if( !viewable ){
/* some statuses that are hidden in the status window */
#ifdef RENEWAL
if(sc && sc->data[SC_ASSUMPTIO])
mdef2 <<= 1;
+ return (short)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
+#else
+ return (short)cap_value(mdef2,1,SHRT_MAX);
#endif
- return (defType)cap_value(mdef2,DEFTYPE_MIN,DEFTYPE_MAX);
}
if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST])
@@ -5050,7 +5065,11 @@ defType status_calc_mdef2(struct block_list *bl, struct status_change *sc, int m
if(sc->data[SC_ANALYZE])
mdef2 -= mdef2 * ( 14 * sc->data[SC_ANALYZE]->val1 ) / 100;
- return (defType)cap_value(mdef2,DEFTYPE_MIN,DEFTYPE_MAX);
+#ifdef RENEWAL
+ return (short)cap_value(mdef2,SHRT_MIN,SHRT_MAX);
+#else
+ return (short)cap_value(mdef2,1,SHRT_MAX);
+#endif
}
static unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc, int speed)
diff --git a/src/map/status.h b/src/map/status.h
index b906a4a1d..617cd9572 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1848,9 +1848,9 @@ int status_check_visibility(struct block_list *src, struct block_list *target);
int status_change_spread( struct block_list *src, struct block_list *bl );
defType status_calc_def(struct block_list *bl, struct status_change *sc, int, bool);
-defType status_calc_def2(struct block_list *,struct status_change *, int, bool);
+signed short status_calc_def2(struct block_list *,struct status_change *, int, bool);
defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int, bool);
-defType status_calc_mdef2(struct block_list *,struct status_change *, int, bool);
+signed short status_calc_mdef2(struct block_list *,struct status_change *, int, bool);
#ifdef RENEWAL
unsigned short status_base_matk(const struct status_data* status, int level);