#==============================================================================
# ■ 姨媽功能型戰鬥介面 by姨媽
#-----------------------------------------------------------------------------------------------------------------------------
# ・為遏止多數Ace繁體橫向戰鬥RPG介面隨便又簡陋的歪風,姨媽設計了這款戰鬥介面。
# ・雖然是針對橫向戰鬥設計,但傳統第一人稱戰鬥也可用。
# ・不需額外放任何圖檔到遊戲資料夾內,插入此腳本即可使用。
# ・支援544*416跟640*480的畫面大小。
# ・請注意,有更改戰鬥背景放大率時敵人指標會跑位,這時不管怎麼調整都會有誤差。
# ・歡迎轉載但請保留綠字註解。
#
# ・2013/11/15:
# 微調敵人名稱位置,使之較不會遮住血條。
# ・2013/11/18:
# 可以調整敵人指標小箭頭RGB顏色。
# ・2013/11/23:
# 可調整計量表(HP、MP、TP)文字的字體大小。
# 可用圖標取代傳統HP、MP、TP文字。
# ・2013/11/24:
# 對齊調整。
# ・2013/11/26:
# 我方指標追加。
# 會自動判斷選項數而改變指令列選單的長度。
# ・2013/12/2:
# 指標資訊可設定顯示敵人名稱或血量百分比。
# ・2013/12/15:
# 可導入姨媽自訂計量條顏色腳本的設定。
# ・2013/12/26:
# 再次對齊調整。
# 優化戰鬥不顯示TP時的頭像位置。
# ・2014/01/01:
# 優化敵人指標上方的資訊。
# ・2014/01/02:
# 可設定計量表(HP、MP、TP)文字是否使用粗體。
# ・2014/01/05:
# 構造內容整理。
# 支援640*480畫面。
#==============================================================================
#==============================================================================
#●特殊功能:
#
#・敵人圖像過大而指標跑出螢幕外,請在該敵人備註欄裡寫上"指標調整"來避免此問題。
#・MAXBM可以設定參戰人數,如果隊伍人數多於參戰人數設定,多出的隊友不會參戰。
#・欲使用簡易版角色命令列請將SMALL_ACMD設為true。
#
#・表情改變功能首先要為每個參戰角色各準備一張專屬的八格表情圖檔(如下表)
#
#
#############################
# # # # #
# 1 # 2 # 3 # 4 #
# # # # #
#############################
# # # # #
# x # x # x # x #
# # # # #
#############################
#
#
#1為通常表情(資料庫裡該角色頭像必須設定為此)
#2為低於50%血量的表情
#3為低於25%血量的表情
#4為陣亡時的表情
# x 為腳本不會使用到的部分可任意安排
#
# 要使用隨血量改變表情的功能,請先將下面BFC = false改為BFC = true
#==============================================================================
#==============================================================================
module YM_CURSOR_P
#調整敵人指標水平位置(左移:負數,右移:正數)
CURSOR_PX = 0
#調整敵人指標垂直位置(上移:負數,下移:正數)
CURSOR_PY = 190
#調整敵人指標小箭頭RGB顏色
CURSOR_COLOR = Color.new(0,255,255)
#調整我方指標箭頭RGB顏色
CURSOR_COLOR2 = Color.new(255,255,255)
end
module YM_BATTLE_OPTION
#最大參戰人數,建議不要超過六人
MAXBM = 6
#設定計量表(HP、MP、TP)文字的字體大小。
GAUGE_TEXTSIZE = 20
#設定計量表(HP、MP、TP)文字是否使用粗體。
GAUGE_TEXTBOLD = true
#是否使用圖標取代傳統HP、MP、TP文字
GAUGE_ICON_USE = false
#HP圖標編號(GAUGE_ICON_USE = true才有效)
GAUGE_ICON_HP = 187
#MP圖標編號(GAUGE_ICON_USE = true才有效)
GAUGE_ICON_MP = 188
#TP圖標編號(GAUGE_ICON_USE = true才有效)
GAUGE_ICON_TP = 189
#是否使用隨血量改變表情功能
BFC = false
#是否使用簡易版角色指令列,簡易版不支援指令選項加上圖標腳本
SMALL_ACMD = false
#指標資訊顯示敵人名稱或血量百分比(true=敵人名稱,false=血量百分比)
ENEMY_NAMEORPERCENT = true
#是否導入姨媽自訂計量條顏色腳本的設定
GAUGE_COLOR_HAVE = false
#遊戲畫面大小是否為640*480?若是請用true,沒改過請保持false
GW640GH480 = false
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :ba_x
attr_accessor :ba_y
attr_accessor :al_x
attr_accessor :al_y
attr_accessor :wd_hide
attr_accessor :face_item_width
alias yima_bv2_initialize initialize
def initialize
yima_bv2_initialize
@ba_x = 0
@ba_y = 0
@al_x = 0
@al_y = 0
@wd_hide = 0
@face_item_width = 0
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
include YM_CURSOR_P
if YM_BATTLE_OPTION::GW640GH480 == false
GW=12
else
GW=4
end
#-------------------------------------------------------------------------
# ● 資訊載入
#-------------------------------------------------------------------------
def update_info_viewport
if YM_BATTLE_OPTION::GW640GH480 == false
move_info_viewport(560) if @party_command_window.active
move_info_viewport(560) if @actor_command_window.active
move_info_viewport(560) if BattleManager.in_turn?
else
move_info_viewport(656) if @party_command_window.active
move_info_viewport(656) if @actor_command_window.active
move_info_viewport(656) if BattleManager.in_turn?
end
@enemy_window.x = $game_system.ba_x+YM_CURSOR_P::CURSOR_PX
@enemy_window.y = $game_system.ba_y+YM_CURSOR_P::CURSOR_PY
@enemy_cursor_window.x = $game_system.ba_x+YM_CURSOR_P::CURSOR_PX
@enemy_cursor_window.y = $game_system.ba_y+28+YM_CURSOR_P::CURSOR_PY
if $game_party.battle_members.size==4
@actor_window.x = $game_system.al_x*@actor_window.index-GW
elsif $game_party.battle_members.size==3
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width
elsif $game_party.battle_members.size==2
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width*2
elsif $game_party.battle_members.size==1
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width*3
elsif $game_party.battle_members.size==5
@actor_window.x = $game_system.al_x*@actor_window.index-GW-$game_system.face_item_width/3
elsif $game_party.battle_members.size>=6
@actor_window.x = $game_system.al_x*@actor_window.index-GW-$game_system.face_item_width/2
end
@actor_window.y = Graphics.height/4*3-56
end
#--------------------------------------------------------------------------
# ● 調整主狀態欄位置
#--------------------------------------------------------------------------
def move_info_viewport(ox)
current_ox = @info_viewport.ox
if YM_BATTLE_OPTION::GW640GH480 == false
@info_viewport.ox = [ox, current_ox + 28].min if current_ox < ox
@info_viewport.ox = [ox, current_ox - 28].max if current_ox > ox
else
@info_viewport.ox = [ox, current_ox + 36].min if current_ox < ox
@info_viewport.ox = [ox, current_ox - 36].max if current_ox > ox
end
end
#--------------------------------------------------------------------------
# ● 主狀態欄
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_BattleStatus.new
if YM_BATTLE_OPTION::GW640GH480 == false
if $game_party.battle_members.size>=4
@status_window.x = 560
elsif $game_party.battle_members.size==3
@status_window.x = 560 + $game_system.face_item_width
elsif $game_party.battle_members.size==2
@status_window.x = 560 + $game_system.face_item_width*2
elsif $game_party.battle_members.size==1
@status_window.x = 560 + $game_system.face_item_width*3
end
else
if $game_party.battle_members.size>=4
@status_window.x = 656
elsif $game_party.battle_members.size==3
@status_window.x = 656 + $game_system.face_item_width
elsif $game_party.battle_members.size==2
@status_window.x = 656 + $game_system.face_item_width*2
elsif $game_party.battle_members.size==1
@status_window.x = 656 + $game_system.face_item_width*3
end
end
end
#--------------------------------------------------------------------------
# ● 角色命令欄
#--------------------------------------------------------------------------
def create_actor_command_window
if YM_BATTLE_OPTION::SMALL_ACMD==true
@actor_command_window = Window_ActorCommandSmall.new
else
@actor_command_window = Window_ActorCommand.new
end
@actor_command_window.set_handler(:attack, method(:command_attack))
@actor_command_window.set_handler(:skill, method(:command_skill))
@actor_command_window.set_handler(:guard, method(:command_guard))
@actor_command_window.set_handler(:item, method(:command_item))
@actor_command_window.set_handler(:cancel, method(:prior_command))
end
#--------------------------------------------------------------------------
# ● 小隊命令列
#--------------------------------------------------------------------------
def create_party_command_window
@party_command_window = Window_PartyCommand.new
@party_command_window.set_handler(:fight, method(:command_fight))
@party_command_window.set_handler(:escape, method(:command_escape))
@party_command_window.unselect
end
#--------------------------------------------------------------------------
# ● 選擇我方目標的視窗
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Window_BattleActor_Neo.new(@info_viewport)
@actor_window.set_handler(:ok, method(:on_actor_ok))
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
if $game_party.battle_members.size==4
@actor_window.x = $game_system.al_x*@actor_window.index-GW
elsif $game_party.battle_members.size==3
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width
elsif $game_party.battle_members.size==2
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width*2
elsif $game_party.battle_members.size==1
@actor_window.x = $game_system.al_x*@actor_window.index-GW+$game_system.face_item_width*3
elsif $game_party.battle_members.size==5
@actor_window.x = $game_system.al_x*@actor_window.index-GW-$game_system.face_item_width/3
elsif $game_party.battle_members.size>=6
@actor_window.x = $game_system.al_x*@actor_window.index-GW-$game_system.face_item_width/2
end
@actor_window.y = Graphics.height/4*3-56
end
#--------------------------------------------------------------------------
# ● 選擇敵方目標的視窗
#--------------------------------------------------------------------------
def create_enemy_window
@enemy_window = Window_BattleEnemy.new(@info_viewport)
@enemy_cursor_window = Window_EnemyCursor.new(@info_viewport)
@enemy_window.set_handler(:ok, method(:on_enemy_ok))
@enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
@enemy_window.x = $game_system.ba_x+YM_CURSOR_P::CURSOR_PX
@enemy_window.y = $game_system.ba_y+YM_CURSOR_P::CURSOR_PY
@enemy_cursor_window.x = $game_system.ba_x+YM_CURSOR_P::CURSOR_PX
@enemy_cursor_window.y = $game_system.ba_y+20+YM_CURSOR_P::CURSOR_PY
end
#--------------------------------------------------------------------------
# ● 下一個隊友
#--------------------------------------------------------------------------
def next_command
if BattleManager.next_command
start_actor_command_selection
@actor_command_window.show
else
turn_start
end
end
#--------------------------------------------------------------------------
# ● 選擇隊友時
#--------------------------------------------------------------------------
alias yima_bv2_select_actor_selection select_actor_selection
def select_actor_selection
yima_bv2_select_actor_selection
@actor_command_window.hide
end
#--------------------------------------------------------------------------
# ● 取消選擇隊友
#--------------------------------------------------------------------------
alias yima_bv2_on_actor_cancel on_actor_cancel
def on_actor_cancel
yima_bv2_on_actor_cancel
if $game_system.wd_hide==1
@actor_command_window.show
else
@actor_command_window.hide
end
end
#--------------------------------------------------------------------------
# ● 選擇敵人
#--------------------------------------------------------------------------
alias yima_bv2_select_enemy_selection select_enemy_selection
def select_enemy_selection
yima_bv2_select_enemy_selection
@enemy_cursor_window.refresh
@enemy_cursor_window.show.activate
@skill_window.hide
@item_window.hide
@actor_command_window.hide
end
#--------------------------------------------------------------------------
# ● 敵人決定
#--------------------------------------------------------------------------
def on_enemy_ok
BattleManager.actor.input.target_index = @enemy_window.enemy.index
@enemy_window.hide
@enemy_cursor_window.hide
@skill_window.hide
@item_window.hide
next_command
end
#--------------------------------------------------------------------------
# ● 取消選擇敵人
#--------------------------------------------------------------------------
def on_enemy_cancel
@enemy_window.hide
@enemy_cursor_window.hide
case @actor_command_window.current_symbol
when :attack
@actor_command_window.activate
when :skill
@skill_window.activate.show
when :item
@item_window.activate.show
end
if $game_system.wd_hide==1
@actor_command_window.show
else
@actor_command_window.hide
end
end
alias yima_bv2_command_skill command_skill
def command_skill
yima_bv2_command_skill
if $game_system.wd_hide==1
@actor_command_window.show.activate
else
@actor_command_window.hide
end
end
alias yima_bv2_command_item command_item
def command_item
yima_bv2_command_item
if $game_system.wd_hide==1
@actor_command_window.show.activate
else
@actor_command_window.hide
end
end
def on_skill_cancel
@skill_window.hide
if $game_system.wd_hide==1
@actor_command_window.show.activate
else
@actor_command_window.hide
end
end
def on_item_cancel
@item_window.hide
if $game_system.wd_hide==1
@actor_command_window.show.activate
else
@actor_command_window.hide
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
include YM_BATTLE_OPTION
#--------------------------------------------------------------------------
# ● 臉圖重切,預設96*96太大張會壓在血條下面不好看
#--------------------------------------------------------------------------
def draw_actor_face_yima(actor, x, y, enabled = true)
draw_face_m(actor.face_name, actor.face_index, x, y, enabled)
contents.font.name="VL Gothic"
contents.font.bold = YM_BATTLE_OPTION::GAUGE_TEXTBOLD
end
def draw_actor_face_yima2(actor, x, y, enabled = true)
draw_face_m2(actor.face_name, actor.face_index, x, y, enabled)
end
def draw_actor_face_yima3(actor, x, y, enabled = true)
draw_face_m3(actor.face_name, actor.face_index, x, y, enabled)
end
def draw_actor_face_yima4(actor, x, y, enabled = true)
draw_face_m4(actor.face_name, actor.face_index, x, y, enabled)
end
def draw_face_m(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new(face_index % 4 * 96, face_index>=4 ? (face_index+16) / 4 * 24 : (face_index+4) / 4 * 24, 96, 48)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
def draw_face_m2(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new((face_index+1) % 4 * 96, face_index>=4 ? (face_index+16) / 4 * 24 : (face_index+4) / 4 * 24, 96, 48)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
def draw_face_m3(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new((face_index+2) % 4 * 96, face_index>=4 ? (face_index+16) / 4 * 24 : (face_index+4) / 4 * 24, 96, 48)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
def draw_face_m4(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
rect = Rect.new((face_index+3) % 4 * 96, face_index>=4 ? (face_index+16) / 4 * 24 : (face_index+4) / 4 * 24, 96, 48)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# ● HP 繪製微調
#--------------------------------------------------------------------------
def draw_actor_hp_ym(actor, x, y, width = 124)
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x+14, y, width-14, actor.hp_rate, YM_GAUGE_COLOR::HP_COLOR1, YM_GAUGE_COLOR::HP_COLOR2)
else
draw_gauge(x+14, y, width-14, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
end
else
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x, y, width, actor.hp_rate, YM_GAUGE_COLOR::HP_COLOR1, YM_GAUGE_COLOR::HP_COLOR2)
else
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
end
end
change_color(system_color)
contents.font.size=YM_BATTLE_OPTION::GAUGE_TEXTSIZE
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
draw_icon(YM_BATTLE_OPTION::GAUGE_ICON_HP, x-4, y+2)
else
draw_text(x, y+4, 30, line_height, Vocab::hp_a)
end
if $game_party.battle_members.size>=5
draw_current_values_ym(x, y+4, width, actor.hp, actor.mhp,hp_color(actor), normal_color)
else
draw_current_and_max_values(x, y+4, width, actor.hp, actor.mhp,hp_color(actor), normal_color)
end
end
#--------------------------------------------------------------------------
# ● MP 繪製微調
#--------------------------------------------------------------------------
def draw_actor_mp_ym(actor, x, y, width = 124)
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x+14, y, width-14, actor.mp_rate, YM_GAUGE_COLOR::MP_COLOR1, YM_GAUGE_COLOR::MP_COLOR2)
else
draw_gauge(x+14, y, width-14, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
end
else
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x, y, width, actor.mp_rate, YM_GAUGE_COLOR::MP_COLOR1, YM_GAUGE_COLOR::MP_COLOR2)
else
draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
end
end
change_color(system_color)
contents.font.size=YM_BATTLE_OPTION::GAUGE_TEXTSIZE
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
draw_icon(YM_BATTLE_OPTION::GAUGE_ICON_MP, x-4, y+2)
else
draw_text(x, y+4, 30, line_height, Vocab::mp_a)
end
if $game_party.battle_members.size>=5
draw_current_values_ym(x, y+4, width, actor.mp, actor.mmp,mp_color(actor), normal_color)
else
draw_current_and_max_values(x, y+4, width, actor.mp, actor.mmp,mp_color(actor), normal_color)
end
end
#--------------------------------------------------------------------------
# ● TP 繪製微調
#--------------------------------------------------------------------------
def draw_actor_tp_ym(actor, x, y, width = 124)
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x+14, y, width-14, actor.tp_rate, YM_GAUGE_COLOR::TP_COLOR1, YM_GAUGE_COLOR::TP_COLOR2)
else
draw_gauge(x+14, y, width-14, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
end
else
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x, y, width, actor.tp_rate, YM_GAUGE_COLOR::TP_COLOR1, YM_GAUGE_COLOR::TP_COLOR2)
else
draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
end
end
change_color(system_color)
contents.font.size=YM_BATTLE_OPTION::GAUGE_TEXTSIZE
if YM_BATTLE_OPTION::GAUGE_ICON_USE == true
draw_icon(YM_BATTLE_OPTION::GAUGE_ICON_TP, x-4, y+2)
else
draw_text(x, y+4, 30, line_height, Vocab::tp_a)
end
change_color(tp_color(actor))
draw_text(x + width - 42, y+4, 42, line_height, actor.tp.to_i, 2)
end
#--------------------------------------------------------------------------
# ● 不顯示最大值時
#--------------------------------------------------------------------------
def draw_current_values_ym(x, y, width, current, max, color1, color2)
change_color(color1)
xr = x + width
draw_text(xr - 42, y, 42, line_height, current, 2)
end
end
#==============================================================================
# ■ Window_BattleEnemy 指標上方資訊
#==============================================================================
class Window_BattleEnemy < Window_Selectable
#--------------------------------------------------------------------------
# ●初始化
#--------------------------------------------------------------------------
def initialize(info_viewport)
super(0,0, window_width, fitting_height(1)+8)
refresh
self.visible = false
self.arrows_visible = false
end
#--------------------------------------------------------------------------
# ●行數
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ●寬度
#--------------------------------------------------------------------------
def window_width
return 200
end
#--------------------------------------------------------------------------
# ●每格高度
#--------------------------------------------------------------------------
def item_height
return 32
end
#--------------------------------------------------------------------------
# ●視窗顯示
#--------------------------------------------------------------------------
def show
width_remain = Graphics.width - width
select(0)
$game_system.ba_x=$game_troop.alive_members[index].screen_x-width/2
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height-70
if $game_troop.alive_members[index].enemy.note.include?("指標調整")
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height
end
super
end
#--------------------------------------------------------------------------
# ●移動處理
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
cursor_down(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R)
cursor_pageup if !handle?(:pageup) && Input.trigger?(:L)
Sound.play_cursor if @index != last_index
end
def cursor_down(wrap = false)
if index < item_max - col_max || (wrap && col_max == 1)
select((index + col_max) % item_max)
$game_system.ba_x=$game_troop.alive_members[index].screen_x-width/2
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height-70
if $game_troop.alive_members[index].enemy.note.include?("指標調整")
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height
end
end
end
def cursor_up(wrap = false)
if index >= col_max || (wrap && col_max == 1)
select((index - col_max + item_max) % item_max)
$game_system.ba_x=$game_troop.alive_members[index].screen_x-width/2
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height-70
if $game_troop.alive_members[index].enemy.note.include?("指標調整")
$game_system.ba_y=$game_troop.alive_members[index].screen_y-battler_graphic.height
end
end
end
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
end
end
def battler_graphic
Cache.battler(enemy.battler_name, enemy.battler_hue)
end
#--------------------------------------------------------------------------
# ● 項目繪製
#--------------------------------------------------------------------------
def draw_item(index)
change_color(normal_color)
name = $game_troop.alive_members[index].name
draw_text(item_rect_for_text_1(index), name,1) if YM_BATTLE_OPTION::ENEMY_NAMEORPERCENT == true
draw_hp(index)
end
#--------------------------------------------------------------------------
# ● 微調位置
#--------------------------------------------------------------------------
def item_rect_for_text_1(index)
rect = item_rect(index)
rect.x += 4
rect.y -= 6
rect.width -= 8
rect
end
#--------------------------------------------------------------------------
# ● 敵HP繪製
#--------------------------------------------------------------------------
def draw_hp(index)
rect = item_rect_for_text(index)
w = rect.width
x = 0
hp = $game_troop.alive_members[index].hp_rate
if YM_BATTLE_OPTION::GAUGE_COLOR_HAVE == true
draw_gauge(x+3, rect.y+5, w, hp, YM_GAUGE_COLOR::HP_COLOR1,YM_GAUGE_COLOR::HP_COLOR2)
else
draw_gauge(x+3, rect.y+5, w, hp, hp_gauge_color1, hp_gauge_color2)
end
if YM_BATTLE_OPTION::ENEMY_NAMEORPERCENT == false
contents.font.name="VL Gothic"
contents.font.bold = YM_BATTLE_OPTION::GAUGE_TEXTBOLD
contents.font.size=YM_BATTLE_OPTION::GAUGE_TEXTSIZE
change_color(system_color)
draw_text(x+3, rect.y-2, 100, line_height, Vocab::hp_a)
eee = $game_troop.alive_members[index]
change_color(normal_color)
draw_en_hp_values(x+3, rect.y, width, eee.hp, eee.mhp, normal_color, normal_color)
contents.font.name=Font.default_name
else
end
end
def draw_en_hp_values(x, y, width, current, max, color1, color2)
change_color(color1)
xr = x + width
draw_text(xr-84 , y-2, 42, line_height, current*100/max,2)
draw_text(xr-72, y-2, 42, line_height, "%", 2)
end
end
#==============================================================================
# ■ Window_BattleActor_Neo 我方指標製作
#==============================================================================
class Window_BattleActor_Neo < Window_Selectable
def initialize(info_viewport)
super(0, info_viewport.rect.y, window_width, fitting_height(4))
refresh
self.openness = 255
self.visible = false
self.arrows_visible = false
select(0)
contents.font.name="VL Gothic"
self.opacity = 0
end
def window_width
184
end
def window_height
fitting_height(line_number)
end
def visible_line_number
return 4
end
def item_height
60
end
def item_max
$game_party.battle_members.size
end
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
end
end
def refresh
contents.clear
draw_all_items
end
def draw_item(index)
change_color(normal_color)
contents.font.size = 50
contents.font.color.set(YM_CURSOR_P::CURSOR_COLOR2)
draw_text(item_rect_for_text(index), "▼",1)
end
def basic_area_rect(index)
rect = item_rect_for_text(index)
rect.width -= gauge_area_width + 10
rect
end
def gauge_area_rect(index)
rect = item_rect_for_text(index)
rect.x += rect.width - gauge_area_width
rect.width = gauge_area_width
rect
end
def gauge_area_width
return 220
end
def pos_x
if $game_party.battle_members.size>=4
(Graphics.width-24) / $game_party.battle_members.size
elsif $game_party.battle_members.size==3
(Graphics.width-22-$game_system.face_item_width*2) / $game_party.battle_members.size
elsif $game_party.battle_members.size==2
(Graphics.width-20-$game_system.face_item_width*4) / $game_party.battle_members.size
elsif $game_party.battle_members.size==1
(Graphics.width-18-$game_system.face_item_width*6) / $game_party.battle_members.size
end
end
def pos_y
Graphics.height
end
#--------------------------------------------------------------------------
# ●移動處理
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_up (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R)
cursor_pageup if !handle?(:pageup) && Input.trigger?(:L)
Sound.play_cursor if @index != last_index
end
def cursor_down(wrap = false)
if index < item_max - col_max || (wrap && col_max == 1)
select((index + col_max) % item_max)
end
end
def cursor_up(wrap = false)
if index >= col_max || (wrap && col_max == 1)
select((index - col_max + item_max) % item_max)
end
end
def show
$game_system.al_x=pos_x
$game_system.al_y=pos_y
if @info_viewport
width_remain = Graphics.width - width
self.x = width_remain
@info_viewport.rect.width = width_remain
select(0)
end
super
end
def hide
@info_viewport.rect.width = Graphics.width if @info_viewport
super
end
end
#==============================================================================
# ■ Window_PartyCommand 小隊命令
#==============================================================================
class Window_PartyCommand < Window_Command
def initialize
super(Graphics.width/2-window_width/2, 108)
self.openness = 0
deactivate
end
def alignment
return 1
end
def window_width
return 108
end
def window_height
return 72
end
end
#==============================================================================
# ■ Window_EnemyCursor 指標製作
#==============================================================================
class Window_EnemyCursor < Window_Selectable
def initialize(info_viewport)
super(0, 0, window_width, fitting_height(2))
refresh
self.visible = false
self.opacity = 0
end
def window_width
200
end
def col_max
return 1
end
def item_height
48
end
def item_max
1
end
def draw_item(index)
change_color(normal_color)
contents.font.size = 35
contents.font.name="Arial"
contents.font.color.set(YM_CURSOR_P::CURSOR_COLOR)
draw_text(item_rect_for_text(index), "▲",1)#▼",1)
end
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
end
end
def show
width_remain = Graphics.width - width
self.x = width_remain
select(0)
super
end
def hide
super
end
end
#==============================================================================
# ■ Window_BattleSkill 視窗資訊暫存
#==============================================================================
class Window_BattleSkill < Window_SkillList
alias yima_bv2_show show
def show
$game_system.wd_hide=0
yima_bv2_show
end
alias yima_bv2_hide hide
def hide
$game_system.wd_hide=1
yima_bv2_hide
end
end
#==============================================================================
# ■ Window_BattleItem 視窗資訊暫存
#==============================================================================
class Window_BattleItem < Window_ItemList
alias yima_bv2_show show
def show
$game_system.wd_hide=0
yima_bv2_show
end
alias yima_bv2_hide hide
def hide
$game_system.wd_hide=1
yima_bv2_hide
end
end
#==============================================================================
# ■ Window_ActorCommand 角色指令
#==============================================================================
class Window_ActorCommand < Window_Command
alias yima_bacmd_initialize initialize
def initialize
yima_bacmd_initialize
self.arrows_visible = false
end
#--------------------------------------------------------------------------
# ●寬
#--------------------------------------------------------------------------
def window_width
return $game_party.battle_members.size>=6 ? 110 : 128
end
#--------------------------------------------------------------------------
# ●設定位置
#--------------------------------------------------------------------------
def setup(actor)
acmd_arrange = $game_system.face_item_width
@actor = actor
if $game_party.battle_members.size==4
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2
elsif $game_party.battle_members.size==3
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange
elsif $game_party.battle_members.size==2
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange*2
elsif $game_party.battle_members.size==1
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange*3
elsif $game_party.battle_members.size>=5
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2
end
self.y = actor.pos_y - self.height-100
clear_command_list
make_command_list
refresh
self.height = fitting_height(@list.size)
self.y = actor.pos_y - self.height-100
select(0)
activate
open
end
end
#==============================================================================
# ■ Game_Actor 設定位置
#==============================================================================
class Game_Actor < Game_Battler
def pos_x
if $game_party.battle_members.size>=4
(Graphics.width-24) / $game_party.battle_members.size
elsif $game_party.battle_members.size==3
(Graphics.width-22-$game_system.face_item_width*2) / $game_party.battle_members.size
elsif $game_party.battle_members.size==2
(Graphics.width-20-$game_system.face_item_width*4) / $game_party.battle_members.size
elsif $game_party.battle_members.size==1
(Graphics.width-18-$game_system.face_item_width*6) / $game_party.battle_members.size
end
end
def pos_y
Graphics.height
end
end
#==============================================================================
# ■ Game_Party 參戰人數
#==============================================================================
class Game_Party < Game_Unit
def max_battle_members
return YM_BATTLE_OPTION::MAXBM
end
end
#==============================================================================
# ■ Window_ActorCommandSmall 簡易命令列製作
#==============================================================================
class Window_ActorCommandSmall < Window_HorzCommand
#--------------------------------------------------------------------------
# ●初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0)
self.openness = 0
deactivate
@actor = nil
self.arrows_visible = false
end
#--------------------------------------------------------------------------
# ●移動處理
#--------------------------------------------------------------------------
def window_width
return $game_party.battle_members.size>=6 ? 110 : 128
end
def window_height
return 48
end
def item_width
(width - standard_padding * 2 + spacing) /1 - spacing
end
def col_max
return @list.size+1
end
def row_max
1
end
def page_col_max
1
end
def col
index / row_max
end
def top_col
ox / (item_width + spacing)
end
def bottom_col
top_col + page_col_max - 1
end
def bottom_col=(col)
self.top_col = col - (page_col_max - 1)
end
def ensure_cursor_visible
self.top_col = col if col < top_col
self.bottom_col = col if col > bottom_col
end
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# ●箭頭繪製
#--------------------------------------------------------------------------
def draw_item(index)
change_color(normal_color, command_enabled?(index))
draw_text(item_rect_for_text(index), command_name(index), alignment)
change_color(normal_color)
contents.font.size = 16
contents.font.name="Arial"
if $game_party.battle_members.size>=6
draw_text(item_rect_for_text(index), "◄ ►",alignment)
else
draw_text(item_rect_for_text(index), "◄ ►",alignment)
end
contents.font.name=Font.default_name
contents.font.size = Font.default_size
change_color(normal_color, command_enabled?(index))
end
#--------------------------------------------------------------------------
# ●建立指令列
#--------------------------------------------------------------------------
def make_command_list
return unless @actor
add_attack_command
add_skill_commands
add_guard_command
add_item_command
end
#--------------------------------------------------------------------------
# ●增加攻擊指令
#--------------------------------------------------------------------------
def add_attack_command
add_command(Vocab::attack, :attack, @actor.attack_usable?)
end
#--------------------------------------------------------------------------
# ●增加技能指令
#--------------------------------------------------------------------------
def add_skill_commands
@actor.added_skill_types.sort.each do |stype_id|
name = $data_system.skill_types[stype_id]
add_command(name, :skill, true, stype_id)
end
end
#--------------------------------------------------------------------------
# ●增加防禦指令
#--------------------------------------------------------------------------
def add_guard_command
add_command(Vocab::guard, :guard, @actor.guard_usable?)
end
#--------------------------------------------------------------------------
# ●增加物品指令
#--------------------------------------------------------------------------
def add_item_command
add_command(Vocab::item, :item)
end
#--------------------------------------------------------------------------
# ●建立
#--------------------------------------------------------------------------
def setup(actor)
acmd_arrange = $game_system.face_item_width
@actor = actor
if $game_party.battle_members.size==4
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2
elsif $game_party.battle_members.size==3
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange
elsif $game_party.battle_members.size==2
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange*2
elsif $game_party.battle_members.size==1
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2+acmd_arrange*3
elsif $game_party.battle_members.size>=5
self.x = actor.pos_x*@actor.index+acmd_arrange - item_width/2
end
self.y = actor.pos_y - self.height-100
clear_command_list
make_command_list
refresh
select(0)
activate
open
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 8, Graphics.width, window_height)
self.opacity = 0
refresh
self.openness = 0
end
#--------------------------------------------------------------------------
# ● 高
#--------------------------------------------------------------------------
def window_height
fitting_height(visible_line_number)
end
#--------------------------------------------------------------------------
# ● 三條計量表行高
#--------------------------------------------------------------------------
def gauge_line_height
return 16
end
#--------------------------------------------------------------------------
# ● 行數
#--------------------------------------------------------------------------
def col_max
return [item_max, 4].max
end
#--------------------------------------------------------------------------
# ● 項目間隔
#--------------------------------------------------------------------------
def spacing
return 0
end
#--------------------------------------------------------------------------
# ● 項目繪製區
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = contents_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * contents_height
rect
end
#--------------------------------------------------------------------------
# ● 基本繪製區域
#--------------------------------------------------------------------------
def basic_area_rect(index)
rect = item_rect_for_text(index)
rect.height -= gauge_area_height
rect
end
#--------------------------------------------------------------------------
# ● 棒條繪製區域
#--------------------------------------------------------------------------
def gauge_area_rect(index)
rect = item_rect_for_text(index)
rect.y += contents_height - gauge_area_height - 8
rect.height = gauge_area_height
rect
end
#--------------------------------------------------------------------------
# ● 棒條繪製區域高
#--------------------------------------------------------------------------
def gauge_area_height
return (gauge_line_height * ($data_system.opt_display_tp ? 3 : 2))
end
#--------------------------------------------------------------------------
# ● 內容繪製
#--------------------------------------------------------------------------
def draw_basic_area(rect, actor)
$game_system.face_item_width=item_width/2
bms=$game_party.battle_members.size
if $data_system.opt_display_tp
notpy=0
else
notpy=8
end
if YM_BATTLE_OPTION::BFC==true
if actor.hp < actor.mhp / 2 && actor.hp > actor.mhp / 4
draw_actor_face_yima2(actor, rect.x+item_width/2-52, rect.y+2, !actor.dead?)
elsif actor.hp < actor.mhp / 4 && actor.hp > 0
draw_actor_face_yima3(actor, rect.x+item_width/2-52, rect.y+2, !actor.dead?)
elsif actor.hp == 0
draw_actor_face_yima4(actor, rect.x+item_width/2-52, rect.y+2, !actor.dead?)
else
draw_actor_face_yima(actor, rect.x+item_width/2-52, rect.y+2, !actor.dead?)
end
else
draw_actor_face_yima(actor, rect.x+item_width/2-52, rect.y+2, !actor.dead?)
end
draw_actor_icons(actor, rect.x, rect.y, rect.width+8)
end
#--------------------------------------------------------------------------
# ● 計量表繪製
#--------------------------------------------------------------------------
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp_ym(actor, rect.x, rect.y + gauge_line_height * 0, rect.width)
draw_actor_mp_ym(actor, rect.x, rect.y + gauge_line_height * 1, rect.width)
draw_actor_tp_ym(actor, rect.x, rect.y + gauge_line_height * 2, rect.width)
end
#--------------------------------------------------------------------------
# ● 計量表繪製(無TP)
#--------------------------------------------------------------------------
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp_ym(actor, rect.x, rect.y + gauge_line_height * 0-8, rect.width)
draw_actor_mp_ym(actor, rect.x, rect.y + gauge_line_height * 1-8, rect.width)
end
end