From 97607005941e41e60a8025c53f585c7927306fd7 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 4 Mar 2007 16:39:30 +0000 Subject: - 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 --- src/map/skill.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/map/skill.c') 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; -- cgit v1.2.3-60-g2f50