* 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
This commit is contained in:
Playtester 2007-10-18 16:19:51 +00:00
parent 613b8a5b65
commit 12f4be5b2e
2 changed files with 44 additions and 21 deletions

View File

@ -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).

View File

@ -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)) { //Fire property mobs and Undeads are never knocked back by firewall
//This is the best Aegis approximation we can do without //Should hit every 20ms [Playtester]
//changing the minimum skill unit interval. [Skotlex] while (count++ < battle_config.firewall_hits_on_undead && !status_isdead(bl) && src->val2--)
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*20,1);
skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*10,1); } else {
} else { int count=0;
skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); int x = bl->x, y = bl->y;
src->val2--; //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--)
if (src->val2<=0) skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*20,0);
skill_delunit(src);
break;
} }
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); status_zap(bl, 0, 15);
else if(status_charge(ss, 0, 2)) }
//Otherwise, Knockback attack. 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) int count=0;
skill_delunit(src); //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;
} }