浏览代码

- Removed typedef bool from socket.h and included cbasetypes.c instead.
- Cleaned up and corrected the calculation of hit/flee/cri/lucky dodge in status_calc_bl.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6890 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 年之前
父节点
当前提交
d72c881051
共有 3 个文件被更改,包括 29 次插入53 次删除
  1. 4 0
      Changelog-Trunk.txt
  2. 1 29
      src/common/socket.h
  3. 24 24
      src/map/status.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/05/31
+	* Removed typedef bool from socket.h and included cbasetypes.c instead.
+	  [Skotlex]
+	* Cleaned up and corrected the calculation of hit/flee/cri/lucky dodge in
+	  status_calc_bl. [Skotlex]
 	* [Improved]:
 	  - SQL upgrade file for the new loginlog. Thanks to ultramage. [Lance]
 	* [Fixed]:

+ 1 - 29
src/common/socket.h

@@ -16,6 +16,7 @@
 #endif
 #include <time.h>
 #include "malloc.h"
+#include "cbasetypes.h"
 
 extern time_t last_tick;
 extern time_t stall_time;
@@ -121,41 +122,12 @@ extern struct socket_data *session[FD_SETSIZE];
 
 extern int fd_max;
 
-
-
-
-
-/////////////////////////////
-// for those still not building c++
-#ifndef __cplusplus
-//////////////////////////////
-
-// boolean types for C
-typedef int bool;
-#define false	(1==0)
-#define true	(1==1)
-
-//////////////////////////////
-#endif // not cplusplus
-//////////////////////////////
-
-
-
 //////////////////////////////////
 // some checking on sockets
 extern bool session_isValid(int fd);
 extern bool session_isActive(int fd);
 //////////////////////////////////
 
-
-
-
-
-
-
-
-
-
 // Function prototype declaration
 
 int make_listen_port(int);

+ 24 - 24
src/map/status.c

@@ -2498,54 +2498,54 @@ void status_calc_bl(struct block_list *bl, unsigned long flag)
 	}
 
 	if(flag&SCB_HIT) {
-		status->hit = b_status->hit - b_status->dex + status->dex;
-		status->hit = status_calc_hit(bl, sc, status->hit);
+		if (status->dex == b_status->dex)
+			status->hit = status_calc_hit(bl, sc, b_status->hit);
+		else
+			status->hit = status_calc_hit(bl, sc, b_status->hit +(status->dex - b_status->dex));
 	}
 
 	if(flag&SCB_FLEE) {
-		status->flee = b_status->flee - b_status->agi + status->agi;
-		status->flee = status_calc_flee(bl, sc, status->flee);
+		if (status->agi == b_status->agi)
+			status->flee = status_calc_flee(bl, sc, b_status->flee);
+		else
+			status->flee = status_calc_flee(bl, sc, b_status->flee +(status->agi - b_status->agi));
 	}
 
 	if(flag&SCB_DEF)
 		status->def = status_calc_def(bl, sc, b_status->def);
 
 	if(flag&SCB_DEF2) {
-		status->def2 = status->vit;
-		temp = b_status->def2 - b_status->vit;
-		if (temp)
-			status->def2+=temp;
-		status->def2 = status_calc_def2(bl, sc, status->def2);
+		if (status->vit == b_status->vit)
+			status->def2 = status_calc_def2(bl, sc, b_status->def2);
+		else
+			status->def2 = status_calc_def2(bl, sc, b_status->def2 + (status->vit - b_status->vit));
 	}
 
 	if(flag&SCB_MDEF)
 		status->mdef = status_calc_mdef(bl, sc, b_status->mdef);
 		
 	if(flag&SCB_MDEF2) {
-		status->mdef2 = status->int_ + (status->vit>>1);
-		temp = b_status->mdef2 -(b_status->int_ + (b_status->vit>>1));
-		if (temp)
-			status->mdef2+=temp;
-		status->mdef2 = status_calc_mdef2(bl, sc, status->mdef2);
+		if (status->int_ == b_status->int_ && status->vit == b_status->vit)
+			status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2);
+		else
+			status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_) +((status->vit - b_status->vit)>>1));
 	}
 
 	if(flag&SCB_SPEED)
 		status->speed = status_calc_speed(bl, sc, b_status->speed);
 
 	if(flag&SCB_CRI && b_status->cri) {
-		status->cri = status->luk*3 + 10;
-		temp = b_status->cri - (b_status->luk*3 + 10);
-		if (temp)
-			status->cri += temp;
-		status->cri = status_calc_critical(bl, sc, status->cri);
+		if (status->luk == b_status->luk)
+			status->cri = status_calc_critical(bl, sc, b_status->cri);
+		else
+			status->cri = status_calc_critical(bl, sc, b_status->cri + 3*(status->luk - b_status->luk));
 	}
 
 	if(flag&SCB_FLEE2 && b_status->flee2) {
-		status->flee2 = status->luk + 10;
-		temp = b_status->flee2 - b_status->flee2 + 10;
-		if (temp)
-			status->flee2 += temp;
-		status->flee2 = status_calc_flee2(bl, sc, status->flee2);
+		if (status->luk == b_status->luk)
+			status->flee2 = status_calc_flee2(bl, sc, b_status->flee2);
+		else
+			status->flee2 = status_calc_flee2(bl, sc, b_status->flee2 +(status->luk - b_status->luk));
 	}
 
 	if(flag&SCB_ATK_ELE) {