summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-14 14:07:25 +0000
committerepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-14 14:07:25 +0000
commitc0d762eba9f73c6eb239cd100e32270e44b5fb2d (patch)
tree9610818c0afa7da908fc89b86f9946760603d3d2 /src/map/skill.c
parentcbe6d3dd387bd86beb1c521e686a1f8b8c52c5c3 (diff)
downloadhercules-c0d762eba9f73c6eb239cd100e32270e44b5fb2d.tar.gz
hercules-c0d762eba9f73c6eb239cd100e32270e44b5fb2d.tar.bz2
hercules-c0d762eba9f73c6eb239cd100e32270e44b5fb2d.tar.xz
hercules-c0d762eba9f73c6eb239cd100e32270e44b5fb2d.zip
- Added new check conditions to prevent abuse from no-delay .act files (bugreport:4249)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15105 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 973e38bf7..137af795f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -433,6 +433,15 @@ int skillnotok (int skillid, struct map_session_data *sd)
if( skillid == AL_TELEPORT && sd->skillitem == skillid && sd->skillitemlv > 2 )
return 0; // Teleport lv 3 bypasses this check.[Inkfish]
+ // Epoque:
+ // This code will compare the player's attack motion value which is influenced by ASPD before
+ // allowing a skill to be cast. This is to prevent no-delay ACT files from spamming skills such as
+ // AC_DOUBLE which do not have a skill delay and are not regarded in terms of attack motion.
+ if( sd->canskill_tick && DIFF_TICK(gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (100 + battle_config.skill_amotion_leniency) / 100) )
+ {// attempted to cast a skill before the attack motion has finished
+ return 1;
+ }
+
if (sd->blockskill[i] > 0)
return 1;
@@ -3832,15 +3841,21 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
}
map_freeblock_unlock();
-
+
if( sd && !(flag&1) )
- {
- if( sd->state.arrow_atk ) //Consume arrow on last invocation to this skill.
+ {// ensure that the skill last-cast tick is recorded
+ sd->canskill_tick = gettick();
+
+ if( sd->state.arrow_atk )
+ {// consume arrow on last invocation to this skill.
battle_consume_ammo(sd, skillid, skilllv);
+ }
+
+ // perform auto-cast routines and skill requirement consumption
skill_onskillusage(sd, bl, skillid, tick);
skill_consume_requirement(sd,skillid,skilllv,2);
}
-
+
return 0;
}
@@ -7090,9 +7105,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
if( sd && !(flag&1) )
- {
- if( sd->state.arrow_atk ) //Consume arrow on last invocation to this skill.
+ {// ensure that the skill last-cast tick is recorded
+ sd->canskill_tick = gettick();
+
+ if( sd->state.arrow_atk )
+ {// consume arrow on last invocation to this skill.
battle_consume_ammo(sd, skillid, skilllv);
+ }
+
+ // perform auto-cast routines and skill requirement consumption
skill_onskillusage(sd, bl, skillid, tick);
skill_consume_requirement(sd,skillid,skilllv,2);
}
@@ -8078,9 +8099,15 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
status_change_end(src, SC_MAGICPOWER, INVALID_TIMER);
if( sd )
- {
- if( sd->state.arrow_atk && !(flag&1) ) //Consume arrow if a ground skill was not invoked. [Skotlex]
+ {// ensure that the skill last-cast tick is recorded
+ sd->canskill_tick = gettick();
+
+ if( sd->state.arrow_atk && !(flag&1) )
+ {// consume arrow if this is a ground skill
battle_consume_ammo(sd, skillid, skilllv);
+ }
+
+ // perform auto-cast routines and skill requirement consumption
skill_onskillusage(sd, NULL, skillid, tick);
skill_consume_requirement(sd,skillid,skilllv,2);
}