赞 | 0 |
VIP | 2 |
好人卡 | 0 |
积分 | 1 |
经验 | 36758 |
最后登录 | 2016-8-2 |
在线时间 | 739 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 739 小时
- 注册时间
- 2013-4-15
- 帖子
- 1756
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 576437081 于 2013-11-10 15:52 编辑
我用的是横版战斗3.3,用了战斗血条对应脚本之后,发现血条,状态和数字没有对齐,
而我也不懂怎么调整坐标(总是调不准)。
游戏界面规格:544,416
附上血条:
由于工程较大,还请各位把素材和脚本复制进新的工程,然后进行调整。
战斗血条对应脚本:
module STRRGSS2 ST_SX = -24 # ステータスのX座標修正 ST_SY = -96 # ステータスのY座標修正 ST_WIDTH = 80 # ステータス横幅 ST_NAME = true # ステータスに名前を表示する PCOMMAND_W = true # パーティコマンドを横並びに変更 PCOMMAND_R = [0,0,544,1] # パーティコマンド[X座標, Y座標, 幅, 文字揃え] end class Window_BattleStatus < Window_Selectable # バトルステータス座標 def set_xy @x = [] @y = [] for i in 0...$game_party.members.size w = 128 + 8 x = (544 / 2) - (($game_party.members.size - 1) * (w / 2)) x += (i * (w+40)) -20 @x[i] = x + STRRGSS2::ST_SX @y[i] = 416 + STRRGSS2::ST_SY end end end #============================================================================== # ■ Window_PartyCommand #============================================================================== class Window_PartyCommand < Window_Command #-------------------------------------------------------------------------- # ★ 再定義 #-------------------------------------------------------------------------- def initialize s1 = Vocab::fight s2 = Vocab::escape super(128, [s1, s2], 1, 4) draw_item(0, true) draw_item(1, $game_troop.can_escape) self.x = 544-128#STRRGSS2::PCOMMAND_R[0] self.y = STRRGSS2::PCOMMAND_R[1] self.active = false end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index], STRRGSS2::PCOMMAND_R[3]) end def update super self.visible = self.active end end #============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ★ エイリアス #-------------------------------------------------------------------------- alias initialize_str11c initialize def initialize(f = false) @f = f @lvuppop = [] set_xy @s_sprite = [] @s_party = [] @s_lv = [] [url=home.php?mod=space&uid=316553]@opacity[/url] = 0 initialize_str11c self.contents.dispose self.contents = Bitmap.new(STRRGSS2::ST_WIDTH, height - 32) self.back_opacity = 0 self.opacity = 0 @column_max = 4#$game_party.actors.size end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size for i in 0...@item_max draw_item(i) end update end #-------------------------------------------------------------------------- # ● 名前の描画 #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y) self.contents.font.color = hp_color(actor) self.contents.draw_text(x, y, STRRGSS2::ST_WIDTH, WLH, actor.name) end #-------------------------------------------------------------------------- # ★ 再定義 #-------------------------------------------------------------------------- def draw_item(index) return unless @f rect = item_rect(index) rect.x = 0 rect.y = 0 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color actor = $game_party.members[index] draw_actor_name(actor, rect.x, rect.y + 72 - 24 - 40) if STRRGSS2::ST_NAME w = STRRGSS2::ST_WIDTH draw_actor_state(actor, rect.x, rect.y + 72, w) draw_actor_hp(actor, rect.x, rect.y + 72 - 24 - 20, w) draw_actor_mp(actor, rect.x, rect.y + 72 - 24, w) # @s_sprite[index] = Sprite.new if @s_sprite[index] == nil @s_sprite[index].bitmap = self.contents.clone @s_sprite[index].x = @x[index] + 4 @s_sprite[index].y = @y[index] @s_sprite[index].opacity = @opacity @s_lv[index] = actor.level @s_party[index] = [actor.name, actor.hp, actor.maxhp, actor.mp, actor.maxmp, actor.states] # self.contents.clear end def update super return unless @f for i in [email]0...@s_sprite.size[/email] @s_sprite[i].opacity = @opacity end [url=home.php?mod=space&uid=316553]@opacity[/url] += 8 for i in [email]0...@s_sprite.size[/email] a = $game_party.members[i] m = @s_party[i] if (a.name != m[0]) or (a.hp != m[1]) or (a.mp != m[3]) or (a.states != m[5]) or (a.maxhp != m[2]) or (a.maxmp != m[4]) @s_sprite[i].bitmap.dispose draw_item(i) end end end def dispose super return unless @f for i in [email]0...@lvuppop.size[/email] @lvuppop[i].dispose if @lvuppop[i] != nil end @lvuppop = nil for i in [email]0...@s_sprite.size[/email] @s_sprite[i].bitmap.dispose @s_sprite[i].dispose end end def item_rect(index) rect = Rect.new(0, 0, 0, 0) return rect end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ★ エイリアス(v1.4修正箇所) #-------------------------------------------------------------------------- alias start_str11c start def start # 配列記憶 @str_member = $game_party.members.clone @trid = -1 start_str11c end alias terminate_str11c terminate def terminate terminate_str11c end alias process_battle_event_str11c process_battle_event def process_battle_event process_battle_event_str11c # パーティメンバーに変更があった場合、 # ステータス?バトラーを作り直し if @str_member != $game_party.members @str_member = $game_party.members.clone @spriteset.dispose_actors @spriteset.create_actors @status_window.dispose @status_window = Window_BattleStatus.new(true) @status_window.x = 0 @status_window.y = 416 - 128 p end end alias process_escape_str11c process_escape def process_escape @party_command_window.visible = false process_escape_str11c end alias update_party_command_selection_str11c update_party_command_selection def update_party_command_selection update_party_command_selection_str11c end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_str11 update def update if @status_window.index != -1 m = 4#$game_party.actors a = $game_actors[m[@status_window.index]] end if @target_enemy_window != nil m = @target_enemy_window.enemy a = $game_troop.members[m.index] text = a.name elsif @target_actor_window != nil m = $game_party.actors a = $game_actors[m[@target_actor_window.index]] text = a.name elsif @status_window.index != -1 m = 4#$game_party.actors a = $game_actors[m[@status_window.index]] else end update_str11 end alias update_basic_str11c update_basic def update_basic(m = false) update_basic_str11c(m) @status_window.update end end
module STRRGSS2
ST_SX = -24 # ステータスのX座標修正
ST_SY = -96 # ステータスのY座標修正
ST_WIDTH = 80 # ステータス横幅
ST_NAME = true # ステータスに名前を表示する
PCOMMAND_W = true # パーティコマンドを横並びに変更
PCOMMAND_R = [0,0,544,1] # パーティコマンド[X座標, Y座標, 幅, 文字揃え]
end
class Window_BattleStatus < Window_Selectable
# バトルステータス座標
def set_xy
@x = []
@y = []
for i in 0...$game_party.members.size
w = 128 + 8
x = (544 / 2) - (($game_party.members.size - 1) * (w / 2))
x += (i * (w+40)) -20
@x[i] = x + STRRGSS2::ST_SX
@y[i] = 416 + STRRGSS2::ST_SY
end
end
end
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# ★ 再定義
#--------------------------------------------------------------------------
def initialize
s1 = Vocab::fight
s2 = Vocab::escape
super(128, [s1, s2], 1, 4)
draw_item(0, true)
draw_item(1, $game_troop.can_escape)
self.x = 544-128#STRRGSS2::PCOMMAND_R[0]
self.y = STRRGSS2::PCOMMAND_R[1]
self.active = false
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], STRRGSS2::PCOMMAND_R[3])
end
def update
super
self.visible = self.active
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ★ エイリアス
#--------------------------------------------------------------------------
alias initialize_str11c initialize
def initialize(f = false)
@f = f
@lvuppop = []
set_xy
@s_sprite = []
@s_party = []
@s_lv = []
[url=home.php?mod=space&uid=316553]@opacity[/url] = 0
initialize_str11c
self.contents.dispose
self.contents = Bitmap.new(STRRGSS2::ST_WIDTH, height - 32)
self.back_opacity = 0
self.opacity = 0
@column_max = 4#$game_party.actors.size
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for i in 0...@item_max
draw_item(i)
end
update
end
#--------------------------------------------------------------------------
# ● 名前の描画
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, STRRGSS2::ST_WIDTH, WLH, actor.name)
end
#--------------------------------------------------------------------------
# ★ 再定義
#--------------------------------------------------------------------------
def draw_item(index)
return unless @f
rect = item_rect(index)
rect.x = 0
rect.y = 0
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_actor_name(actor, rect.x, rect.y + 72 - 24 - 40) if STRRGSS2::ST_NAME
w = STRRGSS2::ST_WIDTH
draw_actor_state(actor, rect.x, rect.y + 72, w)
draw_actor_hp(actor, rect.x, rect.y + 72 - 24 - 20, w)
draw_actor_mp(actor, rect.x, rect.y + 72 - 24, w)
#
@s_sprite[index] = Sprite.new if @s_sprite[index] == nil
@s_sprite[index].bitmap = self.contents.clone
@s_sprite[index].x = @x[index] + 4
@s_sprite[index].y = @y[index]
@s_sprite[index].opacity = @opacity
@s_lv[index] = actor.level
@s_party[index] = [actor.name, actor.hp, actor.maxhp, actor.mp, actor.maxmp, actor.states]
#
self.contents.clear
end
def update
super
return unless @f
for i in [email]0...@s_sprite.size[/email]
@s_sprite[i].opacity = @opacity
end
[url=home.php?mod=space&uid=316553]@opacity[/url] += 8
for i in [email]0...@s_sprite.size[/email]
a = $game_party.members[i]
m = @s_party[i]
if (a.name != m[0]) or (a.hp != m[1]) or (a.mp != m[3]) or
(a.states != m[5]) or (a.maxhp != m[2]) or (a.maxmp != m[4])
@s_sprite[i].bitmap.dispose
draw_item(i)
end
end
end
def dispose
super
return unless @f
for i in [email]0...@lvuppop.size[/email]
@lvuppop[i].dispose if @lvuppop[i] != nil
end
@lvuppop = nil
for i in [email]0...@s_sprite.size[/email]
@s_sprite[i].bitmap.dispose
@s_sprite[i].dispose
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
return rect
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ★ エイリアス(v1.4修正箇所)
#--------------------------------------------------------------------------
alias start_str11c start
def start
# 配列記憶
@str_member = $game_party.members.clone
@trid = -1
start_str11c
end
alias terminate_str11c terminate
def terminate
terminate_str11c
end
alias process_battle_event_str11c process_battle_event
def process_battle_event
process_battle_event_str11c
# パーティメンバーに変更があった場合、
# ステータス?バトラーを作り直し
if @str_member != $game_party.members
@str_member = $game_party.members.clone
@spriteset.dispose_actors
@spriteset.create_actors
@status_window.dispose
@status_window = Window_BattleStatus.new(true)
@status_window.x = 0
@status_window.y = 416 - 128
p
end
end
alias process_escape_str11c process_escape
def process_escape
@party_command_window.visible = false
process_escape_str11c
end
alias update_party_command_selection_str11c update_party_command_selection
def update_party_command_selection
update_party_command_selection_str11c
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_str11 update
def update
if @status_window.index != -1
m = 4#$game_party.actors
a = $game_actors[m[@status_window.index]]
end
if @target_enemy_window != nil
m = @target_enemy_window.enemy
a = $game_troop.members[m.index]
text = a.name
elsif @target_actor_window != nil
m = $game_party.actors
a = $game_actors[m[@target_actor_window.index]]
text = a.name
elsif @status_window.index != -1
m = 4#$game_party.actors
a = $game_actors[m[@status_window.index]]
else
end
update_str11
end
alias update_basic_str11c update_basic
def update_basic(m = false)
update_basic_str11c(m)
@status_window.update
end
end
class Window_BattleStatus < Window_Selectable BTSKIN_00 = "" # メインスキン BTSKIN_01 = "Btskin_hp" # HP(ゲージ) BTSKIN_02 = "Btskin_mp" # MP(ゲージ) BTSKIN_04 = "Btskin_n00" # HP(数字) BTSKIN_05 = "Btskin_n00" # MP(数字) BTSKIN_03 = ""#"Btskin_state" # ステートスキン # 各スキン座標[ x, y] BTSKIN_B_XY = [ 0, 0] # 基準座標 BTSKIN_00XY = [ 0, 0] # メインスキン BTSKIN_01XY = [124, 13] # HP(ゲージ) BTSKIN_02XY = [207, 14] # MP(ゲージ) BTSKIN_04XY = [148-16, 1] # HP(数字) BTSKIN_05XY = [232-16, 1] # MP(数字) BTSKIN_03XY = [180, -10] # State Skin BTSKIN_06XY = [460, 3] # State # Various Settings BTSKIN_01GS = 2 # HP Gauge Speed (Low values are fast) BTSKIN_02GS = 4 # MP Gauge Speed(Low values are fast) BTSKIN_04SS = 8 # HP Rolling Numbers Speed(Low values are fast) BTSKIN_05SS = 2 # MP Rolling Numbers Speed(Low values are fast) BTSKIN_04NS = 4 # HP Maximum Digits BTSKIN_05NS = 4 # MP Maximum Digits BTSKIN_06WH = [24,24] # [State Width, Height] BTSKIN_06SC = 2 # State Icon Scroll Speed # (Values close to 1 are fast) # バトルステータス座標 def set_xy @x = [] @y = [] for i in 0...$game_party.members.size x = 0 y = (i * 24) @x[i] = x + 16#+ STRRGSS2::ST_SX @y[i] = y + 16#+ STRRGSS2::ST_SY end end # 設定箇所ここまで @@f = false #-------------------------------------------------------------------------- # ★ エイリアス #-------------------------------------------------------------------------- alias initialize_str33 initialize def initialize(f = false) initialize_str33 unless @@f @f = @@f = true else @f = false end set_xy @s_sprite = [] @s_party = [] @s_lv = [] [url=home.php?mod=space&uid=316553]@opacity[/url] = 0 self.contents.dispose self.create_contents self.back_opacity = 0 self.opacity = 0 #@column_max = $game_party.actors.size @viewport = Viewport.new(0, 416-128, 416, 128) @hpgw = (Cache.system(BTSKIN_01)).width @mpgw = (Cache.system(BTSKIN_02)).width @viewport.z = self.z - 1 @state_opacity = [] @item_max = $game_party.members.size return unless @f for i in 0...@item_max draw_item(i) end update end #-------------------------------------------------------------------------- # ● リフレッシュ潰し #-------------------------------------------------------------------------- def refresh # :-) end #-------------------------------------------------------------------------- # ● ステートの描画 #-------------------------------------------------------------------------- def draw_actor_state(actor) icon = Cache.system("Iconset") w = actor.states.size * 24 w = 24 if w < 1 bitmap = Bitmap.new(w, BTSKIN_06WH[1]) count = 0 for state in actor.states icon_index = state.icon_index x = 24 * count rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) bitmap.blt(x, 0, icon, rect) count += 1 end return bitmap end #-------------------------------------------------------------------------- # ● 名前作成 #-------------------------------------------------------------------------- def name_bitmap(actor) bitmap = Bitmap.new(100, 24) bitmap.font.size = 16 return bitmap end #-------------------------------------------------------------------------- # ● ステート数取得 #-------------------------------------------------------------------------- def state_size(actor) return actor.states.size end #-------------------------------------------------------------------------- # ● アイテム作成 #-------------------------------------------------------------------------- def draw_item(index) return unless @f actor = $game_party.members[index] # @s_sprite[index] = [] s = @s_sprite[index] # メインスキン s[0] = Sprite.new(@viewport) s[0].bitmap = Cache.system(BTSKIN_00) s[0].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_00XY[0] s[0].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_00XY[1] s[0].z = 0 # HP s[1] = Sprite.new(@viewport) s[1].bitmap = Cache.system(BTSKIN_01) s[1].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0] s[1].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1] s[1].z = 4 w = s[1].bitmap.width h = s[1].bitmap.height / 2 s[1].src_rect.set(0, 0, w, h) s[2] = Sprite.new(@viewport) s[2].bitmap = Cache.system(BTSKIN_01) s[2].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0] s[2].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1] s[2].z = 3 s[2].src_rect.set(0, h, w, h) s[11] = 96 s[6] = Sprite_strNumbers.new(@viewport, BTSKIN_04, BTSKIN_04NS) s[6].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_04XY[0] s[6].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_04XY[1] s[6].z = 5 s[13] = actor.hp s[6].update(s[13]) # MP s[3] = Sprite.new(@viewport) s[3].bitmap = Cache.system(BTSKIN_02) s[3].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0] s[3].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1] s[3].z = 4 w = s[3].bitmap.width h = s[3].bitmap.height / 2 s[3].src_rect.set(0, 0, w, h) s[4] = Sprite.new(@viewport) s[4].bitmap = Cache.system(BTSKIN_02) s[4].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0] s[4].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1] s[4].z = 3 s[4].src_rect.set(0, h, w, h) s[12] = 56 s[7] = Sprite_strNumbers.new(@viewport, BTSKIN_05, BTSKIN_05NS) s[7].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_05XY[0] s[7].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_05XY[1] s[7].z = 5 s[14] = actor.mp s[7].update(s[14]) # ステート s[5] = Viewport.new(0, 0, BTSKIN_06WH[0], BTSKIN_06WH[1]) s[5].rect.x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_06XY[0] + @viewport.rect.x s[5].rect.y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_06XY[1] + @viewport.rect.y s[5].z = @viewport.z + 1 s[8] = Sprite.new(@viewport) s[8].bitmap = Cache.system(BTSKIN_03) s[8].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_03XY[0] s[8].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_03XY[1] s[8].z = -2 s[9] = Plane.new(s[5]) s[9].bitmap = draw_actor_state(actor) s[10] = state_size(actor) # 現在のステータスに s[11] = ((@hpgw * (actor.hp / (actor.maxhp * 1.0))) + 1).truncate if actor.maxmp != 0 s[12] = ((@mpgw * (actor.mp / (actor.maxmp * 1.0))) + 1).truncate else s[12] = 0 end s[15] = Sprite.new(@viewport) s[15].bitmap = name_bitmap(actor) s[15].x = @x[index] + 4 s[15].y = @y[index] + 2 s[15].z = 0 s[1].src_rect.width = s[11] s[2].src_rect.width = s[11] s[3].src_rect.width = s[12] s[4].src_rect.width = s[12] s[6].update(s[13]) s[7].update(s[14]) # 不可視に for l in [0,1,2,3,4,8,9,15] s[l].opacity = 0 end for l in [6,7] s[l].o = 0 end # 情報記憶 @s_lv[index] = actor.level @s_party[index] = [actor.name, actor.hp, actor.maxhp, actor.mp, actor.maxmp, actor.states] # x = index * 161 - 20 y = 15 s[16] = Sprite.new s[16].bitmap = Cache.system("HUD_" + actor.name) s[16].x = @x[index] + 4 - 20 s[16].y = @y[index] + 2 + 285 s[16].z = 0 end #-------------------------------------------------------------------------- # ● オブジェクト開放 #-------------------------------------------------------------------------- def dispose super return unless @f for i in [email]0...@s_sprite.size[/email] for l in [0,1,2,3,4,8,9,15,16] @s_sprite[i][l].bitmap.dispose @s_sprite[i][l].dispose end for l in [5,6,7] @s_sprite[i][l].dispose end end @@f = false end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super return unless @f for i in [email]0...@s_sprite.size[/email] s = @s_sprite[i] a = $game_party.members[i] m = @s_party[i] @state_opacity[i] = 0 if @state_opacity[i] == nil # 不透明度アップ @state_opacity[i] += 8 if @opacity < 272 @opacity += 8 for l in [0,1,2,3,4,15] s[l].opacity = @opacity end for l in [6,7] s[l].o = @opacity end end # 名前更新 if a.name != m[0] s[15].bitmap.dispose s[15].bitmap = name_bitmap(a) m[0] = a.name end # HP/MP更新 update_hp(s,a,m) update_mp(s,a,m) # ステート更新 if s[10] > BTSKIN_06WH[0] / 24 and (Graphics.frame_count % BTSKIN_06SC) == 0 s[9].ox += 1 end if s[10] > 0 and @state_opacity[i] < 272 for l in [8,9] s[l].opacity = @state_opacity[i] end end if a.states != m[5] m[5] = a.states s[9].ox = 0 s[9].bitmap.dispose s[9].bitmap = draw_actor_state($game_party.members[i]) s[10] = state_size($game_party.members[i]) @state_opacity[i] = 0 for l in [8,9] s[l].opacity = @state_opacity[i] end end end end #-------------------------------------------------------------------------- # ● フレーム更新 (HP) #-------------------------------------------------------------------------- def update_hp(s,a,m) # HPくるくる if a.hp != s[13] c = 0; c = 1 if a.hp < a.maxhp / 4; c = 2 if a.hp == 0 if s[13] > a.hp s[13] -= BTSKIN_04SS s[13] = a.hp if s[13] < a.hp else s[13] += BTSKIN_04SS s[13] = a.hp if s[13] > a.hp end s[6].update(s[13], c) end # HP if a.hp != m[1] s[11] = ((@hpgw * (a.hp / (a.maxhp * 1.0))) + 1).truncate m[1] = a.hp end sr = s[1].src_rect if sr.width != s[11] sp = BTSKIN_01GS sr.width = (s[11] + (s[1].src_rect.width * (sp - 1))) / sp sr.width = 2 if sr.width <= 1 and a.hp > 0 end sr = s[2].src_rect sp = 2 if sr.width != s[1].src_rect.width and (Graphics.frame_count % sp) == 0 if sr.width < s[1].src_rect.width sr.width += 1 else sr.width -= 1 end end sr.width = 2 if sr.width <= 1 and a.hp > 0 end #-------------------------------------------------------------------------- # ● フレーム更新 (MP) #-------------------------------------------------------------------------- def update_mp(s,a,m) # MPくるくる if a.mp != s[14] c = 0; c = 1 if a.mp < a.maxmp / 4 if s[14] > a.mp s[14] -= BTSKIN_05SS s[14] = a.mp if s[14] < a.mp else s[14] += BTSKIN_05SS s[14] = a.mp if s[14] > a.mp end s[7].update(s[14], c) end # MP if a.mp != m[3] if a.maxmp != 0 s[12] = ((@mpgw * (a.mp / (a.maxmp * 1.0))) + 1).truncate else s[12] = 0 end m[3] = a.mp end sr = s[3].src_rect if sr.width != s[12] sp = BTSKIN_02GS sr.width = (s[12] + (s[3].src_rect.width * (sp - 1))) / sp sr.width = 2 if sr.width <= 1 and a.mp > 0 end sr = s[4].src_rect sp = 2 if sr.width != s[3].src_rect.width and (Graphics.frame_count % sp) == 0 if sr.width < s[3].src_rect.width sr.width += 1 else sr.width -= 1 end end sr.width = 2 if sr.width <= 1 and a.mp > 0 end end #============================================================================== # ■ Sprite_strNumber #============================================================================== class Sprite_strNumber < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(v, gra, n = 0) @n = n super(v) self.bitmap = Cache.system(gra) [url=home.php?mod=space&uid=133944]@w[/url] = self.bitmap.width/10 @h = self.bitmap.height/3 self.src_rect = Rect.new(@n*@w, 0, @w, @h) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update(n = -1, c = 0) @n = n self.src_rect.x = @n*@w self.src_rect.y = c*@h end end #============================================================================== # ■ Sprite_strNumbers #============================================================================== class Sprite_strNumbers attr_accessor :x attr_accessor :y attr_accessor :z attr_accessor :o #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(v, gra, n = 4, s = 0) @n = n # 桁数 @x = 0 @y = 0 @z = 0 @o = 255 [url=home.php?mod=space&uid=114926]@sprite[/url] = [] # 字間設定 b = Cache.system(gra) @s = b.width / 10 - s # スプライト作成 for i in 0...n @sprite[i] = Sprite_strNumber.new(v, gra) end update end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update(v = 0, c = 0) val = [] # 数値を配列に格納 for i in 0...@n if (10 ** (i)) == 0 val[i] = v % 10 else val[i] = v / (10 ** (i)) % 10 end end val = val.reverse # 先頭の0を取り除く for i in 0...@n if val[i] == 0 and @n != i + 1 val[i] = -1 else break end end # スプライト更新 for i in 0...@n @sprite[i].update(val[i], c) @sprite[i].x = @x + (i * @s) @sprite[i].y = @y @sprite[i].z = @z @sprite[i].opacity = @o end end #-------------------------------------------------------------------------- # ● 不透明度の適用 #-------------------------------------------------------------------------- def o=(val) @o = val for i in 0...@n @sprite[i].opacity = @o end end #-------------------------------------------------------------------------- # ● オブジェクト開放 #-------------------------------------------------------------------------- def dispose for i in [email]0...@sprite.size[/email] @sprite[i].bitmap.dispose @sprite[i].dispose end end end
class Window_BattleStatus < Window_Selectable
BTSKIN_00 = "" # メインスキン
BTSKIN_01 = "Btskin_hp" # HP(ゲージ)
BTSKIN_02 = "Btskin_mp" # MP(ゲージ)
BTSKIN_04 = "Btskin_n00" # HP(数字)
BTSKIN_05 = "Btskin_n00" # MP(数字)
BTSKIN_03 = ""#"Btskin_state" # ステートスキン
# 各スキン座標[ x, y]
BTSKIN_B_XY = [ 0, 0] # 基準座標
BTSKIN_00XY = [ 0, 0] # メインスキン
BTSKIN_01XY = [124, 13] # HP(ゲージ)
BTSKIN_02XY = [207, 14] # MP(ゲージ)
BTSKIN_04XY = [148-16, 1] # HP(数字)
BTSKIN_05XY = [232-16, 1] # MP(数字)
BTSKIN_03XY = [180, -10] # State Skin
BTSKIN_06XY = [460, 3] # State
# Various Settings
BTSKIN_01GS = 2 # HP Gauge Speed (Low values are fast)
BTSKIN_02GS = 4 # MP Gauge Speed(Low values are fast)
BTSKIN_04SS = 8 # HP Rolling Numbers Speed(Low values are fast)
BTSKIN_05SS = 2 # MP Rolling Numbers Speed(Low values are fast)
BTSKIN_04NS = 4 # HP Maximum Digits
BTSKIN_05NS = 4 # MP Maximum Digits
BTSKIN_06WH = [24,24] # [State Width, Height]
BTSKIN_06SC = 2 # State Icon Scroll Speed
# (Values close to 1 are fast)
# バトルステータス座標
def set_xy
@x = []
@y = []
for i in 0...$game_party.members.size
x = 0
y = (i * 24)
@x[i] = x + 16#+ STRRGSS2::ST_SX
@y[i] = y + 16#+ STRRGSS2::ST_SY
end
end
# 設定箇所ここまで
@@f = false
#--------------------------------------------------------------------------
# ★ エイリアス
#--------------------------------------------------------------------------
alias initialize_str33 initialize
def initialize(f = false)
initialize_str33
unless @@f
@f = @@f = true
else
@f = false
end
set_xy
@s_sprite = []
@s_party = []
@s_lv = []
[url=home.php?mod=space&uid=316553]@opacity[/url] = 0
self.contents.dispose
self.create_contents
self.back_opacity = 0
self.opacity = 0
#@column_max = $game_party.actors.size
@viewport = Viewport.new(0, 416-128, 416, 128)
@hpgw = (Cache.system(BTSKIN_01)).width
@mpgw = (Cache.system(BTSKIN_02)).width
@viewport.z = self.z - 1
@state_opacity = []
@item_max = $game_party.members.size
return unless @f
for i in 0...@item_max
draw_item(i)
end
update
end
#--------------------------------------------------------------------------
# ● リフレッシュ潰し
#--------------------------------------------------------------------------
def refresh
# :-)
end
#--------------------------------------------------------------------------
# ● ステートの描画
#--------------------------------------------------------------------------
def draw_actor_state(actor)
icon = Cache.system("Iconset")
w = actor.states.size * 24
w = 24 if w < 1
bitmap = Bitmap.new(w, BTSKIN_06WH[1])
count = 0
for state in actor.states
icon_index = state.icon_index
x = 24 * count
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
bitmap.blt(x, 0, icon, rect)
count += 1
end
return bitmap
end
#--------------------------------------------------------------------------
# ● 名前作成
#--------------------------------------------------------------------------
def name_bitmap(actor)
bitmap = Bitmap.new(100, 24)
bitmap.font.size = 16
return bitmap
end
#--------------------------------------------------------------------------
# ● ステート数取得
#--------------------------------------------------------------------------
def state_size(actor)
return actor.states.size
end
#--------------------------------------------------------------------------
# ● アイテム作成
#--------------------------------------------------------------------------
def draw_item(index)
return unless @f
actor = $game_party.members[index]
#
@s_sprite[index] = []
s = @s_sprite[index]
# メインスキン
s[0] = Sprite.new(@viewport)
s[0].bitmap = Cache.system(BTSKIN_00)
s[0].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_00XY[0]
s[0].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_00XY[1]
s[0].z = 0
# HP
s[1] = Sprite.new(@viewport)
s[1].bitmap = Cache.system(BTSKIN_01)
s[1].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]
s[1].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]
s[1].z = 4
w = s[1].bitmap.width
h = s[1].bitmap.height / 2
s[1].src_rect.set(0, 0, w, h)
s[2] = Sprite.new(@viewport)
s[2].bitmap = Cache.system(BTSKIN_01)
s[2].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]
s[2].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]
s[2].z = 3
s[2].src_rect.set(0, h, w, h)
s[11] = 96
s[6] = Sprite_strNumbers.new(@viewport, BTSKIN_04, BTSKIN_04NS)
s[6].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_04XY[0]
s[6].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_04XY[1]
s[6].z = 5
s[13] = actor.hp
s[6].update(s[13])
# MP
s[3] = Sprite.new(@viewport)
s[3].bitmap = Cache.system(BTSKIN_02)
s[3].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0]
s[3].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1]
s[3].z = 4
w = s[3].bitmap.width
h = s[3].bitmap.height / 2
s[3].src_rect.set(0, 0, w, h)
s[4] = Sprite.new(@viewport)
s[4].bitmap = Cache.system(BTSKIN_02)
s[4].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_02XY[0]
s[4].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_02XY[1]
s[4].z = 3
s[4].src_rect.set(0, h, w, h)
s[12] = 56
s[7] = Sprite_strNumbers.new(@viewport, BTSKIN_05, BTSKIN_05NS)
s[7].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_05XY[0]
s[7].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_05XY[1]
s[7].z = 5
s[14] = actor.mp
s[7].update(s[14])
# ステート
s[5] = Viewport.new(0, 0, BTSKIN_06WH[0], BTSKIN_06WH[1])
s[5].rect.x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_06XY[0] + @viewport.rect.x
s[5].rect.y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_06XY[1] + @viewport.rect.y
s[5].z = @viewport.z + 1
s[8] = Sprite.new(@viewport)
s[8].bitmap = Cache.system(BTSKIN_03)
s[8].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_03XY[0]
s[8].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_03XY[1]
s[8].z = -2
s[9] = Plane.new(s[5])
s[9].bitmap = draw_actor_state(actor)
s[10] = state_size(actor)
# 現在のステータスに
s[11] = ((@hpgw * (actor.hp / (actor.maxhp * 1.0))) + 1).truncate
if actor.maxmp != 0
s[12] = ((@mpgw * (actor.mp / (actor.maxmp * 1.0))) + 1).truncate
else
s[12] = 0
end
s[15] = Sprite.new(@viewport)
s[15].bitmap = name_bitmap(actor)
s[15].x = @x[index] + 4
s[15].y = @y[index] + 2
s[15].z = 0
s[1].src_rect.width = s[11]
s[2].src_rect.width = s[11]
s[3].src_rect.width = s[12]
s[4].src_rect.width = s[12]
s[6].update(s[13])
s[7].update(s[14])
# 不可視に
for l in [0,1,2,3,4,8,9,15]
s[l].opacity = 0
end
for l in [6,7]
s[l].o = 0
end
# 情報記憶
@s_lv[index] = actor.level
@s_party[index] = [actor.name, actor.hp, actor.maxhp,
actor.mp, actor.maxmp, actor.states]
#
x = index * 161 - 20
y = 15
s[16] = Sprite.new
s[16].bitmap = Cache.system("HUD_" + actor.name)
s[16].x = @x[index] + 4 - 20
s[16].y = @y[index] + 2 + 285
s[16].z = 0
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
super
return unless @f
for i in [email]0...@s_sprite.size[/email]
for l in [0,1,2,3,4,8,9,15,16]
@s_sprite[i][l].bitmap.dispose
@s_sprite[i][l].dispose
end
for l in [5,6,7]
@s_sprite[i][l].dispose
end
end
@@f = false
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
return unless @f
for i in [email]0...@s_sprite.size[/email]
s = @s_sprite[i]
a = $game_party.members[i]
m = @s_party[i]
@state_opacity[i] = 0 if @state_opacity[i] == nil
# 不透明度アップ
@state_opacity[i] += 8
if @opacity < 272
@opacity += 8
for l in [0,1,2,3,4,15]
s[l].opacity = @opacity
end
for l in [6,7]
s[l].o = @opacity
end
end
# 名前更新
if a.name != m[0]
s[15].bitmap.dispose
s[15].bitmap = name_bitmap(a)
m[0] = a.name
end
# HP/MP更新
update_hp(s,a,m)
update_mp(s,a,m)
# ステート更新
if s[10] > BTSKIN_06WH[0] / 24 and (Graphics.frame_count % BTSKIN_06SC) == 0
s[9].ox += 1
end
if s[10] > 0 and @state_opacity[i] < 272
for l in [8,9]
s[l].opacity = @state_opacity[i]
end
end
if a.states != m[5]
m[5] = a.states
s[9].ox = 0
s[9].bitmap.dispose
s[9].bitmap = draw_actor_state($game_party.members[i])
s[10] = state_size($game_party.members[i])
@state_opacity[i] = 0
for l in [8,9]
s[l].opacity = @state_opacity[i]
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (HP)
#--------------------------------------------------------------------------
def update_hp(s,a,m)
# HPくるくる
if a.hp != s[13]
c = 0; c = 1 if a.hp < a.maxhp / 4; c = 2 if a.hp == 0
if s[13] > a.hp
s[13] -= BTSKIN_04SS
s[13] = a.hp if s[13] < a.hp
else
s[13] += BTSKIN_04SS
s[13] = a.hp if s[13] > a.hp
end
s[6].update(s[13], c)
end
# HP
if a.hp != m[1]
s[11] = ((@hpgw * (a.hp / (a.maxhp * 1.0))) + 1).truncate
m[1] = a.hp
end
sr = s[1].src_rect
if sr.width != s[11]
sp = BTSKIN_01GS
sr.width = (s[11] + (s[1].src_rect.width * (sp - 1))) / sp
sr.width = 2 if sr.width <= 1 and a.hp > 0
end
sr = s[2].src_rect
sp = 2
if sr.width != s[1].src_rect.width and (Graphics.frame_count % sp) == 0
if sr.width < s[1].src_rect.width
sr.width += 1
else
sr.width -= 1
end
end
sr.width = 2 if sr.width <= 1 and a.hp > 0
end
#--------------------------------------------------------------------------
# ● フレーム更新 (MP)
#--------------------------------------------------------------------------
def update_mp(s,a,m)
# MPくるくる
if a.mp != s[14]
c = 0; c = 1 if a.mp < a.maxmp / 4
if s[14] > a.mp
s[14] -= BTSKIN_05SS
s[14] = a.mp if s[14] < a.mp
else
s[14] += BTSKIN_05SS
s[14] = a.mp if s[14] > a.mp
end
s[7].update(s[14], c)
end
# MP
if a.mp != m[3]
if a.maxmp != 0
s[12] = ((@mpgw * (a.mp / (a.maxmp * 1.0))) + 1).truncate
else
s[12] = 0
end
m[3] = a.mp
end
sr = s[3].src_rect
if sr.width != s[12]
sp = BTSKIN_02GS
sr.width = (s[12] + (s[3].src_rect.width * (sp - 1))) / sp
sr.width = 2 if sr.width <= 1 and a.mp > 0
end
sr = s[4].src_rect
sp = 2
if sr.width != s[3].src_rect.width and (Graphics.frame_count % sp) == 0
if sr.width < s[3].src_rect.width
sr.width += 1
else
sr.width -= 1
end
end
sr.width = 2 if sr.width <= 1 and a.mp > 0
end
end
#==============================================================================
# ■ Sprite_strNumber
#==============================================================================
class Sprite_strNumber < Sprite
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(v, gra, n = 0)
@n = n
super(v)
self.bitmap = Cache.system(gra)
[url=home.php?mod=space&uid=133944]@w[/url] = self.bitmap.width/10
@h = self.bitmap.height/3
self.src_rect = Rect.new(@n*@w, 0, @w, @h)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update(n = -1, c = 0)
@n = n
self.src_rect.x = @n*@w
self.src_rect.y = c*@h
end
end
#==============================================================================
# ■ Sprite_strNumbers
#==============================================================================
class Sprite_strNumbers
attr_accessor :x
attr_accessor :y
attr_accessor :z
attr_accessor :o
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(v, gra, n = 4, s = 0)
@n = n # 桁数
@x = 0
@y = 0
@z = 0
@o = 255
[url=home.php?mod=space&uid=114926]@sprite[/url] = []
# 字間設定
b = Cache.system(gra)
@s = b.width / 10 - s
# スプライト作成
for i in 0...n
@sprite[i] = Sprite_strNumber.new(v, gra)
end
update
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update(v = 0, c = 0)
val = []
# 数値を配列に格納
for i in 0...@n
if (10 ** (i)) == 0
val[i] = v % 10
else
val[i] = v / (10 ** (i)) % 10
end
end
val = val.reverse
# 先頭の0を取り除く
for i in 0...@n
if val[i] == 0 and @n != i + 1
val[i] = -1
else
break
end
end
# スプライト更新
for i in 0...@n
@sprite[i].update(val[i], c)
@sprite[i].x = @x + (i * @s)
@sprite[i].y = @y
@sprite[i].z = @z
@sprite[i].opacity = @o
end
end
#--------------------------------------------------------------------------
# ● 不透明度の適用
#--------------------------------------------------------------------------
def o=(val)
@o = val
for i in 0...@n
@sprite[i].opacity = @o
end
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
for i in [email]0...@sprite.size[/email]
@sprite[i].bitmap.dispose
@sprite[i].dispose
end
end
end
#============================================================================== # ■ Bitmap #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ● 文字描画 #-------------------------------------------------------------------------- def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,255)) shadow = self.font.shadow b_color = self.font.color.dup font.shadow = false font.color = color draw_text(x + 1, y, width, height, str, align) draw_text(x - 1, y, width, height, str, align) draw_text(x, y + 1, width, height, str, align) draw_text(x, y - 1, width, height, str, align) font.color = b_color draw_text(x, y, width, height, str, align) font.shadow = shadow end def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,255)) draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color) end end
#==============================================================================
# ■ Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● 文字描画
#--------------------------------------------------------------------------
def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,255))
shadow = self.font.shadow
b_color = self.font.color.dup
font.shadow = false
font.color = color
draw_text(x + 1, y, width, height, str, align)
draw_text(x - 1, y, width, height, str, align)
draw_text(x, y + 1, width, height, str, align)
draw_text(x, y - 1, width, height, str, align)
font.color = b_color
draw_text(x, y, width, height, str, align)
font.shadow = shadow
end
def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,255))
draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
end
end
|
评分
-
查看全部评分
|