浏览代码

* Optimized the skill unit code
- reverted the unit timer interval to 100ms to save CPU usage
- rewrote the unit code of Fire Wall, Fire Formation and Heat so that they hit every 20ms if the target wasn't knocked back despite of the unit timer interval
- Heat now does 15 SP damage to players instead of 60 per hit
- optimized memory usage
- TODO: Renaming or removing firewall_hits_on_undead config

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11509 54d463be-8e91-2dee-dedb-b68131a5f0ec

Playtester 17 年之前
父节点
当前提交
12f4be5b2e
共有 2 个文件被更改,包括 44 次插入21 次删除
  1. 7 0
      Changelog-Trunk.txt
  2. 37 21
      src/map/skill.c

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ 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.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2007/10/18
 2007/10/18
+	* Optimized the skill unit code [Playtester]
+	- reverted the unit timer interval to 100ms to save CPU usage
+	- rewrote the unit code of Fire Wall, Fire Formation and Heat so that they hit
+	  every 20ms if the target wasn't knocked back despite of the unit timer interval
+	- Heat now does 15 SP damage to players instead of 60 per hit
+	- optimized memory usage
+	- TODO: Renaming or removing firewall_hits_on_undead config
 	* Clarified how npc names work in script_commands.txt.
 	* Clarified how npc names work in script_commands.txt.
 	* Fixed a forgotten "return 0;" that stopped the parsing of the file 
 	* Fixed a forgotten "return 0;" that stopped the parsing of the file 
 	  after the first "script" of the file is parsed sucessfully (caused by r11502).
 	  after the first "script" of the file is parsed sucessfully (caused by r11502).

+ 37 - 21
src/map/skill.c

@@ -36,7 +36,7 @@
 #include <time.h>
 #include <time.h>
 
 
 
 
-#define SKILLUNITTIMER_INVERVAL	20
+#define SKILLUNITTIMER_INVERVAL	100
 //Guild Skills are shifted to these to make them stick into the skill array.
 //Guild Skills are shifted to these to make them stick into the skill array.
 #define GD_SKILLRANGEMIN 900
 #define GD_SKILLRANGEMIN 900
 #define GD_SKILLRANGEMAX GD_SKILLRANGEMIN+MAX_GUILDSKILL
 #define GD_SKILLRANGEMAX GD_SKILLRANGEMIN+MAX_GUILDSKILL
@@ -7288,21 +7288,22 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
 	switch (sg->unit_id)
 	switch (sg->unit_id)
 	{
 	{
 		case UNT_FIREWALL:
 		case UNT_FIREWALL:
-			{
+			if (tstatus->def_ele == ELE_FIRE || battle_check_undead(tstatus->race, tstatus->def_ele)) {
 				int count=0;
 				int count=0;
-				if (tstatus->def_ele == ELE_FIRE || battle_check_undead(tstatus->race, tstatus->def_ele)) {
-					//This is the best Aegis approximation we can do without 
-					//changing the minimum skill unit interval. [Skotlex]
-					while (count++ < battle_config.firewall_hits_on_undead && src->val2-- && !status_isdead(bl))
-						skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*10,1);
-				} else {
-					skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
-					src->val2--;
-				}
-				if (src->val2<=0)
-					skill_delunit(src);
-			break;
+				//Fire property mobs and Undeads are never knocked back by firewall
+				//Should hit every 20ms [Playtester]
+				while (count++ < battle_config.firewall_hits_on_undead && !status_isdead(bl) && src->val2--)
+					skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*20,1);
+			} else {
+				int count=0;
+				int x = bl->x, y = bl->y;
+				//If mob isn't knocked back it should hit every 20ms [Playtester]
+				while (count++ < battle_config.firewall_hits_on_undead && x == bl->x && y == bl->y && !status_isdead(bl) && src->val2--)
+					skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*20,0);
 			}
 			}
+			if (src->val2<=0)
+				skill_delunit(src);
+			break;
 
 
 		case UNT_SANCTUARY:
 		case UNT_SANCTUARY:
 			if (battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race==RC_DEMON)
 			if (battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race==RC_DEMON)
@@ -7358,12 +7359,22 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
 				case SG_SUN_WARM: //SG skills [Komurka]
 				case SG_SUN_WARM: //SG skills [Komurka]
 				case SG_MOON_WARM:
 				case SG_MOON_WARM:
 				case SG_STAR_WARM:
 				case SG_STAR_WARM:
-					if(bl->type==BL_PC)
+					if(!status_charge(ss, 0, 2)){  //should end when out of sp.
+						sg->limit=DIFF_TICK(tick,sg->tick);
+						break;
+					}
+					else if(bl->type==BL_PC){
 						//Only damage SP [Skotlex]
 						//Only damage SP [Skotlex]
-						status_zap(bl, 0, 60);
-					else if(status_charge(ss, 0, 2))
-						//Otherwise, Knockback attack.
+						status_zap(bl, 0, 15);
+					}
+					else{
+						int count=1;
+						int x = bl->x, y = bl->y;
 						skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
 						skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+						//If mob isn't knocked back it should hit every 20ms [Playtester]
+						while (count++ < battle_config.firewall_hits_on_undead && x == bl->x && y == bl->y && !status_isdead(bl) && status_charge(ss, 0, 2))
+							skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*20,0);
+					}
 				break;
 				break;
 				case WZ_STORMGUST:
 				case WZ_STORMGUST:
 					if (tsc && tsc->data[SC_FREEZE].val4 != sg->group_id)
 					if (tsc && tsc->data[SC_FREEZE].val4 != sg->group_id)
@@ -7620,9 +7631,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
 			break;
 			break;
 
 
 		case UNT_KAENSIN:
 		case UNT_KAENSIN:
-			skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
-			if (--src->val2 <= 0)
-				skill_delunit(src);
+			{
+				int count=0;
+				//Should hit every 20ms [Playtester]
+				while (count++ < battle_config.firewall_hits_on_undead && !status_isdead(bl) && src->val2--)
+					skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*20,0);
+				if (src->val2 <= 0)
+					skill_delunit(src);
+			}
 			break;
 			break;
 	}
 	}