summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-18 14:08:16 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-18 14:08:16 +0000
commit960989d97bf8dd06e02a2eb840bda61fe2563e77 (patch)
treea77e13f61b66b17b90f6f9fed6e5c0d37079cc75 /src/map
parenteb16323cc0a2c1423d51f252ca9eaacf940f6439 (diff)
downloadhercules-960989d97bf8dd06e02a2eb840bda61fe2563e77.tar.gz
hercules-960989d97bf8dd06e02a2eb840bda61fe2563e77.tar.bz2
hercules-960989d97bf8dd06e02a2eb840bda61fe2563e77.tar.xz
hercules-960989d97bf8dd06e02a2eb840bda61fe2563e77.zip
Fixed bugreport:6343 homun-s skill tree now is properly populated with previous homun form skills, note the sql table update: upgrade_svn16663.sql
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16663 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/homunculus.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index f90c8c185..3856dd939 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -157,32 +157,53 @@ int merc_hom_delete(struct homun_data *hd, int emote)
int merc_hom_calc_skilltree(struct homun_data *hd)
{
- int i,id=0 ;
- int j,f=1;
- int c=0;
+ int i, id = 0;
+ int j, f = 1;
+ int c = 0;
nullpo_ret(hd);
+ /* load previous homunculus form skills first. */
+ if( hd->homunculus.prev_class != 0 ) {
+ c = hd->homunculus.prev_class - HM_CLASS_BASE;
+
+ for( i = 0; i < MAX_SKILL_TREE && ( id = hskill_tree[c][i].id ) > 0; i++ ) {
+ if( hd->homunculus.hskill[ id - HM_SKILLBASE ].id )
+ continue; //Skill already known.
+ if(!battle_config.skillfree) {
+ for( j = 0; j < MAX_PC_SKILL_REQUIRE; j++ ) {
+ if( hskill_tree[c][i].need[j].id &&
+ merc_hom_checkskill(hd,hskill_tree[c][i].need[j].id) < hskill_tree[c][i].need[j].lv ) {
+ f = 0;
+ break;
+ }
+ }
+ }
+ if ( f )
+ hd->homunculus.hskill[id-HM_SKILLBASE].id = id;
+ }
+
+ f = 1;
+ id = c = 0;
+ }
+
c = hd->homunculus.class_ - HM_CLASS_BASE;
- for(i=0;i < MAX_SKILL_TREE && (id = hskill_tree[c][i].id) > 0;i++)
- {
- if(hd->homunculus.hskill[id-HM_SKILLBASE].id)
+ for( i = 0; i < MAX_SKILL_TREE && ( id = hskill_tree[c][i].id ) > 0; i++ ) {
+ if( hd->homunculus.hskill[ id - HM_SKILLBASE ].id )
continue; //Skill already known.
- if(!battle_config.skillfree)
- {
- for(j=0;j<MAX_PC_SKILL_REQUIRE;j++)
- {
+ if(!battle_config.skillfree) {
+ for( j = 0; j < MAX_PC_SKILL_REQUIRE; j++ ) {
if( hskill_tree[c][i].need[j].id &&
- merc_hom_checkskill(hd,hskill_tree[c][i].need[j].id) < hskill_tree[c][i].need[j].lv)
- {
- f=0;
+ merc_hom_checkskill(hd,hskill_tree[c][i].need[j].id) < hskill_tree[c][i].need[j].lv ) {
+ f = 0;
break;
}
}
}
- if (f)
- hd->homunculus.hskill[id-HM_SKILLBASE].id = id ;
+ if ( f )
+ hd->homunculus.hskill[id-HM_SKILLBASE].id = id;
}
+
if( hd->master )
clif_homskillinfoblock(hd->master);
return 0;
@@ -370,7 +391,7 @@ int hom_mutate(struct homun_data *hd, int homun_id)
{
struct s_homunculus *hom;
struct map_session_data *sd;
- int m_class, m_id;
+ int m_class, m_id, prev_class = 0;
nullpo_ret(hd);
m_class = hom_class2mapid(hd->homunculus.class_);
@@ -385,6 +406,8 @@ int hom_mutate(struct homun_data *hd, int homun_id)
if (!sd)
return 0;
+ prev_class = hd->homunculus.class_;
+
if (!merc_hom_change_class(hd, homun_id)) {
ShowError("hom_mutate: Can't evolve homunc from %d to %d", hd->homunculus.class_, homun_id);
return 0;
@@ -397,10 +420,12 @@ int hom_mutate(struct homun_data *hd, int homun_id)
clif_emotion(&sd->bl, E_NO1);
clif_specialeffect(&hd->bl,568,AREA);
+
//status_Calc flag&1 will make current HP/SP be reloaded from hom structure
hom = &hd->homunculus;
hom->hp = hd->battle_status.hp;
hom->sp = hd->battle_status.sp;
+ hom->prev_class = prev_class;
status_calc_homunculus(hd,1);
if (!(battle_config.hom_setting&0x2))