From 94e745cce4166dea9b34b617cf66b14cfa1faab1 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 17 Apr 2007 15:43:40 +0000 Subject: - Expanded the autospell structure to hold a flag, which contains the required Battle Flag conditions required for a skill to trigger. - Added the required constants to const.txt to specify the autospell trigger properties. - Added bonus5 bAutoSpell/bAutoSpellWhenHit. The new parameter is used to specify when the spell should trigger (melee/range + weapon/magic/misc attack), see item_bonus for details. - Applied use of packet 0x28a (clif_changeoption2) to transmit opt3 changes. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10278 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/skill.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/map/skill.c') 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); -- cgit v1.2.3-70-g09d2