summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-07-02 12:51:05 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-07-02 12:51:05 +0000
commit4cd7e3cac14b8d8caccd385b806e286bc18a9340 (patch)
tree18ea70fed482017dd3089b660e4a5b838c18cee2
parent9463bf2e1b9afd636b9b7a69b5511817d3c66337 (diff)
downloadhercules-4cd7e3cac14b8d8caccd385b806e286bc18a9340.tar.gz
hercules-4cd7e3cac14b8d8caccd385b806e286bc18a9340.tar.bz2
hercules-4cd7e3cac14b8d8caccd385b806e286bc18a9340.tar.xz
hercules-4cd7e3cac14b8d8caccd385b806e286bc18a9340.zip
* Updated autobonus [Inkfish]
- added documentation for autobonus. - invoke status_calc_pc to complete autobonus execution and this will refresh client display as well. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13922 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--doc/script_commands.txt57
-rw-r--r--src/map/pc.c7
-rw-r--r--src/map/skill.c6
4 files changed, 45 insertions, 29 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 544019286..1f4ce47d9 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+09/07/02
+ * Updated autobonus [Inkfish]
+ - added documentation for autobonus.
+ - invoke status_calc_pc after execution so that client display gets refreshed if neccessary.
09/06/30
* Fixed when dynamic_mobs is active, reloading script right after the last player having left a map leads to permanet mobs not spawning on that map. [Inkfish]
09/06/29
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index a57a261bd..e67aaf601 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -128,6 +128,8 @@
//= Changed the error behaviour of delitem/delitem2/Zeny. [FlavioJS]
//= 3.25.20081220
//= Extended the behaviour of duplicates (warps/shops/cashshops). [FlavioJS]
+//= 3.26.20090702
+//= Replaced 'bonusautoscript' by 'autobonus'. [Inkfish]
//=========================================================
This document is a reference manual for all the scripting commands and functions
@@ -4502,42 +4504,55 @@ kind in 'doc/item_bonus.txt'.
---------------------------------------
-*bonusautoscript <script>,<rate>{,<flag>}
-*bonusautoscript2 <script>,<rate>{,<flag>}
+*autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
+*autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
+*autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
+*autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
These commands are meant to be used in item scripts. They will probably work
outside item scripts, but the bonus will not persist for long. They, as
expected, refer only to an invoking character.
What these commands do is 'attach' a script to the player which will get
-executed on attack (or when attacked in the case of bonusautoscript2). Rate is
-the trigger rate of the script (1000 = 100%). The optional argument flag is
-used to classify the type of attack where the script can trigger (it shares
-the same flags as the bAutoSpell bonus script):
+executed on attack (or when attacked in the case of autobonus2).
+
+Rate is the trigger rate of the script (1000 = 100%).
+
+Duration is the time that the bonus will last for since the script has triggered.
+
+The optional argument 'flag' is used to classify the type of attack where the script
+can trigger (it shares the same flags as the bAutoSpell bonus script):
Range criteria:
- BF_SHORT: Trigger on melee attack
- BF_LONG: Trigger on ranged attack
- Default: BF_SHORT+BF_LONG
+ BF_SHORT: Trigger on melee attack
+ BF_LONG: Trigger on ranged attack
+ Default: BF_SHORT+BF_LONG
Attack type criteria:
BF_WEAPON: Trigger on weapon skills
- BF_MAGIC: Trigger on magic skills
- BF_MISC: Trigger on misc skills
- Default: BF_WEAPON
+ BF_MAGIC: Trigger on magic skills
+ BF_MISC: Trigger on misc skills
+ Default: BF_WEAPON
Skill criteria:
BF_NORMAL: Trigger on normal attacks
- BF_SKILL: Trigger on skills
- default: If the attack type is BF_WEAPON (only) BF_NORMAL is used, otherwise
- BF_SKILL+BF_NORMAL is used.
+ BF_SKILL: Trigger on skills
+ default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
+ otherwise BF_SKILL+BF_NORMAL is used.
+
+The difference between the optional argument 'other script' and the 'bonus script' is that,
+the former one triggers only when attacking(or attacked) and the latter one runs on
+status calculation as well, which makes sure, within the duration, the "bonus" that get
+lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
+"bonus" command only. And we usually use 'other script' to show visual effects.
-In both cases, when the script triggers, the attached player will be the one
-who holds the bonus. There is currently no way of knowing within this script
-who was the other character (the attacker in autoscript2, or the target in
-autoscript).
+In all cases, when the script triggers, the attached player will be the one
+who holds the bonus. There is currently no way of knowing within this script
+who was the other character (the attacker in autobonus2, or the target in
+autobonus and autobonus3).
//Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
-//using weapon or misc attacks (both melee and ranged skills).
- bonusautoscript "{ sc_start SC_INCALLSTATUS,10000,10; }",10,BF_WEAPON|BF_MISC;
+//using weapon or misc attacks (both melee and ranged skills) and shows a special
+//effect when the bonus is active.
+ autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
---------------------------------------
diff --git a/src/map/pc.c b/src/map/pc.c
index 7b9a0dd4e..6c2bffeb8 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1655,13 +1655,16 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
nullpo_retr(0, sd);
nullpo_retr(0, autobonus);
- if( autobonus->bonus_script )
- run_script(autobonus->bonus_script,0,sd->bl.id,0);
if( autobonus->other_script )
+ {
+ sd->state.autocast = 1;
run_script(autobonus->other_script,0,sd->bl.id,0);
+ sd->state.autocast = 0;
+ }
autobonus->active = add_timer(gettick()+autobonus->duration, pc_endautobonus, sd->bl.id, (intptr)autobonus);
sd->state.autobonus |= autobonus->pos;
+ status_calc_pc(sd,0);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 6c6bb0cf0..637253834 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1056,9 +1056,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
sd->autobonus[i].atk_type&attack_type&BF_RANGEMASK &&
sd->autobonus[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- sd->state.autocast = 1;
pc_exeautobonus(sd,&sd->autobonus[i]);
- sd->state.autocast = 0;
}
}
@@ -1140,9 +1138,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s
continue;
if( sd->autobonus3[i].atk_type != skillid )
continue;
- sd->state.autocast = 1;
pc_exeautobonus(sd,&sd->autobonus3[i]);
- sd->state.autocast = 0;
}
}
@@ -1333,9 +1329,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
dstsd->autobonus2[i].atk_type&attack_type&BF_RANGEMASK &&
dstsd->autobonus2[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- dstsd->state.autocast = 1;
pc_exeautobonus(dstsd,&dstsd->autobonus2[i]);
- dstsd->state.autocast = 0;
}
}