summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-03 21:47:47 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-03 21:47:47 +0000
commit9aff15a57af029d3ec66fa9a038cdb4ba265ce3e (patch)
treef044ec66c090d7397703498a5aff3d13507da5ad /src
parentb61a1f62f63da6ff26f8913bc58573e480ac436b (diff)
downloadhercules-9aff15a57af029d3ec66fa9a038cdb4ba265ce3e.tar.gz
hercules-9aff15a57af029d3ec66fa9a038cdb4ba265ce3e.tar.bz2
hercules-9aff15a57af029d3ec66fa9a038cdb4ba265ce3e.tar.xz
hercules-9aff15a57af029d3ec66fa9a038cdb4ba265ce3e.zip
* Moved the homunculus shuffle code to mercenary.c, fixing the bug in the atcommand not using the bonus evolution stats for homunculus.
* Added a new script command "homshuffle" to reset the homunculus stats using NPC. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11350 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c29
-rw-r--r--src/map/mercenary.c50
-rw-r--r--src/map/mercenary.h1
-rw-r--r--src/map/script.c13
4 files changed, 68 insertions, 25 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index da70bbd06..d72342e0a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8137,7 +8137,7 @@ static int atshowmobs_sub(struct block_list *bl,va_list ap)
md = (struct mob_data *)bl;
- if(md->special_state.ai || md->master_id)
+ if(md->special_state.ai || md->master_id)
return 0; //Hide slaves and player summoned mobs. [Skotlex]
if(fd && (mob_id==-1 || (md->class_==mob_id))){
@@ -8466,9 +8466,6 @@ int atcommand_homstats(const int fd, struct map_session_data* sd, const char* co
int atcommand_homshuffle(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
struct homun_data *hd;
- int lv, i, skillpts;
- unsigned int exp;
- struct skill b_skill[MAX_HOMUNSKILL];
TBL_PC* tsd = sd;
nullpo_retr(-1, sd);
@@ -8492,28 +8489,10 @@ int atcommand_homshuffle(const int fd, struct map_session_data* sd, const char*
}
hd = tsd->hd;
- if(!merc_is_hom_active(hd))
+
+ if(!merc_hom_shuffle(hd))
return -1;
-
- lv = hd->homunculus.level;
- exp = hd->homunculus.exp;
- memcpy(&b_skill, &hd->homunculus.hskill, sizeof(b_skill));
- skillpts = hd->homunculus.skillpts;
- //Reset values to level 1.
- merc_reset_stats(hd);
- //Level it back up
- for (i = 1; i < lv && hd->exp_next; i++){
- hd->homunculus.exp += hd->exp_next;
- merc_hom_levelup(hd);
- }
- hd->homunculus.exp = exp;
- memcpy(&hd->homunculus.hskill, &b_skill, sizeof(b_skill));
- hd->homunculus.skillpts = skillpts;
- clif_homskillinfoblock(hd->master);
- status_calc_homunculus(hd,0);
- status_percent_heal(&hd->bl, 100, 100);
- clif_misceffect2(&hd->bl,568);
- clif_displaymessage(fd, "Homunculus stats altered");
+
//Print out the new stats
//This will send the commands to the invoker since they all use this fd regardless of sd value.
atcommand_homstats(fd, tsd, command, message);
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 577cbf22b..b23669955 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -834,6 +834,56 @@ void merc_reset_stats(struct homun_data *hd)
hd->homunculus.skillpts = 0;
}
+int merc_hom_shuffle(struct homun_data *hd)
+{
+ struct map_session_data *sd = hd->master;
+ int lv, i, skillpts;
+ unsigned int exp;
+ struct skill b_skill[MAX_HOMUNSKILL];
+
+ if (!merc_is_hom_active(hd))
+ return 0;
+
+ lv = hd->homunculus.level;
+ exp = hd->homunculus.exp;
+ memcpy(&b_skill, &hd->homunculus.hskill, sizeof(b_skill));
+ skillpts = hd->homunculus.skillpts;
+ //Reset values to level 1.
+ merc_reset_stats(hd);
+ //Level it back up
+ for (i = 1; i < lv && hd->exp_next; i++){
+ hd->homunculus.exp += hd->exp_next;
+ merc_hom_levelup(hd);
+ }
+
+ clif_displaymessage(sd->fd, "[Homunculus Stats Altered]");
+
+ if(!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class) {
+ // Homunculus Evolucionado
+ struct s_homunculus *hom = &hd->homunculus;
+ struct h_stats *max = &hd->homunculusDB->emax, *min = &hd->homunculusDB->emin;
+ hom->max_hp += rand(min->HP, max->HP);
+ hom->max_sp += rand(min->SP, max->SP);
+ hom->str += 10*rand(min->str, max->str);
+ hom->agi += 10*rand(min->agi, max->agi);
+ hom->vit += 10*rand(min->vit, max->vit);
+ hom->int_+= 10*rand(min->int_,max->int_);
+ hom->dex += 10*rand(min->dex, max->dex);
+ hom->luk += 10*rand(min->luk, max->luk);
+ clif_displaymessage(sd->fd, "[Adding Bonus Stats for Evolved Homunculus]");
+ }
+
+ hd->homunculus.exp = exp;
+ memcpy(&hd->homunculus.hskill, &b_skill, sizeof(b_skill));
+ hd->homunculus.skillpts = skillpts;
+ clif_homskillinfoblock(sd);
+ status_calc_homunculus(hd,0);
+ status_percent_heal(&hd->bl, 100, 100);
+ clif_misceffect2(&hd->bl,568);
+
+ return 1;
+}
+
int read_homunculusdb(void)
{
FILE *fp;
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 3b2d2661f..143b88a06 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -44,6 +44,7 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag);
int merc_resurrect_homunculus(struct map_session_data *sd, unsigned char per, short x, short y);
void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
void merc_reset_stats(struct homun_data *hd);
+int merc_hom_shuffle(struct homun_data *hd); // [Zephyrus]
void merc_save(struct homun_data *hd);
int merc_call_homunculus(struct map_session_data *sd);
int merc_create_homunculus_request(struct map_session_data *sd, int class_);
diff --git a/src/map/script.c b/src/map/script.c
index 306076fc4..fc2d75eee 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4022,6 +4022,7 @@ BUILDIN_FUNC(awake);
BUILDIN_FUNC(getvariableofnpc);
BUILDIN_FUNC(warpportal);
BUILDIN_FUNC(homunculus_evolution) ; //[orn]
+BUILDIN_FUNC(homunculus_shuffle); // [Zephyrus]
BUILDIN_FUNC(eaclass);
BUILDIN_FUNC(roclass);
BUILDIN_FUNC(setitemscript);
@@ -4364,6 +4365,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getvariableofnpc,"rs"),
BUILDIN_DEF(warpportal,"iisii"),
BUILDIN_DEF2(homunculus_evolution,"homevolution",""), //[orn]
+ BUILDIN_DEF2(homunculus_shuffle,"homshuffle",""), //[Zephyrus]
BUILDIN_DEF(eaclass,"*"), //[Skotlex]
BUILDIN_DEF(roclass,"i*"), //[Skotlex]
BUILDIN_DEF(checkvending,"*"),
@@ -8744,6 +8746,17 @@ BUILDIN_FUNC(homunculus_evolution)
return 0;
}
+// [Zephyrus]
+BUILDIN_FUNC(homunculus_shuffle)
+{
+ TBL_PC *sd;
+ sd=script_rid2sd(st);
+ if(merc_is_hom_active(sd->hd))
+ merc_hom_shuffle(sd->hd);
+
+ return 0;
+}
+
//These two functions bring the eA MAPID_* class functionality to scripts.
BUILDIN_FUNC(eaclass)
{