设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 89|回复: 0

[转载发布] DoubleX RMMV Autobattle Bugfix

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8039

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30085
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    39018

    灌水之王

    发表于 5 天前 | 显示全部楼层 |阅读模式
    Purpose
    Lets you fixes leaked side effects bugs when an autobattle actor has skills/items with damage formulae having side effects

    Spoiler: Introduction
    1. In the default RMMV battle system, doing anything other than calculating the skill/item damage in its damage formula can lead to those side effects unintentionally applied to all possible targets of that skill/item if the actor having it is in autobattle mode as its damage formula will be run to have the evaluated damage value for each target in order to determine which usable skill/item should be used to which possible target
    2. This plugin lets you specify a regular expression to use only the desired portions of the damage formula when running the aforementioned evaluation, while still preserving the damage formula as-is when actually executing the action
    3. You should try to standardize the damage formula structure so you can write an easy, simple and small regular expression that can always separate the side effects parts from the damage calculation parts
    Spoiler: Video
    Spoiler: Parameters
                    JavaScript:       
    1. * @param isEnabled
    2. * @type note
    3. * @desc Sets whether this plugin will be enabled
    4. * It'll be the contents of a function returning a Boolean
    5. * @default "return true;"
    6. *
    7. * @param sideEffectFreeDmgFormula
    8. * @type note
    9. * @desc Sets how to pick which damage formula part to use
    10. * It'll be the contents of a function returning a String
    11. * @default "return dmgFormula.replace(new RegExp('.*[};] *', 'gim'), '');"
    复制代码


    Spoiler: Parameter Info
                    JavaScript:       
    1. *    # Function arguments
    2. *      1. isEnabled
    3. *         None
    4. *      2. sideEffectFreeDmgFormula
    5. *         dmgFormula - The original damage formula of the skill/item to be
    6. *                      evaluated when the actor in the autobattle mode
    7. *                      evaluates which skill/item to be used on which target
    8. *    # Valid values
    9. *      1. isEnabled
    10. *         Any valid Javascript(It'll always be regarded as truthy/falsy)
    11. *      2. sideEffectFreeDmgFormula
    12. *         Any valid Javascript returning the damage formula which returns a
    13. *         Number and has no unintended side effects
    14. *    # Examples
    15. *      1. isEnabled
    16. *         Setting isEnabled as
    17. *         return $gameSwitches.value(1);
    18. *         will enable this plugin only if the game switch with id 1 is on
    19. *      2. sideEffectFreeDmgFormula
    20. *         Setting sideEffectFreeDmgFormula as
    21. *         return dmgFormula.replace(new RegExp(.*[};] *, 'gim'), "");
    22. *         will only use the damage formula portion after the last } or ;
    23. *         - The following original damage formula:
    24. *           if ($gameSwitches.value(2)) { b.addState(4); } a.atk * 2 - b.def
    25. *           Will become:
    26. *           a.atk * 2 - b.def
    27. *           Which is a valid damage formula just returning the damage
    28. *         - The following original damage formula:
    29. *           b.addState(4); a.atk * 2 - b.def
    30. *           Will become:
    31. *           a.atk * 2 - b.def
    32. *           Which is a valid damage formula just returning the damage
    33. *         - The following original damage formula:
    34. *           $gameSwitches.value(2)?(b.addState(4);a.atk*4-b.def*2):a.atk*2-b.def
    35. *           Will become:
    36. *           a.atk*4-b.def*2):a.atk*2-b.def
    37. *           Which is syntactically invalid so the new formula won't be run
    复制代码


    Spoiler: Prerequisites
    Abilities:
    1. Little RMMV plugin development proficiency to fully utilize this plugin in intended ways
    Regular Expression Learning Sites:
    1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
    2. https://regex101.com/
    Javascript Sandbox:
    1. https://playcode.io/
    Spoiler: Instructions
    1. The default plugin parameters file name is doubleX rmmv autobattle bugfix v100a
    If you want to change that, you must edit the value of DoubleX_RMMV.Autobattle_Bugfix_File, which must be done via opening this plugin js file directly
    Spoiler: Terms Of Use
    1. Commercial use's always allowed and crediting me's always optional.
    2. You shall keep this plugin's Plugin Info part's contents intact.
    3. You shalln't claim that this plugin's written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you've violated this.
    4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.
    5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you've my permissions not needing follow so.
    6. I always reserve the right to deny you from using this plugin anymore if you've violated any of the above.
    Spoiler: Contributors
    Authors:
    1. DoubleX
    Plugin Development Collaborators:
    - None So Far
    Bug Reporters:
    - None So Far
    Compatibility Issue Raisers:
    - None So Far
    Feature Requesters:
    - None So Far
    Spoiler: Changelog
    v1.00a(GMT 0400 7-Jun-2020)
    1. 1st version of this plugin finished
    Download Link
    Pastebin


    本贴来自国际rpgmaker官方论坛作者:DoubleX处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/doublex-rmmv-autobattle-bugfix.122548/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 10:46 , Processed in 0.130104 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表