diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-01-06 08:09:56 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-01-06 08:09:56 -0300 |
commit | 174d11705a13bd780dbb5c908f786fc65a6c2f9c (patch) | |
tree | b8fbb3bcce34dcf74ead90e905afad539be37a73 /src/map/homunculus.c | |
parent | e9505e1a1a958e51bdc4380c88f58b79f83a0fb8 (diff) | |
download | hercules-174d11705a13bd780dbb5c908f786fc65a6c2f9c.tar.gz hercules-174d11705a13bd780dbb5c908f786fc65a6c2f9c.tar.bz2 hercules-174d11705a13bd780dbb5c908f786fc65a6c2f9c.tar.xz hercules-174d11705a13bd780dbb5c908f786fc65a6c2f9c.zip |
[TMW2] Patch Level: Homunculus Skill Tree Pre-Requeriments
Diffstat (limited to 'src/map/homunculus.c')
-rw-r--r-- | src/map/homunculus.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c index fbb94334c..0b501a93f 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -305,27 +305,46 @@ static int homunculus_skill_tree_get_max(int id, int b_class) static void homunculus_skillup(struct homun_data *hd, uint16 skill_id) { - int i = 0 ; + int i = 0; nullpo_retv(hd); - if(hd->homunculus.vaporize != HOM_ST_ACTIVE) + if (hd->homunculus.vaporize != HOM_ST_ACTIVE) return; i = skill_id - HM_SKILLBASE; Assert_retv(i >= 0 && i < MAX_HOMUNSKILL); - if(hd->homunculus.skillpts > 0 && + if (hd->homunculus.skillpts > 0 && hd->homunculus.hskill[i].id && hd->homunculus.hskill[i].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] hd->homunculus.hskill[i].lv < homun->skill_tree_get_max(skill_id, hd->homunculus.class_) ) { - hd->homunculus.hskill[i].lv++; - hd->homunculus.skillpts-- ; - status_calc_homunculus(hd,SCO_NONE); - if (hd->master) { - clif->homskillup(hd->master, skill_id); - clif->hominfo(hd->master,hd,0); - clif->homskillinfoblock(hd->master); + bool stop = false; + // Check if pre-requisites were met + if (!battle_config.skillfree) { + int c = hd->homunculus.class_ - HM_CLASS_BASE; + if (hd->homunculus.intimacy < homun->dbs->skill_tree[c][i].intimacylv) + stop = true; + if (!stop) { + for (int j = 0; j < MAX_HOM_SKILL_REQUIRE; j++) { + if (homun->dbs->skill_tree[c][i].need[j].id && + homun->checkskill(hd, homun->dbs->skill_tree[c][i].need[j].id) < homun->dbs->skill_tree[c][i].need[j].lv) { + stop = true; + break; + } + } + } + } + // Level up skill if requisites were met + if (!stop) { + hd->homunculus.hskill[i].lv++; + hd->homunculus.skillpts-- ; + status_calc_homunculus(hd, SCO_NONE); + if (hd->master) { + clif->homskillup(hd->master, skill_id); + clif->hominfo(hd->master, hd, 0); + clif->homskillinfoblock(hd->master); + } } } } |