summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/map/pc.c72
-rw-r--r--src/map/status.c33
3 files changed, 72 insertions, 37 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 2606739f2..8a6e6705c 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/30
+ * Added function pc_check_skilltree for checking if you unlocked new
+ tree-skills when raising non-passive skills. [Skotlex]
+ * Fixed flee/hit calculation in status_calc_bl to account for bonuses from
+ the base status. [Skotlex]
* [Fixed]:
- Compatibility problems in login.c [Lance]
* Fixed pets ignoring can-act delays for skill usage. [Skotlex]
diff --git a/src/map/pc.c b/src/map/pc.c
index 1e032a125..8e76d3c7e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -923,6 +923,8 @@ int pc_calc_skilltree(struct map_session_data *sd)
flag=0;
for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0;i++){
int j,f=1;
+ if(sd->status.skill[id].id)
+ continue; //Skill already known.
if(!battle_config.skillfree) {
for(j=0;j<5;j++) {
if( skill_tree[c][i].need[j].id &&
@@ -937,20 +939,18 @@ int pc_calc_skilltree(struct map_session_data *sd)
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)
}
- if(sd->status.skill[id].id==0 ){
- 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;
- }
- } else if (f){
+ 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;
}
+ } else if (f){
+ sd->status.skill[id].id=id;
+ flag=1;
}
}
} while(flag);
@@ -971,6 +971,54 @@ int pc_calc_skilltree(struct map_session_data *sd)
return 0;
}
+//Checks if you can learn a new skill after having leveled up a skill.
+static void pc_check_skilltree(struct map_session_data *sd, int skill) {
+ int i,id=0,flag;
+ int c=0;
+
+ if(battle_config.skillfree)
+ return; //Function serves no purpose if this is set
+
+ i = pc_calc_skilltree_normalize_job(sd);
+ c = pc_mapid2jobid(i, sd->status.sex);
+ if (c == -1) { //Unable to normalize job??
+ if (battle_config.error_log)
+ ShowError("pc_check_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id);
+ return;
+ }
+
+ do {
+ flag=0;
+ for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0;i++){
+ int j,f=1;
+
+ if(sd->status.skill[id].id) //Already learned
+ continue;
+
+ 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;
+ break;
+ }
+ }
+ if (!f)
+ continue;
+ if (sd->status.job_level < skill_tree[c][i].joblv)
+ continue;
+ else if (pc_checkskill(sd, NV_BASIC) < 9 && id != NV_BASIC && !(skill_get_inf2(id)&INF2_QUEST_SKILL))
+ continue; // Do not unlock normal skills when Basic Skills is not maxed out (can happen because of skill reset)
+
+ if(skill_get_inf2(id)&INF2_SPIRIT_SKILL)
+ //Spirit skills cannot be learned
+ continue;
+ sd->status.skill[id].id=id;
+ flag=1;
+ }
+ } while(flag);
+}
+
// Make sure all the skills are in the correct condition
// before persisting to the backend.. [MouseJstr]
int pc_clean_skilltree(struct map_session_data *sd) {
@@ -4158,6 +4206,8 @@ int pc_skillup(struct map_session_data *sd,int skill_num)
sd->status.skill_point--;
if (!skill_get_inf(skill_num)) //Only recalculate for passive skills.
status_calc_pc(sd,0);
+ else
+ pc_check_skilltree(sd, skill_num);
clif_skillup(sd,skill_num);
clif_updatestatus(sd,SP_SKILLPOINT);
clif_skillinfoblock(sd);
diff --git a/src/map/status.c b/src/map/status.c
index c95524a9b..48212875d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1211,24 +1211,11 @@ int status_calc_pet(struct pet_data *pd, int first)
status->rhw.atk2 = battle_config.pet_max_atk2;
status->str = cap_value(status->str,1,battle_config.pet_max_stats);
- if(status->str > battle_config.pet_max_stats)
- status->str = battle_config.pet_max_stats;
- else if (status->str < 1) status->str = 1;
- if(status->agi > battle_config.pet_max_stats)
- status->agi = battle_config.pet_max_stats;
- else if (status->agi < 1) status->agi = 1;
- if(status->vit > battle_config.pet_max_stats)
- status->vit = battle_config.pet_max_stats;
- else if (status->vit < 1) status->vit = 1;
- if(status->int_ > battle_config.pet_max_stats)
- status->int_ = battle_config.pet_max_stats;
- else if (status->int_ < 1) status->int_ = 1;
- if(status->dex > battle_config.pet_max_stats)
- status->dex = battle_config.pet_max_stats;
- else if (status->dex < 1) status->dex = 1;
- if(status->luk > battle_config.pet_max_stats)
- status->luk = battle_config.pet_max_stats;
- else if (status->luk < 1) status->luk = 1;
+ status->agi = cap_value(status->agi,1,battle_config.pet_max_stats);
+ status->vit = cap_value(status->vit,1,battle_config.pet_max_stats);
+ status->int_= cap_value(status->int_,1,battle_config.pet_max_stats);
+ status->dex = cap_value(status->dex,1,battle_config.pet_max_stats);
+ status->luk = cap_value(status->luk,1,battle_config.pet_max_stats);
status->batk = status_base_atk(&pd->bl, &pd->status);
status_calc_misc(&pd->status, lv);
@@ -2511,18 +2498,12 @@ void status_calc_bl(struct block_list *bl, unsigned long flag)
}
if(flag&SCB_HIT) {
- status->hit = status_get_lv(bl) + status->dex;
- temp = b_status->dex - status->dex;
- if (temp)
- status->hit += temp;
+ status->hit = b_status->hit - b_status->dex + status->dex;
status->hit = status_calc_hit(bl, sc, status->hit);
}
if(flag&SCB_FLEE) {
- status->flee = status_get_lv(bl) + status->agi;
- temp = b_status->agi - status->agi;
- if (temp)
- status->flee += temp;
+ status->flee = b_status->flee - b_status->agi + status->agi;
status->flee = status_calc_flee(bl, sc, status->flee);
}