summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-18 02:50:39 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-18 02:50:39 +0000
commit53a59a6135eb43e1db0cf82d0d367e4258ff6b86 (patch)
tree387a862d12692ce458b79f3db8c91321452f9615 /src/map/script.c
parent14593221de9da87afddc5b6fb9e261160f673a7e (diff)
downloadhercules-53a59a6135eb43e1db0cf82d0d367e4258ff6b86.tar.gz
hercules-53a59a6135eb43e1db0cf82d0d367e4258ff6b86.tar.bz2
hercules-53a59a6135eb43e1db0cf82d0d367e4258ff6b86.tar.xz
hercules-53a59a6135eb43e1db0cf82d0d367e4258ff6b86.zip
- Implemented new item and bonuses for Kreiger Von Midgard rewards.
* Execute script on skill (bonusautoscript3) * Add effect on skill (bAddEffOnSkill) * Execute skill on skill (bAutoSpellOnSkill) - Fixed some boxes Rental time according to item descriptions. - Implemented SC_ITEMSCRIPT, a status that gives you temporally the effect of an item. Check items 14597 to 14605 if you want to get the idea. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13596 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 5c1836c97..82c8079d1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6519,11 +6519,13 @@ BUILDIN_FUNC(bonus)
{
case SP_AUTOSPELL:
case SP_AUTOSPELL_WHENHIT:
+ case SP_AUTOSPELL_ONSKILL:
case SP_SKILL_ATK:
case SP_SKILL_HEAL:
case SP_SKILL_HEAL2:
case SP_ADD_SKILL_BLOW:
case SP_CASTRATE:
+ case SP_ADDEFF_ONSKILL:
// these bonuses support skill names
val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
break;
@@ -6547,13 +6549,21 @@ BUILDIN_FUNC(bonus)
pc_bonus3(sd, type, val1, val2, val3);
break;
case 4:
- val2 = script_getnum(st,4);
+ if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
+ val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
+ else
+ val2 = script_getnum(st,4);
+
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
pc_bonus4(sd, type, val1, val2, val3, val4);
break;
case 5:
- val2 = script_getnum(st,4);
+ if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
+ val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
+ else
+ val2 = script_getnum(st,4);
+
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
val5 = script_getnum(st,7);
@@ -6588,7 +6598,7 @@ BUILDIN_FUNC(bonusautoscript)
script = parse_script(str, "autoscript bonus", 0, 0);
if( !script )
return 1;
- if( !pc_autoscript_add(sd->autoscript, ARRAYLENGTH(sd->autoscript), rate, flag, target, script) )
+ if( !pc_autoscript_add(sd->autoscript, ARRAYLENGTH(sd->autoscript), rate, flag, target, script, false) )
{
script_free_code(script);
return 1;
@@ -6616,13 +6626,40 @@ BUILDIN_FUNC(bonusautoscript2)
script = parse_script(str, "autoscript2 bonus", 0, 0);
if (!script)
return 1;
- if (!pc_autoscript_add(sd->autoscript2, ARRAYLENGTH(sd->autoscript2), rate, flag, target, script))
+ if (!pc_autoscript_add(sd->autoscript2, ARRAYLENGTH(sd->autoscript2), rate, flag, target, script, false))
{
script_free_code(script);
return 1;
}
return 0;
}
+/// Bonus script that has a chance of being executed when used a skill
+BUILDIN_FUNC(bonusautoscript3)
+{
+ int rate, skill, target = 0;
+ const char *str;
+ struct script_code *script;
+ TBL_PC* sd;
+
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0;// no player attached, report source
+
+ str = script_getstr(st,2);
+ rate = script_getnum(st,3);
+ skill = ( script_isstring(st,4) ? skill_name2id(script_getstr(st,4)) : script_getnum(st,4) );
+ if( script_hasdata(st,5) )
+ target = script_getnum(st,5);
+ script = parse_script(str, "autoscript3 bonus", 0, 0);
+ if( !script )
+ return 1;
+ if( !pc_autoscript_add(sd->autoscript3, ARRAYLENGTH(sd->autoscript3), rate, skill, target, script, true) )
+ {
+ script_free_code(script);
+ return 1;
+ }
+ return 0;
+}
/// Changes the level of a player skill.
/// <flag> defaults to 1
@@ -13649,10 +13686,11 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(bonus,"iv"),
BUILDIN_DEF2(bonus,"bonus2","ivi"),
BUILDIN_DEF2(bonus,"bonus3","ivii"),
- BUILDIN_DEF2(bonus,"bonus4","iviii"),
- BUILDIN_DEF2(bonus,"bonus5","iviiii"),
+ BUILDIN_DEF2(bonus,"bonus4","ivvii"),
+ BUILDIN_DEF2(bonus,"bonus5","ivviii"),
BUILDIN_DEF(bonusautoscript,"si??"),
BUILDIN_DEF(bonusautoscript2,"si??"),
+ BUILDIN_DEF(bonusautoscript3,"siv?"),
BUILDIN_DEF(skill,"vi?"),
BUILDIN_DEF(addtoskill,"vi?"), // [Valaris]
BUILDIN_DEF(guildskill,"vi"),