Project1

标题: 战斗行动想把弱点击破改到攻击的下面,请问怎么改? [打印本页]

作者: chen12311    时间: 2024-7-12 17:02
标题: 战斗行动想把弱点击破改到攻击的下面,请问怎么改?
本帖最后由 chen12311 于 2024-7-12 17:09 编辑

RUBY 代码复制
  1. module Text
  2.   TEXT="弱点击破"
  3.   SKILL_ID=27
  4.   SRECH_ID=2#ID判断是否为进攻
  5. end
  6. #获得技能ID
  7. class Game_Action
  8.   def rout?
  9.     if Text::SRECH_ID==2
  10.       p '空'
  11.     else
  12.       item == $data_skills[subject.rout_skill_id]
  13.     end
  14.   end
  15.   def set_rout
  16.     set_skill(subject.rout_skill_id)
  17.     self
  18.   end
  19. end
  20. class Game_BattlerBase
  21.   def rout_skill_id
  22.     return Text::SKILL_ID
  23.   end
  24. #判定技能使用
  25.   def rout_usable?
  26.     usable?($data_skills[rout_skill_id])
  27.   end
  28. end
  29. class Window_ActorCommand < Window_Command
  30.   def add_rout_command
  31.     add_command(Vocab::rout, :rout, @actor.rout_usable?)
  32.   end
  33. end
  34. class Scene_Battle < Scene_Base
  35.   def command_rout
  36.     if Text::SRECH_ID==2
  37.       BattleManager.actor.input.set_rout
  38.       next_command
  39.     else
  40.       BattleManager.actor.input.set_rout
  41.       select_enemy_selection
  42.     end
  43.   end
  44. end
  45. #以上为技能选项的前台,不能显示选项
  46. class Game_Temp
  47.   attr_accessor :battle_rout
  48.   alias initialize_battle_rout initialize
  49.   def initialize
  50.     initialize_battle_rout
  51.     @battle_equip = false   
  52.   end
  53. end
  54. class Window_ActorCommand < Window_Command
  55.   def add_rout_command
  56.     add_command([Text::TEXT, nil], :rout, true)
  57.   end
  58.   alias make_command_list_rout make_command_list
  59.   def make_command_list
  60.     make_command_list_rout
  61.     add_rout_command
  62.   end
  63.   def set_up(a)
  64.     @actor=a
  65.     clear_command_list
  66.     make_command_list
  67.     refresh
  68.     select(0)
  69.     activate
  70.     open
  71.   end
  72. end
  73.  
  74. class Scene_Battle < Scene_Base
  75.   alias create_all_windows_rout create_all_windows
  76.   def create_all_windows
  77.     create_all_windows_rout
  78.   end
  79.   alias create_actor_command_window_rout create_actor_command_window
  80.   def create_actor_command_window
  81.     create_actor_command_window_rout
  82.     @actor_command_window.set_handler(:rout, method(:command_rout))
  83.   end
  84.   def on_enemy_ok
  85.     BattleManager.actor.input.target_index = @enemy_window.enemy.index
  86.     @enemy_window.hide
  87.     @skill_window.hide
  88.     @item_window.hide
  89.     next_command
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 敌人“取消”
  93.   #--------------------------------------------------------------------------
  94.   alias rout_on_enemy_cancel on_enemy_cancel
  95.   def on_enemy_cancel
  96.     case @actor_command_window.current_symbol
  97.     when :rout
  98.       @actor_command_window.activate
  99.     end
  100.     rout_on_enemy_cancel
  101.   end
  102. end

