summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-19 20:31:57 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-19 20:31:57 +0000
commit9a83b5ad626f8bfd4011277173e8bf385e4971fe (patch)
treefac179a5bb93199cf5f0314ff21e935d7da47b72 /src/map/skill.c
parentca003ef941f7a039a4251f28d0a60b61de66f186 (diff)
downloadhercules-9a83b5ad626f8bfd4011277173e8bf385e4971fe.tar.gz
hercules-9a83b5ad626f8bfd4011277173e8bf385e4971fe.tar.bz2
hercules-9a83b5ad626f8bfd4011277173e8bf385e4971fe.tar.xz
hercules-9a83b5ad626f8bfd4011277173e8bf385e4971fe.zip
- Added bonusautoscript and bonusautoscript2. These are used to attach a script to a player which gets executed on attack (or when attacked). Required for several of the more recent items.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11519 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 2db05ed82..ab9368820 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1508,6 +1508,22 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
}
}
+ //Auto-script when attacking
+ if(sd && src != bl && sd->autoscript[0].script) {
+ int i;
+ for (i = 0; i < ARRAYLENGTH(sd->autoscript) && sd->autoscript[i].script; i++) {
+
+ if(!(sd->autoscript[i].flag&attack_type&BF_WEAPONMASK &&
+ sd->autoscript[i].flag&attack_type&BF_RANGEMASK &&
+ sd->autoscript[i].flag&attack_type&BF_SKILLMASK))
+ continue; // one or more trigger conditions were not fulfilled
+ if (rand()%1000 > sd->autoscript[i].rate)
+ continue;
+ run_script(sd->autoscript[i].script,0,sd->bl.id,0);
+ break; //Have only one script execute at a time.
+ }
+ }
+
//Polymorph
if(sd && sd->classchange && attack_type&BF_WEAPON &&
dstmd && !(tstatus->mode&MD_BOSS) &&
@@ -1683,6 +1699,24 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
break; //trigger only one auto-spell per hit.
}
}
+ //Auto-script when attacked
+ if(dstsd && !status_isdead(bl) && src != bl && dstsd->autoscript2[0].script &&
+ !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE))
+ {
+ int i;
+ for (i = 0; i < ARRAYLENGTH(dstsd->autoscript2) && dstsd->autoscript2[i].script; i++) {
+
+ if(!(dstsd->autoscript2[i].flag&attack_type&BF_WEAPONMASK &&
+ dstsd->autoscript2[i].flag&attack_type&BF_RANGEMASK &&
+ dstsd->autoscript2[i].flag&attack_type&BF_SKILLMASK))
+ continue; // one or more trigger conditions were not fulfilled
+ if (rand()%1000 > dstsd->autoscript2[i].rate)
+ continue;
+ run_script(dstsd->autoscript2[i].script,0,dstsd->bl.id,0);
+ break; //Have only one script execute at a time.
+ }
+ }
+
return 0;
}
/*=========================================================================