Added script command sc_end_class (#2368)

* Added a new script command sc_end_class to remove status changes from any learned skills.
* Adjusted the custom Reset NPC to make use of this behavior.
Thanks to @sader1992!

* Follow up to f93680b
* Adjusted documentation.

* Follow up to f93680b
* Removed the check from script command resetskill.
* Added a new script command sc_end_class.

* Fixed a compile error
* Corrected the define of the script command.
* Adjusted some documentation.
* Reverted some formatting from the original commit.
Thanks to @sader1992 and @Lemongrass3110!
This commit is contained in:
Aleos 2017-08-25 13:26:22 -04:00 committed by GitHub
parent c9ce29c00e
commit 4539d557e2
3 changed files with 34 additions and 11 deletions

View File

@ -5316,10 +5316,11 @@ Used in reset NPC's (duh!)
---------------------------------------
*sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
*sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
*sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
*sc_end <effect type>{,<GID>};
*sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
*sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
*sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
*sc_end <effect type>{,<GID>};
*sc_end_class {<char_id>};
These commands will bestow a status effect on a character.
@ -5357,6 +5358,9 @@ and theirs val1, val2, val3, and val4 usage in source.
'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
perform a complete removal of all statuses (although permanent ones will re-apply).
'sc_end_class' works like 'sc_end' but will remove all status effects from any learned
skill on the invoking character.
Examples:
// This will poison the invoking character for 10 minutes at 50% chance.
sc_start SC_POISON,600000,0,5000;

View File

@ -1,11 +1,5 @@
//===== rAthena Script =======================================
//= Reset NPC
//===== By: ==================================================
//= rAthena Dev Team
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= Resets skills, stats, or both.
//===== Additional Comments: =================================
@ -15,6 +9,7 @@
//= 1.3 All statuses removed upon skill reset. [Euphy]
//= 1.4 Compressed Script, Added limit use option [Stolao]
//= Changed set -> setarray, Improved text with F_InsertPlural
//= 1.5 Added sc_end_class to reset related status changes [sader1992]
//============================================================
prontera,150,193,4 script Reset Girl 124,{
// Skills, Stats, Both, Limit
@ -44,7 +39,7 @@ prontera,150,193,4 script Reset Girl 124,{
}
set Zeny, Zeny-.@Reset[.@i-1];
if(.@i&1){
sc_end SC_ALL;// TODO make a sc_end current classes sc only
sc_end_class;
ResetSkill;
}
if(.@i&2) ResetStatus;

View File

@ -11319,6 +11319,29 @@ BUILDIN_FUNC(sc_end)
return SCRIPT_CMD_SUCCESS;
}
/**
* Ends all status effects from any learned skill on the attached player.
* sc_end_class {<char_id>};
*/
BUILDIN_FUNC(sc_end_class)
{
struct map_session_data *sd;
uint16 skill_id;
int i;
if (!script_charid2sd(2, sd))
return SCRIPT_CMD_FAILURE;
for (i = 0; i < MAX_SKILL_TREE && (skill_id = skill_tree[pc_class2idx(sd->status.class_)][i].skill_id) > 0; i++) { // Remove status specific to your current tree skills.
enum sc_type sc = status_skill2sc(skill_id);
if (sc > SC_COMMON_MAX && sd->sc.data[sc])
status_change_end(&sd->bl, sc, INVALID_TIMER);
}
return SCRIPT_CMD_SUCCESS;
}
/*==========================================
* @FIXME atm will return reduced tick, 0 immune, 1 no tick
*------------------------------------------*/
@ -23747,6 +23770,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF2(sc_start,"sc_start2","iiii???"),
BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"),
BUILDIN_DEF(sc_end,"i?"),
BUILDIN_DEF(sc_end_class,"?"),
BUILDIN_DEF(getstatus, "i??"),
BUILDIN_DEF(getscrate,"ii?"),
BUILDIN_DEF(debugmes,"s"),