Quellcode durchsuchen

- Fixed pets ignoring can-act delays for skill usage.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6870 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex vor 19 Jahren
Ursprung
Commit
bce845e94f
3 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen
  1. 1 0
      Changelog-Trunk.txt
  2. 1 1
      doc/client_packet.txt
  3. 11 1
      src/map/pet.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ 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.
 
 2006/05/30
+	* Fixed pets ignoring can-act delays for skill usage. [Skotlex]
 	* [Added]:
 	  - Mercenary.c in VS.NET 2005 project files
 	  [Improved]:

+ 1 - 1
doc/client_packet.txt

@@ -108,7 +108,7 @@ S 0072 <account ID>.l <charactor ID>.l <login ID1>.l <login ID2>.l <sex>.b
 	ゲーム鯖接続要求
 R 0073 <server tick>.l <coordidate>.3B ?.2B
 	ゲーム鯖接続成功&サーバ側1ms時計&出現位置
-R 0078 <ID>.l <speed>.w <opt1>.w <opt2>.w <option>.w <class>.w <hair>.w <weapon>.w <head option bottom>.w <sheild>.w <head option top>.w <head option mid>.w <hair color>.w ?.w <head dir>.w <guild>.l <emblem>.l <manner>.w <karma>.B <sex>.B <X_Y_dir>.3B ?.B ?.B <sit>.B <Lv>.B
+R 0078 <ID>.l <speed>.w <opt1>.w <opt2>.w <option>.w <class>.w <hair>.w <weapon>.w <head option bottom>.w <sheild>.w <head option top>.w <head option mid>.w <hair color>.w <cloth color>.w <head dir>.w <guild>.l <emblem>.l <manner>.w <karma>.B <sex>.B <X_Y_dir>.3B ?.B ?.B <sit>.B <Lv>.B
 	マップロード時&移動時用、向き付き用キャラ情報?
 R 0079 <ID>.l <speed>.w <opt1>.w <opt2>.w <option>.w <class>.w <hair>.w <weapon>.w <head option bottom>.w <sheild>.w <head option top>.w <head option mid>.w <hair color>.w ?.w <head dir>.w <guild>.l <emblem>.l <manner>.w <karma>.B <sex>.B <X_Y_dir>.3B ?.B ?.B <Lv>.B
 	テレポ等の表示範囲内沸きキャラ用、向き付き無しキャラ情報?

+ 11 - 1
src/map/pet.c

@@ -130,12 +130,16 @@ int pet_attackskill(struct pet_data *pd, int target_id)
 		(battle_config.pet_equip_required && !pd->equip))
 		return 0;
 
+	if (DIFF_TICK(pd->ud.canact_tick, gettick()) > 0)
+		return 0;
+	
 	if (rand()%100 < (pd->a_skill->rate +pd->msd->pet.intimate*pd->a_skill->bonusrate/1000))
 	{	//Skotlex: Use pet's skill 
 		bl=map_id2bl(target_id);
 		if(bl == NULL || pd->bl.m != bl->m || bl->prev == NULL || status_isdead(bl) ||
 			!check_distance_bl(&pd->bl, bl, pd->db->range3))
 			return 0;
+
 		if (skill_get_inf(pd->a_skill->id) & INF_GROUND_SKILL)
 			unit_skilluse_pos(&pd->bl, bl->x, bl->y, pd->a_skill->id, pd->a_skill->lv);
 		else
@@ -1217,13 +1221,19 @@ int pet_skill_support_timer(int tid,unsigned int tick,int id,int data)
 	}
 	
 	status = status_get_status_data(&sd->bl);
+
+	if (DIFF_TICK(pd->ud.canact_tick, tick) > 0)
+	{	//Wait until the pet can act again.
+		pd->s_skill->timer=add_timer(pd->ud.canact_tick,pet_skill_support_timer,sd->bl.id,0);
+		return 0;
+	}
 	
 	if(pc_isdead(sd) ||
 		(rate = status->sp*100/status->max_sp) > pd->s_skill->sp ||
 		(rate = status->hp*100/status->max_hp) > pd->s_skill->hp ||
 		(rate = (pd->ud.skilltimer != -1)) //Another skill is in effect
 	) {  //Wait (how long? 1 sec for every 10% of remaining)
-		pd->s_skill->timer=add_timer(gettick()+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
+		pd->s_skill->timer=add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
 		return 0;
 	}