From 5178ca9df008ecff5e78fb52baddedac9c318702 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Sun, 31 Dec 2006 12:12:42 +0000 Subject: * 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 --- src/map/unit.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/map/unit.c') 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; -- cgit v1.2.3-70-g09d2