Bläddra i källkod

- 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://svn.code.sf.net/p/rathena/svn/trunk@11433 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 17 år sedan
förälder
incheckning
1e999c8051
6 ändrade filer med 20 tillägg och 21 borttagningar
  1. 3 0
      Changelog-Trunk.txt
  2. 2 4
      src/map/atcommand.c
  3. 4 6
      src/map/mercenary.c
  4. 1 1
      src/map/mob.c
  5. 9 9
      src/map/skill.c
  6. 1 1
      src/map/skill.h

+ 3 - 0
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.

+ 2 - 4
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);

+ 4 - 6
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;

+ 1 - 1
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) {

+ 9 - 9
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.

+ 1 - 1
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)