Prechádzať zdrojové kódy

* Refer to http://www.eathena.ws/board/index.php?showtopic=130285
- Renamed pc_checkweighticon to pc_updateweightstatus and cleaned it.
- Updated pc_is50overweight to use battle_config.natural_heal_weight_rate.
- Added 90% weight check when attacking.

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

FlavioJS 18 rokov pred
rodič
commit
e0399ebb83
7 zmenil súbory, kde vykonal 45 pridanie a 35 odobranie
  1. 4 0
      Changelog-Trunk.txt
  2. 3 3
      src/map/clif.c
  3. 17 20
      src/map/pc.c
  4. 3 3
      src/map/pc.h
  5. 1 1
      src/map/status.c
  6. 16 7
      src/map/unit.c
  7. 1 1
      src/map/unit.h

+ 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/12/31
+	* Refer to http://www.eathena.ws/board/index.php?showtopic=130285
+	- Renamed pc_checkweighticon to pc_updateweightstatus and cleaned it.
+	- Updated pc_is50overweight to use battle_config.natural_heal_weight_rate.
+	- Added 90% weight check when attacking.
 	* Updated getitem and guardian entries in script_commands.txt.
 	* Fixed getitem trying to get <character ID> from the wrong argument.
 	* Now getitem can be run on scripts without a player attached if 

+ 3 - 3
src/map/clif.c

@@ -2585,8 +2585,8 @@ int clif_updatestatus(struct map_session_data *sd,int type)
 	switch(type){
 		// 00b0
 	case SP_WEIGHT:
-		pc_checkweighticon(sd);
-		WFIFOW(fd,0)=0xb0;	//Need to re-set as pc_checkweighticon can alter the buffer. [Skotlex]
+		pc_updateweightstatus(sd);
+		WFIFOW(fd,0)=0xb0;	//Need to re-set as pc_updateweightstatus can alter the buffer. [Skotlex]
 		WFIFOW(fd,2)=type;
 		WFIFOL(fd,4)=sd->weight;
 		break;
@@ -8914,7 +8914,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
 
 	if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris]
 		target_id = sd->bl.id;
-		
+
 	switch(action_type) {
 	case 0x00: // once attack
 	case 0x07: // continuous attack

+ 17 - 20
src/map/pc.c

@@ -1089,37 +1089,34 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) {
 }
 
 /*==========================================
- * �d—ʃAƒCƒRƒ“‚ÌŠm”F
+ * Updates the weight status
  *------------------------------------------
  */
-int pc_checkweighticon(struct map_session_data *sd)
+int pc_updateweightstatus(struct map_session_data *sd)
 {
 	int flag=0;
 
 	nullpo_retr(0, sd);
 
-	//Consider the battle option 50% criteria....
-	if(sd->weight*100 >= sd->max_weight*battle_config.natural_heal_weight_rate)
-		flag=1;
-	if(sd->weight*10 >= sd->max_weight*9)
+	if( pc_is90overweight(sd) )
 		flag=2;
+	else if( pc_is50overweight(sd) )
+		flag=1;
 
-	if(flag==1){
-		if(sd->sc.data[SC_WEIGHT50].timer==-1)
-			sc_start(&sd->bl,SC_WEIGHT50,100,0,0);
-	}else{
-		if(sd->sc.data[SC_WEIGHT50].timer!=-1)
-			status_change_end(&sd->bl,SC_WEIGHT50,-1);
-	} 
-	if(flag==2){
-		if(sd->sc.data[SC_WEIGHT90].timer==-1)
-			sc_start(&sd->bl,SC_WEIGHT90,100,0,0);
-	}else{
-		if(sd->sc.data[SC_WEIGHT90].timer!=-1)
-			status_change_end(&sd->bl,SC_WEIGHT90,-1);
-	}
+	// 50% overweight icon
+	if( flag == 1 && sd->sc.data[SC_WEIGHT50].timer == -1 )
+		sc_start(&sd->bl,SC_WEIGHT50,100,0,0);
+	else if( sd->sc.data[SC_WEIGHT50].timer != -1 )
+		status_change_end(&sd->bl,SC_WEIGHT50,-1);
+	// 90% overwheight icon
+	if( flag == 2 && sd->sc.data[SC_WEIGHT90].timer == -1 )
+		sc_start(&sd->bl,SC_WEIGHT90,100,0,0);
+	else if( sd->sc.data[SC_WEIGHT90].timer != -1 )
+		status_change_end(&sd->bl,SC_WEIGHT90,-1);
+	// update overweight status
 	if (flag != sd->regen.state.overweight)
 		sd->regen.state.overweight = flag;
+
 	return 0;
 }
 

