diff options
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 9174bdccd..d7d95c57b 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -459,10 +459,10 @@ static int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) } if (tbl->m == bl->m && check_distance_bl(bl, tbl, ud->chaserange)) { //Reached destination. + ud->target_to = 0; if (ud->state.attack_continue) { //Aegis uses one before every attack, we should //only need this one for syncing purposes. [Skotlex] - ud->target_to = 0; clif->fixpos(bl); unit->attack(bl, tbl->id, ud->state.attack_continue); } @@ -544,6 +544,8 @@ static int unit_walktoxy(struct block_list *bl, short x, short y, int flag) ud->to_x = x; ud->to_y = y; unit->stop_attack(bl); //Sets target to 0 + if ((flag & 8) == 0) // Stepaction might be delayed due to occupied cell + unit->stop_stepaction(bl); // unit->walktoxy removes any remembered stepaction and resets ud->target_to sc = status->get_sc(bl); if( sc ) { @@ -661,7 +663,7 @@ static void unit_run_hit(struct block_list *bl, struct status_change *sc, struct lv = sc->data[type]->val1; //If you can't run forward, you must be next to a wall, so bounce back. [Skotlex] if( type == SC_RUN ) - clif->sc_load(bl,bl->id,AREA,SI_TING,0,0,0); + clif->sc_load(bl, bl->id, AREA, status->get_sc_icon(SC_TING), 0, 0, 0); ud = unit->bl2ud(bl); nullpo_retv(ud); @@ -673,7 +675,7 @@ static void unit_run_hit(struct block_list *bl, struct status_change *sc, struct if (lv > 0) skill->blown(bl, bl, skill->get_blewcount(TK_RUN, lv), unit->getdir(bl), 0); clif->fixpos(bl); //Why is a clif->slide (skill->blown) AND a fixpos needed? Ask Aegis. - clif->sc_end(bl, bl->id, AREA, SI_TING); + clif->sc_end(bl, bl->id, AREA, status->get_sc_icon(SC_TING)); } else if (sd) { clif->fixpos(bl); skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, timer->gettick(), SD_LEVEL); @@ -918,7 +920,7 @@ static int unit_blown(struct block_list *bl, int dx, int dy, int count, int flag //Warps a unit/ud to a given map/position. //In the case of players, pc->setpos is used. //it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks. -static int unit_warp(struct block_list *bl, short m, short x, short y, clr_type type) +static int unit_warp(struct block_list *bl, short m, short x, short y, enum clr_type type) { struct unit_data *ud; nullpo_ret(bl); @@ -957,7 +959,7 @@ static int unit_warp(struct block_list *bl, short m, short x, short y, clr_type return 2; } - } else if (map->getcell(m, bl, x, y, CELL_CHKNOREACH)) { + } else if (bl->type != BL_NPC && map->getcell(m, bl, x, y, CELL_CHKNOREACH)) { //Invalid target cell ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map->list[m].name, x,y); @@ -1090,6 +1092,7 @@ static int unit_can_move(struct block_list *bl) if (sd && ( pc_issit(sd) || sd->state.vending || + sd->state.prevend || sd->state.buyingstore || sd->block_action.move )) @@ -1327,6 +1330,12 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill if (src->type==BL_HOM) switch(skill_id) { //Homun-auto-target skills. + case HVAN_CHAOTIC: + target_id = ud->target; // Choose attack target for now + target = map->id2bl(target_id); + if (target != NULL) + break; + FALLTHROUGH // Attacking nothing, choose master as default target instead case HLIF_HEAL: case HLIF_AVOID: case HAMI_DEFENCE: @@ -1409,13 +1418,6 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill } } - if (src->type == BL_HOM) { - // In case of homunuculus, set the sd to the homunculus' master, as needed below - struct block_list *master = battle->get_master(src); - if (master) - sd = map->id2sd(master->id); - } - if (sd) { /* temporarily disabled, awaiting for kenpachi to detail this so we can make it work properly */ #if 0 @@ -1836,7 +1838,7 @@ static int unit_set_target(struct unit_data *ud, int target_id) struct block_list* target; if (ud->target && (target = map->id2bl(ud->target)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count > 0) --ux->target_count; - if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL) + if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count < UCHAR_MAX) ++ux->target_count; } @@ -1930,8 +1932,10 @@ static int unit_attack(struct block_list *src, int target_id, int continuous) if (src->type == BL_PC) { struct map_session_data *sd = BL_UCAST(BL_PC, src); - if( target->type == BL_NPC ) { // monster npcs [Valaris] - npc->click(sd, BL_UCAST(BL_NPC, target)); // submitted by leinsirk10 [Celest] + if (target->type == BL_NPC) { // monster npcs [Valaris] + if (sd->block_action.npc == 0) { // *pcblock script command + npc->click(sd, BL_UCAST(BL_NPC, target)); // submitted by leinsirk10 [Celest] + } return 0; } if( pc_is90overweight(sd) || pc_isridingwug(sd) ) { // overweight or mounted on warg - stop attacking @@ -2419,7 +2423,7 @@ static int unit_changeviewsize(struct block_list *bl, short size) * Otherwise it is assumed bl is being warped. * On-Kill specific stuff is not performed here, look at status->damage for that. *------------------------------------------*/ -static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func) +static int unit_remove_map(struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func) { struct unit_data *ud = unit->bl2ud(bl); struct status_change *sc = status->get_sc(bl); @@ -2665,7 +2669,7 @@ static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char * return 1; } -static void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) +static void unit_remove_map_pc(struct map_session_data *sd, enum clr_type clrtype) { nullpo_retv(sd); unit->remove_map(&sd->bl,clrtype,ALC_MARK); @@ -2697,7 +2701,7 @@ static void unit_free_pc(struct map_session_data *sd) * Function to free all related resources to the bl * if unit is on map, it is removed using the clrtype specified *------------------------------------------*/ -static int unit_free(struct block_list *bl, clr_type clrtype) +static int unit_free(struct block_list *bl, enum clr_type clrtype) { struct unit_data *ud = unit->bl2ud( bl ); nullpo_ret(bl); @@ -2764,6 +2768,7 @@ static int unit_free(struct block_list *bl, clr_type clrtype) aFree(sd->instance); sd->instance = NULL; } + VECTOR_CLEAR(sd->channels); VECTOR_CLEAR(sd->script_queues); VECTOR_CLEAR(sd->achievement); // Achievement [Smokexyz/Hercules] VECTOR_CLEAR(sd->storage.item); |