Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正 batrec_query 和 expandinventory_adjust 部分情况下没有返回值的问题 #758

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/pandas_script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ NPC名称:
BRA_DISCRETE - 按独立单位进行查询 (可以单独查询宠物/佣兵对记录宿主的(被)攻击记录)

返回值:
返回 -1 表示查无记录, 含 0 正整数表示伤害值
返回 -1 表示查无记录或发生错误, 含 0 正整数表示伤害值

提示信息:
若返回的伤害值是 0, 则表示交互单位和宿主之间发生了没有伤害的技能交互 (比如: 缓速术)
Expand Down Expand Up @@ -3262,7 +3262,7 @@ NPC名称:
setarray .@rate[0],2,6,3,5;

返回值:
成功则返回随机命中的索引序号, 失败则保存并中断脚本的执行
成功则返回随机命中的索引序号, 失败则报错并中断脚本的执行
索引序号将从 0 开始计算, 第一个元素为 0, 第二个元素为 1 以此类推...

用法演示:
Expand Down
5 changes: 4 additions & 1 deletion src/map/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31747,7 +31747,7 @@ BUILDIN_FUNC(unlockcmd) {
* 指令: batrec_query
* 描述: 查询指定单位的战斗记录, 查看与交互目标单位产生的具体记录值
* 用法: batrec_query <记录宿主的单位编号>,<交互目标的单位编号>,<记录类型>{,<聚合规则>};
* 返回: 返回 -1 表示查无记录, 含 0 正整数表示伤害值
* 返回: 返回 -1 表示查无记录或发生错误, 含 0 正整数表示伤害值
* 作者: Sola丶小克
* -----------------------------------------------------------*/
BUILDIN_FUNC(batrec_query) {
Expand All @@ -31761,11 +31761,13 @@ BUILDIN_FUNC(batrec_query) {
int rec_type = script_getnum(st, 4);
if (rec_type != BRT_DMG_RECEIVE && rec_type != BRT_DMG_CAUSE) {
ShowError("%s: The battle record type is not invalid.\n", __func__);
script_pushint(st, -1);
return SCRIPT_CMD_FAILURE;
}

int aggregation = BRA_COMBINE;
if (!script_get_optnum(st, 5, "Aggregation strategy", aggregation, true, BRA_COMBINE)) {
script_pushint(st, -1);
return SCRIPT_CMD_FAILURE;
}

Expand Down Expand Up @@ -32291,6 +32293,7 @@ BUILDIN_FUNC(bonus_script_info) {
BUILDIN_FUNC(expandinventory_adjust) {
TBL_PC* sd = nullptr;
if (!script_rid2sd(sd)) {
script_pushint(st, 0);
return SCRIPT_CMD_FAILURE;
}

Expand Down
Loading