+ 3 - 3
src/map/pc.h

@@ -98,8 +98,8 @@ enum {
 #define pc_isfalcon(sd) ((sd)->sc.option&OPTION_FALCON)
 #define pc_isriding(sd) ((sd)->sc.option&OPTION_RIDING)
 #define pc_isinvisible(sd) ((sd)->sc.option&OPTION_INVISIBLE)
-#define pc_is50overweight(sd) (sd->weight*2 >= sd->max_weight) 
-#define pc_is90overweight(sd) (sd->weight*10 >= sd->max_weight*9)
+#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate )
+#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
 #define pc_maxparameter(sd) ((sd->class_&JOBL_BABY) ? battle_config.max_baby_parameter : battle_config.max_parameter)
 
 #define pc_stop_attack(sd) { if (sd->ud.attacktimer!=-1) { unit_stop_attack(&sd->bl); sd->ud.target = 0; } }
@@ -159,7 +159,7 @@ int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
 int pc_takeitem(struct map_session_data*,struct flooritem_data*);
 int pc_dropitem(struct map_session_data*,int,int);
 
-int pc_checkweighticon(struct map_session_data *sd);
+int pc_updateweightstatus(struct map_session_data *sd);
 
 int pc_bonus(struct map_session_data*,int,int);
 int pc_bonus2(struct map_session_data *sd,int,int,int);

+ 1 - 1
src/map/status.c

@@ -2273,7 +2273,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		clif_updatestatus(sd,SP_WEIGHT);
 	if(b_max_weight != sd->max_weight) {
 		clif_updatestatus(sd,SP_MAXWEIGHT);
-		pc_checkweighticon(sd);
+		pc_updateweightstatus(sd);
 	}
 	if(b_status.str != status->str)
 		clif_updatestatus(sd,SP_STR);

+ 16 - 7
src/map/unit.c

@@ -1147,7 +1147,7 @@ int unit_unattackable(struct block_list *bl) {
  *------------------------------------------
  */
 
-int unit_attack(struct block_list *src,int target_id,int type)
+int unit_attack(struct block_list *src,int target_id,int continuous)
 {
 	struct block_list *target;
 	struct unit_data  *ud;
@@ -1160,9 +1160,18 @@ int unit_attack(struct block_list *src,int target_id,int type)
 		return 1;
 	}
 
-	if(src->type == BL_PC && target->type==BL_NPC) { // monster npcs [Valaris]
-		npc_click((TBL_PC*)src,(TBL_NPC*)target); // submitted by leinsirk10 [Celest]
-		return 0;
+	if( src->type == BL_PC ){
+		TBL_PC* sd = (TBL_PC*)src;
+		if( target->type == BL_NPC )
+		{// monster npcs [Valaris]
+			npc_click(sd,(TBL_NPC*)target); // submitted by leinsirk10 [Celest]
+			return 0;
+		} else if( pc_is90overweight(sd) )
+		{// overwheight - stop attacking and walking
+			unit_stop_attack(src);
+			unit_stop_walking(src,1);
+			return 0;
+		}
 	}
 
 	if(battle_check_target(src,target,BCT_ENEMY)<=0 ||
@@ -1173,10 +1182,10 @@ int unit_attack(struct block_list *src,int target_id,int type)
 	}
 
 	ud->target = target_id;
-	ud->state.attack_continue = type;
-	if (type) //If you re to attack continously, set to auto-case character
+	ud->state.attack_continue = continuous;
+	if (continuous) //If you're to attack continously, set to auto-case character
 		ud->chaserange = status_get_range(src);
-	
+
 	//Just change target/type. [Skotlex]
 	if(ud->attacktimer != -1)
 		return 0;

+ 1 - 1
src/map/unit.h

@@ -36,7 +36,7 @@ int unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, i
 
 // �UŒ‚ŠÖ˜A
 int unit_stop_attack(struct block_list *bl);
-int unit_attack(struct block_list *src,int target_id,int type);
+int unit_attack(struct block_list *src,int target_id,int continuous);
 int unit_cancel_combo(struct block_list *bl);
 
 // ƒXƒLƒ‹Žg—p