diff options
author | lordttseven <lordttseven@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-20 16:50:27 +0000 |
---|---|---|
committer | lordttseven <lordttseven@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-20 16:50:27 +0000 |
commit | 25d71a5dcfbda1f3442982db42bd8d642db12833 (patch) | |
tree | bfffac7061d4da4808de4f11c05db240643f9d07 /src/map | |
parent | 76db7098b56ecc06267d210afa20ad01c291f705 (diff) | |
download | hercules-25d71a5dcfbda1f3442982db42bd8d642db12833.tar.gz hercules-25d71a5dcfbda1f3442982db42bd8d642db12833.tar.bz2 hercules-25d71a5dcfbda1f3442982db42bd8d642db12833.tar.xz hercules-25d71a5dcfbda1f3442982db42bd8d642db12833.zip |
* fixed third class skill point allocation logic (follow-up to r15594, bugreport:5329)
* replaced some hard-coded constant values in the vicinity with DB lookups
- removed semi-sensible special scenarios for borked GM character's skill trees in pc_calc_skilltree_normalize_job
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15625 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pc.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 9424c834b..56793c9c2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1495,28 +1495,41 @@ int pc_clean_skilltree(struct map_session_data *sd) int pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int skill_point; + int req_points; int c = sd->class_; if (!battle_config.skillup_limit) return c; skill_point = pc_calc_skillpoint(sd); - if(pc_checkskill(sd, NV_BASIC) < 9) //Consider Novice Tree when you don't have NV_BASIC maxed. + + // limit 1st class and above to novice job levels + req_points = max_level[pc_class2idx(JOB_NOVICE)][1] - 1; + if(skill_point < req_points) c = MAPID_NOVICE; - else - //Do not send S. Novices to first class (Novice) - if ((sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE && - sd->status.skill_point >= sd->status.job_level && - ((sd->change_level > 0 && skill_point < sd->change_level+8) || skill_point < 58)) { - //Send it to first class. - c &= MAPID_BASEMASK; - } - if (sd->class_&JOBL_UPPER) //Convert to Upper - c |= JOBL_UPPER; - else if (sd->class_&JOBL_BABY) //Convert to Baby - c |= JOBL_BABY; - if( sd->class_&JOBL_THIRD && skill_point < 107 )//bugreport:5329, require to spend all 2.x points in your 2.x - c &= MAPID_UPPERMASK; + + // limit 2nd class and above to first class job levels (super novices are exempt) + if ((sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) + { + req_points += (sd->change_level > 0 ? sd->change_level : max_level[pc_class2idx(pc_mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex))][1]) - 1; + + if (skill_point < req_points) + { + c &= MAPID_BASEMASK; + } + // limit 3rd class to 2nd class/trans job levels + else if(sd->class_&JOBL_THIRD) + { + req_points += max_level[pc_class2idx(pc_mapid2jobid(sd->class_&(MAPID_UPPERMASK|JOBL_UPPER), sd->status.sex))][1] - 1; + + if (skill_point < req_points) + c &= MAPID_UPPERMASK; + } + } + + // restore non-limiting flags + c |= sd->class_&(JOBL_UPPER|JOBL_BABY); + return c; } @@ -6649,7 +6662,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if (!(sd->class_&JOBL_2)) sd->change_level = sd->status.job_level; else if (!sd->change_level) - sd->change_level = 40; //Assume 40? + sd->change_level = max_level[pc_class2idx(pc_mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex))][1]; // Assume max level pc_setglobalreg (sd, "jobchange_level", sd->change_level); } |