summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-12 22:48:56 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-12 22:48:56 +0000
commit96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5 (patch)
tree7a4d8210878c359c60f51c4882253c5565f1cff9
parent2b9e300e11b6b36fbbf3626b205b89e84ec4b3ee (diff)
downloadhercules-96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5.tar.gz
hercules-96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5.tar.bz2
hercules-96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5.tar.xz
hercules-96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5.zip
- cleaned up homshuffle and fixed a possible crash in it.
- Updated the skill_delayfix function to behave as recently discovered by Tharis: Skills with no delay set will use amotion ONLY if the skill was instant-casted. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11433 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/atcommand.c6
-rw-r--r--src/map/mercenary.c10
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/skill.c18
-rw-r--r--src/map/skill.h2
6 files changed, 20 insertions, 21 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index db354bb4c..f1f977491 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/10/12
+ * Updated the skill_delayfix function to behave as recently discovered by
+ Tharis: Skills with no delay set will use amotion ONLY if the skill was
+ instant-casted. [Skotlex]
* Fixed Bragi's aftercast delay reduction [Playtester]
2007/10/10
* Fixed itemdb_read_sqldb blowing up the server with segmentation faults.
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 1d05e915f..b584c6218 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8465,7 +8465,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;
TBL_PC* tsd = sd;
nullpo_retr(-1, sd);
@@ -8488,11 +8487,10 @@ int atcommand_homshuffle(const int fd, struct map_session_data* sd, const char*
}
}
- hd = tsd->hd;
-
- if(!merc_hom_shuffle(hd))
+ if(!merc_hom_shuffle(tsd->hd))
return -1;
+ clif_displaymessage(sd->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 1477797c5..ff13eacb1 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -836,7 +836,7 @@ void merc_reset_stats(struct homun_data *hd)
int merc_hom_shuffle(struct homun_data *hd)
{
- struct map_session_data *sd = hd->master;
+ struct map_session_data *sd;
int lv, i, skillpts;
unsigned int exp;
struct skill b_skill[MAX_HOMUNSKILL];
@@ -844,6 +844,7 @@ int merc_hom_shuffle(struct homun_data *hd)
if (!merc_is_hom_active(hd))
return 0;
+ sd = hd->master;
lv = hd->homunculus.level;
exp = hd->homunculus.exp;
memcpy(&b_skill, &hd->homunculus.hskill, sizeof(b_skill));
@@ -856,10 +857,8 @@ int merc_hom_shuffle(struct homun_data *hd)
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
+ if(hd->homunculus.class_ == hd->homunculusDB->evo_class) {
+ //Evolved bonuses
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);
@@ -870,7 +869,6 @@ int merc_hom_shuffle(struct homun_data *hd)
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;
diff --git a/src/map/mob.c b/src/map/mob.c
index 2fb8405cd..a21659466 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3007,8 +3007,8 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char
ms[i].permillage = 500*battle_config.mob_skill_rate/100; //Default chance of all skills: 5%
ms[i].emotion = -1;
ms[i].cancel = 0;
- ms[i].delay = 5000+skill_delayfix(&sd->bl,skill_id, ms[i].skill_lv);
ms[i].casttime = skill_castfix(&sd->bl,skill_id, ms[i].skill_lv);
+ ms[i].delay = 5000+skill_delayfix(&sd->bl,skill_id, ms[i].skill_lv, ms[i].casttime == 0);
inf = skill_get_inf(skill_id);
if (inf&INF_ATTACK_SKILL) {
diff --git a/src/map/skill.c b/src/map/skill.c
index f7df711b3..4f500a2ba 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1513,7 +1513,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
//Set canact delay. [Skotlex]
ud = unit_bl2ud(src);
if (ud) {
- rate = skill_delayfix(src, skill, skilllv);
+ rate = skill_delayfix(src, skill, skilllv, true);
if (DIFF_TICK(ud->canact_tick, tick + rate) < 0)
ud->canact_tick = tick+rate;
}
@@ -1689,7 +1689,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
//Set canact delay. [Skotlex]
ud = unit_bl2ud(bl);
if (ud) {
- rate = skill_delayfix(bl, skillid, skilllv);
+ rate = skill_delayfix(bl, skillid, skilllv, true);
if (DIFF_TICK(ud->canact_tick, tick + rate) < 0)
ud->canact_tick = tick+rate;
}
@@ -5910,7 +5910,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
if (ud->walktimer != -1 && ud->skillid != TK_RUN)
unit_stop_walking(src,1);
- ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv);
+ ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv, tid == -1);
if (skill_get_state(ud->skillid) != ST_MOVE_ENABLE)
unit_set_walkdelay(src, tick, battle_config.default_skill_delay+skill_get_walkdelay(ud->skillid, ud->skilllv), 1);
@@ -6079,7 +6079,7 @@ int skill_castend_pos (int tid, unsigned int tick, int id, int data)
ShowInfo("Type %d, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n",
src->type, src->id, ud->skillid, ud->skilllv, ud->skillx, ud->skilly);
unit_stop_walking(src,1);
- ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv);
+ ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv, tid == -1);
unit_set_walkdelay(src, tick, battle_config.default_skill_delay+skill_get_walkdelay(ud->skillid, ud->skilllv), 1);
map_freeblock_lock();
@@ -8855,7 +8855,7 @@ int skill_castfix_sc (struct block_list *bl, int time)
/*==========================================
* Does delay reductions based on dex/agi, sc data, item bonuses, ...
*------------------------------------------*/
-int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
+int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv, bool instantcast)
{
int delaynodex = skill_get_delaynodex(skill_id, skill_lv);
int time = skill_get_delay(skill_id, skill_lv);
@@ -8865,14 +8865,14 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
if (bl->type&battle_config.no_skill_delay)
return battle_config.min_skill_delay_limit;
- // instant cast attack skills depend on aspd as delay [celest]
+ // instant delay skills have aspd delay IF they were also instant cast (reported by Tharis) [Skotlex]
if (time == 0) {
- if (skill_get_type(skill_id)&(BF_WEAPON|BF_MISC) && !(skill_get_nk(skill_id)&NK_NO_DAMAGE))
- time = status_get_adelay(bl); //Use attack delay as default delay.
+ if (instantcast)
+ time = status_get_amotion(bl); //Use attack delay.
else
time = battle_config.default_skill_delay;
} else if (time < 0)
- time = -time + status_get_amotion(bl); // if set to <0, the attack motion is added.
+ time = -time + status_get_amotion(bl); // if set to <0, add to attack motion.
else //Agi reduction should apply only to non-zero delay skills.
switch (skill_id)
{ //Monk combo skills have their delay reduced by agi/dex.
diff --git a/src/map/skill.h b/src/map/skill.h
index 9905c761b..d8e8b4f5a 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -215,7 +215,7 @@ int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl,
int skill_castfix( struct block_list *bl, int skill_id, int skill_lv);
int skill_castfix_sc( struct block_list *bl, int time);
-int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv);
+int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv, bool instantcast);
int skill_check_condition( struct map_session_data *sd,int skill, int lv, int type);
int skill_check_pc_partner(struct map_session_data *sd, int skill_id, int* skill_lv, int range, int cast_flag);
// -- moonsoul (added skill_check_unit_cell)