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

[转载发布] KSwap XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    4471

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 前天 13:40 | 显示全部楼层 |阅读模式
    KSwap XP

    by Kyonides Arkanthes



    Introduction

    Did you ever want to swap actors' skills or enemies' actions?
    Or perhaps you failed to swap actor's weapons or enemies' atk attribute on you own.
    If so, you would also need to be able to nullify such skills, don't you think?

    Then you will be glad to find out that this scriptlet will make it possible!


    The Script

                    Ruby:        
    1. # * KSwap XP
    2. #   Scripter : Kyonides Arkanthes
    3. #   2022-01-04
    4. # Swap the Skills of your Enemies!
    5. # Heroes can swap the foes' ATK parameters.
    6. # Monsters can also swap the heroes' Weapons at will!
    7. # There is also a Nullify Swaps skill as well!
    8. # Check the KSwap module and edit the CONSTANTS accordingly.
    9. # You can prevent the party from casting the "Skill Swap" skill by turning on
    10. # a specific game switch.
    11. # * Aliased Methods * #
    12. # Game_Battler#skill_effect(user, skill)
    13. # Game_Actor#skill_can_use?(skill_id)
    14. # Game_Enemy#atk and actions
    15. # Scene_Battle#start_phase5
    16. module KSwap
    17.   # If Switch is ON, then the player can't cast them
    18.   BOSS_BATTLE_SWITCH_ID = 1
    19.   # [ Weapon Swap ID, Skill Swap ID, Nullify Swaps ID ]
    20.   SKILL_IDS = [81, 82, 83]
    21.   # Add Skill IDs that will be forbidden during Boss Battles
    22.   FORBIDDEN_SKILL_IDS = [81, 82]
    23.   # * END OF SETTINGS SECTION * #
    24.   extend self
    25.   def clear_all
    26.     @weapons = nil
    27.     @skills = nil
    28.   end
    29.   def weapon_skill_id() SKILL_IDS[0] end
    30.   def skill_id() SKILL_IDS[1] end
    31.   def nullify_skill_id() SKILL_IDS[2] end
    32.   attr_accessor :weapons, :skills
    33. end
    34. class Array
    35.   def simple_shuffle
    36.     ary = []
    37.     size.times do |n|
    38.       elem = self[n]
    39.       case rand(6)
    40.       when 0,2,4 then ary.unshift(elem)
    41.       when 1,3,5 then ary.push(elem)
    42.       end
    43.     end
    44.     ary.compact
    45.   end
    46. end
    47. class Game_Battler
    48.   alias :kyon_swap_skill_fx :skill_effect
    49.   def skill_effect(user, skill)
    50.     case skill.id
    51.     when KSwap.weapon_skill_id
    52.       return false unless rand(100) < user.hit
    53.       team.auto_swap_weapons
    54.       return true
    55.     when KSwap.skill_id
    56.       return false unless rand(100) < user.hit
    57.       team.auto_swap_skills
    58.       return true
    59.     when KSwap.nullify_skill_id
    60.       return false unless rand(100) < user.hit
    61.       team.nullify_swap
    62.     end
    63.     kyon_swap_skill_fx(user, skill)
    64.   end
    65. end
    66. class Game_Actor
    67.   attr_writer :skills, :weapon_id
    68.   alias :kyon_swap_gm_actor_skill_use? :skill_can_use?
    69.   def skill_can_use?(skid)
    70.     switch = KSwap::BOSS_BATTLE_SWITCH_ID
    71.     skill_ids = KSwap::FORBIDDEN_SKILL_IDS
    72.     return false if $game_switches[switch] and skill_ids.include?(skid)
    73.     kyon_swap_gm_actor_skill_use?(skid)
    74.   end
    75.   def team() $game_party end
    76. end
    77. class Game_Enemy
    78.   alias :kyon_swap_gm_nmy_actions :actions
    79.   alias :kyon_swap_gm_nmy_base_atk :base_atk
    80.   def alter_actions() $data_enemies[@alter_id].actions end
    81.   def alter_atk() $data_enemies[@atk_id].atk end
    82.   def base_atk
    83.     @atk_id ? alter_atk : kyon_swap_gm_nmy_base_atk
    84.   end
    85.   def actions
    86.     @alter_id ? alter_actions : kyon_swap_gm_nmy_actions
    87.   end
    88.   def team() $game_troop end
    89.   attr_writer :atk_id, :alter_id
    90. end
    91. class Game_Party
    92.   def auto_swap_weapons
    93.     KSwap.weapons ||= @actors.map{|a| a.weapon_id }
    94.     lotto = KSwap.weapons.simple_shuffle
    95.     @actors.each{|a| a.weapon_id = lotto.shift }
    96.   end
    97.   def auto_swap_skills
    98.     KSwap.skills ||= @actors.map{|a| a.skills }
    99.     lotto = KSwap.skills.simple_shuffle
    100.     @actors.each{|a| a.skills = lotto.shift }
    101.   end
    102.   def nullify_swap
    103.     list = KSwap.weapons
    104.     @actors.each{|a| a.weapon_id = list.shift } if list
    105.     list = KSwap.skills
    106.     @actors.each{|a| a.skills = list.shift } if list
    107.     KSwap.clear_all
    108.   end
    109. end
    110. class Game_Troop
    111.   def ids() @enemies.map{|e| e.id } end
    112.   def auto_swap_weapons
    113.     lotto = ids.simple_shuffle
    114.     @enemies.each{|a| a.atk_id = lotto.shift }
    115.   end
    116.   def auto_swap_skills
    117.     lotto = ids.simple_shuffle
    118.     @enemies.each{|e| e.alter_id = lotto.shift }
    119.   end
    120.   def nullify_swap
    121.     @enemies.each do |e|
    122.       e.atk_id = nil
    123.       e.alter_id = nil
    124.     end
    125.   end
    126. end
    127. class Scene_Battle
    128.   alias :kyon_swap_scn_bttl_start_ph5 :start_phase5
    129.   def start_phase5
    130.     $game_party.nullify_swap
    131.     kyon_swap_scn_bttl_start_ph5
    132.   end
    133. end
    复制代码


    Side Notes

    As far as I know it is compatible with the Default XP Battle System and those that barely modify it.

    Terms & Conditions

    Mention my nickname in your game credits scene.
    Free for non commercial games. Contact me if you want to go commercial.
    That's all, folks!



    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kswap-xp.143621/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 17:57 , Processed in 0.136465 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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