From a8952b3c7b1067f304e24237bd035263e6b62ed9 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 4 Aug 2007 16:24:49 +0000 Subject: Some all-around code reformatting/cleaning git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10947 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/unit.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/map/unit.c') diff --git a/src/map/unit.c b/src/map/unit.c index d3c691c92..c53a8b6c6 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1366,21 +1366,17 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t ud->attacktimer=-1; target=map_id2bl(ud->target); - if(src->prev == NULL || target==NULL || target->prev == NULL) + if(src == NULL || src->prev == NULL || target==NULL || target->prev == NULL) return 0; - if(ud->skilltimer != -1 && (!sd || pc_checkskill(sd,SA_FREECAST) <= 0)) - return 0; - if(src->m != target->m || status_isdead(src) || status_isdead(target) || !status_check_skilluse(src, target, 0, 0)) - return 0; - - sstatus = status_get_status_data(src); + return 0; // can't attack under these conditions - if(!battle_config.sdelay_attack_enable && - DIFF_TICK(ud->canact_tick,tick) > 0 && - (!sd || pc_checkskill(sd,SA_FREECAST) <= 0) - ) { + if(ud->skilltimer != -1 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0)) + return 0; // can't attack while casting + + if(!battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0)) + { // attacking when under cast delay has restrictions: if (tid == -1) { //requested attack. if(sd) clif_skill_fail(sd,1,4,0); return 0; @@ -1394,6 +1390,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t return 1; } + sstatus = status_get_status_data(src); range = sstatus->rhw.range; if(!sd || sd->status.weapon != W_BOW) range++; //Dunno why everyone but bows gets this extra range... @@ -1420,9 +1417,9 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t //Non-players use the sync packet on the walk timer. [Skotlex] if (tid == -1 && sd) clif_fixpos(src); - if(DIFF_TICK(ud->attackabletime,tick) <= 0) { - if (battle_config.attack_direction_change && - (src->type&battle_config.attack_direction_change)) { + if(DIFF_TICK(ud->attackabletime,tick) <= 0) + { + if (battle_config.attack_direction_change && (src->type&battle_config.attack_direction_change)) { ud->dir = map_calc_dir(src, target->x,target->y ); } if(ud->walktimer != -1) @@ -1433,8 +1430,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t if (sstatus->mode&MD_ASSIST && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME) { // Link monsters nearby [Skotlex] md->last_linktime = tick; - map_foreachinrange(mob_linksearch, src, md->db->range2, - BL_MOB, md->class_, target, tick); + map_foreachinrange(mob_linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick); } } if(src->type == BL_PET && pet_attackskill((TBL_PET*)src, target->id)) -- cgit v1.2.3-60-g2f50