summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-04 16:39:30 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-04 16:39:30 +0000
commit97607005941e41e60a8025c53f585c7927306fd7 (patch)
tree91a93f5f16b7156c60d2d098ba91ab2c11f96842 /src/map/skill.c
parent24989a7e159e88bfa6d5561a4bd2e579cefbe70b (diff)
downloadhercules-97607005941e41e60a8025c53f585c7927306fd7.tar.gz
hercules-97607005941e41e60a8025c53f585c7927306fd7.tar.bz2
hercules-97607005941e41e60a8025c53f585c7927306fd7.tar.xz
hercules-97607005941e41e60a8025c53f585c7927306fd7.zip
- Added the +20hit that were missing the NPC elemental attack skills.
- Added support for autospells using "a random skill level". The last value of bonus4 bAutoSpell is used for determining this as well as the target. &1 is to cast on target (otherwise cast on self), and &2 is to use a random level UP to the level specified in the script (otherwise always cast the specified level) - Updated item_bonus.txt with the documentation for the bAutoSpell/bAutoSpellWhenHit changes. - Corrected @refresh not reupdating the basic stat bonuses. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9952 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 1b06c355a..8e792f604 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1408,7 +1408,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
if (skillnotok(skill, sd))
continue;
- skilllv = (sd->autospell[i].lv > 0) ? sd->autospell[i].lv : 1;
+ skilllv = sd->autospell[i].lv?sd->autospell[i].lv:1;
+ if (skilllv < 0) skilllv = 1+rand()%(-skilllv);
+
rate = (!sd->state.arrow_atk) ? sd->autospell[i].rate : sd->autospell[i].rate / 2;
if (rand()%1000 > rate)
@@ -1569,12 +1571,12 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
struct unit_data *ud;
int i, skillid, skilllv, rate;
- for (i = 0; i < MAX_PC_BONUS; i++) {
- if (dstsd->autospell2[i].id == 0)
- break;
+ for (i = 0; i < MAX_PC_BONUS && dstsd->autospell2[i].id; i++) {
skillid = (dstsd->autospell2[i].id > 0) ? dstsd->autospell2[i].id : -dstsd->autospell2[i].id;
- skilllv = (dstsd->autospell2[i].lv > 0) ? dstsd->autospell2[i].lv : 1;
+ skilllv = dstsd->autospell2[i].lv?dstsd->autospell2[i].lv:1;
+ if (skilllv < 0) skilllv = 1+rand()%(-skilllv);
+
rate = ((sd && !sd->state.arrow_atk) || (status_get_range(src)<=2)) ?
dstsd->autospell2[i].rate : dstsd->autospell2[i].rate / 2;