作者: 邱小谦    时间: 2025-3-4 14:24

  1. module Text
  2.   TEXT="弱点击破"  # Ruby中字符串需要保留双引号,此处保持原样
  3.     SKILL_ID=27
  4.     SRECH_ID=2#ID判断是否为进攻
  5. end
  6. #获得技能ID
  7. class Game_Action
  8.   def rout?
  9.     if Text::SRECH_ID==2
  10.       p '空'
  11.     else
  12.       item == $data_skills[subject.rout_skill_id]
  13.     end
  14.   end
  15.   def set_rout
  16.     set_skill(subject.rout_skill_id)
  17.     self
  18.   end
  19. end
  20. class Game_BattlerBase
  21.   def rout_skill_id
  22.     return Text::SKILL_ID
  23.   end
  24. #判定技能使用
  25.   def rout_usable?
  26.     usable?($data_skills[rout_skill_id])
  27.   end
  28. end





  29. class Window_ActorCommand < Window_Command
  30.   def add_rout_command
  31.     add_command(Vocab::rout, :rout, @actor.rout_usable?)
  32.   end
  33. end
  34. class Scene_Battle < Scene_Base
  35.   def command_rout
  36.     if Text::SRECH_ID==2
  37.       BattleManager.actor.input.set_rout
  38.       next_command
  39.     else
  40.       BattleManager.actor.input.set_rout
  41.       select_enemy_selection
  42.     end
  43.   end
  44. end
  45. #以上为技能选项的前台,不能显示选项
  46. class Game_Temp
  47.   attr_accessor :battle_rout
  48.   alias initialize_battle_rout initialize
  49.   def initialize
  50.     initialize_battle_rout
  51.     @battle_equip = false   
  52.   end
  53. end
  54. class Window_ActorCommand < Window_Command
  55.   def add_rout_command
  56.       add_command([Text::TEXT], :rout, true)  # 保持数组结构但移除nil
  57.     end
  58.   alias make_command_list_rout make_command_list
  59.   
  60.   
  61.   
  62.   def make_command_list
  63.       make_command_list_rout
  64.       # 在原始指令列表中找到攻击指令的位置
  65.       attack_index = @list.find_index { |cmd| cmd[:symbol] == :attack }
  66.        # 在攻击指令后插入弱点击破
  67.           if attack_index
  68.               rout_command = { name: [Text::TEXT], symbol: :rout, enabled: true }  # 保持数组结构
  69.               @list.insert(attack_index + 1, rout_command)
  70.           else
  71.               add_rout_command
  72.           end
  73.           # 移除最后自动添加的弱点击破指令(如果有)
  74.           @list.delete_if { |cmd| cmd[:symbol] == :rout && cmd != rout_command }
  75.         end
  76.         
  77.         
  78.         
  79.         
  80.   def set_up(a)
  81.     @actor=a
  82.     clear_command_list
  83.     make_command_list
  84.     refresh
  85.     select(0)
  86.     activate
  87.     open
  88.   end
  89. end

  90. class Scene_Battle < Scene_Base
  91.   alias create_all_windows_rout create_all_windows
  92.   def create_all_windows
  93.     create_all_windows_rout
  94.   end
  95.   alias create_actor_command_window_rout create_actor_command_window
  96.   def create_actor_command_window
  97.     create_actor_command_window_rout
  98.     @actor_command_window.set_handler(:rout, method(:command_rout))
  99.   end
  100.   def on_enemy_ok
  101.     BattleManager.actor.input.target_index = @enemy_window.enemy.index
  102.     @enemy_window.hide
  103.     @skill_window.hide
  104.     @item_window.hide
  105.     next_command
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 敌人“取消”
  109.   #--------------------------------------------------------------------------
  110.   alias rout_on_enemy_cancel on_enemy_cancel
  111.   def on_enemy_cancel
  112.     case @actor_command_window.current_symbol
  113.     when :rout
  114.       @actor_command_window.activate
  115.     end
  116.     rout_on_enemy_cancel
  117.   end
  118. end
复制代码

你试试看,帮你调整了一下。
作者: chen12311    时间: 2025-3-4 15:15
邱小谦 发表于 2025-3-4 14:24
你试试看,帮你调整了一下。

这个帖子其实已经有人帮忙改了,但因为回档了所以。。。。
作者: 邱小谦    时间: 2025-3-4 15:18
chen12311 发表于 2025-3-4 15:15
这个帖子其实已经有人帮忙改了,但因为回档了所以。。。。

没关系,就当我练手了。
作者: 间桐樱    时间: 2025-3-4 15:54
邱小谦 发表于 2025-3-4 15:18
没关系,就当我练手了。


大佬大佬,你在的话我想问个问题,我怎么在脚本里指定敌人免疫某个状态。
例如,死神(enemy.id == 444)本身没有死亡概念(death_state_id),只有像魔王那样被封印才能结束战斗,但我这边又能技能神圣净化,无论好坏【2-999】状态全解除,怎么直接在脚本里直接指定死神免疫死亡
  #--------------------------------------------------------------------------
  # ● 获取免疫状态数组
  #--------------------------------------------------------------------------
  def state_resist_set
    features_set(FEATURE_STATE_RESIST)
  end
  #--------------------------------------------------------------------------
  # ● 判定状态是否免疫
  #--------------------------------------------------------------------------
  def state_resist?(state_id)
    state_resist_set.include?(state_id)
  end
作者: 邱小谦    时间: 2025-3-4 16:16
间桐樱 发表于 2025-3-4 15:54
大佬大佬,你在的话我想问个问题,我怎么在脚本里指定敌人免疫某个状态。
例如,死神(enemy.id == 444)本 ...
  1. #--------------------------------------------------------------------------
  2. # ● 获取免疫状态数组【新增死亡状态免疫】
  3. #--------------------------------------------------------------------------
  4. def state_resist_set
  5.   base = features_set(FEATURE_STATE_RESIST)
  6.   # 当敌人ID为444时,强制追加死亡状态免疫
  7.   base += [death_state_id] if self.is_a?(Game_Enemy) && self.enemy_id == 444
  8.   base
  9. end
复制代码

我这边没办法具体测试你那边的情况,反正我正常攻击敌人怎么都死不了,你用你的工程试试,不行再说。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1