$imported = {} if $imported.nil?
$kms_imported = {} if $kms_imported.nil?
class Window_BattleStatus < Window_Selectable
if $imported["YEA-BattleEngine"] && $kms_imported["GenericGauge"]
#--------------------------------------------------------------------------
# overwrite method: draw_actor_hp
#--------------------------------------------------------------------------
def draw_actor_hp(actor, dx, dy, width = 124)#124
super(actor, dx, dy, width - 4)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_mp
#--------------------------------------------------------------------------
def draw_actor_mp(actor, dx, dy, width = 124)
super(actor, dx, dy, width - 4)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_tp
#--------------------------------------------------------------------------
def draw_actor_tp(actor, dx, dy, width = 124)
super(actor, dx, dy, width - 4)
end
def draw_actor_exp(actor, dx, dy, width = 124)
super(actor, dx, dy, width - 4)
end
end # if $imported
end
module KMS_GenericGauge
# * Gauge File Names
# Images must be placed in the "Graphics/System" folder of your project
HP_IMAGE = "GaugeHP" # HP
MP_IMAGE = "GaugeMP" # MP
TP_IMAGE = "GaugeTP" # TP
EXP_IMAGE = "GaugeEXP" # EXP
# * Gauge Position Offset [x, y]
HP_OFFSET = [-30, -2] # HP
MP_OFFSET = [-30, -2] # MP
TP_OFFSET = [-30, -2] # TP
EXP_OFFSET = [-30, -2] # EXP
# * Gauge Length Adjustment
HP_LENGTH = -8 # HP 4
MP_LENGTH = -8 # MP
TP_LENGTH = -8 # TP
EXP_LENGTH = -8 # EXP
# * Gauge Slope
# Must be between -89 ~ 89 degrees
HP_SLOPE = 0 # HP
MP_SLOPE = 0 # MP
TP_SLOPE = 0 # TP
EXP_SLOPE = 0 # EXP
end
#==============================================================================
# ☆ END Setting ☆
#==============================================================================
$kms_imported = {} if $kms_imported == nil
$kms_imported["GenericGauge"] = true
# *****************************************************************************
#--------------------------------------------------------------------------
# Notes to Scripters
#--------------------------------------------------------------------------
# Drawing your own custom gauge within a window can be done by using a single
# method:
#
# draw_gauge(file, x, y, width, rate, offset, len_offset,
# slope, gauge_type = :normal)
#
# ++ Draw Generic Gauge Arguments
# file : Gauge image filename
# x, y : x, y draw coordinates
# width : Gauge width
# rate : Gauge fill ratio (0.0 ~ 1.0)
# offset : Gauge coordinate adjustment [x, y]
# len_offset : Length Adjustment
# slope : Gauge slope degree (-89~89)
# gauge_type : Gauge type ( :normal , :decrease , :increase )
#--------------------------------------------------------------------------
# gauge_type determines how the gauge fills depending on the current
# value of the gauge.
#--------------------------------------------------------------------------
# This script overwrites Window_Base#draw_gauge and adds 2 extra args
# which will cause compatibility issues with other scripts that uses
# the default draw_gauge method and args.
#--------------------------------------------------------------------------
#==============================================================================
# ■ Bitmap
#==============================================================================
unless $kms_imported["BitmapExtension"]
class Bitmap
#--------------------------------------------------------------------------
# ○ 平行四辺形転送
#--------------------------------------------------------------------------
def skew_blt(x, y, src_bitmap, src_rect, slope, opacity = 255)
slope = [[slope, -90].max, 90].min
sh = src_rect.height
off = sh / Math.tan(Math::PI * (90 - slope.abs) / 180.0)
if slope >= 0
dx = x + off.round
diff = -off / sh
else
dx = x
diff = off / sh
end
rect = Rect.new(src_rect.x, src_rect.y, src_rect.width, 1)
sh.times { |i|
blt(dx - (diff * i).round - 16, y + i, src_bitmap, rect, opacity)
rect.y += 1
}
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○ 現在のレベルから次のレベルまでの全必要経験値取得
#--------------------------------------------------------------------------
def next_level_exp_full
return next_level_exp - current_level_exp
end
#--------------------------------------------------------------------------
# ○ 次のレベルまでの残り経験値取得
#--------------------------------------------------------------------------
def next_level_exp_rest
return next_level_exp - exp
end
#--------------------------------------------------------------------------
# ○ 次のレベルまでの経験値取得率取得
#--------------------------------------------------------------------------
def exp_rate
diff = [next_level_exp_full, 1].max
rest = [next_level_exp_rest, 1].max
return (diff - rest) * 1.0 / diff
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ○ 定数
#--------------------------------------------------------------------------
# ゲージ転送元座標 [x, y]
GAUGE_SRC_POS = {
:normal => [ 0, 24],
:decrease => [ 0, 48],
:increase => [72, 48],
}
#--------------------------------------------------------------------------
# ○ クラス変数
#--------------------------------------------------------------------------
@@__gauge_buf = Bitmap.new(320, 24)
#--------------------------------------------------------------------------
# ○ ゲージ描画
# file : ゲージ画像ファイル名
# x, y : 描画先 X, Y 座標
# width : 幅
# ratio : 割合
# offset : 座標調整 [x, y]
# len_offset : 長さ調整
# slope : 傾き
# gauge_type : ゲージタイプ
#--------------------------------------------------------------------------
def draw_gauge(file, x, y, width, ratio, offset, len_offset, slope,
gauge_type = :normal)
img = Cache.system(file)
x += offset[0]
y += offset[1]
width += len_offset
draw_gauge_base(img, x, y, width, slope)
gw = (width * ratio).to_i
draw_gauge_bar(img, x, y, width, gw, slope, GAUGE_SRC_POS[gauge_type])
end
#--------------------------------------------------------------------------
# ○ ゲージベース描画
# img : ゲージ画像
# x, y : 描画先 X, Y 座標
# width : 幅
# slope : 傾き
#--------------------------------------------------------------------------
def draw_gauge_base(img, x, y, width, slope)
rect = Rect.new(0, 0, 24, 24)
if slope != 0
contents.skew_blt(x, y, img, rect, slope)
rect.x = 96
contents.skew_blt(x + width + 24, y, img, rect, slope)
rect.x = 24
rect.width = 72
dest_rect = Rect.new(0, 0, width, 24)
@@__gauge_buf.clear
@@__gauge_buf.stretch_blt(dest_rect, img, rect)
contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
else
contents.blt(x, y, img, rect)
rect.x = 96
contents.blt(x + width + 24, y, img, rect)
rect.x = 24
rect.width = 72
dest_rect = Rect.new(x + 24, y, width, 24)
contents.stretch_blt(dest_rect, img, rect)
end
end
#--------------------------------------------------------------------------
# ○ ゲージ内部描画
# img : ゲージ画像
# x, y : 描画先 X, Y 座標
# width : 全体幅
# gw : 内部幅
# slope : 傾き
# src_pos : 転送元座標 [x, y]
# start : 開始位置
#--------------------------------------------------------------------------
def draw_gauge_bar(img, x, y, width, gw, slope, src_pos, start = 0)
rect = Rect.new(src_pos[0], src_pos[1], 72, 24)
dest_rect = Rect.new(0, 0, width, 24)
@@__gauge_buf.clear
@@__gauge_buf.stretch_blt(dest_rect, img, rect)
dest_rect.x = start
dest_rect.width = gw
x += start
if slope != 0
contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
else
contents.blt(x + 24, y, @@__gauge_buf, dest_rect)
end
end
#--------------------------------------------------------------------------
# ● HP の描画
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 124)
draw_actor_hp_gauge(actor, x, y, width)
change_color(system_color)
contents.font.size = 16
draw_text(x + 10-35, y + 2, 30, line_height, Vocab::hp_a)#季季暴力修改
draw_current_and_max_values(x + 7-35, y + 2, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# ● MP の描画
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 124)
draw_actor_mp_gauge(actor, x, y, width)
change_color(system_color)
draw_text(x + 10-35, y + 2, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(x + 7-35, y + 2, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# ● TP の描画
#--------------------------------------------------------------------------
def draw_actor_tp(actor, x, y, width = 124)
draw_actor_tp_gauge(actor, x, y, width)
change_color(system_color)
draw_text(x + 10-35, y + 2, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(x + width - 42 + 7-35, y + 2, 42, line_height, actor.tp.to_i, 2)
end
#--------------------------------------------------------------------------
# ○ HP ゲージの描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 120)
draw_gauge(KMS_GenericGauge::HP_IMAGE,
x, y, width, actor.hp_rate,
KMS_GenericGauge::HP_OFFSET,
KMS_GenericGauge::HP_LENGTH,
KMS_GenericGauge::HP_SLOPE
)
end
#--------------------------------------------------------------------------
# ○ MP ゲージの描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_mp_gauge(actor, x, y, width = 120)
draw_gauge(KMS_GenericGauge::MP_IMAGE,
x, y, width, actor.mp_rate,
KMS_GenericGauge::MP_OFFSET,
KMS_GenericGauge::MP_LENGTH,
KMS_GenericGauge::MP_SLOPE
)
end
#--------------------------------------------------------------------------
# ○ TP ゲージの描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_tp_gauge(actor, x, y, width = 120)
draw_gauge(KMS_GenericGauge::TP_IMAGE,
x, y, width, actor.tp_rate,
KMS_GenericGauge::TP_OFFSET,
KMS_GenericGauge::TP_LENGTH,
KMS_GenericGauge::TP_SLOPE
)
end
#--------------------------------------------------------------------------
# ○ Exp の描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y, width = 180)
str = actor.max_level? ? "-------" : actor.exp
change_color(normal_color)
draw_text(x, y, width, line_height, str, 2)
end
#--------------------------------------------------------------------------
# ○ NextExp の描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_next_exp(actor, x, y, width = 180)
draw_actor_exp_gauge(actor, x, y, width)
change_color(system_color)
draw_text(x + 12, y, 80, line_height, "Next Lv.")
str = actor.max_level? ? "-------" : actor.next_level_exp_rest
change_color(normal_color)
draw_text(x + 4, y, width, line_height, str, 2)
end
#--------------------------------------------------------------------------
# ○ Exp ゲージの描画
# actor : アクター
# x, y : 描画先 X, Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_exp_gauge(actor, x, y, width = 180)
draw_gauge(KMS_GenericGauge::EXP_IMAGE,
x, y, width, actor.exp_rate,
KMS_GenericGauge::EXP_OFFSET,
KMS_GenericGauge::EXP_LENGTH,
KMS_GenericGauge::EXP_SLOPE
)
end
end
#==============================================================================
# ■ Window_Status
#==============================================================================
class Window_Status < Window_Selectable
#--------------------------------------------------------------------------
# ● 経験値情報の描画
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s_next = sprintf(Vocab::ExpNext, Vocab::level)
change_color(system_color)
#draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
#draw_text(x, y + line_height * 2, 180, line_height, s_next)
change_color(normal_color)
#draw_actor_exp( @actor, x, y + line_height * 1)
draw_actor_next_exp(@actor, x, y + line_height * 3, 128)
end
end