Browse Source

Allow negative Equipment Attack
* Fixes #2191.
* In renewal Equipment Attack can become negative and is not capped to 0.
Thanks to @jezznar and @reigneil!

aleos 7 years ago
parent
commit
a5e18f1250
3 changed files with 5 additions and 4 deletions
  1. 2 1
      src/map/pc.c
  2. 1 1
      src/map/status.c
  3. 2 2
      src/map/status.h

+ 2 - 1
src/map/pc.c

@@ -2504,7 +2504,8 @@ void pc_bonus(struct map_session_data *sd,int type,int val)
 		case SP_BASE_ATK:
 			if(sd->state.lr_flag != 2) {
 #ifdef RENEWAL
-				sd->bonus.eatk += val;
+				bonus = sd->bonus.eatk + val;
+				sd->bonus.eatk = cap_value(bonus, SHRT_MIN, SHRT_MAX);
 #else
 				bonus = status->batk + val;
 				status->batk = cap_value(bonus, 0, USHRT_MAX);

+ 1 - 1
src/map/status.c

@@ -3782,7 +3782,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 #else
 	base_status->watk = status_weapon_atk(base_status->rhw, sd);
 	base_status->watk2 = status_weapon_atk(base_status->lhw, sd);
-	base_status->eatk = max(sd->bonus.eatk,0);
+	base_status->eatk = sd->bonus.eatk;
 #endif
 
 // ----- HP MAX CALCULATION -----

+ 2 - 2
src/map/status.h

@@ -2096,13 +2096,13 @@ struct status_data {
 		hp, sp,  // see status_cpy before adding members before hp and sp
 		max_hp, max_sp;
 	short
-		str, agi, vit, int_, dex, luk;
+		str, agi, vit, int_, dex, luk,
+		eatk;
 	unsigned short
 		batk,
 #ifdef RENEWAL
 		watk,
 		watk2,
-		eatk,
 #endif
 		matk_min, matk_max,
 		speed,