class Window_Base
#--------------------------------------------------------------------------
# ● 生成描绘用的状态字符串
# actor : 角色
# width : 描画目标的宽度
# need_normal : [正常] 是否为必须 (true / false)
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# 获取括号的宽
#brackets_width = self.contents.text_size("[]").width
# 生成状态名字符串
#text = ""
states = []
for i in battler.states
state = $data_states
# 开始判断第二个以后的状态是否定量和之前的相同
break if states.size > 0 && state.rating != states[-1].rating
if $data_states.rating >= 1
states.push(state)
#if text == ""
# text = $data_states.name
#else
# new_text = text + "/" + $data_states.name
# text_width = self.contents.text_size(new_text).width
# if text_width > width - brackets_width
# break
# end
# text = new_text
#end
end
end
# 状态名空的字符串是 "[正常]" 的情况下
#if text == ""
if states.size == 0
if need_normal
text = "[正常]"
end
else
# 加上括号
#text = "[" + text + "]"
# 在所有定量相同的状态的集合中随机抽取一个状态显示
text = "[" + states[rand(states.size)].name + "]"
end
# 返回完成后的文字类
return text
end
end
data_states = load_data("Data/States.rxdata")
data_states[1].rating = 600 # 修改 1 号状态的定量
data_states[2].rating = 30 # 修改 2 号状态的定量
data_states[3].rating = 65535 # 修改 3 号状态的定量
File.open("Data/States.rxdata", "wb") { |fout|
Marshal.dump(data_states, fout)
}
# 在所有定量相同的状态的集合中随机抽取一个状态显示
r = rand(states.size)
text = "[" + states[r].name + "]"
battler.state_anim_id = r
class Game_Battler
attr_accessor :state_anim_id
def state_animation_id
# 一个状态也没被附加的情况下
if @states.size == 0
return 0
end
# 返回概率最大的状态动画 ID
#return $data_states[@states[0]].animation_id
return $data_states[@states[@state_anim_id]].animation_id
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |