summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-24 02:45:17 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-24 02:45:17 +0000
commit1ee38cb82d69a58dbff91a148d68658ab679e352 (patch)
tree1bf7bfc78a66591d3cd73415cf32a5ed2ca763b3 /src/map/mob.c
parentbbd2f8ef6d5b1f58d921edd627139a7bc32114ed (diff)
downloadhercules-1ee38cb82d69a58dbff91a148d68658ab679e352.tar.gz
hercules-1ee38cb82d69a58dbff91a148d68658ab679e352.tar.bz2
hercules-1ee38cb82d69a58dbff91a148d68658ab679e352.tar.xz
hercules-1ee38cb82d69a58dbff91a148d68658ab679e352.zip
- Idle skills won't trigger while the mob is walking.
- Idle skills will now trigger each IDLE_SKILL_INTERVAL iterations (10 currently) - Added support for walk packet 0x22c (disabled currently as it's non-walk packet equivalent is yet missing), it will be used when PACKETVER is set to 7 or above. - Normal walking will now also trigger mob skills (due to the walk skill condition) - Updated mob_skill_db: all idle and walk skills had their rate go up x10. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6245 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 9aa611c57..81f5bb928 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -34,6 +34,7 @@
#include "irc.h"
#define MIN_MOBTHINKTIME 100
+#define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME)
#define MOB_LAZYSKILLPERC 10 // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute)
#define MOB_LAZYMOVEPERC 50 // Move probability in the negligent mode MOB (rate of 1000 minute)
@@ -983,9 +984,9 @@ int mob_randomwalk(struct mob_data *md,int tick)
nullpo_retr(0, md);
- speed=status_get_speed(&md->bl);
if(DIFF_TICK(md->next_walktime,tick)<0 && unit_can_move(&md->bl)){
int i,x,y,c,d=12-md->move_fail_count;
+ speed=status_get_speed(&md->bl);
if(d<5) d=5;
for(i=0;i<retrycount;i++){ // Search of a movable place
int r=rand();
@@ -1247,11 +1248,13 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
}
}
- // When there's no target, it is idling.
- md->state.skillstate = MSS_IDLE;
- if (mobskill_use(md, tick, -1))
- return 0;
-
+ if(md->ud.walktimer == -1) {
+ // When there's no target, it is idling.
+ // Is it terribly exploitable to reuse the walkcounter for idle state skills? [Skotlex]
+ md->state.skillstate = MSS_IDLE;
+ if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mobskill_use(md, tick, -1))
+ return 0;
+ }
// Nothing else to do... except random walking.
// Slaves do not random walk! [Skotlex]
if (can_move && !md->master_id)
@@ -2685,7 +2688,6 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
//Execute skill
if (skill_get_casttype(ms[i].skill_id) == CAST_GROUND)
{
- // 場所指定
struct block_list *bl = NULL;
short x = 0, y = 0;
if (ms[i].target <= MST_AROUND) {
@@ -2735,7 +2737,6 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (!flag) md->skillidx = -1; //Skill failed.
return flag;
} else {
- // ID指定
if (ms[i].target <= MST_MASTER) {
struct block_list *bl;
switch (ms[i].target) {