设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2405|回复: 2
打印 上一主题 下一主题

[已经解决] TOMO的状态详细确认窗口和MOG的ATB制混用问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
867
在线时间
194 小时
注册时间
2019-4-11
帖子
56
跳转到指定楼层
1
发表于 2021-2-19 04:37:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 sxjkjly8010 于 2021-2-19 07:45 编辑

考虑到ATB需要素材问题就直接用上一次帖子的工程吧,和上一次帖子的压缩包内容是没有变的,可以直接在那个工程插入这个脚本
上一次帖子https://rpg.blue/thread-484706-1-1.html
RUBY 代码复制
  1. # 状态详细确认窗口
  2. #
  3. # 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
  4. # を追加します。
  5.  
  6. $imported_yana_scripts ||= {}
  7. $imported_yana_scripts["StateHelpWindow"] = true
  8.  
  9. module StateHelp
  10.   Buffs = {}
  11.   States = []
  12.  
  13. # 请按照下面的描写进行备注
  14.  
  15.   Buffs[[0,:up]] = "HPの強化効果\n最大10段階"
  16.   Buffs[[1,:up]] = "MPの強化効果\n最大10段階"
  17.   Buffs[[2,:up]] = "攻撃力の強化効果\n最大10段階"
  18.   Buffs[[3,:up]] = "防御力の強化効果\n最大10段階"
  19.   Buffs[[4,:up]] = "魔法力の強化効果\n最大10段階"
  20.   Buffs[[5,:up]] = "魔法防御の強化効果\n最大10段階"
  21.   Buffs[[6,:up]] = "敏捷の強化効果\n最大10段階"
  22.   Buffs[[7,:up]] = "運の強化効果\n最大10段階"
  23.  
  24.   Buffs[[0,:down]] = "HPの弱体効果\n最大5段階"
  25.   Buffs[[1,:down]] = "MPの弱体効果\n最大5段階"
  26.   Buffs[[2,:down]] = "攻撃力の弱体効果\n最大5段階"
  27.   Buffs[[3,:down]] = "防御力の弱体効果\n最大5段階"
  28.   Buffs[[4,:down]] = "魔法力の弱体効果\n最大5段階"
  29.   Buffs[[5,:down]] = "魔法防御の弱体効果\n最大5段階"
  30.   Buffs[[6,:down]] = "敏捷の弱体効果\n最大5段階"
  31.   Buffs[[7,:down]] = "運の弱体効果\n最大5段階"
  32.  
  33.   States[1]  = "戦闘不能\nHPが0になり、すべての行動ができない。"
  34.   States[2]  = "毒\n毎ターン、最大HPの5%のダメージを受ける。"
  35.   States[3]  = "暗闇\n物理命中率が40%低下する。"
  36.   States[4]  = "沈黙\n魔法に属するコマンドが使用できなくなる。"
  37.   States[5]  = "混乱\n混乱し、敵味方の区別なく攻撃を繰り出す。"
  38.   States[6]  = "睡眠\n行動できない、狙われ率が上がって回避が下がる。"
  39.   States[7]  = "麻痺\n40%の確率で行動できない。回避が下がる"
  40.   States[8]  = "スタン\nスタンしてしまって行動できない状態。"
  41.   States[9]  = "防御\n被ダメージを減少する"
  42.   States[10] = "石化\n行動できない。回避と防御、狙われ率が下がる"
  43.   States[36] = "自身5回合内敏捷+50%,命中率+20%。"
  44.  
  45.  
  46. end
  47.  
  48. class Game_BattlerBase
  49.   attr_reader :buffs
  50. end
  51.  
  52. class Window_State < Window_Selectable
  53.   def initialize(help_window)
  54.     super(0,0,32,32)
  55.     self.x = [Graphics.width / 2 - self.width / 2,0].max
  56.     self.y = 65#[Graphics.height / 2 - self.height / 2,help_window.height].max - 91
  57.     self.openness = 0
  58.     @help_window = help_window
  59.     refresh
  60.   end
  61.   def all_battle_members;($game_party.battle_members + $game_troop.members).select{|m| m.exist? };end
  62.   def row_max;all_battle_members.size;end
  63.   def col_max
  64.     m = all_battle_members.max_by{|a| a.state_icons.size + a.buff_icons.size }
  65.     [m.state_icons.size + m.buff_icons.size,1].max
  66.   end
  67.   def item_max;row_max*col_max;end
  68.   def item_height; line_height + 2 ; end
  69.   def item_width; line_height + 2 ; end
  70.  
  71.   def fitting_window #位置修正
  72.     self.height = item_height * row_max - standard_padding*4
  73.     self.width = 144+(col_max*item_width) + standard_padding*2
  74.     self.x = [Graphics.width / 2 - self.width / 2,0].max
  75.     self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max - 28
  76.   end
  77.   def refresh
  78.     fitting_window
  79.     make_data
  80.     create_contents
  81.     all_battle_members.each_with_index{|a,i|
  82.       draw_actor_name(a,0,i*item_height+1)
  83.       draw_text(128,i*item_height+1,20,line_height,":")
  84.       draw_icons(a, 144, i*item_height+1, contents.width - 144)
  85.     }
  86.   end
  87.  
  88.   def draw_icons(subject, x, y, width = 96)
  89.     icons = (subject.state_icons + subject.buff_icons)[0, width / item_width]
  90.     icons.each_with_index {|n, i| draw_icon(n, x + item_width * i, y) }
  91.   end
  92.  
  93.   def item_rect(index)
  94.     rect = Rect.new
  95.     rect.width = item_width
  96.     rect.height = item_height
  97.     rect.x = index % col_max * item_width + 143
  98.     rect.y = index / col_max * item_height
  99.     rect
  100.   end
  101.  
  102.   def update_help
  103.     @help_window.set_text(description)
  104.   end
  105.  
  106.   def make_data
  107.     @data = all_battle_members.inject([]){|r,m|
  108.       a = []
  109.       a += m.states.select{|st| st.icon_index != 0 }
  110.       bf = []
  111.       m.buffs.each_with_index{|b,i| bf.push([i,b > 0 ? :up : :down]) if b != 0}
  112.       a += bf
  113.       a += Array.new(col_max - a.size){nil} if col_max > a.size
  114.       r += a
  115.     }
  116.   end
  117.  
  118.   def description
  119.     return "" unless @data[index]
  120.     if @data[index].is_a?(Array)
  121.       return StateHelp::Buffs[@data[index]]
  122.     else
  123.       return StateHelp::States[@data[index].id]
  124.     end
  125.   end
  126.   def cursor_down(wrap = false)
  127.     return if @data.compact.empty?
  128.     loop do
  129.       select((index + col_max) % item_max)
  130.       break if @data[index]
  131.     end
  132.   end
  133.   def cursor_up(wrap = false)
  134.     return if @data.compact.empty?
  135.     loop do
  136.       select((index - col_max + item_max) % item_max)
  137.       break if @data[index]
  138.     end
  139.   end
  140.   def cursor_right(wrap = false)
  141.     return if @data.compact.empty?
  142.     loop do
  143.       select((index + 1) % item_max)
  144.       break if @data[index]
  145.     end
  146.   end
  147.   def cursor_left(wrap = false)
  148.     return if @data.compact.empty?
  149.     loop do
  150.       select((index - 1 + item_max) % item_max)
  151.       break if @data[index]
  152.     end
  153.   end
  154.   def smooth_select
  155.     return select(0) if @data.compact.empty?
  156.     @data.each_with_index{|d,i|
  157.       if d
  158.         select(i)
  159.         return
  160.       end
  161.     }
  162.   end
  163. end
  164.  
  165. class Window_PartyCommand < Window_Command
  166.   alias _ex_state_make_command_list make_command_list
  167.   def make_command_list
  168.     _ex_state_make_command_list
  169.     add_command("状态",  :state)
  170.   end
  171. end
  172.  
  173. class Scene_Battle < Scene_Base
  174.   alias _ex_state_create_all_windows create_all_windows
  175.   def create_all_windows
  176.     _ex_state_create_all_windows
  177.     create_state_window
  178.   end
  179.   alias _ex_state_create_party_command_window create_party_command_window
  180.   def create_party_command_window
  181.     _ex_state_create_party_command_window
  182.     @party_command_window.set_handler(:state, method(:command_state))
  183.   end
  184.  
  185.   def create_state_window
  186.     @state_window = Window_State.new(@help_window)
  187.     @state_window.set_handler(:ok,  method(:command_state_cancel))
  188.     @state_window.set_handler(:cancel, method(:command_state_cancel))
  189.     @state_window.unselect
  190.   end
  191.  
  192.   def command_state
  193.     @party_command_window.deactivate
  194.     @state_window.refresh
  195.     @state_window.open.activate.smooth_select
  196.     @help_window.show
  197.   end
  198.  
  199.   def command_state_cancel
  200.     @state_window.deactivate.close.unselect
  201.     @party_command_window.activate
  202.     @help_window.hide
  203.   end
  204. end

