diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mob.c | 26 | ||||
-rw-r--r-- | src/map/skill.c | 23 | ||||
-rw-r--r-- | src/map/status.c | 11 |
3 files changed, 42 insertions, 18 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 diff --git a/src/map/skill.c b/src/map/skill.c index daf0abc04..ff75a71f9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4937,18 +4937,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_EMOTION_ON: case NPC_EMOTION: - if(md && md->skillidx >= 0) + //va[0] is the emotion to use. + //NPC_EMOTION & NPC_EMOTION_ON can change a mob's mode 'permanently' [Skotlex] + //val[1] 'sets' the mode + //val[2] adds to the current mode + //val[3] removes from the current mode + //val[4] if set, asks to delete the previous mode change. + if(md && md->skillidx >= 0 && tsc) { - clif_emotion(&md->bl,md->db->skill[md->skillidx].val[0]); - if(!md->special_state.ai && - (md->db->skill[md->skillidx].val[1] || md->db->skill[md->skillidx].val[2])) - //NPC_EMOTION & NPC_EMOTION_ON can change a mob's mode 'permanently' [Skotlex] - //val[1] 'sets' the mode, val[2] can add/remove from the current mode based on skill used: - //NPC_EMOTION_ON adds a mode / NPC_EMOTION removes it. + clif_emotion(bl, md->db->skill[md->skillidx].val[0]); + if(md->db->skill[md->skillidx].val[4] && tsc->data[type].timer != -1) + status_change_end(bl, type, -1); + + if(md->db->skill[md->skillidx].val[1] || md->db->skill[md->skillidx].val[2]) sc_start4(src, type, 100, skilllv, md->db->skill[md->skillidx].val[1], - skillid==NPC_EMOTION_ON?md->db->skill[md->skillidx].val[2]:0, - skillid==NPC_EMOTION ?md->db->skill[md->skillidx].val[2]:0, + md->db->skill[md->skillidx].val[2], + md->db->skill[md->skillidx].val[3], skill_get_time(skillid, skilllv)); } break; diff --git a/src/map/status.c b/src/map/status.c index b69417757..dee934c8f 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4631,12 +4631,15 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val int mode; struct status_data *bstatus = status_get_base_status(bl); if (!bstatus) return 0; + if (sc->data[type].timer != -1) + { //Pile up with previous values. + if(!val2) val2 = sc->data[type].val2; + val3 |= sc->data[type].val3; + val4 |= sc->data[type].val4; + } mode = val2?val2:bstatus->mode; //Base mode - //Mode added AND removed? Added has priority. - if ((val3&val4)) - val4&= ~(val3&val4); - if (val3) mode|= val3; //Add mode if (val4) mode&=~val4; //Del mode + if (val3) mode|= val3; //Add mode if (mode == bstatus->mode) { //No change. if (sc->data[type].timer != -1) //Abort previous status return status_change_end(bl, type, -1); |