#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
# 欢迎访问www.66RPG.com
# 梦想世界,在你手中
#==============================================================================
#==============================================================================
# 图标显示状态 v1.1
# By 叶子
# 9-30-2007 v1.1
# 修正了描绘状态的一个致命BUG
# 12-31-2005 v1.0
# 重定义类:Window_Base, Window_Help
#==============================================================================
# 脚本功能:
# 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。
# 默认最多同时显示5个状态 108行定义,已改为8
#------------------------------------------------------------------------------
# 设置方法:
# 一个状态对应的图标文件名为“状态的动画ID”
# 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png”或“Icons\50.jpg”
# 如果找不到对应的文件,会报错 ◎_◎
#==============================================================================
# 注意,在ICON_STATE_IDS中写上需要带图标的状态ID
# ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件
# 例如:
# 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8]
# 要20到50号状态带图标:ICON_STATE_IDS = 20..50
ICON_STATE_IDS = 1..999
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘状态
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120) #改动了一下
text = make_battler_state_text(actor, width, true)
text.gsub!(/\[/) { "" }
text.gsub!(/\]/) { "" }
s = text.split("/")
sp = 0
s.each do |i|
bitmap = RPG::Cache.icon("#{i}")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + sp, y, bitmap, src_rect)
sp += cw + 10
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘状态
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 240)
state_size = 0
# buff_idx = 0
#debuff_idx = 0
for state in actor.states
# 图标数量超出宽度就中断循环
if state_size >= 24
break
end
# 此状态不带图标就跳过
if !ICON_STATE_IDS.include?(state)
next
end
bitmap = RPG::Cache.icon($data_states[state].animation_id.to_s)
if actor.states_turn[state] >= $data_states[state].hold_turn/2
opacity = 255
else
opacity = 100
end
# 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24)
# if $data_states[state].name.include?"☆"
# if debuff_idx <= 5
# self.contents.blt(x + 24 * debuff_idx, y + 56, bitmap, Rect.new(0, 0, 24, 24), opacity)
# else
# self.contents.blt(x + 24 * (debuff_idx-5), y +88, bitmap, Rect.new(0, 0, 24, 24), opacity)
#end
#debuff_idx += 1
#else
# if buff_idx <= 5
# self.contents.blt(x + 24 * buff_idx, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
#else
#self.contents.blt(x + 24 * (buff_idx-5), y + 30, bitmap, Rect.new(0, 0, 24, 24), opacity)
#end
#buff_idx += 1
#end
if state_size <= 7
self.contents.blt(x+24 * state_size, y+4, bitmap, Rect.new(0, 0, 24, 24), opacity)
else
self.contents.blt(x+24 * (state_size-5), y+4+30, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
state_size += 1
end
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 设置敌人
# enemy : 要显示名字和状态的敌人
#--------------------------------------------------------------------------
def set_enemy(enemy)
@text = ""
# 描绘敌人名字
set_text(enemy.name, 1)
# 描绘状态图标
state_size = 0
for state in enemy.states
# 图标数量超出宽度就中断循环
if state_size >= 10
break
end
#此状态不带图标就跳过
# if !ICON_STATE_IDS.include?(state)
# next
#end
#bitmap = RPG::Cache.icon($data_states[state].animation_id.to_s)
#if enemy.states_turn[state] >= $data_states[state].hold_turn/2
# opacity = 255
#else
# opacity = 100
#end
#self.contents.blt(108+24 * state_size,0, bitmap, Rect.new(0, 0, 24, 24), opacity)
#state_size += 1
#只显示某些状态的文字
@text +=" "
if $data_states[state].id < 111 or ($data_states[state].id > 800 && $data_states[state].id < 999)
@text += $data_states[state].name.to_s
end
@text +=" "
end # of for
set_text(@text, 0)
#========================================================================
end
end
class Game_Battler
attr_reader :states_turn # 声明状态剩余回合
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
# 欢迎访问www.66RPG.com
# 梦想世界,在你手中
#==============================================================================
enghao_lim 发表于 2021-2-6 02:47
问题描述有点模糊,为啥普通攻击后状态会消失?默认情况状态只有设置被攻击有机会消失,没有印象有砍人也会 ...
238.09 KB, 下载次数: 1
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |