From 468e13d4d12dadc9b2a1666f6d2303e30cf93d82 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sat, 25 Oct 2014 18:15:42 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/map/battle.c | 8 ++++---- src/map/clif.c | 2 +- src/map/mob.c | 24 ++++++++++++------------ src/map/skill.c | 2 +- src/map/status.c | 24 ++++++++++++------------ 5 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index 5b041d9c3..1b8e44cb3 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6254,10 +6254,10 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if (inf2&INF2_TARGET_SELF) return 1; } - //Status changes that prevent traps from triggering - if (sc && sc->count && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { - if( sc->data[SC_WZ_SIGHTBLASTER] && sc->data[SC_WZ_SIGHTBLASTER]->val2 > 0 && sc->data[SC_WZ_SIGHTBLASTER]->val4%2 == 0) - return -1; + //Status changes that prevent traps from triggering + if (sc && sc->count && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { + if( sc->data[SC_WZ_SIGHTBLASTER] && sc->data[SC_WZ_SIGHTBLASTER]->val2 > 0 && sc->data[SC_WZ_SIGHTBLASTER]->val4%2 == 0) + return -1; } } break; diff --git a/src/map/clif.c b/src/map/clif.c index c9ad1245c..b9cd4cbaf 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4785,7 +4785,7 @@ int clif_outsight(struct block_list *bl,va_list ap) } if (sd && sd->fd) { //sd is watching tbl go out of view. nullpo_ret(tbl); - if(tbl->type == BL_SKILL) //Trap knocked out of sight + if(tbl->type == BL_SKILL) //Trap knocked out of sight clif->clearchar_skillunit((struct skill_unit *)tbl,sd->fd); else if (((vd=status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) && !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->option&OPTION_INVISIBLE))) diff --git a/src/map/mob.c b/src/map/mob.c index eea1ff18e..eaf8c8468 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1603,7 +1603,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //Attempt to attack. //At this point we know the target is attackable, we just gotta check if the range matches. - if (battle->check_range(&md->bl, tbl, md->status.rhw.range) && !(md->sc.option&OPTION_HIDE)) + if (battle->check_range(&md->bl, tbl, md->status.rhw.range) && !(md->sc.option&OPTION_HIDE)) { //Target within range and able to use normal attack, engage if (md->ud.target != tbl->id || md->ud.attacktimer == INVALID_TIMER) { //Only attack if no more attack delay left @@ -1624,17 +1624,17 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { return true; } - //Monsters in berserk state, unable to use normal attacks, will always attempt a skill - if(md->ud.walktimer == INVALID_TIMER && (md->state.skillstate == MSS_BERSERK || md->state.skillstate == MSS_ANGRY)) { - if (DIFF_TICK(md->ud.canmove_tick, tick) <= MIN_MOBTHINKTIME && DIFF_TICK(md->ud.canact_tick, tick) < -MIN_MOBTHINKTIME*IDLE_SKILL_INTERVAL) - { //Only use skill if able to walk on next tick and not used a skill the last second - mob->skill_use(md, tick, -1); - } - } - - //Target still in attack range, no need to chase the target - if(battle->check_range(&md->bl, tbl, md->status.rhw.range)) - return true; + //Monsters in berserk state, unable to use normal attacks, will always attempt a skill + if(md->ud.walktimer == INVALID_TIMER && (md->state.skillstate == MSS_BERSERK || md->state.skillstate == MSS_ANGRY)) { + if (DIFF_TICK(md->ud.canmove_tick, tick) <= MIN_MOBTHINKTIME && DIFF_TICK(md->ud.canact_tick, tick) < -MIN_MOBTHINKTIME*IDLE_SKILL_INTERVAL) + { //Only use skill if able to walk on next tick and not used a skill the last second + mob->skill_use(md, tick, -1); + } + } + + //Target still in attack range, no need to chase the target + if(battle->check_range(&md->bl, tbl, md->status.rhw.range)) + return true; //Out of range... diff --git a/src/map/skill.c b/src/map/skill.c index 2c52f24ac..0fe4b99ea 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2792,7 +2792,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr map->freeblock_unlock(); - if ((flag&0x4000) && rmdamage == 1) + if ((flag&0x4000) && rmdamage == 1) return 0; //Should return 0 when damage was reflected return (int)cap_value(damage,INT_MIN,INT_MAX); diff --git a/src/map/status.c b/src/map/status.c index 315a5e4a5..ac7d7d237 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6060,8 +6060,8 @@ int status_get_guild_id(struct block_list *bl) { return ((TBL_NPC*)bl)->u.scr.guild_id; break; case BL_SKILL: - if (((TBL_SKILL*)bl)->group) - return ((TBL_SKILL*)bl)->group->guild_id; + if (((TBL_SKILL*)bl)->group) + return ((TBL_SKILL*)bl)->group->guild_id; break; case BL_ELEM: if (((TBL_ELEM*)bl)->master) @@ -10526,9 +10526,9 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC_SIGHT: case SC_RUWACH: case SC_WZ_SIGHTBLASTER: - if(type == SC_WZ_SIGHTBLASTER) { - //Restore trap immunity - if(sce->val4%2) + if(type == SC_WZ_SIGHTBLASTER) { + //Restore trap immunity + if(sce->val4%2) sce->val4--; map->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick); } else @@ -11331,13 +11331,13 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) { if (battle->check_target( src, bl, BCT_ENEMY ) > 0 && status->check_skilluse(src, bl, WZ_SIGHTBLASTER, 2) ) { - struct skill_unit *su = (struct skill_unit *)bl; - if (sce && skill->attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,sce->val1,tick,0x4000) - && (!su || !su->group || !(skill->get_inf2(su->group->skill_id)&INF2_TRAP))) { // The hit is not counted if it's against a trap - sce->val2 = 0; // This signals it to end. - } else if((bl->type&BL_SKILL) && sce->val4%2 == 0) { - //Remove trap immunity temporarily so it triggers if you still stand on it - sce->val4++; + struct skill_unit *su = (struct skill_unit *)bl; + if (sce && skill->attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,sce->val1,tick,0x4000) + && (!su || !su->group || !(skill->get_inf2(su->group->skill_id)&INF2_TRAP))) { // The hit is not counted if it's against a trap + sce->val2 = 0; // This signals it to end. + } else if((bl->type&BL_SKILL) && sce->val4%2 == 0) { + //Remove trap immunity temporarily so it triggers if you still stand on it + sce->val4++; } } break; -- cgit v1.2.3-60-g2f50