summaryrefslogtreecommitdiff
path: root/src/map/mercenary.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-15 15:26:51 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-15 15:26:51 +0000
commite4803fa9d29af8a88a20039c636cb47fcb2a898a (patch)
treec2c2b944b02f050d2f2fc41370552c3b3f3c9da9 /src/map/mercenary.c
parentfa6f60245d391ec204be0cf1a6a8a2fca5bea609 (diff)
downloadhercules-e4803fa9d29af8a88a20039c636cb47fcb2a898a.tar.gz
hercules-e4803fa9d29af8a88a20039c636cb47fcb2a898a.tar.bz2
hercules-e4803fa9d29af8a88a20039c636cb47fcb2a898a.tar.xz
hercules-e4803fa9d29af8a88a20039c636cb47fcb2a898a.zip
- Asura Strike now moves you to the target on fail always (unless the target does not exists or is in another map or there's a obstacle on the way)
- Corrected skill_attack_area hitting dead characters on it's splash range. - Swapped the values for OPTION_XMAS and OPTION_FLYING. This should enable SG to show the fly animation again, even if sometimes others will see him as Santa. As for xmas cloth, it shouldn't make much of a difference since the view class is changed to christmas anyway. - Moved the AM_CALLHOMUN code from castend_id to castend_pos. - Made AM_CALLHOMUN and AM_RESURRECTHOMUN be like the wedding skills, where they automatically pick a spot around you. - Cleaned up some the AM_RESURRECTHOMUN code. Hopefully it works now. - Cleaned up some the hom evolution code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8292 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mercenary.c')
-rw-r--r--src/map/mercenary.c72
1 files changed, 45 insertions, 27 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 13b15b029..589f5c6ff 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -329,23 +329,28 @@ int merc_hom_levelup(struct homun_data *hd)
int merc_hom_evolution(struct homun_data *hd)
{
+ struct map_session_data *sd;
+ short x,y;
nullpo_retr(0, hd);
- if(hd && hd->homunculusDB->evo_class)
+ if(!hd->homunculusDB->evo_class)
{
- hd->master->homunculus.class_ = hd->homunculusDB->evo_class;
- hd->master->homunculus.vaporize = 1;
- merc_stop_walking(hd, 1);
- merc_stop_attack(hd);
- merc_hom_delete(hd, -1) ;
- merc_call_homunculus(hd->master);
- clif_emotion(&hd->master->bl, 21) ; //no1
- clif_misceffect2(&hd->bl,568);
- return 1 ;
- } else {
clif_emotion(&hd->bl, 4) ; //swt
return 0 ;
}
+ sd = hd->master;
+ if (!sd) return 0;
+
+ //TODO: Clean this up to avoid free'ing/realloc'ing.
+ sd->homunculus.class_ = hd->homunculusDB->evo_class;
+ x = hd->bl.x;
+ y = hd->bl.y;
+ merc_hom_vaporize(sd, 0);
+ unit_free(&hd->bl);
+ merc_call_homunculus(hd->master, x, y);
+ clif_emotion(&sd->bl, 21) ; //no1
+ clif_misceffect2(&hd->bl,568);
+ return 1 ;
}
int merc_hom_gainexp(struct homun_data *hd,int exp)
@@ -820,7 +825,7 @@ int merc_hom_data_init(struct map_session_data *sd)
return 0;
}
-int merc_call_homunculus(struct map_session_data *sd)
+int merc_call_homunculus(struct map_session_data *sd, short x, short y)
{
struct homun_data *hd;
@@ -838,6 +843,8 @@ int merc_call_homunculus(struct map_session_data *sd)
hd = sd->hd;
if (hd->bl.prev == NULL)
{ //Spawn him
+ hd->bl.x = x;
+ hd->bl.y = y;
map_addblock(&hd->bl);
clif_spawn(&hd->bl);
clif_send_homdata(sd,SP_ACK,0);
@@ -847,7 +854,7 @@ int merc_call_homunculus(struct map_session_data *sd)
merc_save(hd);
} else
//Warp him to master.
- unit_warp(&hd->bl,sd->bl.m,sd->bl.x,sd->bl.y,0);
+ unit_warp(&hd->bl,sd->bl.m, x, y,0);
return 1;
}
@@ -926,29 +933,40 @@ int merc_create_homunculus(struct map_session_data *sd, int class_)
return 1;
}
-int merc_hom_revive(struct map_session_data *sd, int per)
+int merc_revive_homunculus(struct map_session_data *sd, unsigned char per, short x, short y)
{
+ struct homun_data *hd;
nullpo_retr(0, sd);
+ if (!sd->status.hom_id)
+ return 0;
- // Homunc not already loaded, load it, else just init timers
- if (!sd->hd)
+ if (!sd->hd) //Load homun data;
merc_hom_create(sd);
- else
- merc_hom_data_init(sd);
+
+ hd = sd->hd;
- if ( sd->hd && sd->bl.prev != NULL) {
- sd->homunculus.hp = sd->hd->base_status.hp = sd->hd->battle_status.hp = 1 ;
- status_heal(&sd->hd->bl, sd->homunculus.max_hp*per/100, 0, 1) ;
+ if (!status_isdead(&hd->bl))
+ return 0;
+
+ if (!hd->bl.prev)
+ { //Add it back to the map.
+ hd->bl.m = sd->bl.m;
+ hd->bl.x = x;
+ hd->bl.y = y;
map_addblock(&sd->hd->bl);
clif_spawn(&sd->hd->bl);
- clif_send_homdata(sd,SP_ACK,0);
- clif_hominfo(sd,sd->hd,1);
- clif_hominfo(sd,sd->hd,0);
- clif_homskillinfoblock(sd);
- clif_specialeffect(&sd->hd->bl,77,AREA) ; //resurrection angel
}
+ return status_revive(&hd->bl, per, 0);
+}
- return 1 ;
+void merc_homun_revive(struct homun_data *hd, unsigned int hp, unsigned int sp)
+{
+ struct map_session_data *sd = hd->master;
+ if (!sd) return;
+ clif_send_homdata(sd,SP_ACK,0);
+ clif_hominfo(sd,hd,1);
+ clif_hominfo(sd,hd,0);
+ clif_homskillinfoblock(sd);
}
int read_homunculusdb()