summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorPlaytester <Playtester@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-18 16:19:51 +0000
committerPlaytester <Playtester@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-18 16:19:51 +0000
commit0f67020b198c036d79e2bbfad1d9e55e5802721a (patch)
treeaee0e3b71f59eb2edd81e4403aa1d7c73541eb69 /src/map/skill.c
parent01f6ac5ca68d029aefd93481de076ca5eec33864 (diff)
downloadhercules-0f67020b198c036d79e2bbfad1d9e55e5802721a.tar.gz
hercules-0f67020b198c036d79e2bbfad1d9e55e5802721a.tar.bz2
hercules-0f67020b198c036d79e2bbfad1d9e55e5802721a.tar.xz
hercules-0f67020b198c036d79e2bbfad1d9e55e5802721a.zip
* 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11509 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index f3cc9a2c5..659ca6817 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -36,7 +36,7 @@
#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.
#define GD_SKILLRANGEMIN 900
#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)
{
case UNT_FIREWALL:
- {
+ if (tstatus->def_ele == ELE_FIRE || battle_check_undead(tstatus->race, tstatus->def_ele)) {
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:
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_MOON_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]
- 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);
+ //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;
case WZ_STORMGUST:
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;
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;
}