赞 | 274 |
VIP | 0 |
好人卡 | 3 |
积分 | 496 |
经验 | 40966 |
最后登录 | 2024-9-22 |
在线时间 | 1920 小时 |
Lv5.捕梦者
- 梦石
- 10
- 星屑
- 39592
- 在线时间
- 1920 小时
- 注册时间
- 2010-11-14
- 帖子
- 3320
|
简单写的,你可以看一下。
module CLD99 module Config # 是否固定状态绘制的起始位置 STATES_FIX_POS = false # 固定状态绘制的起始位置时,X坐标位置 STATES_X = 100 # 是否固定状态绘制的宽度 STATES_FIX_WIDTH = false # 留给状态的最大宽度 STATES_WIDTH = 100 # 状态的绘制间隔 STATE_MARGIN = 24 # 状态与血条的间隔 STATE_PADDING = 8 # 留给血条的宽度 GAUGE_WIDTH = 60 # 血条与弱点的间隔 GAUGE_PADDING = 8 # 当属性伤害到达多少倍时视作弱点属性 ELEMENT_RATIO = 1.5 # 弱点的绘制间隔 ELEMENT_MARGIN = 24 # 属性アイコン設定 [なし, 物理, 吸収, 炎, 氷, 雷, 水, 大地, 風, 神聖, 暗黒] # iconのindexを上記の順に指定してください。 ELEMENT_ICONS = [0, 15, 10, 96, 97, 98, 99, 100, 101, 102, 103] end end class Window_BattleEnemy include CLD99::Config alias draw_all_items_for_states_cld99 draw_all_items def draw_all_items begin if STATES_FIX_POS @_state_x = STATES_X else @_state_x = $game_troop.alive_members.map { |m| self.text_size(m.name).width }.max + 24 end if STATES_FIX_WIDTH @_state_width = STATES_WIDTH else @_state_width = $game_troop.alive_members.map { |m| [m.states.size - 1, (STATES_WIDTH - 24) / STATE_MARGIN].min }.max * STATE_MARGIN + 24 end rescue @_state_x = STATES_X @_state_width = STATES_WIDTH end draw_all_items_for_states_cld99 end alias draw_item_for_states_cld99 draw_item def draw_item(index) draw_item_for_states_cld99(index) draw_item_states(index) draw_item_gauge(index) draw_item_weak(index) end def draw_item_states(index) return if $game_troop.alive_members.size < 1 if STATES_FIX_POS x = STATES_X else x = $game_troop.alive_members.map { |m| self.text_size(m.name).width }.max + 24 end @_state_x = x enemy = $game_troop.alive_members[index] rect = item_rect(index) states = enemy.state_icons + enemy.buff_icons states.each_with_index do |n, i| break if x + 24 > @_state_x + STATES_WIDTH draw_icon(n, x, rect.y) x += STATE_MARGIN end end def draw_item_gauge(index) return if $game_troop.alive_members.size < 1 x = @_state_x + @_state_width + STATE_PADDING enemy = $game_troop.alive_members[index] rect = item_rect(index) text_rect = text_size(enemy.hp.to_s) draw_gauge(x, rect.y, GAUGE_WIDTH, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2) change_color(hp_color(enemy)) draw_text(x + GAUGE_WIDTH - text_rect.width, rect.y, text_rect.width, text_rect.height, enemy.hp) change_color(normal_color) end def draw_item_weak(index) return if $game_troop.alive_members.size < 1 x = @_state_x + @_state_width + STATE_PADDING + GAUGE_WIDTH + GAUGE_PADDING inc = 0 enemy = $game_troop.alive_members[index] rect = item_rect(index) width = rect.width - x 1.upto($data_system.elements.size) do |i| break if inc + 24 > width next unless enemy.element_rate(i) >= ELEMENT_RATIO draw_icon(ELEMENT_ICONS[i], x + inc, rect.y) inc += ELEMENT_MARGIN end end end
module CLD99
module Config
# 是否固定状态绘制的起始位置
STATES_FIX_POS = false
# 固定状态绘制的起始位置时,X坐标位置
STATES_X = 100
# 是否固定状态绘制的宽度
STATES_FIX_WIDTH = false
# 留给状态的最大宽度
STATES_WIDTH = 100
# 状态的绘制间隔
STATE_MARGIN = 24
# 状态与血条的间隔
STATE_PADDING = 8
# 留给血条的宽度
GAUGE_WIDTH = 60
# 血条与弱点的间隔
GAUGE_PADDING = 8
# 当属性伤害到达多少倍时视作弱点属性
ELEMENT_RATIO = 1.5
# 弱点的绘制间隔
ELEMENT_MARGIN = 24
# 属性アイコン設定 [なし, 物理, 吸収, 炎, 氷, 雷, 水, 大地, 風, 神聖, 暗黒]
# iconのindexを上記の順に指定してください。
ELEMENT_ICONS = [0, 15, 10, 96, 97, 98, 99, 100, 101, 102, 103]
end
end
class Window_BattleEnemy
include CLD99::Config
alias draw_all_items_for_states_cld99 draw_all_items
def draw_all_items
begin
if STATES_FIX_POS
@_state_x = STATES_X
else
@_state_x = $game_troop.alive_members.map { |m|
self.text_size(m.name).width
}.max + 24
end
if STATES_FIX_WIDTH
@_state_width = STATES_WIDTH
else
@_state_width = $game_troop.alive_members.map { |m|
[m.states.size - 1, (STATES_WIDTH - 24) / STATE_MARGIN].min
}.max * STATE_MARGIN + 24
end
rescue
@_state_x = STATES_X
@_state_width = STATES_WIDTH
end
draw_all_items_for_states_cld99
end
alias draw_item_for_states_cld99 draw_item
def draw_item(index)
draw_item_for_states_cld99(index)
draw_item_states(index)
draw_item_gauge(index)
draw_item_weak(index)
end
def draw_item_states(index)
return if $game_troop.alive_members.size < 1
if STATES_FIX_POS
x = STATES_X
else
x = $game_troop.alive_members.map { |m| self.text_size(m.name).width }.max + 24
end
@_state_x = x
enemy = $game_troop.alive_members[index]
rect = item_rect(index)
states = enemy.state_icons + enemy.buff_icons
states.each_with_index do |n, i|
break if x + 24 > @_state_x + STATES_WIDTH
draw_icon(n, x, rect.y)
x += STATE_MARGIN
end
end
def draw_item_gauge(index)
return if $game_troop.alive_members.size < 1
x = @_state_x + @_state_width + STATE_PADDING
enemy = $game_troop.alive_members[index]
rect = item_rect(index)
text_rect = text_size(enemy.hp.to_s)
draw_gauge(x, rect.y, GAUGE_WIDTH, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(hp_color(enemy))
draw_text(x + GAUGE_WIDTH - text_rect.width, rect.y, text_rect.width, text_rect.height, enemy.hp)
change_color(normal_color)
end
def draw_item_weak(index)
return if $game_troop.alive_members.size < 1
x = @_state_x + @_state_width + STATE_PADDING + GAUGE_WIDTH + GAUGE_PADDING
inc = 0
enemy = $game_troop.alive_members[index]
rect = item_rect(index)
width = rect.width - x
1.upto($data_system.elements.size) do |i|
break if inc + 24 > width
next unless enemy.element_rate(i) >= ELEMENT_RATIO
draw_icon(ELEMENT_ICONS[i], x + inc, rect.y)
inc += ELEMENT_MARGIN
end
end
end
通过设置也可以固定状态的X值
|
评分
-
查看全部评分
|