summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/map/clif.c40
-rw-r--r--src/map/mob.c17
-rw-r--r--src/map/unit.c11
3 files changed, 53 insertions, 15 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 27fff5618..bdc81724d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -981,7 +981,45 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
lv = status_get_lv(bl);
if(pcdb_checkid(vd->class_)) {
-#if PACKETVER > 3
+#if PACKETVER > 6
+ //Packet 0x22c, still in construction. [Skotlex]
+ memset(buf,0,packet_len_table[0x22c]);
+
+ WBUFW(buf,0)=0x22c;
+ WBUFL(buf,2)=bl->id;
+ WBUFW(buf,6)=status_get_speed(bl);
+ if (sc) {
+ WBUFW(buf,8)= sc->opt1;
+ WBUFW(buf,10)= sc->opt2;
+ WBUFL(buf,12)= sc->option;
+ WBUFL(buf,48)= sc->opt3;
+ }
+ WBUFW(buf,16)=vd->class_;
+ WBUFW(buf,18)=vd->hair_style;
+ WBUFW(buf,20)=vd->weapon;
+ WBUFW(buf,22)=vd->shield;
+ WBUFW(buf,24)=vd->head_bottom;
+ WBUFL(buf,26)=gettick();
+ WBUFW(buf,30)=vd->head_top;
+ WBUFW(buf,32)=vd->head_mid;
+ WBUFW(buf,34)=vd->hair_color;
+ WBUFW(buf,36)=vd->cloth_color;
+ WBUFW(buf,38)=sd?sd->head_dir:unit_getdir(bl);
+ WBUFL(buf,40)=guild_id;
+ WBUFW(buf,44)=emblem_id;
+ if (sd) {
+ WBUFW(buf,46)=sd->status.manner;
+ WBUFB(buf,52)=sd->status.karma;
+ }
+ WBUFB(buf,53)=vd->sex;
+ WBUFPOS2(buf,54,bl->x,bl->y,ud->to_x,ud->to_y);
+ WBUFB(buf,59)=0x88; // Deals with acceleration in directions. [Valaris]
+ WBUFB(buf,60)=0;
+ WBUFB(buf,61)=0;
+ WBUFW(buf,62)=clif_setlevel(lv);
+
+ return packet_len_table[0x22c];
+#elif PACKETVER > 3
memset(buf,0,packet_len_table[0x1da]);
WBUFW(buf,0)=0x1da;
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) {
diff --git a/src/map/unit.c b/src/map/unit.c
index ba33bc8d2..d86224f22 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -190,12 +190,11 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
sc_start(&sd->bl,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration);
}
} else if (md) {
- if (ud->target && ud->state.attack_continue) {
- if(md->min_chase > md->db->range2) md->min_chase--;
- if(!(ud->walk_count%WALK_SKILL_INTERVAL) &&
- mobskill_use(md, tick, -1))
- return 0;
- }
+ if (md->min_chase > md->db->range2) md->min_chase--;
+ //Walk skills are triggered regardless of target due to the idle-walk mob state.
+ if(!(ud->walk_count%WALK_SKILL_INTERVAL) &&
+ mobskill_use(md, tick, -1))
+ return 0;
}
if(ud->state.change_walk_target)