diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 6b12523b7e..15c3ac0e93 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/24 + * Fixed skillidx not being set whenever a mob uses a skill. This explains + skills like metamorphosis/summon_slaves not working at all. [Skotlex] * Fixed unit_skillcastcancel reading the nocastcancel flags the exact wrong way around [blackhole89] * Added function map_search_freecell to locate an available cell around an diff --git a/src/map/mob.c b/src/map/mob.c index e0488bc3d4..71cf014bab 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -198,6 +198,7 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) md->lootitem = (struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); md->spawn_n = -1; md->deletetimer = -1; + md->skillidx = -1; for (i = 0; i < MAX_STATUSCHANGE; i++) md->sc.data[i].timer = -1; @@ -2822,8 +2823,11 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) (ms[i].target-MST_AROUND5) +1; map_search_freecell(&md->bl, md->bl.m, &x, &y, r, r, 3); } - return unit_skilluse_pos2(&md->bl, x, y, ms[i].skill_id, ms[i].skill_lv, + md->skillidx = i; + flag = unit_skilluse_pos2(&md->bl, x, y, ms[i].skill_id, ms[i].skill_lv, skill_castfix(&md->bl,ms[i].skill_id, ms[i].skill_lv, ms[i].casttime), ms[i].cancel); + if (!flag) md->skillidx = -1; //Skill failed. + return flag; } else { // IDŽw’è if (ms[i].target <= MST_MASTER) { @@ -2850,8 +2854,11 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) bl = &md->bl; break; } - return (bl && unit_skilluse_id2(&md->bl, bl->id, ms[i].skill_id, ms[i].skill_lv, + md->skillidx = i; + flag = (bl && unit_skilluse_id2(&md->bl, bl->id, ms[i].skill_id, ms[i].skill_lv, skill_castfix(&md->bl,ms[i].skill_id, ms[i].skill_lv, ms[i].casttime), ms[i].cancel)); + if (!flag) md->skillidx = -1; + return flag; } else { if (battle_config.error_log) ShowWarning("Wrong mob skill target 'around' for non-ground skill %d (%s). Mob %d - %s\n", diff --git a/src/map/skill.c b/src/map/skill.c index 786a3b17d2..38e6f987b5 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4793,7 +4793,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_PROVOCATION: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(md) + if(md && md->skillidx >= 0) clif_pet_performance(src,md->db->skill[md->skillidx].val[0]); break;