Project1
标题:
让横版战斗系统的 战斗/逃跑 的视窗出现(不是原创)
[打印本页]
作者:
aaasss955
时间:
2007-6-10 22:01
标题:
让横版战斗系统的 战斗/逃跑 的视窗出现(不是原创)
#==============================================================================
# ++ 纵リスト型バトルステータス ver. 1.10 ++
# Script by パラ犬
# http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# バトルステータス画面をサイドビューらしい纵型表示にします。
#==============================================================================
module PARA_CTB
# HP槽左边的颜色
HP_COLOR_LEFT = Color.new(128、0、0、255)
# HP槽右边的颜色
HP_COLOR_RIGHT= Color.new(255、0、0、255)
# SP槽左边的颜色
SP_COLOR_LEFT = Color.new(0、0、128、255)
# SP槽右边的颜色
SP_COLOR_RIGHT= Color.new(0、0、255、255)
# 各种条边框的颜色
FRAME_COLOR = Color.new(192、192、192、255)
# 表范围的粗
FRAME_BORDER = 1
# 各种条边框的底色
BACK_COLOR = Color.new(128、128、128、128)
# 角色名称的字号(数字越大字越大)
NAME_FONT_SIZE =16
# HP/SP的字号
HPSP_FONT_SIZE =18
# 敌人名称的字号
ENEMY_FONT_SIZE =16
# 是否显示对大HP/MP( 显示true / 不显示false )
MAX_DRAW = false
# バトルメンバーの最大数(多人数PTスクリプトを导入している时に设定)
PARTY_SIZE = 4
# エネミー名をグループ化( true / false )
# (trueにすると“ゴースト 2”のようにまとめて表示します)
ENEMY_GROUPING = false
# 在敌人窗口中显示的东西( 0:只显示名字 / 1:显示HP)
# (エネミー名をグループ化している场合は无效)
ENEMY_DRAWING_MATER = 0
# actor的帮助窗口表示HP/SP量规( true / false )
HELP_DRAWING_MATER_ACTOR = false
# 是否在选择攻击对象的时候显示敌人的HP/MP和状态(预设为显示(true))
HELP_DRAWING_MATER_ENEMY = false
# 是否在一个地方强制显示攻击对话框(攻击框就显示在一个地方,预设为true(是))
#(他の方のサイドビュースクリプトを并用していて
# コマンドウインドウの位置がどうしても不自然になるならtrueに)
# ※trueにしても适用されない场合、このスクリプトを
# サイドビューよりも下に置いてみてください
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X座标
WINDOWPOS_Y = 320 # Y座标
# 战斗窗口的不透明度,数字越高透明度越差
WINDOW_OPACITY = 160
end
# ↑ 设定项目ここまで
#------------------------------------------------------------------------------
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン处理
#--------------------------------------------------------------------------
alias main_ctb main
def main
# エネミー名ウインドウを作成
@status_window2 = Window_BattleStatus_enemy.new
main_ctb
# エネミー名ウインドウを破弃
@status_window2.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
# バトルイベント实行中の场合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを强制されているバトラーが存在しない场合
if $game_temp.forcing_battler == nil
# バトルイベントの实行が终わった场合
unless $game_system.battle_interpreter.running?
# 战斗继续の场合、バトルイベントのセットアップを再实行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# エネミー名リストを更新
@status_window2.refresh
end
end
end
ctb_update
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を设定
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# ステータスウインドウに隐れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
alias update_phase1_ctb update_phase1
def update_phase1
# エネミー名リストを更新
@status_window2.refresh
update_phase1_ctb
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
# エネミー名リストを更新
@status_window2.refresh
update_phase4_step6_ctb
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160、320、480、160)
self.contents = Bitmap.new(width - 32、height - 32)
@level_up_flags = []
for i in 0..$game_party.actors.size
@level_up_flags.push(false)
end
@before_hp = []
@before_sp = []
@before_states = []
@now_hp = []
@now_sp = []
@now_states = []
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# 现在のステータスを配列に
@now_hp[i] = actor.hp
@now_sp[i] = actor.sp
@now_states[i] = actor.states
# レベルアップ
if @level_up_flags[i]
self.contents.fill_rect(344、actor_y、100、32、Color.new(0、0、0、0))
self.contents.font.color = normal_color
self.contents.draw_text(344、actor_y、120、32、"LEVEL UP!")
end
end
# バトルステータスの轻量化处理
# ステータスの配列が变化したときのみ描画处理
if @before_hp == nil or @before_sp == nil or @before_states == nil or @before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
self.contents.clear
for i2 in 0...$game_party.actors.size
actor = $game_party.actors[i2]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i2 * line_height + 4
self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
# 名前を描画
draw_actor_name(actor、4、actor_y+16-PARA_CTB::NAME_FONT_SIZE)
# HPを描画
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp、actor.maxhp、125、actor_y+14、80、8、hp_color1、hp_color2)
draw_actor_hp(actor、102、actor_y+16-PARA_CTB::HPSP_FONT_SIZE、100)
# SPを描画
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp、actor.maxsp、245、actor_y+14、80、8、sp_color1、sp_color2)
draw_actor_sp(actor、222、actor_y+16-PARA_CTB::HPSP_FONT_SIZE、100)
# 变化后のステータスを配列に
@before_hp[i2] = actor.hp
@before_sp[i2] = actor.sp
@before_states[i2] = actor.states
# レベルアップ
if @level_up_flags[i2] == false
draw_actor_state(actor、344、actor_y)
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
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.font.size = 16
self.contents.draw_text(x、y+2、32、32、$data_system.words.hp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxHP を描画
self.contents.draw_text(x、y、width、32、actor.maxhp.to_s、2)
text_size = self.contents.text_size(actor.maxhp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x、y、12、32、"/"、1)
# HP を描画
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x、y、text_size.width、32、actor.hp.to_s、2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x、y、width、32、actor.hp.to_s、2)
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.font.size = 16
self.contents.draw_text(x、y+2、32、32、$data_system.words.sp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxSP を描画
self.contents.draw_text(x、y、width、32、actor.maxsp.to_s、2)
text_size = self.contents.text_size(actor.maxsp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x、y、12、32、"/"、1)
# SP を描画
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x、y、text_size.width、32、actor.sp.to_s、2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x、y、width、32、actor.sp.to_s、2)
end
end
end
#==============================================================================
# □ 敌の名前を表示するウインドウ
#==============================================================================
class Window_BattleStatus_enemy < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0、320、160、160)
self.contents = Bitmap.new(width - 32、height - 32)
refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
@exist_enemies = []
if $game_troop.enemies != nil
if PARA_CTB::ENEMY_GROUPING
ememy_list = []
ememy_list_index = []
# エネミーをグループ化
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
if ememy_list.include?(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] += 1
else
# エネミー名を记录
ememy_list.push(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] = 1
end
end
end
# エネミーの名前と数を描画
enemy_index = 0
for enemy_name in ememy_list
enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
if ememy_list_index[enemy_index] > 1
enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
end
self.contents.draw_text(4、enemy_y、160、20、enemy_name)
enemy_index += 1
end
else
# エネミーの名前を描画
enemy_index = 0
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
@exist_enemies.push(enemy)
line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
if PARA_CTB::ENEMY_DRAWING_MATER != 0
line_height += 10
end
enemy_y = enemy_index * line_height + 4
self.contents.draw_text(4、enemy_y、160、20、enemy.name)
enemy_index += 1
# HPゲージを描画
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
draw_meter(enemy.hp、enemy.maxhp、4、y、80、8、hp_color1、hp_color2)
end
end
end
end
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ○ ゲージを描画
#--------------------------------------------------------------------------
def draw_meter(now、max、x、y、width、height、start_color、end_color=start_color )
self.contents.fill_rect(x、y、width、height、PARA_CTB::FRAME_COLOR)
self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER、y+PARA_CTB::FRAME_BORDER、width-PARA_CTB::FRAME_BORDER*2、height-PARA_CTB::FRAME_BORDER*2、PARA_CTB::BACK_COLOR)
now = now > max ? max : now
percentage = max != 0 ? (width-2) * now / max.to_f : 0
if start_color == end_color
self.contents.fill_rect(x+1、y+1、percentage、height-2、start_color)
else
for i in 1..percentage
r = start_color.red + (end_color.red - start_color.red) / percentage * i
g = start_color.green + (end_color.green - start_color.green) / percentage * i
b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
self.contents.fill_rect(x+i、y+1、1、height-2、Color.new(r、g、b、a))
end
end
end
end
#==============================================================================
# ■ Window_Help
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● アクター设定
# actor : ステータスを表示するアクター
#--------------------------------------------------------------------------
alias set_actor_ctb set_actor
def set_actor(actor)
if PARA_CTB::HELP_DRAWING_MATER_ACTOR
self.contents.clear
draw_actor_name(actor、4、0)
draw_actor_state(actor、140、0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp、actor.maxhp、316、18、112、8、hp_color1、hp_color2)
draw_actor_hp(actor、284、0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp、actor.maxsp、492、18、112、8、sp_color1、sp_color2)
draw_actor_sp(actor、460、0)
@actor = actor
@text = nil
self.visible = true
else
set_actor_ctb(actor)
end
end
#--------------------------------------------------------------------------
# ● エネミー设定
# enemy : 名前とステートを表示するエネミー
#--------------------------------------------------------------------------
alias set_enemy_ctb set_enemy
def set_enemy(enemy)
if PARA_CTB::HELP_DRAWING_MATER_ENEMY
self.contents.clear
draw_actor_name(enemy、4、0)
draw_actor_state(enemy、140、0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(enemy.hp、enemy.maxhp、316、18、112、8、hp_color1、hp_color2)
draw_actor_hp(enemy、284、0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(enemy.sp、enemy.maxsp、492、18、112、8、sp_color1、sp_color2)
draw_actor_sp(enemy、460、0)
self.visible = true
else
set_enemy_ctb(enemy)
end
end
end
复制代码
作者:
aaasss955
时间:
2007-6-10 22:01
标题:
让横版战斗系统的 战斗/逃跑 的视窗出现(不是原创)
#==============================================================================
# ++ 纵リスト型バトルステータス ver. 1.10 ++
# Script by パラ犬
# http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# バトルステータス画面をサイドビューらしい纵型表示にします。
#==============================================================================
module PARA_CTB
# HP槽左边的颜色
HP_COLOR_LEFT = Color.new(128、0、0、255)
# HP槽右边的颜色
HP_COLOR_RIGHT= Color.new(255、0、0、255)
# SP槽左边的颜色
SP_COLOR_LEFT = Color.new(0、0、128、255)
# SP槽右边的颜色
SP_COLOR_RIGHT= Color.new(0、0、255、255)
# 各种条边框的颜色
FRAME_COLOR = Color.new(192、192、192、255)
# 表范围的粗
FRAME_BORDER = 1
# 各种条边框的底色
BACK_COLOR = Color.new(128、128、128、128)
# 角色名称的字号(数字越大字越大)
NAME_FONT_SIZE =16
# HP/SP的字号
HPSP_FONT_SIZE =18
# 敌人名称的字号
ENEMY_FONT_SIZE =16
# 是否显示对大HP/MP( 显示true / 不显示false )
MAX_DRAW = false
# バトルメンバーの最大数(多人数PTスクリプトを导入している时に设定)
PARTY_SIZE = 4
# エネミー名をグループ化( true / false )
# (trueにすると“ゴースト 2”のようにまとめて表示します)
ENEMY_GROUPING = false
# 在敌人窗口中显示的东西( 0:只显示名字 / 1:显示HP)
# (エネミー名をグループ化している场合は无效)
ENEMY_DRAWING_MATER = 0
# actor的帮助窗口表示HP/SP量规( true / false )
HELP_DRAWING_MATER_ACTOR = false
# 是否在选择攻击对象的时候显示敌人的HP/MP和状态(预设为显示(true))
HELP_DRAWING_MATER_ENEMY = false
# 是否在一个地方强制显示攻击对话框(攻击框就显示在一个地方,预设为true(是))
#(他の方のサイドビュースクリプトを并用していて
# コマンドウインドウの位置がどうしても不自然になるならtrueに)
# ※trueにしても适用されない场合、このスクリプトを
# サイドビューよりも下に置いてみてください
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X座标
WINDOWPOS_Y = 320 # Y座标
# 战斗窗口的不透明度,数字越高透明度越差
WINDOW_OPACITY = 160
end
# ↑ 设定项目ここまで
#------------------------------------------------------------------------------
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン处理
#--------------------------------------------------------------------------
alias main_ctb main
def main
# エネミー名ウインドウを作成
@status_window2 = Window_BattleStatus_enemy.new
main_ctb
# エネミー名ウインドウを破弃
@status_window2.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
# バトルイベント实行中の场合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを强制されているバトラーが存在しない场合
if $game_temp.forcing_battler == nil
# バトルイベントの实行が终わった场合
unless $game_system.battle_interpreter.running?
# 战斗继续の场合、バトルイベントのセットアップを再实行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# エネミー名リストを更新
@status_window2.refresh
end
end
end
ctb_update
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を设定
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# ステータスウインドウに隐れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
alias update_phase1_ctb update_phase1
def update_phase1
# エネミー名リストを更新
@status_window2.refresh
update_phase1_ctb
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
# エネミー名リストを更新
@status_window2.refresh
update_phase4_step6_ctb
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160、320、480、160)
self.contents = Bitmap.new(width - 32、height - 32)
@level_up_flags = []
for i in 0..$game_party.actors.size
@level_up_flags.push(false)
end
@before_hp = []
@before_sp = []
@before_states = []
@now_hp = []
@now_sp = []
@now_states = []
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# 现在のステータスを配列に
@now_hp[i] = actor.hp
@now_sp[i] = actor.sp
@now_states[i] = actor.states
# レベルアップ
if @level_up_flags[i]
self.contents.fill_rect(344、actor_y、100、32、Color.new(0、0、0、0))
self.contents.font.color = normal_color
self.contents.draw_text(344、actor_y、120、32、"LEVEL UP!")
end
end
# バトルステータスの轻量化处理
# ステータスの配列が变化したときのみ描画处理
if @before_hp == nil or @before_sp == nil or @before_states == nil or @before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
self.contents.clear
for i2 in 0...$game_party.actors.size
actor = $game_party.actors[i2]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i2 * line_height + 4
self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
# 名前を描画
draw_actor_name(actor、4、actor_y+16-PARA_CTB::NAME_FONT_SIZE)
# HPを描画
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp、actor.maxhp、125、actor_y+14、80、8、hp_color1、hp_color2)
draw_actor_hp(actor、102、actor_y+16-PARA_CTB::HPSP_FONT_SIZE、100)
# SPを描画
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp、actor.maxsp、245、actor_y+14、80、8、sp_color1、sp_color2)
draw_actor_sp(actor、222、actor_y+16-PARA_CTB::HPSP_FONT_SIZE、100)
# 变化后のステータスを配列に
@before_hp[i2] = actor.hp
@before_sp[i2] = actor.sp
@before_states[i2] = actor.states
# レベルアップ
if @level_up_flags[i2] == false
draw_actor_state(actor、344、actor_y)
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
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.font.size = 16
self.contents.draw_text(x、y+2、32、32、$data_system.words.hp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxHP を描画
self.contents.draw_text(x、y、width、32、actor.maxhp.to_s、2)
text_size = self.contents.text_size(actor.maxhp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x、y、12、32、"/"、1)
# HP を描画
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x、y、text_size.width、32、actor.hp.to_s、2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x、y、width、32、actor.hp.to_s、2)
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.font.size = 16
self.contents.draw_text(x、y+2、32、32、$data_system.words.sp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxSP を描画
self.contents.draw_text(x、y、width、32、actor.maxsp.to_s、2)
text_size = self.contents.text_size(actor.maxsp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x、y、12、32、"/"、1)
# SP を描画
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x、y、text_size.width、32、actor.sp.to_s、2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x、y、width、32、actor.sp.to_s、2)
end
end
end
#==============================================================================
# □ 敌の名前を表示するウインドウ
#==============================================================================
class Window_BattleStatus_enemy < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0、320、160、160)
self.contents = Bitmap.new(width - 32、height - 32)
refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
@exist_enemies = []
if $game_troop.enemies != nil
if PARA_CTB::ENEMY_GROUPING
ememy_list = []
ememy_list_index = []
# エネミーをグループ化
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
if ememy_list.include?(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] += 1
else
# エネミー名を记录
ememy_list.push(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] = 1
end
end
end
# エネミーの名前と数を描画
enemy_index = 0
for enemy_name in ememy_list
enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
if ememy_list_index[enemy_index] > 1
enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
end
self.contents.draw_text(4、enemy_y、160、20、enemy_name)
enemy_index += 1
end
else
# エネミーの名前を描画
enemy_index = 0
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
@exist_enemies.push(enemy)
line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
if PARA_CTB::ENEMY_DRAWING_MATER != 0
line_height += 10
end
enemy_y = enemy_index * line_height + 4
self.contents.draw_text(4、enemy_y、160、20、enemy.name)
enemy_index += 1
# HPゲージを描画
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
draw_meter(enemy.hp、enemy.maxhp、4、y、80、8、hp_color1、hp_color2)
end
end
end
end
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ○ ゲージを描画
#--------------------------------------------------------------------------
def draw_meter(now、max、x、y、width、height、start_color、end_color=start_color )
self.contents.fill_rect(x、y、width、height、PARA_CTB::FRAME_COLOR)
self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER、y+PARA_CTB::FRAME_BORDER、width-PARA_CTB::FRAME_BORDER*2、height-PARA_CTB::FRAME_BORDER*2、PARA_CTB::BACK_COLOR)
now = now > max ? max : now
percentage = max != 0 ? (width-2) * now / max.to_f : 0
if start_color == end_color
self.contents.fill_rect(x+1、y+1、percentage、height-2、start_color)
else
for i in 1..percentage
r = start_color.red + (end_color.red - start_color.red) / percentage * i
g = start_color.green + (end_color.green - start_color.green) / percentage * i
b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
self.contents.fill_rect(x+i、y+1、1、height-2、Color.new(r、g、b、a))
end
end
end
end
#==============================================================================
# ■ Window_Help
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● アクター设定
# actor : ステータスを表示するアクター
#--------------------------------------------------------------------------
alias set_actor_ctb set_actor
def set_actor(actor)
if PARA_CTB::HELP_DRAWING_MATER_ACTOR
self.contents.clear
draw_actor_name(actor、4、0)
draw_actor_state(actor、140、0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp、actor.maxhp、316、18、112、8、hp_color1、hp_color2)
draw_actor_hp(actor、284、0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp、actor.maxsp、492、18、112、8、sp_color1、sp_color2)
draw_actor_sp(actor、460、0)
@actor = actor
@text = nil
self.visible = true
else
set_actor_ctb(actor)
end
end
#--------------------------------------------------------------------------
# ● エネミー设定
# enemy : 名前とステートを表示するエネミー
#--------------------------------------------------------------------------
alias set_enemy_ctb set_enemy
def set_enemy(enemy)
if PARA_CTB::HELP_DRAWING_MATER_ENEMY
self.contents.clear
draw_actor_name(enemy、4、0)
draw_actor_state(enemy、140、0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(enemy.hp、enemy.maxhp、316、18、112、8、hp_color1、hp_color2)
draw_actor_hp(enemy、284、0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(enemy.sp、enemy.maxsp、492、18、112、8、sp_color1、sp_color2)
draw_actor_sp(enemy、460、0)
self.visible = true
else
set_enemy_ctb(enemy)
end
end
end
复制代码
作者:
战神~
时间:
2007-6-11 01:14
提示:
作者被禁止或删除 内容自动屏蔽
作者:
704467444
时间:
2007-6-16 08:20
我不知道呵呵!!!!!{/cy}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1