#==============================================================================
# â– Window_Base
#------------------------------------------------------------------------------
#  ゲームä¸ã®ã™ã¹ã¦ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ã‚¹ãƒ¼ãƒ‘ークラスã§ã™ã€‚
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
# x : ウィンドウ㮠X 座標
# y : ウィンドウ㮠Y 座標
# width : ウィンドウã®å¹…
# height : ウィンドウã®é«˜ã•
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
# NEW - David
@main_color=normal_color
@secondary_color=system_color
@davids_color=Color.new(255, 255, 64, 255)
# NEW - David - 04.14.05
@d_light = Color.new(50, 50, 50, 255)
@d_dark = Color.new(200, 200, 200, 255)
@d_black = Color.new(0, 0, 0, 255)
end
#--------------------------------------------------------------------------
# ◠解放
#--------------------------------------------------------------------------
def dispose
# ウィンドウ内容ã®ãƒ“ットマップãŒè¨å®šã•ã‚Œã¦ã„ã‚Œã°è§£æ”¾
if self.contents != nil
self.contents.dispose
end
super
end
#--------------------------------------------------------------------------
# â— æ–‡å—色å–å¾—
# n : æ–‡å—è‰²ç•ªå· (0~7)
#--------------------------------------------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
#--------------------------------------------------------------------------
# ◠通常文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
#--------------------------------------------------------------------------
# ◠無効文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
#--------------------------------------------------------------------------
# ◠システム文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
#--------------------------------------------------------------------------
# ◠ピンãƒæ–‡å—色ã®å–å¾—
#--------------------------------------------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
#--------------------------------------------------------------------------
# ◠戦闘ä¸èƒ½æ–‡å—色ã®å–å¾—
#--------------------------------------------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
super
# ウィンドウスã‚ンãŒå¤‰æ›´ã•ã‚ŒãŸå ´åˆã€å†è¨å®š
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
#--------------------------------------------------------------------------
# ◠グラフィックã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# â— åå‰ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
#FACE PICS-------------------------------------------
def draw_actor_face(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 5, y - ch, bitmap, src_rect)
end
#----------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#--------------------------------------------------------------------------
# ◠クラスã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
#--------------------------------------------------------------------------
# ◠レベルã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# â— æ画用ã®ã‚¹ãƒ†ãƒ¼ãƒˆæ–‡å—列作æˆ
# actor : アクター
# width : æ画先ã®å¹…
# need_normal : [æ£å¸¸] ãŒå¿…è¦ã‹ã©ã†ã‹ (true / false)
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# 括弧ã®å¹…ã‚’å–å¾—
brackets_width = self.contents.text_size("[]").width
# ステートåã®æ–‡å—列を作æˆ
text = ""
for i in battler.states
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].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 need_normal
text = "[Normal]"
end
else
# 括弧をã¤ã‘ã‚‹
text = "[" + text + "]"
end
# 完æˆã—ãŸæ–‡å—列を返ã™
return text
end
#--------------------------------------------------------------------------
# ◠ステートã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# width : æ画先ã®å¹…
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# â— EXP ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x +2, y, 32, 32, "Exp")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# â— HP ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# width : æ画先ã®å¹…
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# æ–‡å—列 "HP" ã‚’æç”»
self.contents.font.color = system_color
self.contents.draw_text(x +2, y, 32, 32, $data_system.words.hp)
# MaxHP ã‚’æç”»ã™ã‚‹ã‚¹ãƒšãƒ¼ã‚¹ãŒã‚ã‚‹ã‹è¨ˆç®—
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# HP ã‚’æç”»
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# MaxHP ã‚’æç”»
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# â— SP ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# width : æ画先ã®å¹…
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# æ–‡å—列 "SP" ã‚’æç”»
self.contents.font.color = system_color
self.contents.draw_text(x +2, y, 32, 32, $data_system.words.sp)
# MaxSP ã‚’æç”»ã™ã‚‹ã‚¹ãƒšãƒ¼ã‚¹ãŒã‚ã‚‹ã‹è¨ˆç®—
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# SP ã‚’æç”»
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
#self.contents.draw_text(sp_x, y, 48, 32, $game_temp.battle_turn.to_s, 2)
# MaxSP ã‚’æç”»
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ◠パラメータã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# type : パラメータã®ç¨®é¡ž (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ◠アイテムåã®æç”»
# item : アイテãƒ
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
# NEW - David - All below
def draw_total_number(actor, total, x, y)
sp_x = x + 144 - 108
#self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x, y, 48, 32, total.to_s)
end
# NEW - David - All below
def draw_actor_ct_meter(actor, x, y, width = 144, height = 8)
if type == 1 and actor.hp == 0
return
end
for i in 0 ... $total_number
if actor == $keep_id[i]
actor_turn = $keep_number[i]
end
end
actor_ct = $keep_count[actor_turn]
if (actor_ct > 1000) or (actor_ct == -1)
actor_ct = 1000
end
self.contents.fill_rect(x-1, y, width +2, height +2, @d_light)
self.contents.fill_rect(x-1, y, width +1, height +1, @d_dark)
self.contents.fill_rect(x, y+1, width, height, @d_black)
self.contents.fill_rect(x, y+1, width * actor_ct / $ct_full, height, @davids_color)
end
# NEW - David - All below
def draw_enemy_ct_meter(enemy, x, y, width = 144, height = 8)
if type == 1 and enemy.hp == 0
return
end
for i in 0 ... $total_number
if enemy == $keep_id[i]
enemy_turn = $keep_number[i]
end
end
enemy_ct = $keep_count[enemy_turn]
if (enemy_ct > $ct_full) or (enemy_ct == -1)
enemy_ct = $ct_full
end
self.contents.fill_rect(x-1, y, width +2, height +2, @d_light)
self.contents.fill_rect(x-1, y, width +1, height +1, @d_dark)
self.contents.fill_rect(x, y+1, width, height, @d_black)
self.contents.fill_rect(x, y+1, width * enemy_ct / $ct_full, height, @davids_color)
end
end
#--------------------------------------------------------------------------
# Showing the HP BAR
# Script by Firewords
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 200, height =8)
# Showing and cutting the picture
self.contents.fill_rect(x-1, y-2, width +2, height +2, Color.new(0, 0, 0, 255))
bitmap=RPG::Cache.picture("HP_Barra")
cw=bitmap.width
ch=bitmap.height
src_rect=Rect.new(0,0,cw,ch)
# %
dest_rect=Rect.new(x,y-1,width * actor.hp / actor.maxhp,height)
# Shows if there's a real value
if actor.hp != 0
self.contents.stretch_blt(dest_rect,bitmap,src_rect)
end
end
#--------------------------------------------------------------------------
# Showing the SP BAR
# Script by Firewords
#--------------------------------------------------------------------------
def draw_actor_mp_bar(actor, x, y, width = 200, height =8)
# Showing and cutting the picture
self.contents.fill_rect(x-1, y-2, width +2, height +2, Color.new(0, 0, 0, 255))
bitmap=RPG::Cache.picture("MP_Barra")
cw=bitmap.width
ch=bitmap.height
src_rect=Rect.new(0,0,cw,ch)
# %
dest_rect=Rect.new(x,y-1,width * actor.sp / actor.maxsp,height)
# Shows if there's a real value
if actor.sp != 0
self.contents.stretch_blt(dest_rect,bitmap,src_rect)
end
end # of Window_Base