summaryrefslogtreecommitdiff
path: root/src/map
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
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')
-rw-r--r--src/map/mercenary.c72
-rw-r--r--src/map/mercenary.h5
-rw-r--r--src/map/skill.c75
-rw-r--r--src/map/status.c10
-rw-r--r--src/map/status.h6
5 files changed, 89 insertions, 79 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()
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 851abd4ee..1837a7446 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -63,9 +63,10 @@ int merc_hom_levelup(struct homun_data *hd) ;
int merc_hom_evolution(struct homun_data *hd) ;
void merc_hom_heal(struct homun_data *hd,int hp,int sp);
int merc_hom_vaporize(struct map_session_data *sd, int flag);
-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);
+void merc_homun_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
void merc_save(struct homun_data *hd);
-int merc_call_homunculus(struct map_session_data *sd);
+int merc_call_homunculus(struct map_session_data *sd, short x, short y);
int merc_create_homunculus(struct map_session_data *sd, int class_);
int search_homunculusDB_index(int key,int type);
int merc_menu(struct map_session_data *sd,int menunum);
diff --git a/src/map/skill.c b/src/map/skill.c
index cdd6a90ce..d0a2cd8ad 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5486,37 +5486,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
break;
- case AM_CALLHOMUN: //[orn]
- if (sd && !merc_call_homunculus(sd))
- clif_skill_fail(sd,skillid,0,0);
- break;
-
case AM_REST: //[orn]
if (sd && !merc_hom_vaporize(sd,1))
clif_skill_fail(sd,skillid,0,0);
break;
- case AM_RESURRECTHOMUN: //[orn]
- {
- if (sd)
- {
- if (sd->status.hom_id && sd->homunculus.hp == 0)
- {
- if( map_flag_gvg(bl->m) )
- { //No reviving in WoE grounds!
- clif_skill_fail(sd,skillid,0,0);
- break;
- }
- if (merc_hom_revive(sd, 10 * skilllv) )
- clif_skill_nodamage(src,&sd->hd->bl,AM_RESURRECTHOMUN,skilllv,1);
- else
- clif_skill_fail(sd,skillid,0,0);
- } else
- clif_skill_fail(sd,skillid,0,0);
- }
- break;
- }
-
case HAMI_CASTLE: //[orn]
if(rand()%100 > 20*skilllv || src == bl)
break; //Failed.
@@ -5631,10 +5605,12 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
}
switch (ud->skillid) {
- //These three should become skill_castend_pos
+ //These should become skill_castend_pos
case WE_CALLPARTNER:
case WE_CALLPARENT:
- case WE_CALLBABY:
+ case WE_CALLBABY:
+ case AM_CALLHOMUN:
+ case AM_RESURRECTHOMUN:
//Find a random spot to place the skill. [Skotlex]
inf2 = skill_get_splash(ud->skillid, ud->skilllv);
ud->skillx = src->x + inf2;
@@ -5787,9 +5763,8 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
if (sc->data[SC_BLADESTOP].timer != -1)
status_change_end(src,SC_BLADESTOP,-1);
}
- if (target && target->m == src->m &&
- (tid == -1 || status_check_skilluse(src, target, ud->skillid, 1))
- ) { //Move character to target anyway.
+ if (target && target->m == src->m)
+ { //Move character to target anyway.
int dx,dy;
dx = target->x - src->x;
dy = target->y - src->y;
@@ -6273,6 +6248,23 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
skill_unitsetting(src,skillid,skilllv,src->x,src->y,0);
break;
+ case AM_CALLHOMUN: //[orn]
+ if (sd && !merc_call_homunculus(sd, x, y))
+ clif_skill_fail(sd,skillid,0,0);
+ break;
+
+ case AM_RESURRECTHOMUN: //[orn]
+ if (sd)
+ {
+ if (map_flag_gvg(src->m) || //No reviving in WoE grounds!
+ !merc_revive_homunculus(sd, 10*skilllv, x, y))
+ {
+ clif_skill_fail(sd,skillid,0,0);
+ break;
+ }
+ }
+ break;
+
default:
ShowWarning("skill_castend_pos2: Unknown skill used:%d\n",skillid);
return 1;
@@ -9149,26 +9141,23 @@ int skill_attack_area (struct block_list *bl, va_list ap)
int atk_type,skillid,skilllv,flag,type;
unsigned int tick;
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
+ if(status_isdead(bl))
+ return 0;
atk_type = va_arg(ap,int);
- if((src=va_arg(ap,struct block_list*)) == NULL)
- return 0;
- if((dsrc=va_arg(ap,struct block_list*)) == NULL)
- return 0;
+ src=va_arg(ap,struct block_list*);
+ dsrc=va_arg(ap,struct block_list*);
skillid=va_arg(ap,int);
skilllv=va_arg(ap,int);
- if(skillid > 0 && skilllv <= 0) return 0; // celest
tick=va_arg(ap,unsigned int);
flag=va_arg(ap,int);
type=va_arg(ap,int);
- if(battle_check_target(dsrc,bl,type) > 0 &&
- status_check_skilluse(NULL, bl, skillid, 2)) //also check if they can be hit.
- skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag);
-
- return 0;
+ if(battle_check_target(dsrc,bl,type) <= 0 ||
+ !status_check_skilluse(NULL, bl, skillid, 2))
+ return 0;
+
+ return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag);
}
/*==========================================
*
diff --git a/src/map/status.c b/src/map/status.c
index fa7de060e..a198de02f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -852,16 +852,18 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
status->hp += hp;
status->sp += sp;
- clif_resurrection(bl, 1);
+ if (bl->prev) //Animation only if character is already on a map.
+ clif_resurrection(bl, 1);
switch (bl->type) {
case BL_MOB:
mob_revive((TBL_MOB*)bl, hp);
break;
case BL_PC:
pc_revive((TBL_PC*)bl, hp, sp);
-// case BL_HOM: //[orn]
-// merc_hom_revive((TBL_HOM*)bl, hp, sp);
-// break;
+ break;
+ case BL_HOM: //[orn]
+ merc_homun_revive((TBL_HOM*)bl, hp, sp);
+ break;
}
return 1;
}
diff --git a/src/map/status.h b/src/map/status.h
index ae30b5415..970a6e578 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -475,9 +475,9 @@ enum {
#define OPTION_WEDDING 0x00001000
#define OPTION_RUWACH 0x00002000
#define OPTION_CHASEWALK 0x00004000
-#define OPTION_XMAS 0x00008000
-//Note that clientside Flying is 0x8000, the SAME as Xmas!!
-#define OPTION_FLYING 0x0020000
+//Note that clientside Flying and Xmas are 0x8000!!
+#define OPTION_XMAS 0x00020000
+#define OPTION_FLYING 0x0008000
//TODO: Get these Missing options...
#define OPTION_SIGHTTRASHER 0x00010000