summaryrefslogtreecommitdiff
path: root/src/map/homunculus.c
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-09-12 13:13:23 -0300
committerJesusaves <cpntb1@ymail.com>2020-09-12 13:13:23 -0300
commit1443f47ca63972f737bd9cc0322f77dc416ff2a0 (patch)
tree6b851ced5b878ac8b2b13eeb01e04d598bacfe43 /src/map/homunculus.c
parentc53f8a099151f2e8c26c0ab36f35d34256c0d6cb (diff)
downloadhercules-1443f47ca63972f737bd9cc0322f77dc416ff2a0.tar.gz
hercules-1443f47ca63972f737bd9cc0322f77dc416ff2a0.tar.bz2
hercules-1443f47ca63972f737bd9cc0322f77dc416ff2a0.tar.xz
hercules-1443f47ca63972f737bd9cc0322f77dc416ff2a0.zip
This is Hercules v2019.09.22
Diffstat (limited to 'src/map/homunculus.c')
-rw-r--r--src/map/homunculus.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 31744f479..43cb8d84b 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -172,7 +172,7 @@ static int homunculus_dead(struct homun_data *hd)
}
//Vaporize a character's homun. If flag, HP needs to be 80% or above.
-static int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag)
+static int homunculus_vaporize(struct map_session_data *sd, enum homun_state state, bool force)
{
struct homun_data *hd;
@@ -185,13 +185,13 @@ static int homunculus_vaporize(struct map_session_data *sd, enum homun_state fla
if (status->isdead(&hd->bl))
return 0; //Can't vaporize a dead homun.
- if (flag == HOM_ST_REST && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80)
+ if (!force && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80)
return 0;
hd->regen.state.block = 3; //Block regen while vaporized.
//Delete timers when vaporized.
homun->hunger_timer_delete(hd);
- hd->homunculus.vaporize = flag;
+ hd->homunculus.vaporize = state;
if(battle_config.hom_setting&0x40)
memset(hd->blockskill, 0, sizeof(hd->blockskill));
clif->hominfo(sd, sd->hd, 0);
@@ -258,7 +258,7 @@ static int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve)
for( i = 0; i < MAX_SKILL_TREE && ( id = homun->dbs->skill_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;
+ j = ( flag_evolve ) ? 1000 : hd->homunculus.intimacy;
if( j < homun->dbs->skill_tree[c][i].intimacylv )
continue;
if(!battle_config.skillfree) {
@@ -525,6 +525,21 @@ static bool homunculus_mutate(struct homun_data *hd, int homun_id)
return true;
}
+static int homunculus_gainexp_real(struct homun_data *hd, unsigned int exp)
+{
+ nullpo_ret(hd);
+ nullpo_ret(hd->master);
+
+ hd->homunculus.exp += exp;
+
+ if (hd->master->state.showexp && hd->exp_next > 0) {
+ char output[256];
+ sprintf(output, msg_fd(hd->master->fd, 449), exp, ((float)exp / (float)hd->exp_next * (float)100));
+ clif_disp_onlyself(hd->master, output);
+ }
+ return 1;
+}
+
static int homunculus_gainexp(struct homun_data *hd, unsigned int exp)
{
enum homun_type htype;
@@ -550,16 +565,10 @@ static int homunculus_gainexp(struct homun_data *hd, unsigned int exp)
break;
}
- hd->homunculus.exp += exp;
-
- if (hd->master->state.showexp && hd->exp_next > 0) {
- char output[256];
- sprintf(output, "Homunculus Experience Gained Base:%u (%.2f%%)", exp, ((float)exp / (float)hd->exp_next * (float)100));
- clif_disp_onlyself(hd->master, output);
- }
+ homun->gainexp_real(hd, exp);
- if(hd->homunculus.exp < hd->exp_next) {
- clif->hominfo(hd->master,hd,0);
+ if (hd->homunculus.exp < hd->exp_next) {
+ clif->hominfo(hd->master, hd, 0);
return 0;
}
@@ -826,7 +835,7 @@ static int homunculus_db_search(int key, int type)
* @param hom The homunculus source data.
* @retval false in case of errors.
*/
-static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom)
+static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom, bool is_new)
{
struct homun_data *hd;
int i = 0;
@@ -870,7 +879,9 @@ static bool homunculus_create(struct map_session_data *sd, const struct s_homunc
map->addiddb(&hd->bl);
status_calc_homunculus(hd,SCO_FIRST);
- status_percent_heal(&hd->bl, 100, 100);
+ if (is_new) {
+ status_percent_heal(&hd->bl, 100, 100);
+ }
hd->hungry_timer = INVALID_TIMER;
return true;
@@ -927,6 +938,7 @@ static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh,
{
struct map_session_data *sd;
struct homun_data *hd;
+ bool is_new = false;
nullpo_retr(false, sh);
@@ -942,15 +954,17 @@ static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh,
if (sd->status.char_id != sh->char_id && sd->status.hom_id != sh->hom_id)
return false;
- if (sd->status.hom_id == 0) //Hom just created.
+ if (sd->status.hom_id == 0) { // Hom just created.
sd->status.hom_id = sh->hom_id;
+ is_new = true;
+ }
if (sd->hd != NULL) {
//uh? Overwrite the data.
memcpy(&sd->hd->homunculus, sh, sizeof sd->hd->homunculus);
sd->hd->homunculus.char_id = sd->status.char_id; // Correct char id if necessary.
} else {
- homun->create(sd, sh);
+ homun->create(sd, sh, is_new);
}
hd = sd->hd;
@@ -1312,7 +1326,7 @@ static bool homunculus_read_skill_db_sub(char *split[], int columns, int current
homun->dbs->skill_tree[classid][j].need[k].lv = atoi(split[3+k*2+minJobLevelPresent+1]);
}
- homun->dbs->skill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]);
+ homun->dbs->skill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]) * 100;
return true;
}
@@ -1439,6 +1453,7 @@ void homunculus_defaults(void)
homun->evolve = homunculus_evolve;
homun->mutate = homunculus_mutate;
homun->gainexp = homunculus_gainexp;
+ homun->gainexp_real = homunculus_gainexp_real;
homun->add_intimacy = homunculus_add_intimacy;
homun->consume_intimacy = homunculus_consume_intimacy;
homun->healed = homunculus_healed;