summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c14
-rw-r--r--src/map/skill.c11
-rw-r--r--src/map/skill.h25
3 files changed, 31 insertions, 19 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index f4e30e51f..43597979e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1316,8 +1316,18 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
return 0;
//Follow up if possible.
- if (!mob_can_reach(md, tbl, md->min_chase, MSS_RUSH) ||
- !unit_walktobl(&md->bl, tbl, md->status.rhw.range, 2))
+ if (mob_can_reach(md, tbl, md->min_chase, MSS_RUSH) &&
+ unit_walktobl(&md->bl, tbl, md->status.rhw.range, 2))
+ return 0; //Chasing.
+
+ //Can't chase locked target. Return to IDLE.
+ if(md->state.skillstate == MSS_IDLE ||
+ md->state.skillstate == MSS_WALK)
+ { //Mob is already idle, try a idle skill before giving up.
+ if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL))
+ mobskill_use(md, tick, -1);
+ md->target_id=0;
+ } else
mob_unlocktarget(md,tick);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index d7334a079..b2dfd3abd 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5676,14 +5676,17 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
if(inf&INF_ATTACK_SKILL ||
(inf&INF_SELF_SKILL && inf2&INF2_NO_TARGET_SELF)) //Combo skills
inf = BCT_ENEMY; //Offensive skill.
- else
- inf = 0;
+ else if(inf2&INF2_NO_ENEMY)
+ inf = BCT_NOENEMY;
if(inf2 & (INF2_PARTY_ONLY|INF2_GUILD_ONLY) && src != target)
+ {
inf |=
(inf2&INF2_PARTY_ONLY?BCT_PARTY:0)|
- (inf2&INF2_GUILD_ONLY?BCT_GUILD:0)|
- (inf2&INF2_ALLOW_ENEMY?BCT_ENEMY:0);
+ (inf2&INF2_GUILD_ONLY?BCT_GUILD:0);
+ //Remove neutral targets (but allow enemy if skill is designed to be so)
+ inf &= ~BCT_NEUTRAL;
+ }
if (inf && battle_check_target(src, target, inf) <= 0)
break;
diff --git a/src/map/skill.h b/src/map/skill.h
index 55233f3c3..9d61a8f54 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -36,20 +36,19 @@
//Constants to identify a skill's inf2 value.
#define INF2_QUEST_SKILL 1
//NPC skills are those that players can't have in their skill tree.
-#define INF2_NPC_SKILL 2
-#define INF2_WEDDING_SKILL 4
-#define INF2_SPIRIT_SKILL 8
-#define INF2_GUILD_SKILL 16
-#define INF2_SONG_DANCE 32
-#define INF2_ENSEMBLE_SKILL 64
-#define INF2_TRAP 128
+#define INF2_NPC_SKILL 0x2
+#define INF2_WEDDING_SKILL 0x4
+#define INF2_SPIRIT_SKILL 0x8
+#define INF2_GUILD_SKILL 0x10
+#define INF2_SONG_DANCE 0x20
+#define INF2_ENSEMBLE_SKILL 0x40
+#define INF2_TRAP 0x80
//Refers to ground placed skills that will target the caster as well (like Grandcross)
-#define INF2_TARGET_SELF 256
-#define INF2_NO_TARGET_SELF 512
-#define INF2_PARTY_ONLY 1024
-#define INF2_GUILD_ONLY 2048
-//For Party/Guild only skills that can ALSO be used on enemies.
-#define INF2_ALLOW_ENEMY 4096
+#define INF2_TARGET_SELF 0x100
+#define INF2_NO_TARGET_SELF 0x200
+#define INF2_PARTY_ONLY 0x400
+#define INF2_GUILD_ONLY 0x800
+#define INF2_NO_ENEMY 0x1000
//Walk intervals at which chase-skills are attempted to be triggered.
#define WALK_SKILL_INTERVAL 5