summaryrefslogtreecommitdiff
path: root/src/map/homunculus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/homunculus.c')
-rw-r--r--src/map/homunculus.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index ab3d811b2..8f54481ff 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -76,7 +76,7 @@ int hom_class2mapid(int hom_class)
case 6050: return MAPID_SERA;
case 6051: return MAPID_DIETER;
case 6052: return MAPID_ELANOR;
-
+
default: return -1;
}
}
@@ -86,15 +86,15 @@ int hom_addspiritball(TBL_HOM *hd, int max) {
if (max > MAX_SKILL_LEVEL)
max = MAX_SKILL_LEVEL;
- if (hd->spiritball < 0)
- hd->spiritball = 0;
+ if (hd->homunculus.spiritball < 0)
+ hd->homunculus.spiritball = 0;
- if (hd->spiritball && hd->spiritball >= max) {
- hd->spiritball = max;
+ if (hd->homunculus.spiritball && hd->homunculus.spiritball >= max) {
+ hd->homunculus.spiritball = max;
}
else
- hd->spiritball++;
-
+ hd->homunculus.spiritball++;
+
clif_spiritball(&hd->bl);
return 0;
@@ -103,18 +103,18 @@ int hom_addspiritball(TBL_HOM *hd, int max) {
int hom_delspiritball(TBL_HOM *hd, int count, int type) {
nullpo_ret(hd);
- if (hd->spiritball <= 0) {
- hd->spiritball = 0;
+ if (hd->homunculus.spiritball <= 0) {
+ hd->homunculus.spiritball = 0;
return 0;
}
if (count <= 0)
return 0;
if (count > MAX_SKILL_LEVEL)
count = MAX_SKILL_LEVEL;
- if (count > hd->spiritball)
- count = hd->spiritball;
-
- hd->spiritball -= count;
+ if (count > hd->homunculus.spiritball)
+ count = hd->homunculus.spiritball;
+
+ hd->homunculus.spiritball -= count;
if (!type)
clif_spiritball(&hd->bl);
@@ -154,7 +154,7 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag)
hd = sd->hd;
if (!hd || hd->homunculus.vaporize)
return 0;
-
+
if (status_isdead(&hd->bl))
return 0; //Can't vaporize a dead homun.
@@ -172,7 +172,7 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag)
return unit_remove_map(&hd->bl, CLR_OUTSIGHT);
}
-//delete a homunculus, completely "killing it".
+//delete a homunculus, completely "killing it".
//Emote is the emotion the master should use, send negative to disable.
int merc_hom_delete(struct homun_data *hd, int emote)
{
@@ -204,7 +204,7 @@ int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve)
/* 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.
@@ -220,12 +220,12 @@ int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve)
if ( f )
hd->homunculus.hskill[id-HM_SKILLBASE].id = id;
}
-
+
f = 1;
}
-
+
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 )
continue; //Skill already known.
@@ -244,7 +244,7 @@ int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve)
if ( f )
hd->homunculus.hskill[id-HM_SKILLBASE].id = id;
}
-
+
if( hd->master )
clif_homskillinfoblock(hd->master);
return 0;
@@ -278,7 +278,7 @@ void merc_hom_skillup(struct homun_data *hd,int skillnum)
if(hd->homunculus.vaporize)
return;
-
+
i = skillnum - HM_SKILLBASE;
if(hd->homunculus.skillpts > 0 &&
hd->homunculus.hskill[i].id &&
@@ -316,12 +316,12 @@ int merc_hom_levelup(struct homun_data *hd)
hom = &hd->homunculus;
hom->level++ ;
- if (!(hom->level % 3))
+ if (!(hom->level % 3))
hom->skillpts++ ; //1 skillpoint each 3 base level
hom->exp -= hd->exp_next ;
hd->exp_next = hexptbl[hom->level - 1] ;
-
+
max = &hd->homunculusDB->gmax;
min = &hd->homunculusDB->gmin;
@@ -350,7 +350,7 @@ int merc_hom_levelup(struct homun_data *hd)
hom->dex += growth_dex;
hom->int_+= growth_int;
hom->luk += growth_luk;
-
+
if ( battle_config.homunculus_show_growth ) {
sprintf(output,
"Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ",
@@ -390,7 +390,7 @@ int merc_hom_evolution(struct homun_data *hd)
sd = hd->master;
if (!sd)
return 0;
-
+
if (!merc_hom_change_class(hd, hd->homunculusDB->evo_class)) {
ShowError("merc_hom_evolution: Can't evolve homunc from %d to %d", hd->homunculus.class_, hd->homunculusDB->evo_class);
return 0;
@@ -424,7 +424,7 @@ int merc_hom_evolution(struct homun_data *hd)
if (!(battle_config.hom_setting&0x2))
skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
-
+
return 1 ;
}
@@ -437,18 +437,18 @@ int hom_mutate(struct homun_data *hd, int homun_id)
m_class = hom_class2mapid(hd->homunculus.class_);
m_id = hom_class2mapid(homun_id);
-
+
if( m_class == -1 || m_id == -1 || !(m_class&HOM_EVO) || !(m_id&HOM_S) ) {
clif_emotion(&hd->bl, E_SWT);
return 0;
}
-
+
sd = hd->master;
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;
@@ -461,7 +461,7 @@ 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;
@@ -471,7 +471,7 @@ int hom_mutate(struct homun_data *hd, int homun_id)
if (!(battle_config.hom_setting&0x2))
skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
-
+
return 1;
}
@@ -486,8 +486,8 @@ int merc_hom_gainexp(struct homun_data *hd,int exp)
ShowError("merc_hom_gainexp: Invalid class %d. \n", hd->homunculus.class_);
return 0;
}
-
- if( hd->exp_next == 0 ||
+
+ if( hd->exp_next == 0 ||
((m_class&HOM_REG) && hd->homunculus.level >= battle_config.hom_max_level) ||
((m_class&HOM_S) && hd->homunculus.level >= battle_config.hom_S_max_level) ) {
hd->homunculus.exp = 0;
@@ -507,7 +507,7 @@ int merc_hom_gainexp(struct homun_data *hd,int exp)
merc_hom_levelup(hd) ;
}
while(hd->homunculus.exp > hd->exp_next && hd->exp_next != 0 );
-
+
if( hd->exp_next == 0 )
hd->homunculus.exp = 0 ;
@@ -550,7 +550,7 @@ void merc_save(struct homun_data *hd)
// copy data that must be saved in homunculus struct ( hp / sp )
TBL_PC * sd = hd->master;
//Do not check for max_hp/max_sp caps as current could be higher to max due
- //to status changes/skills (they will be capped as needed upon stat
+ //to status changes/skills (they will be capped as needed upon stat
//calculation on login)
hd->homunculus.hp = hd->battle_status.hp;
hd->homunculus.sp = hd->battle_status.sp;
@@ -562,7 +562,7 @@ int merc_menu(struct map_session_data *sd,int menunum)
nullpo_ret(sd);
if (sd->hd == NULL)
return 1;
-
+
switch(menunum) {
case 0:
break;
@@ -645,7 +645,7 @@ static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr_t data)
}
hd->hungry_timer = INVALID_TIMER;
-
+
hd->homunculus.hunger-- ;
if(hd->homunculus.hunger <= 10) {
clif_emotion(&hd->bl, E_AN);
@@ -653,8 +653,8 @@ static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr_t data)
clif_emotion(&hd->bl, E_HMM);
} else if(hd->homunculus.hunger == 75) {
clif_emotion(&hd->bl, E_OK);
- }
-
+ }
+
if(hd->homunculus.hunger < 0) {
hd->homunculus.hunger = 0;
// Delete the homunculus if intimacy <= 100
@@ -704,7 +704,7 @@ int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag)
if (!merc_is_hom_active(hd)) return 0;
normalize_name(name," ");//bugreport:3032
-
+
if ( !flag || !strlen(name) ) {
clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name
return 0;
@@ -748,7 +748,7 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
nullpo_retr(1, sd);
- Assert((sd->status.hom_id == 0 || sd->hd == 0) || sd->hd->master == sd);
+ Assert((sd->status.hom_id == 0 || sd->hd == 0) || sd->hd->master == sd);
i = search_homunculusDB_index(hom->class_,HOMUNCULUS_CLASS);
if(i < 0) {
@@ -778,7 +778,7 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
unit_calc_pos(&hd->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
hd->bl.x = hd->ud.to_x;
hd->bl.y = hd->ud.to_y;
-
+
map_addiddb(&hd->bl);
status_calc_homunculus(hd,1);
@@ -824,7 +824,7 @@ int merc_call_homunculus(struct map_session_data *sd)
clif_homskillinfoblock(sd);
if (battle_config.slaves_inherit_speed&1)
status_calc_bl(&hd->bl, SCB_SPEED);
- merc_save(hd);
+ merc_save(hd);
} else
//Warp him to master.
unit_warp(&hd->bl,sd->bl.m, sd->bl.x, sd->bl.y,CLR_OUTSIGHT);
@@ -858,7 +858,7 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
memcpy(&sd->hd->homunculus, sh, sizeof(struct s_homunculus));
else
merc_hom_alloc(sd, sh);
-
+
hd = sd->hd;
if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL)
{
@@ -884,7 +884,7 @@ int merc_create_homunculus_request(struct map_session_data *sd, int class_)
i = search_homunculusDB_index(class_,HOMUNCULUS_CLASS);
if(i < 0) return 0;
-
+
memset(&homun, 0, sizeof(struct s_homunculus));
//Initial data
strncpy(homun.name, homunculus_db[i].name, NAME_LENGTH-1);
@@ -893,7 +893,7 @@ int merc_create_homunculus_request(struct map_session_data *sd, int class_)
homun.hunger = 32; //32%
homun.intimacy = 2100; //21/1000
homun.char_id = sd->status.char_id;
-
+
homun.hp = 10 ;
base = &homunculus_db[i].base;
homun.max_hp = base->HP;
@@ -906,7 +906,7 @@ int merc_create_homunculus_request(struct map_session_data *sd, int class_)
homun.luk = base->luk *10;
// Request homunculus creation
- intif_homunculus_create(sd->status.account_id, &homun);
+ intif_homunculus_create(sd->status.account_id, &homun);
return 1;
}
@@ -920,7 +920,7 @@ int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, sh
if (!sd->hd) //Load homun data;
return intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id);
-
+
hd = sd->hd;
if (hd->homunculus.vaporize)
@@ -1029,7 +1029,7 @@ int merc_hom_shuffle(struct homun_data *hd)
static bool read_homunculusdb_sub(char* str[], int columns, int current)
{
- int classid;
+ int classid;
struct s_homunculus_db *db;
//Base Class,Evo Class
@@ -1168,7 +1168,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>,<intimacy lv req>
- int k, classid;
+ int k, classid;
int j;
int minJobLevelPresent = 0;
@@ -1202,7 +1202,7 @@ 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;
@@ -1276,7 +1276,7 @@ int do_init_merc(void)
//Stock view data for homuncs
memset(&hom_viewdb, 0, sizeof(hom_viewdb));
- for (class_ = 0; class_ < ARRAYLENGTH(hom_viewdb); class_++)
+ for (class_ = 0; class_ < ARRAYLENGTH(hom_viewdb); class_++)
hom_viewdb[class_].class_ = HM_CLASS_BASE+class_;
return 0;
}