summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
6 files changed, 41 insertions, 35 deletions
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);
// スキル使用