summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorMichieru <Michieru@users.noreply.github.com>2014-10-25 18:14:59 +0200
committerMichieru <Michieru@users.noreply.github.com>2014-10-25 18:14:59 +0200
commita5c0636f74a2177839aec9153b542afd8c36850a (patch)
treebf4f9b1e09113b4a3bcd6b02b705b3b2e9980ae2 /src/map/mob.c
parent3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5 (diff)
downloadhercules-a5c0636f74a2177839aec9153b542afd8c36850a.tar.gz
hercules-a5c0636f74a2177839aec9153b542afd8c36850a.tar.bz2
hercules-a5c0636f74a2177839aec9153b542afd8c36850a.tar.xz
hercules-a5c0636f74a2177839aec9153b542afd8c36850a.zip
Sight Blaster and other skill fixes, magic reflect, crash, trap display and monster behavior fixes
- Fixed cast time of Sightrasher in pre-renewal (700ms -> 500ms) - Official Sight Blaster behavior (bugreport:6945, partially bugreport:144) * Sight Blaster's AoE is now 3x3 even in pre-renewal (it was originally larger so it hits traps before they trigger) * Sight Blaster will now prevent traps from triggering as long as they are knocked back * Fixed a bug that caused Sight Blaster to not work on traps and ice walls at all * Sight Blaster will no longer expire when the attack was reflected * Sight Blaster will now expire when hitting an ice wall * Sight Blaster will now properly protect you from being attacked from its AoE range - Sight, Ruwach and Sight Blaster will now check for a target every 20ms (previously every 250ms) - Step action will now be canceled when being knocked back (skills won't be executed anymore when knocked out of range) - When knock back magic is reflected it will no longer lead to the caster being knocked back (related to bugreport:6945) - Activated traps can no longer be hit - Fixed a problem that left "trap ghosts" forever on the screen when a trap was knocked out of the screen - Monster behavior fixes * Monsters will no longer be able to do normal attacks when hiding * If out of any reason a monster on "attack" state can't move and can't do normal attacks, it will now use "attack" state skills * The order of monster thought processing is now equal to official servers - Fixed some potential map server crashes Mega thanks to Playtester (rathena b88e95381d6a7)
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index d0a65315a..eea1ff18e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1603,8 +1603,8 @@ 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))
- { //Target within range, engage
+ 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
if(tbl->type == BL_PC)
@@ -1624,6 +1624,19 @@ 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;
+
+
//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.
@@ -1635,15 +1648,6 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) {
return true;
}
- //Before a monster starts to chase a target, it will check if it has a ranged "attack" skill to use on it.
- 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);
- }
- }
-
if (md->ud.walktimer != INVALID_TIMER && md->ud.target == tbl->id &&
(
!(battle_config.mob_ai&0x1) ||