summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-12 15:19:49 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-12 15:19:49 +0000
commitd3446b8051e0f084721198b85c067597f26c5dfd (patch)
treecf3b13227a8de1a1c7c8b131c6b3bd96e94bdc7f /src/map
parent55ba4be17e2abefa0fdaa25c387bf30bdaf49332 (diff)
downloadhercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.gz
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.bz2
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.tar.xz
hercules-d3446b8051e0f084721198b85c067597f26c5dfd.zip
- Changed the meaning of inf2=0x1000. Now it is used to "disable usage on enemies", which only works for non-aggressive (inf!=1) skills.
- If a skill is party/guild only (inf2 0x400/0x800) it will also be castable on enemies if the skill's inf is 1 (offensive target) - Corrected the mob behaviour when it locks into an enemy it can't chase. Previously it would get stuck on a lock->unlock->lock loop, with each unlock resetting the "random walk" timer, causing the mob to just idle in place. Now they will attempt idle skills and no longer reset the "random walk" timer, so they behave as if they were in Idle state properly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10234 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-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