实在对不起最近问的问题可能有点多,还请大佬高抬贵手提供帮助……其实之前自己尝试照抄代码添加一个窗口来显示敌人信息也是这种问题,一按就会闪现一下窗口,然后一秒不到就消失了,然后立即开始行动,实在是看不懂代码,一开始以为是ATB里的skip_command?的问题,后来发现不是这里,明明技能道具窗口都不会跳,怎么这个就会跳?明明都是Window_Selectable啊?这ATB到底是改了什么才导致这种问题呢?RPG知道对方和自身的状态什么效果是很重要的一个东西……果然还是需要解决这个问题

Lv5.捕梦者

梦石
0
星屑
24252
在线时间
5036 小时
注册时间
2016-3-8
帖子
1618
2
发表于 2021-2-19 07:45:53 | 只看该作者
  1. class Scene_Battle < Scene_Base
  2.   
  3.   alias state_window_active_base_window_active? base_window_active?
  4.   def base_window_active?
  5.     return true if @state_window.active
  6.     state_window_active_base_window_active?
  7.   end
  8.   
  9.   alias state_window_active_set_atb_type_wait set_atb_type_wait
  10.   def set_atb_type_wait
  11.     return true if @state_window.active
  12.     state_window_active_set_atb_type_wait
  13.   end
  14.   
  15. end
复制代码

评分

参与人数 1+1 收起 理由
sxjkjly8010 + 1 认可答案

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
867
在线时间
194 小时
注册时间
2019-4-11
帖子
56
3
 楼主| 发表于 2021-2-19 07:47:40 | 只看该作者

真的解决了!感谢大佬帮助
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 00:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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