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

[转载发布] State Slip Skills

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

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-26 16:20:28 | 显示全部楼层 |阅读模式
    State Slip Skills
    by
    MobiusXVI



    Release Notes
    Sep 2014 - v. 1.0 Initial Release
    Oct 2014 - v. 1.5 Improved DBS Integration
    Feb 2020 - v. 1.6 Improved compatibility with other scripts
    Jul 2020 - v. 1.7 Fixed obscure bug where "regen" type skills appeared to damage rather than heal
    Oct 2024 - v. 1.8 Fixed bug preventing equipment auto states from working


    Introduction
        The purpose of the script is to allow you to set skills to replace the default slip damage formula. This allows you to create interesting poison-type skills and also easily create regen-type skills.

    Features
        - Create as many custom states as you want!
        - Use the old (and awful) slip damage formula if you really want to.
        - Create states that need the caster alive to maintain them.

    How to Use
         Copy the script into the script editor below the default scripts but above Main. Follow the instructions and configuration guidance within the script itself.


    Script

    Spoiler                Code:       
    1. #===============================================================================
    2. # State Slip Skills
    3. # Author: Mobius XVI
    4. # Version: 1.8
    5. # Date: 18 OCT 2024
    6. #===============================================================================
    7. #
    8. # Introduction:
    9. #
    10. #   The purpose of this script is to allow you to set skills to replace
    11. #   the default slip damage formula
    12. #
    13. # Instructions:
    14. #
    15. #  - Place this script below all the default scripts but above main
    16. #
    17. #  - In the configuration section below, set up which states will call
    18. #    a skill in place of default slip damage. The format is very simple:
    19. #    'State_ID' => 'Skill_ID', (without quotes)
    20. #    Be sure each line ends in a comma, and make sure all of your lines
    21. #    are in between the two curly brackets, i.e. { and }
    22. #
    23. #  - Lastly, in the database, check the box for 'slip damage' for any
    24. #    state that you set up in the configuration section. If you don't,
    25. #    the script won't call a skill.
    26. #
    27. #  - There are also a few more options described in detail in the
    28. #    configuration section below, so be sure to check those out.
    29. #
    30. #  - One last thing, if you want to use the default slip damage for
    31. #    anything, simply check the 'slip damage' box in the database but
    32. #    don't configure anything below and the script will use the default
    33. #    formula.
    34. #
    35. # Issues/Bugs/Possible Bugs:
    36. #
    37. #   - This script heavily modifies Game_Battler, and my cause bugs in
    38. #     in other custom battle systems.
    39. #
    40. #  Credits/Thanks:
    41. #    - Mobius XVI, author
    42. #    - TheRiotInside, for requesting it
    43. #    - Roninator2, for helping to improve compatibility
    44. #    - Fred_than_dead, for finding an obscure bug
    45. #    - garbiMestolo, for finding an obvious bug
    46. #
    47. #  License
    48. #    The MIT License (MIT)
    49. #
    50. #    Copyright (c) 2024 darmes
    51. #
    52. #  Permission is hereby granted, free of charge, to any person obtaining a copy
    53. #  of this software and associated documentation files (the "Software"), to deal
    54. #  in the Software without restriction, including without limitation the rights
    55. #  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    56. #  copies of the Software, and to permit persons to whom the Software is
    57. #  furnished to do so, subject to the following conditions:
    58. #
    59. #  The above copyright notice and this permission notice shall be included in all
    60. #  copies or substantial portions of the Software.
    61. #
    62. #  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    63. #  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    64. #  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    65. #  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    66. #  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    67. #  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    68. #  SOFTWARE.
    69. #
    70. #    Further, if you do decide to use this script in a commercial product,
    71. #    I'd ask that you let me know via a forum post or a PM. Thanks.
    72. #
    73. #===============================================================================
    74. #                             CONFIGURATION
    75. #===============================================================================
    76. module Mobius
    77.   module State_Slip_Skills
    78.     States_to_Skills = {
    79.                         # The following is an example
    80.                         # that links slip damage on state #21
    81.                         # to call skill #1
    82.                         21 => 1,
    83.                         }
    84.     # Setting this option to "true" causes the skill to track changes
    85.     # to the original caster, i.e. if the caster get buffed then
    86.     # the skill will cause more damage per turn or if the caster gets
    87.     # debuffed the skill will cause less damage.
    88.     # Setting this to "false" will cause the skill to take a snapshot
    89.     # of the original caster, i.e. the skill will deal the same damage
    90.     # each turn (with variance) regardless of what happens to the caster.
    91.     Allow_Changes = true
    92.     # >This option only works if "Allow_Changes" is set to true<
    93.     # >This option only effects skills that are set in States_to_Skills<
    94.     # Setting this option to "true" causes states to be removed when
    95.     # the original caster dies.
    96.     # Setting this option to false will allow states to remain even
    97.     # if the original caster dies.
    98.     End_State_on_Actor_Death = true
    99.   end
    100. end
    101. #===============================================================================
    102. # ** State Slip Skills - EDIT BELOW THIS LINE AT OWN RISK
    103. #===============================================================================
    104. #--------------------------------------------------------------------------
    105. # Changes to class Game_Battler
    106. #--------------------------------------------------------------------------
    107. class Game_Battler
    108.   # Alias old methods
    109.   alias mobius_state_slip_initialize       initialize
    110.   alias mobius_state_slip_add_state        add_state
    111.   alias mobius_state_slip_remove_state     remove_state
    112.   alias mobius_state_slip_attack_effect    attack_effect
    113.   alias mobius_state_slip_skill_effect     skill_effect
    114.   alias mobius_state_slip_damage_effect    slip_damage_effect
    115.   # New methods
    116.   #--------------------------------------------------------------------------
    117.   # * New Public Instance Variables
    118.   #--------------------------------------------------------------------------
    119.   attr_reader                       :animation_queue
    120.   #--------------------------------------------------------------------------
    121.   # * Initialize - adds new variables for tracking states
    122.   #--------------------------------------------------------------------------
    123.   def initialize
    124.     mobius_state_slip_initialize
    125.     @attacker = nil                 # Variable for temp storing attacker
    126.     @states_attacker = {}           # Variable for linking states to attacker
    127.     @animation_queue = []           # Variable for queuing animations
    128.   end
    129.   #--------------------------------------------------------------------------
    130.   # * Add State -  Links applied state to caster/actor that caused it
    131.   #--------------------------------------------------------------------------
    132.   def add_state(state_id, force = false)
    133.     # Get result of old method (returns nil if ineffective)
    134.     result = mobius_state_slip_add_state(state_id, force)
    135.     # If effective, link state_id to current attacker
    136.     if result
    137.        unless @attacker == nil
    138.         if Mobius::State_Slip_Skills::Allow_Changes
    139.           @states_attacker[state_id] = @attacker
    140.         else
    141.           @states_attacker[state_id] = @attacker.clone
    142.         end
    143.       end
    144.     end
    145.     # Pass result to caller
    146.     result
    147.   end
    148.   #--------------------------------------------------------------------------
    149.   # * Remove State - Removes associated caster/actor link
    150.   #--------------------------------------------------------------------------
    151.   def remove_state(state_id, force = false)
    152.     # Get result of old method (returns nil if ineffective)
    153.     result = mobius_state_slip_remove_state(state_id, force)
    154.     # If effective, remove state_id from @states_attacker hash
    155.     if result
    156.       @states_attacker.delete(state_id)
    157.     end
    158.     # Pass result to caller
    159.     result
    160.   end
    161.   #--------------------------------------------------------------------------
    162.   # * Attack Effect - Stores attacker in local variable for linking to state
    163.   #--------------------------------------------------------------------------
    164.   def attack_effect(attacker)
    165.     # temporarily store value of attacker
    166.     @attacker = attacker
    167.     # call original method
    168.     mobius_state_slip_attack_effect(attacker)
    169.     # reset value of attacker
    170.     @attacker = nil
    171.     # attack effect needs to return true to caller
    172.     return true
    173.   end
    174.   #--------------------------------------------------------------------------
    175.   # * Skill Effect - Stores attacker in local variable for linking to state
    176.   #--------------------------------------------------------------------------
    177.   def skill_effect(attacker, skill)
    178.     # temporarily store value of attacker
    179.     @attacker = attacker
    180.     # skill effect return 'effective' to caller
    181.     effective = mobius_state_slip_skill_effect(attacker, skill)
    182.     # reset value of attacker
    183.     @attacker = nil
    184.     # pass value of 'effectve' back to original caller
    185.     return effective
    186.   end
    187.   #--------------------------------------------------------------------------
    188.   # * Slip Damage Effect - drastically overhauled
    189.   #    Now checks for states that are linked to skills and calls those
    190.   #    skills up with an associated caster/actor. It will also store the
    191.   #    results of the skill for display at a later time.
    192.   #    If state is not set up that way, method calls original method
    193.   #--------------------------------------------------------------------------
    194.   def slip_damage_effect
    195.     for state_id in @states
    196.       # If an applied state has slip damage
    197.       if $data_states[state_id].slip_damage
    198.         # Check if state has associated skill
    199.         if skill_id = Mobius::State_Slip_Skills::States_to_Skills[state_id]
    200.           # Check if state has associated attacker
    201.           if skill_attacker = @states_attacker[state_id]
    202.             # Check if End_State option is true and actor is dead
    203.             if Mobius::State_Slip_Skills::End_State_on_Actor_Death and
    204.                skill_attacker.dead?
    205.                # Remove state
    206.                self.remove_state(state_id)
    207.                # Go to next state
    208.                next
    209.             end
    210.             # Call skill with attacker
    211.             skill = $data_skills[skill_id]
    212.             last_hp = self.hp
    213.             effective = self.skill_effect(skill_attacker, skill)
    214.             # Set animation info
    215.             add_animation_to_queue(skill.animation2_id,
    216.                                    self.damage,
    217.                                    self.critical)
    218.             # Restore HP so it can be deducted when animation plays
    219.             if self.damage.is_a?(Numeric)
    220.               actual_damage = (last_hp - self.hp)
    221.               self.hp += actual_damage
    222.             end
    223.           end
    224.         # If state not set with skill, use old slip damage effect
    225.         else
    226.           mobius_state_slip_damage_effect
    227.         end
    228.       end
    229.     end
    230.   end
    231.   #--------------------------------------------------------------------------
    232.   # New methods that allow for queuing damage animations
    233.   # Data structure - Array of arrays with sub arrays containing:
    234.   # [animation_id, damage, critical]
    235.   #--------------------------------------------------------------------------
    236.   # * Add Animation to Queue - adds an animation to the queue
    237.   #--------------------------------------------------------------------------
    238.   def add_animation_to_queue(id, dam, crit)
    239.     arr = [id, dam, crit]
    240.     @animation_queue.push(arr)
    241.   end
    242.   #--------------------------------------------------------------------------
    243.   # * Set Up Animation - Sets up new queued animation data
    244.   #--------------------------------------------------------------------------
    245.   def set_up_queued_animation
    246.     # Get animation data
    247.     arr = @animation_queue[0]
    248.     # Ensure it's not nil
    249.     if arr
    250.       # Set all parameters
    251.       self.animation_id = arr[0]
    252.       self.damage = arr[1]
    253.       self.animation_hit = (self.damage != "Miss")
    254.     end
    255.   end
    256.   #--------------------------------------------------------------------------
    257.   # * Unqueue Animation - Removes queued animation and plays damage pop
    258.   #--------------------------------------------------------------------------
    259.   def unqueue_animation
    260.     # Get animation data
    261.     arr = @animation_queue.shift
    262.     # Ensure it's not nil
    263.     if arr
    264.       # Set all parameters
    265.       self.damage = arr[1]
    266.       self.critical = arr[2]
    267.       self.damage_pop = true
    268.       # If damage is a number, i.e. not "Miss"
    269.       if self.damage.is_a?(Numeric)
    270.         # Deal the damage here, so that the timing is right
    271.         self.hp -= self.damage
    272.       end
    273.     end
    274.   end
    275.   #--------------------------------------------------------------------------
    276.   # * Animation Queued? - returns whether there are animations waiting
    277.   #--------------------------------------------------------------------------
    278.   def animation_queued?
    279.     return ( not (@animation_queue.empty?) )
    280.   end
    281. end # class Game_Battler end
    282. #--------------------------------------------------------------------------
    283. # Changes to class Scene_Battle
    284. #--------------------------------------------------------------------------
    285. class Scene_Battle
    286.   # alias old methods
    287.   alias mobius_state_slip_update_phase4_step1     update_phase4_step1
    288.   #--------------------------------------------------------------------------
    289.   # * Update Phase 4 - Method branches phase 4 to different steps
    290.   #    Added steps 'slip1' and 'slip2'
    291.   #--------------------------------------------------------------------------
    292.   def update_phase4
    293.     case @phase4_step
    294.     when 1
    295.       update_phase4_step1
    296.     when 2
    297.       update_phase4_step2
    298.     when 3
    299.       update_phase4_step3
    300.     when 4
    301.       update_phase4_step4
    302.     when 5
    303.       update_phase4_step5
    304.     when 6
    305.       update_phase4_step6
    306.     when "slip1"
    307.       update_phase4_slip1
    308.     when "slip2"
    309.       update_phase4_slip2
    310.     end
    311.   end
    312.   #--------------------------------------------------------------------------
    313.   # * Update Phase 4 Slip 1 - Plays state animation on target
    314.   #--------------------------------------------------------------------------
    315.   def update_phase4_slip1
    316.     # Animation for target
    317.     @active_battler.set_up_queued_animation
    318.     # Animation has at least 8 frames, regardless of its length
    319.     @wait_count = 8
    320.     # Shift to step slip2
    321.     @phase4_step = "slip2"
    322.   end
    323.   #--------------------------------------------------------------------------
    324.   # * Update Phase 4 Slip 2 - Plays damage pop on target
    325.   #--------------------------------------------------------------------------
    326.   def update_phase4_slip2
    327.     # Display damage
    328.     @active_battler.unqueue_animation
    329.     # Refresh status window
    330.     @status_window.refresh
    331.     # Check if additional animations to show
    332.     if @active_battler.animation_queued?
    333.       # Shift to step slip1
    334.       @phase4_step = "slip1"
    335.     else
    336.       # Shift to step 2
    337.       @phase4_step = 2
    338.     end
    339.   end
    340.   #--------------------------------------------------------------------------
    341.   # * Update Phase 4 Step 1 - After old method runs, checks if there are
    342.   #    animations to play and if there are, then it unsets the damage pop
    343.   #--------------------------------------------------------------------------
    344.   def update_phase4_step1
    345.     # Call old method
    346.     result = mobius_state_slip_update_phase4_step1
    347.     # Check that the active battler is valid and animations are waiting
    348.     if result and @active_battler.animation_queued?
    349.         # Set damage pop to false
    350.         @active_battler.damage_pop = false
    351.         # Shift to slip phase
    352.         @phase4_step = "slip1"
    353.     end
    354.   end
    355. end # class Scene_Battle end
    复制代码







    FAQ
    Q. Can this do _______?
    A. Maybe! Leave a post on the forum, and I might just add the feature if it can't already do it.

    Credits and Thanks
    - MobiusXVI, author
    - TheRiotInside, for requesting it
    - Roninator2, for helping to improve compatibility
    - Fred_than_dead, for finding an obscure bug
    - garbiMestolo, for finding an obvious bug

    License
    This script is licensed under the MIT license, so you can use it for both commercial and non-commercial games!

    See the full license in the script header for notice requirements.


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-4 12:48 , Processed in 0.068363 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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