summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-31 12:12:42 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-31 12:12:42 +0000
commit5178ca9df008ecff5e78fb52baddedac9c318702 (patch)
tree9ebbaf51e6050147a949d24a0107f939488a4aae
parentb81e57a9a349e06fba2ad56757ea3d08b01db586 (diff)
downloadhercules-5178ca9df008ecff5e78fb52baddedac9c318702.tar.gz
hercules-5178ca9df008ecff5e78fb52baddedac9c318702.tar.bz2
hercules-5178ca9df008ecff5e78fb52baddedac9c318702.tar.xz
hercules-5178ca9df008ecff5e78fb52baddedac9c318702.zip
* 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9600 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/pc.c37
-rw-r--r--src/map/pc.h6
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/unit.c23
-rw-r--r--src/map/unit.h2
7 files changed, 45 insertions, 35 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index d4637634f..53b918b4f 100644
--- a/Changelog-Trunk.txt
+++ b/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
diff --git a/src/map/clif.c b/src/map/clif.c
index 937509fa6..928855620 100644
--- a/src/map/clif.c
+++ b/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
diff --git a/src/map/pc.c b/src/map/pc.c
index fc61a65ba..eba537d9f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1089,37 +1089,34 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) {
}
/*==========================================
- * 重量アイコンの確認
+ * 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;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 0eb406c7d..c290ec696 100644
--- a/src/map/pc.h
+++ b/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);
diff --git a/src/map/status.c b/src/map/status.c
index bfc257f7b..40f18e9af 100644
--- a/src/map/status.c
+++ b/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);
diff --git a/src/map/unit.c b/src/map/unit.c
index 213168682..21175cc30 100644
--- a/src/map/unit.c
+++ b/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;
diff --git a/src/map/unit.h b/src/map/unit.h
index 7331f4ca5..8f44616d8 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -36,7 +36,7 @@ int unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, i
// 攻撃関連
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);
// スキル使用