diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index eba537d9f..f0eb54ad6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -918,6 +918,7 @@ int pc_calc_skilltree(struct map_session_data *sd) if (sd->status.skill[i].flag != 13) //Don't touch plagiarized skills sd->status.skill[i].id=0; //First clear skills. } + for(i=0;i<MAX_SKILL;i++){ if (sd->status.skill[i].flag && sd->status.skill[i].flag != 13){ //Restore original level of skills after deleting earned skills. sd->status.skill[i].lv=(sd->status.skill[i].flag==1)?0:sd->status.skill[i].flag-2; @@ -946,41 +947,43 @@ int pc_calc_skilltree(struct map_session_data *sd) } return 0; } + do { - flag=0; - for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0;i++){ - int j,f=1; + flag = 0; + for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[c][i].id) > 0; i++) { + int j, f; + if(sd->status.skill[id].id) continue; //Skill already known. + + f = 1; if(!battle_config.skillfree) { - for(j=0;j<5;j++) { - if( skill_tree[c][i].need[j].id && - pc_checkskill(sd,skill_tree[c][i].need[j].id) < - skill_tree[c][i].need[j].lv) { - f=0; + for(j = 0; j < 5; j++) { + if( skill_tree[c][i].need[j].id && pc_checkskill(sd,skill_tree[c][i].need[j].id) < skill_tree[c][i].need[j].lv) { + f = 0; // one or more prerequisites wasn't satisfied break; } } if (sd->status.job_level < skill_tree[c][i].joblv) - f=0; + f = 0; // job level requirement wasn't satisfied else if (pc_checkskill(sd, NV_BASIC) < 9 && id != NV_BASIC && !(skill_get_inf2(id)&INF2_QUEST_SKILL)) - f=0; // Do not unlock normal skills when Basic Skills is not maxed out (can happen because of skill reset) + f = 0; // Do not unlock normal skills when Basic Skill is not maxed out (can happen because of skill reset) } - if(skill_get_inf2(id)&INF2_SPIRIT_SKILL) - { //Spirit skills cannot be learned, they will only show up on your tree when you get buffed. - if (sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1) - { //Enable Spirit Skills. [Skotlex] - sd->status.skill[id].id=id; - sd->status.skill[id].lv=1; - sd->status.skill[id].flag=1; //So it is not saved, and tagged as a "bonus" skill. - flag=1; + + if (f) { + sd->status.skill[id].id = id; + + if(skill_get_inf2(id)&INF2_SPIRIT_SKILL && sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1) + { //Spirit skills cannot be learned, they will only show up on your tree when you get buffed. + sd->status.skill[id].lv = 1; // need to manually specify a skill level + sd->status.skill[id].flag = 1; //So it is not saved, and tagged as a "bonus" skill. } - } else if (f){ - sd->status.skill[id].id=id; - flag=1; + + flag = 1; // skill list has changed, perform another pass } } } while(flag); + if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON)) { //Grant all Taekwon Tree, but only as bonus skills in case they drop from ranking. [Skotlex] for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0;i++){ |