diff options
author | Michieru <Michieru@users.noreply.github.com> | 2014-10-18 17:52:17 +0200 |
---|---|---|
committer | Michieru <Michieru@users.noreply.github.com> | 2014-10-18 17:52:17 +0200 |
commit | 6a6e3bb8e69890ee69981467f1e5e3591c0f9356 (patch) | |
tree | 552347425d9575b423617326ab3cbdf257479728 /src/map/mob.c | |
parent | 4ac673941714032ada6d26fb60936ec510bbe496 (diff) | |
download | hercules-6a6e3bb8e69890ee69981467f1e5e3591c0f9356.tar.gz hercules-6a6e3bb8e69890ee69981467f1e5e3591c0f9356.tar.bz2 hercules-6a6e3bb8e69890ee69981467f1e5e3591c0f9356.tar.xz hercules-6a6e3bb8e69890ee69981467f1e5e3591c0f9356.zip |
Fix bug:7454
* Official Icewall implementation and other fixes
- Reverted all the icewall-related changes done in SVN r15777 and following as testing shows they aren't official and are actually pretty exploitable (bugreport:7412)
- Instead implemented the official icewall characteristic that monsters can only leave an icewall cell to the west or south, the changes include:
* The "sight" path check no longer checks for the current cell so standing on an icewall allows you to see/attack into any direction
* The path finding will still ignore the current cell as before but the walk routine will not allow to walk east or north while standing on an icewall cell
* This leads monsters in the situation where they go through an AI loop not allowing them to escape the icewall (if their target is north or east of them)
* Monster in this situation will use idle skills and if they get attacked will use their rudeattacked skills if available, similar to traps like Spiderweb
* Added a configuration icewall_walk_block that allows to configure how long a monster should go through the AI loop before the server allows it any movement, this "safety" system is official and seems to equal about 75 AI loops; if you want to disable the whole icewall system so that monsters don't get stuck in icewall at all, just set this to 0
* Here are videos from jRO showing how this system works: http://ragdo.blog56.fc2.com/blog-entry-763.html
- Implemented the official calculation for "direction"; now you will be considered horizontal/vertical/diagonally aligned with a target cell in the exact same way as on official servers, this is for example used to determine whether an icewall or a firewall should be horizontal, vertical or diagonal; the only thing that is still unofficial is the default direction (officially always "west"); effectively now there are more situations considered diagonal than before
- Further cleanups on the idle skill use code for immobile monsters and monsters near a player but without a target (now skill using will always go via mob_unlocktarget)
* This also fixes that monsters switched to idle mode and start to use idle skills one second too late
Mega thanks to Playtester (rathena 5540d89cb0e)
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 122cc91aa..d0a65315a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1076,15 +1076,6 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) && battle->check_range(&md->bl,bl,md->db->range2) ) { //Pick closest target? - - if( map->list[bl->m].icewall_num && - !path->search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) { - - if( !check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) ) - return 0; - - } - (*target) = bl; md->target_id=bl->id; md->min_chase= dist + md->db->range3; @@ -1288,8 +1279,7 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) { md->state.skillstate = MSS_IDLE; case MSS_IDLE: // Idle skill. - if ((md->target_id || !(++md->ud.walk_count%IDLE_SKILL_INTERVAL)) && - mob->skill_use(md, tick, -1)) + if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mob->skill_use(md, tick, -1)) break; //Random walk. if (!md->master_id && @@ -1457,6 +1447,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] || md->sc.data[SC__MANHOLE])) // Not yet confirmed if boss will teleport once it can't reach target. || !mob->can_reach(md, tbl, md->min_chase, MSS_RUSH) + || md->walktoxy_fail_count > 0 ) && md->state.attacked_count++ >= RUDE_ATTACKED_COUNT && !mob->skill_use(md, tick, MSC_RUDEATTACKED) // If can't rude Attack @@ -1479,6 +1470,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] || md->sc.data[SC__MANHOLE])) // Not yet confirmed if boss will teleport once it can't reach target. || !mob->can_reach(md, abl, dist+md->db->range3, MSS_RUSH) + || md->walktoxy_fail_count > 0 ) ) ) { @@ -1551,7 +1543,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { } } - //This handles triggering idle walk/skill. + //This handles triggering idle/walk skill. mob->unlocktarget(md, tick); return true; } @@ -1634,12 +1626,11 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //Out of range... if (!(mode&MD_CANMOVE) || (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0)) - { //Can't chase. Immobile and trapped mobs should unlock target and use an idle skill on next interval. - if ((md->ud.target != tbl->id || md->ud.attacktimer == INVALID_TIMER)) - { //Only unlock target to use idle skill if no more attack left - md->ud.walk_count = (md->ud.walk_count+1)%250; - if (!(md->ud.walk_count%IDLE_SKILL_INTERVAL)) - mob_unlocktarget(md,tick); + { //Can't chase. Immobile and trapped mobs should unlock target and use an idle skill. + if (md->ud.attacktimer == INVALID_TIMER) + { //Only unlock target if no more attack delay left + //This handles triggering idle/walk skill. + mob->unlocktarget(md,tick); } return true; } |