summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 74e254333..08e0f518a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1413,14 +1413,16 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
//Reports say that autospell effects get triggered on skills and pretty much everything including splash attacks. [Skotlex]
//But Gravity Patched this silently, and it now seems to trigger only on
//weapon attacks.
- if(sd && !status_isdead(bl) && src != bl && attack_type&BF_WEAPON
-// !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE)
- ) {
+ if(sd && !status_isdead(bl) && src != bl && sd->autospell[0].id) {
struct block_list *tbl;
struct unit_data *ud;
int i, skilllv;
for (i = 0; i < MAX_PC_BONUS && sd->autospell[i].id; i++) {
+ if(!(sd->autospell[i].flag&attack_type&BF_RANGEMASK &&
+ sd->autospell[i].flag&attack_type&BF_WEAPONMASK))
+ continue; //Attack type or range type did not match.
+
skill = (sd->autospell[i].id > 0) ? sd->autospell[i].id : -sd->autospell[i].id;
if (skillnotok(skill, sd))
@@ -1582,7 +1584,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
}
//Trigger counter-spells to retaliate against damage causing skills. [Skotlex]
- if(dstsd && !status_isdead(bl) && src != bl && !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE))
+ if(dstsd && !status_isdead(bl) && src != bl && dstsd->autospell2[0].id &&
+ !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE))
{
struct block_list *tbl;
struct unit_data *ud;
@@ -1590,6 +1593,10 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
for (i = 0; i < MAX_PC_BONUS && dstsd->autospell2[i].id; i++) {
+ if(!(dstsd->autospell2[i].flag&attack_type&BF_RANGEMASK &&
+ dstsd->autospell2[i].flag&attack_type&BF_WEAPONMASK))
+ continue; //Attack type or range type did not match.
+
skillid = (dstsd->autospell2[i].id > 0) ? dstsd->autospell2[i].id : -dstsd->autospell2[i].id;
skilllv = dstsd->autospell2[i].lv?dstsd->autospell2[i].lv:1;
if (skilllv < 0) skilllv = 1+rand()%(-skilllv);