summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-07 16:42:25 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-07 16:42:25 +0000
commit09d10f90af78019f690853ef3079f19122433262 (patch)
treeb5cbb464f3cc4178a2f0c1b47fcf3121fce9bfc6 /src/map/mob.c
parent322bbe35455b4c423ca8a1ff695a2c68808f5be9 (diff)
downloadhercules-09d10f90af78019f690853ef3079f19122433262.tar.gz
hercules-09d10f90af78019f690853ef3079f19122433262.tar.bz2
hercules-09d10f90af78019f690853ef3079f19122433262.tar.xz
hercules-09d10f90af78019f690853ef3079f19122433262.zip
- Cleaned up implementation of NPC_EMOTION/NPC_EMOTION_ON. Now val0 is the emotion, val1 sets the mode, val2 adds to the mode, val3 removes from the mode. val4 asks to remove the previous mode change.
- Updated the mob skill reading code so it accepts hexadecimals in the 'val' fields. Also, it will optimize the NPC values so that when you set a mob's mode to their db mode, it will just remove the previous mode. - NPC_EMOTION_ON will now automatically move it's new mode to val2 since it should add a mode, and if this mode doesn't has the aggressive bit, it will remove it. See this "ancient" hypothesis on how NPC_EMOTION_ON should work for the details: http://www.eathena.ws/board/index.php?showtopic=63606 - Updated mob_skill_db to account for the updated mob modes on NPC_EMOTION skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9433 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 0547095d7..fba065463 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3797,11 +3797,27 @@ static int mob_readskilldb(void)
if (j < tmp)
ms->cond2=cond2[j].id;
- ms->val[0]=atoi(sp[12]);
- ms->val[1]=atoi(sp[13]);
- ms->val[2]=atoi(sp[14]);
- ms->val[3]=atoi(sp[15]);
- ms->val[4]=atoi(sp[16]);
+ ms->val[0]=(int)strtol(sp[12],NULL,0);
+ ms->val[1]=(int)strtol(sp[13],NULL,0);
+ ms->val[2]=(int)strtol(sp[14],NULL,0);
+ ms->val[3]=(int)strtol(sp[15],NULL,0);
+ ms->val[4]=(int)strtol(sp[16],NULL,0);
+
+ if(ms->skill_id == NPC_EMOTION && mob_id>0 &&
+ ms->val[1] == mob_db(mob_id)->status.mode)
+ {
+ ms->val[1] = 0;
+ ms->val[4] = 1; //request to return mode to normal.
+ }
+ if(ms->skill_id == NPC_EMOTION_ON && mob_id>0 && ms->val[1])
+ { //Adds a mode to the mob.
+ //Remove aggressive mode when the new mob type is passive.
+ if (!(ms->val[1]&MD_AGGRESSIVE))
+ ms->val[3]|=MD_AGGRESSIVE;
+ ms->val[2]|= ms->val[1]; //Add the new mode.
+ ms->val[1] = 0; //Do not "set" it.
+ }
+
if(sp[17] != NULL && strlen(sp[17])>2)
ms->emotion=atoi(sp[17]);
else