查看: 841|回复: 6

[有事请教] 战斗行动想把弱点击破改到攻击的下面,请问怎么改?

[复制链接]
梦石
0
星屑
719
在线时间
124 小时
注册时间
2024-4-13
回帖
25
发表于 2024-7-12 17:02:00 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

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

×
本帖最后由 chen12311 于 2024-7-12 17:09 编辑

[pre lang="ruby"]module Text
  TEXT="弱点击破"
  SKILL_ID=27
  SRECH_ID=2#ID判断是否为进攻
end
#获得技能ID
class Game_Action
  def rout?
    if Text::SRECH_ID==2
      p '空'
    else
      item == $data_skills[subject.rout_skill_id]
    end
  end
  def set_rout
    set_skill(subject.rout_skill_id)
    self
  end
end
class Game_BattlerBase
  def rout_skill_id
    return Text::SKILL_ID
  end
#判定技能使用
  def rout_usable?
    usable?($data_skills[rout_skill_id])
  end
end
class Window_ActorCommand < Window_Command
  def add_rout_command
    add_command(Vocab::rout, :rout, @actor.rout_usable?)
  end
end
class Scene_Battle < Scene_Base
  def command_rout
    if Text::SRECH_ID==2
      BattleManager.actor.input.set_rout
      next_command
    else
      BattleManager.actor.input.set_rout
      select_enemy_selection
    end
  end
end
#以上为技能选项的前台,不能显示选项
class Game_Temp
  attr_accessor :battle_rout
  alias initialize_battle_rout initialize
  def initialize
    initialize_battle_rout
    @battle_equip = false   
  end
end
class Window_ActorCommand < Window_Command
  def add_rout_command
    add_command([Text::TEXT, nil], :rout, true)
  end
  alias make_command_list_rout make_command_list
  def make_command_list
    make_command_list_rout
    add_rout_command
  end
  def set_up(a)
    @actor=a
    clear_command_list
    make_command_list
    refresh
    select(0)
    activate
    open
  end
end

class Scene_Battle < Scene_Base
  alias create_all_windows_rout create_all_windows
  def create_all_windows
    create_all_windows_rout
  end
  alias create_actor_command_window_rout create_actor_command_window
  def create_actor_command_window
    create_actor_command_window_rout
    @actor_command_window.set_handler(:rout, method(:command_rout))
  end
  def on_enemy_ok
    BattleManager.actor.input.target_index = @enemy_window.enemy.index
    @enemy_window.hide
    @skill_window.hide
    @item_window.hide
    next_command
  end
  #--------------------------------------------------------------------------
  # ● 敌人“取消”
  #--------------------------------------------------------------------------
  alias rout_on_enemy_cancel on_enemy_cancel
  def on_enemy_cancel
    case @actor_command_window.current_symbol
    when :rout
      @actor_command_window.activate
    end
    rout_on_enemy_cancel
  end
end
[/pre]
好累,想摸鱼.......
梦石
0
星屑
2859
在线时间
661 小时
注册时间
2012-5-3
回帖
76

开拓者

发表于 2025-3-4 14:24:35 | 显示全部楼层

  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
复制代码

你试试看,帮你调整了一下。
回复

使用道具 举报

梦石
0
星屑
719
在线时间
124 小时
注册时间
2024-4-13
回帖
25
 楼主| 发表于 2025-3-4 15:15:24 | 显示全部楼层
邱小谦 发表于 2025-3-4 14:24
你试试看,帮你调整了一下。

这个帖子其实已经有人帮忙改了,但因为回档了所以。。。。
好累,想摸鱼.......
回复

使用道具 举报

梦石
0
星屑
2859
在线时间
661 小时
注册时间
2012-5-3
回帖
76

开拓者

发表于 2025-3-4 15:18:54 | 显示全部楼层
chen12311 发表于 2025-3-4 15:15
这个帖子其实已经有人帮忙改了,但因为回档了所以。。。。

没关系,就当我练手了。
回复 1 0

使用道具 举报

梦石
0
星屑
1966
在线时间
112 小时
注册时间
2017-9-5
回帖
157
发表于 2025-3-4 15:54:17 | 显示全部楼层
邱小谦 发表于 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
回复 1 0

使用道具 举报

梦石
0
星屑
2859
在线时间
661 小时
注册时间
2012-5-3
回帖
76

开拓者

发表于 2025-3-4 16:16:27 | 显示全部楼层
间桐樱 发表于 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
复制代码

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

点评

我拿小怪试了试,确实打不死,谢谢大佬  发表于 2025-3-4 16:24
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部