赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 4562 |
最后登录 | 2017-12-10 |
在线时间 | 78 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 210
- 在线时间
- 78 小时
- 注册时间
- 2010-7-1
- 帖子
- 58
|
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ HP/SP表示改造2 - KGC_HPSPAlter2 ◆
- #_/ ◇ Last update : 2007/12/23 ◇
- #_/----------------------------------------------------------------------------
- #_/ HP/SP の表示形式を変更します。
- #_/============================================================================
- #_/ 「システム系」スクリプト最上部
- #_/ ≪HP/SP表示改造[HPSPAlter]≫との併用不可
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ カスタマイズ項目 ★
- #==============================================================================
- module KGC
- module HPSPAlter2
- # ◆ HP ゲージ画像
- # "Graphics/Pictures" から読み込む。
- # 拡張子省略可。
- # HP_GAUGE = nil にすると、ゲージ非表示。
- HP_GAUGE = "gauge_hp3"
- # ◆ SP ゲージ画像
- SP_GAUGE = "gauge_sp3"
- # ◆ EXP (NEXT) ゲージ画像
- # ゲージの有無は、使用する機能に依存。
- EXP_GAUGE = "gauge_exp2"
- # ◆非戦闘時 HP ゲージ位置 [x, y]
- # HP 表示位置からの相対座標。
- HP_POSITION = [0, 0]
- # ◆非戦闘時 HP ゲージ長補正
- # ゲージの長さに加算。(負にすれば短くなる)
- HP_LENGTH = 28
- # ◆非戦闘時 SP ゲージ位置 [x, y]
- SP_POSITION = [0, 0]
- # ◆非戦闘時 SP ゲージ長補正
- SP_LENGTH = 28
- # ◆戦闘時 HP ゲージ位置 [x, y]
- HP_POSITION_BATTLE = [0, 2]
- # ◆戦闘時 HP ゲージ長補正
- HP_LENGTH_BATTLE = 28
- # ◆戦闘時 SP ゲージ位置 [x, y]
- SP_POSITION_BATTLE = [0, 2]
- # ◆戦闘時 SP ゲージ長補正
- SP_LENGTH_BATTLE = 28
- # ◆ EXP ゲージ位置 [x, y]
- EXP_POSITION = [-28, 0]
- # ◆ EXP ゲージ長補正
- EXP_LENGTH = 56
- # ◆ HP/SP を画像で描画
- # 画像を使用すると、HP/SP の描画が少しだけ速くなります。
- DRAW_HPSP_IMAGE = true
- # ◆数値画像
- FIGURE_NORMAL = "figure2"
- # ◆数値画像 (瀕死)
- FIGURE_CRISIS = "figure2_crisis"
- # ◆数値画像 (死亡)
- FIGURE_DEAD = "figure2_dead"
- # ◆数値画像の描画位置補正 [x, y]
- DIGIT_POSITION = [0, 8]
- # ◆数値画像の描画間隔
- # 使用する数値画像に合わせて調整。
- DIGIT_SPACE = 11
- # ◆ステータスを影文字で描画
- # 導入した機能によって変化する場合あり。
- TEXT_SHADOW = true
- # ◆戦闘中は最大 HP/SP を描画しない
- HIDE_MAXHPSP_BATTLE = true
- # ◆文字列 "HP" を描画しない
- # 「HP 9999/9999」の "HP" を描画しなくなる。
- HIDE_HP_STRING = true
- # ◆文字列 "SP" を描画しない
- HIDE_SP_STRING = true
- # ◆文字列 "NEXT" を描画しない
- HIDE_NEXT_STRING = false
- # ◆ゲージを流す
- FLOW_GAUGE = true
- # ◆ゲージが流れる速度
- FLOW_SPEED = 4
- # ◆差分ゲージを描画
- DRAW_DIFF_GAUGE = true
- # ◆差分ゲージ速度
- # 数値が大きいほど減少が速い。
- DIFF_GAUGE_SPEED = 5
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- $imported = {} if $imported == nil
- $imported["HPSPAlter2"] = true
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- attr_reader :exp_list
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- @@_hpsp_gauge_x = 0
- #--------------------------------------------------------------------------
- # ● ゲージ位置設定
- #--------------------------------------------------------------------------
- def self.set_hpsp_gauge_x(nx)
- @@_hpsp_gauge_x = nx
- end
- #--------------------------------------------------------------------------
- # ● 数値描画
- # image : 数値画像
- #--------------------------------------------------------------------------
- def draw_number(image, x, y, width, height, number, align = 0)
- string = number.to_s
- space = KGC::HPSPAlter2::DIGIT_SPACE
- rect = Rect.new(0, 0, image.width / 11, image.height)
- dx = x + KGC::HPSPAlter2::DIGIT_POSITION[0]
- case align
- when 0 # 左寄せ
- dx += space * string.length
- when 1 # 中央寄せ
- dx += (width - space * string.length) / 2
- when 2 # 右寄せ
- dx += width - rect.width
- end
- dy = y + KGC::HPSPAlter2::DIGIT_POSITION[1]
- (1..string.length).each { |i|
- char = string[-i, 1]
- if char == "/"
- n = 10
- elsif char =~ /\d/
- n = char.to_i
- else
- next
- end
- rect.x = n * rect.width
- self.contents.blt(dx, dy, image, rect)
- dx -= space
- }
- end
- #--------------------------------------------------------------------------
- # ● 描画メソッド取得
- #--------------------------------------------------------------------------
- def get_text_draw_method
- if KGC::HPSPAlter2::TEXT_SHADOW
- return self.contents.method(:draw_shadow_text)
- else
- return self.contents.method(:draw_text)
- end
- end
- #--------------------------------------------------------------------------
- # ● HP の描画
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 144)
- unless $game_temp.in_battle
- draw_actor_hp_gauge(actor, x, y, width)
- end
- draw_method = get_text_draw_method
- # 文字列 "HP" を描画
- unless KGC::HPSPAlter2::HIDE_HP_STRING
- self.contents.font.color = system_color
- draw_method.call(x, y, 32, 32, $data_system.words.hp)
- end
- if KGC::HPSPAlter2::DRAW_HPSP_IMAGE
- draw_actor_hp_image(actor, x, y, width)
- return
- end
- # MaxHP を描画するスペースがあるか計算
- hp_x = x + width - 48
- flag = false
- if !$game_temp.in_battle || !KGC::HPSPAlter2::HIDE_MAXHPSP_BATTLE
- if width >= 108
- hp_x = x + width - 108
- flag = true
- end
- end
- # HP を描画
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- draw_method.call(hp_x, y, 48, 32, actor.hp.to_s, 2)
- # MaxHP を描画
- if flag
- self.contents.font.color = normal_color
- draw_method.call(hp_x + 48, y, 12, 32, "/", 1)
- draw_method.call(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # ● HP を画像で描画
- #--------------------------------------------------------------------------
- def draw_actor_hp_image(actor, x, y, width)
- # MaxHP を描画するスペースがあるか計算
- hp_x = x + width - 48
- flag = false
- if !$game_temp.in_battle || !KGC::HPSPAlter2::HIDE_MAXHPSP_BATTLE
- if width >= 108
- hp_x = x + width - 108
- flag = true
- end
- end
- # HP を描画
- if actor.hp == 0
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_DEAD)
- elsif actor.hp <= actor.maxhp / 4
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_CRISIS)
- else
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_NORMAL)
- end
- if flag
- draw_number(image, hp_x, y, 108, 32, "#{actor.hp}/#{actor.maxhp}", 2)
- else
- draw_number(image, hp_x, y, 48, 32, actor.hp.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● SP の描画
- #--------------------------------------------------------------------------
- def draw_actor_sp(actor, x, y, width = 144)
- unless $game_temp.in_battle
- draw_actor_sp_gauge(actor, x, y, width)
- end
- draw_method = get_text_draw_method
- # 文字列 "SP" を描画
- unless KGC::HPSPAlter2::HIDE_SP_STRING
- self.contents.font.color = system_color
- draw_method.call(x, y, 32, 32, $data_system.words.sp)
- end
- if KGC::HPSPAlter2::DRAW_HPSP_IMAGE
- draw_actor_sp_image(actor, x, y, width)
- return
- end
- # MaxSP を描画するスペースがあるか計算
- sp_x = x + width - 48
- flag = false
- if !$game_temp.in_battle || !KGC::HPSPAlter2::HIDE_MAXHPSP_BATTLE
- if width >= 108
- sp_x = x + width - 108
- flag = true
- end
- end
- # SP を描画
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- draw_method.call(sp_x, y, 48, 32, actor.sp.to_s, 2)
- # MaxSP を描画
- if flag
- self.contents.font.color = normal_color
- draw_method.call(sp_x + 48, y, 12, 32, "/", 1)
- draw_method.call(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # ● SP を画像で描画
- #--------------------------------------------------------------------------
- def draw_actor_sp_image(actor, x, y, width)
- # MaxSP を描画するスペースがあるか計算
- sp_x = x + width - 48
- flag = false
- if !$game_temp.in_battle || !KGC::HPSPAlter2::HIDE_MAXHPSP_BATTLE
- if width >= 108
- sp_x = x + width - 108
- flag = true
- end
- end
- # SP を描画
- if actor.sp == 0
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_DEAD)
- elsif actor.sp <= actor.maxsp / 4
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_CRISIS)
- else
- image = RPG::Cache.picture(KGC::HPSPAlter2::FIGURE_NORMAL)
- end
- if flag
- draw_number(image, sp_x, y, 108, 32, "#{actor.sp}/#{actor.maxsp}", 2)
- else
- draw_number(image, sp_x, y, 48, 32, actor.sp.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージの描画
- #--------------------------------------------------------------------------
- def draw_actor_hp_gauge(actor, x, y, width)
- if KGC::HPSPAlter2::HP_GAUGE == nil
- return
- end
- bitmap = self.contents
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::HP_GAUGE)
- nx = x + KGC::HPSPAlter2::HP_POSITION[0]
- ny = y + KGC::HPSPAlter2::HP_POSITION[1]
- nw = width + KGC::HPSPAlter2::HP_LENGTH
- gauge_width = calc_hp_gauge_width(actor, nw)
- draw_gauge_back(bitmap, gauge, nx, ny, nw)
- draw_gauge_inside(bitmap, gauge, nx, ny, nw, gauge_width)
- draw_gauge_fore(bitmap, gauge, nx, ny, nw)
- end
- #--------------------------------------------------------------------------
- # ● ゲージ背景の描画
- # bitmap : 描画先画像
- # image : ゲージ画像
- # width : ゲージ幅
- #--------------------------------------------------------------------------
- def draw_gauge_back(bitmap, image, x, y, width)
- src_rect = Rect.new(0, 0, 32, 32)
- bitmap.blt(x, y, image, src_rect)
- src_rect.set(32, 0, 96, 32)
- dest_rect = Rect.new(x + 32, y, width - 64, 32)
- bitmap.stretch_blt(dest_rect, image, src_rect)
- src_rect.set(128, 0, 32, 32)
- bitmap.blt(x + width - 32, y, image, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● ゲージ内部の描画
- # bitmap : 描画先画像
- # image : ゲージ画像
- # width : ゲージ幅
- # gauge_width : ゲージ内部の幅
- #--------------------------------------------------------------------------
- def draw_gauge_inside(bitmap, image, x, y, width, gauge_width)
- src_rect = Rect.new(@@_hpsp_gauge_x, 32, 96, 32)
- src_rect.width = gauge_width * 96 / (width - 64)
- dest_rect = Rect.new(x + 32, y, gauge_width, 32)
- bitmap.stretch_blt(dest_rect, image, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● ゲージ前景の描画
- # bitmap : 描画先画像
- # image : ゲージ画像
- # width : ゲージ幅
- #--------------------------------------------------------------------------
- def draw_gauge_fore(bitmap, image, x, y, width)
- src_rect = Rect.new(160, 0, 32, 32)
- bitmap.blt(x, y, image, src_rect)
- src_rect.set(192, 0, 96, 32)
- dest_rect = Rect.new(x + 32, y, width - 64, 32)
- bitmap.stretch_blt(dest_rect, image, src_rect)
- src_rect.set(288, 0, 32, 32)
- bitmap.blt(x + width - 32, y, image, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージ幅の計算
- #--------------------------------------------------------------------------
- def calc_hp_gauge_width(actor, width)
- gw = actor.hp * (width - 64) / actor.maxhp
- return [[gw, 0].max, width - 64].min
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージの描画
- #--------------------------------------------------------------------------
- def draw_actor_sp_gauge(actor, x, y, width)
- if KGC::HPSPAlter2::SP_GAUGE == nil
- return
- end
- bitmap = self.contents
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::SP_GAUGE)
- nx = x + KGC::HPSPAlter2::SP_POSITION[0]
- ny = y + KGC::HPSPAlter2::SP_POSITION[1]
- nw = width + KGC::HPSPAlter2::SP_LENGTH
- gauge_width = calc_sp_gauge_width(actor, nw)
- draw_gauge_back(bitmap, gauge, nx, ny, nw)
- draw_gauge_inside(bitmap, gauge, nx, ny, nw, gauge_width)
- draw_gauge_fore(bitmap, gauge, nx, ny, nw)
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージ幅の計算
- #--------------------------------------------------------------------------
- def calc_sp_gauge_width(actor, width)
- gw = 0
- if actor.maxsp > 0
- gw = actor.sp * (width - 64) / actor.maxsp
- end
- return [[gw, 0].max, width - 64].min
- end
- #--------------------------------------------------------------------------
- # ● EXP の描画
- #--------------------------------------------------------------------------
- alias draw_actor_exp_KGC_HPSPAlter2 draw_actor_exp
- def draw_actor_exp(actor, x, y)
- draw_actor_exp_gauge(self.contents, actor, x, y, 204)
- draw_actor_exp_KGC_HPSPAlter2(actor, x, y)
- end
- #--------------------------------------------------------------------------
- # ● 次のレベルまでの EXP の描画
- #--------------------------------------------------------------------------
- def draw_actor_next_exp(actor, x, y, width = 144)
- draw_actor_exp_gauge(self.contents, actor, x, y, width)
- draw_method = get_text_draw_method
- # 文字列 "NEXT" を描画
- unless KGC::HPSPAlter2::HIDE_NEXT_STRING
- self.contents.font.color = system_color
- draw_method.call(x, y, 48, 32, "NEXT")
- end
- self.contents.font.color = normal_color
- draw_method.call(x + 48, y, width - 48, 32, actor.next_rest_exp_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● EXP ゲージの描画
- #--------------------------------------------------------------------------
- def draw_actor_exp_gauge(bitmap, actor, x, y, width)
- if KGC::HPSPAlter2::EXP_GAUGE == nil
- return
- end
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::EXP_GAUGE)
- nx = x + KGC::HPSPAlter2::EXP_POSITION[0]
- ny = y + KGC::HPSPAlter2::EXP_POSITION[1]
- nw = width + KGC::HPSPAlter2::EXP_LENGTH
- gauge_width = calc_exp_gauge_width(actor, nw)
- draw_gauge_back(bitmap, gauge, nx, ny, nw)
- draw_gauge_inside(bitmap, gauge, nx, ny, nw, gauge_width)
- draw_gauge_fore(bitmap, gauge, nx, ny, nw)
- end
- #--------------------------------------------------------------------------
- # ● EXP ゲージ幅の計算
- #--------------------------------------------------------------------------
- def calc_exp_gauge_width(actor, width)
- rest_exp = actor.next_rest_exp_s.to_i
- next_exp = actor.next_exp_s.to_i - actor.exp_list[actor.level]
- gx = x
- gw = 0
- if next_exp > 0
- gw = (next_exp - rest_exp) * (width - 64) / next_exp
- end
- return [[gw, 0].max, width - 64].min
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_BattleStatus
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_KGC_HPSPAlter2 initialize
- def initialize
- @@_hpsp_gauge_x = 0
- @_current_hp = {}
- @_current_sp = {}
- @_prev_hp = {}
- @_prev_sp = {}
- $game_party.actors.each { |actor|
- @_current_hp[actor] = actor.hp
- @_prev_hp[actor] = actor.hp
- @_current_sp[actor] = actor.sp
- @_prev_sp[actor] = actor.sp
- }
- create_hpsp_gauge_sprite
- initialize_KGC_HPSPAlter2
- @_hpsp_gauge_sprite.x = self.x + 16
- @_hpsp_gauge_sprite.y = self.y + 16
- @_hpsp_gauge_sprite.z = self.z
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- alias dispose_KGC_HPSPAlter2 dispose
- def dispose
- @_hpsp_gauge_sprite.bitmap.dispose
- @_hpsp_gauge_sprite.dispose
- @_hpsp_gauge_buffer.dispose
- super
- end
- #--------------------------------------------------------------------------
- # ● HP/SPゲージスプライト作成
- #--------------------------------------------------------------------------
- def create_hpsp_gauge_sprite(viewport = nil)
- if @_hpsp_gauge_sprite != nil
- sx = @_hpsp_gauge_sprite.x
- sy = @_hpsp_gauge_sprite.y
- sz = @_hpsp_gauge_sprite.z
- @_hpsp_gauge_sprite.bitmap.dispose
- @_hpsp_gauge_sprite.dispose
- @_hpsp_gauge_buffer.dispose
- else
- sx = sy = sz = 0
- end
- @_hpsp_gauge_sprite = Sprite.new(viewport)
- @_hpsp_gauge_sprite.bitmap = Bitmap.new(608, 128)
- @_hpsp_gauge_sprite.x = sx
- @_hpsp_gauge_sprite.y = sy
- @_hpsp_gauge_sprite.z = sz
- @_hpsp_gauge_buffer = Bitmap.new(
- get_parameter_width + [KGC::HPSPAlter2::HP_LENGTH_BATTLE,
- KGC::HPSPAlter2::SP_LENGTH_BATTLE].max,
- 128)
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- BATTLE_STATUS_REFRESH_CHANGED = true
- def refresh
- @_hpsp_gauge_sprite.bitmap.clear
- # ゲージ同期
- sync_gauge
- # パラメータ描画
- pw = get_parameter_width
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- actor_x = i * get_actor_space + 4
- draw_actor_name(actor, actor_x, 0)
- draw_actor_hp(actor, actor_x, 32, pw)
- draw_actor_sp(actor, actor_x, 64, pw)
- if @level_up_flags[i]
- self.contents.font.color = normal_color
- self.contents.draw_text(actor_x, 96, pw, 32, "LEVEL UP!")
- else
- draw_actor_state(actor, actor_x, 96)
- end
- end
- # ゲージ描画
- draw_hpsp_gauge_buffer(pw)
- draw_hpsp_gauge(pw)
- end
- #--------------------------------------------------------------------------
- # ● パラメータ表示幅取得
- #--------------------------------------------------------------------------
- def get_parameter_width
- return 120
- end
- #--------------------------------------------------------------------------
- # ● アクター間隔取得
- #--------------------------------------------------------------------------
- def get_actor_space
- return 160
- end
- #--------------------------------------------------------------------------
- # ● ゲージ同期
- #--------------------------------------------------------------------------
- def sync_gauge
- $game_party.actors.each { |actor|
- @_current_hp[actor] = actor.hp
- @_current_sp[actor] = actor.sp
- if @_prev_hp[actor] == nil
- @_prev_hp[actor] = actor.hp
- end
- if @_prev_sp[actor] == nil
- @_prev_sp[actor] = actor.sp
- end
- }
- end
- #--------------------------------------------------------------------------
- # ● HP/SPゲージ用バッファ描画
- #--------------------------------------------------------------------------
- def draw_hpsp_gauge_buffer(width)
- @_hpsp_gauge_buffer.clear
- # HP
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::HP_GAUGE)
- dw = width + KGC::HPSPAlter2::HP_LENGTH_BATTLE
- draw_gauge_back(@_hpsp_gauge_buffer, gauge, 0, 0, dw)
- draw_gauge_fore(@_hpsp_gauge_buffer, gauge, 0, 32, dw)
- # SP
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::SP_GAUGE)
- dw = width + KGC::HPSPAlter2::SP_LENGTH_BATTLE
- draw_gauge_back(@_hpsp_gauge_buffer, gauge, 0, 64, dw)
- draw_gauge_fore(@_hpsp_gauge_buffer, gauge, 0, 96, dw)
- end
- #--------------------------------------------------------------------------
- # ● HP/SPゲージ描画
- #--------------------------------------------------------------------------
- def draw_hpsp_gauge(width)
- @_hpsp_gauge_sprite.bitmap.clear
- $game_party.actors.each_with_index { |actor, i|
- actor_x = i * get_actor_space + 4
- draw_actor_hp_gauge(actor, actor_x, 32, width)
- draw_actor_sp_gauge(actor, actor_x, 64, width)
- }
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias update_KGC_HPSPAlter2 update
- def update
- update_KGC_HPSPAlter2
- # ゲージ画像を流す
- if KGC::HPSPAlter2::FLOW_GAUGE
- flow_gauge
- end
- draw_hpsp_gauge(get_parameter_width)
- end
- #--------------------------------------------------------------------------
- # ● ゲージを流す
- #--------------------------------------------------------------------------
- def flow_gauge
- @@_hpsp_gauge_x -= KGC::HPSPAlter2::FLOW_SPEED
- if @@_hpsp_gauge_x < 0
- @@_hpsp_gauge_x += 192
- end
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージの描画
- #--------------------------------------------------------------------------
- def draw_actor_hp_gauge(actor, x, y, width)
- if KGC::HPSPAlter2::HP_GAUGE == nil
- return
- end
- bitmap = @_hpsp_gauge_sprite.bitmap
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::HP_GAUGE)
- nx = x + KGC::HPSPAlter2::HP_POSITION_BATTLE[0]
- ny = y + KGC::HPSPAlter2::HP_POSITION_BATTLE[1]
- nw = width + KGC::HPSPAlter2::HP_LENGTH_BATTLE
- gauge_width = calc_hp_gauge_width(actor, nw)
- diff_gauge_width = calc_hp_diff_gauge_width(actor, nw)
- # 背景を転送
- bitmap.blt(nx, ny, @_hpsp_gauge_buffer, Rect.new(0, 0, nw, 32))
- # 内部を描画
- draw_gauge_inside(bitmap, gauge, nx, ny, nw, gauge_width)
- if diff_gauge_width != 0
- draw_gauge_inside_diff(bitmap, gauge, nx, ny, nw,
- gauge_width, diff_gauge_width)
- end
- # 前景を転送
- bitmap.blt(nx, ny, @_hpsp_gauge_buffer, Rect.new(0, 32, nw, 32))
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージの描画
- #--------------------------------------------------------------------------
- def draw_actor_sp_gauge(actor, x, y, width)
- if KGC::HPSPAlter2::SP_GAUGE == nil
- return
- end
- bitmap = @_hpsp_gauge_sprite.bitmap
- gauge = RPG::Cache.picture(KGC::HPSPAlter2::SP_GAUGE)
- nx = x + KGC::HPSPAlter2::SP_POSITION_BATTLE[0]
- ny = y + KGC::HPSPAlter2::SP_POSITION_BATTLE[1]
- nw = width + KGC::HPSPAlter2::SP_LENGTH_BATTLE
- gauge_width = calc_sp_gauge_width(actor, nw)
- diff_gauge_width = calc_sp_diff_gauge_width(actor, nw)
- # 背景を転送
- bitmap.blt(nx, ny, @_hpsp_gauge_buffer, Rect.new(0, 64, nw, 32))
- # 内部を描画
- draw_gauge_inside(bitmap, gauge, nx, ny, nw, gauge_width)
- if diff_gauge_width != 0
- draw_gauge_inside_diff(bitmap, gauge, nx, ny, nw,
- gauge_width, diff_gauge_width)
- end
- # 前景を転送
- bitmap.blt(nx, ny, @_hpsp_gauge_buffer, Rect.new(0, 96, nw, 32))
- end
- #--------------------------------------------------------------------------
- # ● 差分ゲージの描画
- # bitmap : 対象ビットマップ
- # image : ゲージ画像
- # width : ゲージ幅
- # inside_gauge_width : ゲージ内部の幅
- # diff_gauge_width : 差分の幅
- #--------------------------------------------------------------------------
- def draw_gauge_inside_diff(bitmap, image, x, y, width,
- inside_gauge_width, diff_gauge_width)
- src_rect = Rect.new(0, 64, 96, 32)
- src_rect.width = diff_gauge_width.abs * 96 / (width - 64)
- dest_rect = Rect.new(x + 32, y, diff_gauge_width.abs, 32)
- if diff_gauge_width > 0
- # 増加
- src_rect.x = 96
- dest_rect.x += inside_gauge_width - dest_rect.width
- else
- # 減少
- dest_rect.x += inside_gauge_width
- end
- bitmap.stretch_blt(dest_rect, image, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージ幅の計算
- #--------------------------------------------------------------------------
- def calc_hp_gauge_width(actor, width)
- gw = @_current_hp[actor] * (width - 64) / actor.maxhp
- return [[gw, 0].max, width - 64].min
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージ差分の計算
- #--------------------------------------------------------------------------
- def calc_hp_diff_gauge_width(actor, width)
- unless KGC::HPSPAlter2::DRAW_DIFF_GAUGE
- return 0
- end
- # 差分調整
- n = [actor.maxhp * KGC::HPSPAlter2::DIFF_GAUGE_SPEED / 1000, 1].max
- if @_current_hp[actor] < @_prev_hp[actor]
- # 減少中
- @_prev_hp[actor] -= n
- if @_current_hp[actor] > @_prev_hp[actor]
- @_prev_hp[actor] = @_current_hp[actor]
- end
- elsif @_current_hp[actor] > @_prev_hp[actor]
- # 増加中
- @_prev_hp[actor] += n
- if @_current_hp[actor] < @_prev_hp[actor]
- @_prev_hp[actor] = @_current_hp[actor]
- end
- end
- return (@_current_hp[actor] - @_prev_hp[actor]) * (width - 64) / actor.maxhp
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージ幅の計算
- #--------------------------------------------------------------------------
- def calc_sp_gauge_width(actor, width)
- gw = 0
- if actor.maxsp > 0
- gw = @_current_sp[actor] * (width - 64) / actor.maxsp
- end
- return [[gw, 0].max, width - 64].min
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージ差分の計算
- #--------------------------------------------------------------------------
- def calc_sp_diff_gauge_width(actor, width)
- if !KGC::HPSPAlter2::DRAW_DIFF_GAUGE || actor.maxsp == 0
- return 0
- end
- # 差分調整
- n = [actor.maxsp * KGC::HPSPAlter2::DIFF_GAUGE_SPEED / 1000, 1].max
- if @_current_sp[actor] < @_prev_sp[actor]
- # 減少中
- @_prev_sp[actor] -= n
- if @_current_sp[actor] > @_prev_sp[actor]
- @_prev_sp[actor] = @_current_sp[actor]
- end
- elsif @_current_sp[actor] > @_prev_sp[actor]
- # 増加中
- @_prev_sp[actor] += n
- if @_current_sp[actor] < @_prev_sp[actor]
- @_prev_sp[actor] = @_current_sp[actor]
- end
- end
- return (@_current_sp[actor] - @_prev_sp[actor]) * (width - 64) / actor.maxsp
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle (分割定義 1)
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- alias main_KGC_HPSPAlter2 main
- def main
- main_KGC_HPSPAlter2
- Window_Base.set_hpsp_gauge_x(0)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle (分割定義 2)
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● プレバトルフェーズ開始
- #--------------------------------------------------------------------------
- alias start_phase1_KGC_HPSPAlter2 start_phase1
- def start_phase1
- start_phase1_KGC_HPSPAlter2
- @status_window.create_hpsp_gauge_sprite(@spriteset.viewport2)
- @status_window.refresh
- end
- end
复制代码 換吧
需要圖片
放到Graphics/Pictures |
评分
-
查看全部评分
|