summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-23 18:15:21 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-23 18:15:21 +0000
commitefbd5d0dd7dbf038333d65d59d0becad59e6e2a4 (patch)
treed5b149d3025ef79222eeaa6c34eb976799649b02 /src
parent7298dd6e6f12729de1571628781c3945ae86f31e (diff)
downloadhercules-efbd5d0dd7dbf038333d65d59d0becad59e6e2a4.tar.gz
hercules-efbd5d0dd7dbf038333d65d59d0becad59e6e2a4.tar.bz2
hercules-efbd5d0dd7dbf038333d65d59d0becad59e6e2a4.tar.xz
hercules-efbd5d0dd7dbf038333d65d59d0becad59e6e2a4.zip
Partial fix for bugreport:4337.
A new field was added to homun_skill_tree.txt containing the minimum level of intimacy to unlock a skill. This is used in some skills where the homunculus has to reach a amount of 910 of intimacy. The default value is 0 and it should only affect evolved homunculus. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16954 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c3
-rw-r--r--src/map/homunculus.c15
-rw-r--r--src/map/homunculus.h14
-rw-r--r--src/map/status.c2
4 files changed, 27 insertions, 7 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 75cc51a24..5ed1dc694 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1478,6 +1478,9 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
void clif_send_homdata(struct map_session_data *sd, int state, int param)
{ //[orn]
int fd = sd->fd;
+
+ if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) )
+ merc_hom_calc_skilltree(sd->hd, 0);
WFIFOHEAD(fd, packet_len(0x230));
WFIFOW(fd,0)=0x230;
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 0bb41ebe4..ab3d811b2 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -40,7 +40,7 @@
#include <math.h>
struct s_homunculus_db homunculus_db[MAX_HOMUNCULUS_CLASS]; //[orn]
-struct skill_tree_entry hskill_tree[MAX_HOMUNCULUS_CLASS][MAX_SKILL_TREE];
+struct homun_skill_tree_entry hskill_tree[MAX_HOMUNCULUS_CLASS][MAX_SKILL_TREE];
static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr_t data);
@@ -194,7 +194,7 @@ int merc_hom_delete(struct homun_data *hd, int emote)
return unit_remove_map(&hd->bl,CLR_OUTSIGHT);
}
-int merc_hom_calc_skilltree(struct homun_data *hd)
+int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve)
{
int i, id = 0;
int j, f = 1;
@@ -229,6 +229,9 @@ int merc_hom_calc_skilltree(struct homun_data *hd)
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.
+ j = ( flag_evolve ) ? 10 : hd->homunculus.intimacy;
+ if( j < hskill_tree[c][i].intimacylv )
+ continue;
if(!battle_config.skillfree) {
for( j = 0; j < MAX_PC_SKILL_REQUIRE; j++ ) {
if( hskill_tree[c][i].need[j].id &&
@@ -368,7 +371,7 @@ int merc_hom_change_class(struct homun_data *hd, short class_)
hd->homunculusDB = &homunculus_db[i];
hd->homunculus.class_ = class_;
status_set_viewdata(&hd->bl, class_);
- merc_hom_calc_skilltree(hd);
+ merc_hom_calc_skilltree(hd, 1);
return 1;
}
@@ -1164,7 +1167,7 @@ int read_homunculusdb(void)
}
static bool read_homunculus_skilldb_sub(char* split[], int columns, int current)
-{// <hom class>,<skill id>,<max level>[,<job level>],<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
+{// <hom class>,<skill id>,<max level>[,<job level>],<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>,<intimacy lv req>
int k, classid;
int j;
int minJobLevelPresent = 0;
@@ -1199,6 +1202,8 @@ static bool read_homunculus_skilldb_sub(char* split[], int columns, int current)
hskill_tree[classid][j].need[k].id = atoi(split[3+k*2+minJobLevelPresent]);
hskill_tree[classid][j].need[k].lv = atoi(split[3+k*2+minJobLevelPresent+1]);
}
+
+ hskill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]);
return true;
}
@@ -1206,7 +1211,7 @@ static bool read_homunculus_skilldb_sub(char* split[], int columns, int current)
int read_homunculus_skilldb(void)
{
memset(hskill_tree,0,sizeof(hskill_tree));
- sv_readdb(db_path, "homun_skill_tree.txt", ',', 13, 14, -1, &read_homunculus_skilldb_sub);
+ sv_readdb(db_path, "homun_skill_tree.txt", ',', 13, 15, -1, &read_homunculus_skilldb_sub);
return 0;
}
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index fb18d3394..e46420692 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -49,6 +49,18 @@ struct homun_data {
int spiritball; //for homun S [lighta]
};
+#define MAX_HOM_SKILL_REQUIRE 5
+struct homun_skill_tree_entry {
+ short id;
+ unsigned char max;
+ unsigned char joblv;
+ short intimacylv;
+ struct {
+ short id;
+ unsigned char lv;
+ } need[MAX_HOM_SKILL_REQUIRE];
+}; // Celest
+
#define HOM_EVO 0x100 //256
#define HOM_S 0x200 //512
@@ -84,7 +96,7 @@ int hom_class2mapid(int hom_class);
void merc_damage(struct homun_data *hd);
int merc_hom_dead(struct homun_data *hd);
void merc_hom_skillup(struct homun_data *hd,int skillnum);
-int merc_hom_calc_skilltree(struct homun_data *hd);
+int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve);
int merc_hom_checkskill(struct homun_data *hd,int skill_id);
int merc_hom_gainexp(struct homun_data *hd,int exp);
int merc_hom_levelup(struct homun_data *hd);
diff --git a/src/map/status.c b/src/map/status.c
index 9b4a58676..3d3062fb3 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3175,7 +3175,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first)
status->max_hp = hom->max_hp ;
status->max_sp = hom->max_sp ;
- merc_hom_calc_skilltree(hd);
+ merc_hom_calc_skilltree(hd, 0);
if((skill=merc_hom_checkskill(hd,HAMI_SKIN)) > 0)
status->def += skill * 4;