#==============================================================================
# スコアレポート By 貪藻矢射妥←
#------------------------------------------------------------------------------
# 長編RPGとかで途中で今までの成績を見たい・・・ってな感じの際に重宝する・・・
# かもしんないスクリプト。
#
# $scene = Scene_Score_Repoat.new
# にてシーンが移動します。
#
# ※アイテム回収率なども表示できますが、そのためにはアイテム獲得時に使用する
# スイッチを連続した区域で取る必要うがあります。
# (1500〜1700までの間とか・・・)
#
#==============================================================================
# 変更履歴
#
# 2008:11:16
# ・トータルスコアにマイナスを許可するかを選択可能に
# ・総資産を表示可能に(銀行システムに対応)
#
# 2008:11:23
# ・パーセンテージの表示形式をちょろっと変更
#
# 2008:12:24
# ・銀行システム修正に伴う修正
#
# 2009:04:24
# ・章ごとに表示内容を切り替えるためのスイッチ配列を追加
#
# 2010:03:20
# ・微修正
#
# 2011:03:05
# ・Window_BGを導入することで、ウィンドウの背景を画像に指定可能
# ・章ごとのスイッチ番号配列が全てoffの場合、エラー落ちするバグを修正
#
# 2011:12:08
# ・VX風Vocab対応
#
# 2012:01:21
# ・銀行システムの部分変更
#
# 2012:03:03
# ・一部の共通モジュールのクラス化
#
# 2015:10:01
# ・VXA風Sound対応
#
# 2016:08:01
# ・隠しポイント設置
#
# 2024:06:01
# ・スクリプト中で使用されてる文字列の定義化追加
module SC_REP
# トータルスコアの上限を100に限定するか?
MAX_LIMIT_FLG = false
# トータルスコアのベースポイント(MAX_LIMIT_FLG が true の場合使用しません。)
BASE_PT = 250
# トータルスコアをプラスに限定するか?
MINUS_FLG = false
# トータルスコアの単位
SC_WORD = "pt"
# 章ごとのスイッチ番号
# ゲームの最中にレポートを出力する際にタイトルなどを変更したい場合に使用
EP_SW = [nil, 371, 478]
# スコアレポートの背景に画像を使うか
USE_SR_BG = true
# スコアレポートの背景画像
SR_BACK = "sc_rp_back"
# スコアレポートのタイトルの背景に画像を使うか
USE_TITLE_BG = true
# スコアレポートのタイトルの背景画像
TITLE_BACK = "p_cmd_back"
# 隠しポイントの変数ID
HIDDEN_PT_ID = 109
# 隠しポイントを使うかどうか
USE_HIDDEN_PT = true
end
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :total_score # トータルスコア
attr_reader :bank_gold # 預かり総金額
attr_reader :root_time # 利子計算用時間
end
class Window_Score_Rep < Window_Base
include RUBY_SYS
include SC_REP
include BANK
include DIAMOND
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(100, 96, 440, 320)
refresh
if USE_SR_BG && $OuterFlgs["Window_BG"]
@bg_sprite = nil
make_bg(SR_BACK)
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.contents = Bitmap.new(width - 32, 320 - 32)
update_bg
normal_item_gets = 0
event_item_gets = 0
ura_item_gets = 0
party_char_gets = 0
party_lv = 0
# 第2部END
if $game_switches[EP_SW[2]]
normal_item_max = 158
event_item_max = 27
ura_item_max = 5
party_char_max = 17
# 第1部END
elsif $game_switches[EP_SW[1]]
normal_item_max = 141
event_item_max = 24
ura_item_max = 4
party_char_max = 11
else
normal_item_max = 200
event_item_max = 200
ura_item_max = 200
party_char_max = 18
end
normal_item_comp = 0
event_item_comp = 0
ura_item_comp = 0
party_char_comp = 0
total_score_rate = 0
# 通常アイテム獲得率(連続したスイッチであること)
for i in 1502..1700
if $game_switches[i]
normal_item_gets += 1
end
end
for i in 3002..3100
if $game_switches[i]
normal_item_gets += 1
end
end
# イベントアイテム獲得率(連続したスイッチであること)
for i in 1802..1994
if $game_switches[i]
event_item_gets += 1
end
end
# 隠しアイテム獲得率(連続したスイッチであること)
for i in 1701..1800
if $game_switches[i]
ura_item_gets += 1
end
end
# パーティーメンバー獲得率(連続したスイッチにて管理していること)
for i in 3..20
if $game_switches[i]
party_char_gets += 1
end
end
for i in 1..$game_party.actors.size
party_lv += $game_party.actors[i - 1].level
end
party_lv /= $game_party.actors.size
normal_item_comp = get_percentage(normal_item_gets, normal_item_max)
event_item_comp = get_percentage(event_item_gets, event_item_max)
ura_item_comp = get_percentage(ura_item_gets, ura_item_max)
party_char_comp = get_percentage(party_char_gets, party_char_max)
total_score_rate = normal_item_comp + event_item_comp + ura_item_comp + party_char_comp
total_score_rate /= 500.0
if USE_HIDDEN_PT
tmp_hidden_pt = $game_variables[HIDDEN_PT_ID]
else
tmp_hidden_pt = 0
end
if MAX_LIMIT_FLG
$game_system.total_score = Integer((100 - tmp_hidden_pt) * total_score_rate)
else
$game_system.total_score = Integer((BASE_PT - tmp_hidden_pt) * total_score_rate * (party_lv + 1))
end
# 隠しポイントを使わない限り、マイナスにはならないはず
if MINUS_FLG && USE_HIDDEN_PT
if (MAX_LIMIT_FLG && 100 > $game_variables[HIDDEN_PT_ID]) ||
(!MAX_LIMIT_FLG && BASE_PT > $game_variables[HIDDEN_PT_ID])
$game_system.total_score = 0
end
end
rectr1 = [4, 0, 200, 32]
rectr2 = [rectr1[0], 24, rectr1[2], rectr1[3]]
rectr3 = [rectr1[0], 48, rectr1[2], rectr1[3]]
rectr4 = [rectr1[0], 72, rectr1[2], rectr1[3]]
rectr5 = [rectr1[0], 96, rectr1[2], rectr1[3]]
rectr6 = [rectr1[0], 120, rectr1[2], rectr1[3]]
rectr7 = [rectr1[0], 144, rectr1[2], rectr1[3]]
rectr8 = [rectr1[0], 168, rectr1[2], rectr1[3]]
rectr9 = [rectr1[0], 192, rectr1[2], rectr1[3]]
rectrz = [rectr1[0], 244, 440 - 32 - 8, rectr1[3]]
font_root = self.contents.font.name
self.contents.font.name = ["麗流隷書", "MS ゴシック"]
draw_shadow_text(rectr1, "通常アイテム回収 :", system_color)
draw_shadow_text(rectr2, "イベントアイテム回収:", system_color)
draw_shadow_text(rectr3, "隠しアイテム回収 :", system_color)
draw_shadow_text(rectr4, "仲間にできたキャラ :", system_color)
draw_shadow_text(rectr5, "エネミー辞典 :", system_color)
draw_shadow_text(rectr6, "パーティー平均Lv :", system_color)
if USE_HIDDEN_PT
draw_shadow_text(rectr7, "???? :", system_color)
end
draw_shadow_text(rectr8, "総資産 :", system_color)
draw_shadow_text(rectr9, "トータルスコア :", system_color)
self.contents.font.name = DRAWFONT3
size_root = self.contents.font.size
self.contents.font.size = 30
draw_shadow_text(rectrz, "Go to Next Stage!!" , system_color, 1)
self.contents.font.size = size_root
rectr11 = [220, 120, 60, rectr1[3]]
rectr12 = [rectr11[0], 144, rectr11[2], rectr1[3]]
rectr13 = [rectr11[0], 168, 110, rectr1[3]]
rectr14 = [rectr11[0], 192, rectr13[2], rectr1[3]]
draw_sc_rep_rslt(rectr11[0], 0, normal_item_gets, normal_item_max, normal_item_comp)
draw_sc_rep_rslt(rectr11[0], 24, event_item_gets, event_item_max, event_item_comp)
draw_sc_rep_rslt(rectr11[0], 48, ura_item_gets, ura_item_max, ura_item_comp)
draw_sc_rep_rslt(rectr11[0], 72, party_char_gets, party_char_max, party_char_comp)
# 銀行に預けているお金の算出
if !$OuterFlgs["Bank_Sys"]
$game_system.bank_gold = 0
else
gold_plus
end
self.contents.font.name = DRAWFONT2
draw_shadow_text(rectr11, party_lv.to_s, normal_color, 2)
if USE_HIDDEN_PT
draw_shadow_text(rectr12, $game_variables[HIDDEN_PT_ID].to_s, normal_color, 2)
end
max_gld = $game_party.gold + $game_system.bank_gold
draw_shadow_text(rectr13, max_gld.to_s, normal_color, 2)
rect_gold = rectr13.clone
rect_gold[0] = 350
rect_gold[2] = 48
self.contents.font.name = ["麗流隷書", "MS ゴシック"]
draw_shadow_text(rect_gold, Vocab::gold, system_color)
draw_color = $game_system.total_score <= -1 ? knockout_color : normal_color
draw_shadow_text(rectr14, $game_system.total_score.to_s, draw_color, 2)
rect_pt = rectr14.clone
rect_pt[0] = 350
rect_pt[2] = 48
draw_shadow_text(rect_pt, SC_WORD, system_color)
self.contents.font.name = font_root
end
#--------------------------------------------------------------------------
# ● パーセンテージ算出
# crr : 現在の値
# max : 最大値
# floor : 小数点以下切り捨てか否か
#--------------------------------------------------------------------------
def get_percentage(crr, max, floor = false)
rate = Integer(crr * 10000 / max) / 100.0
if floor
return rate.truncate
else
return rate
end
end
#--------------------------------------------------------------------------
# ● パラメーター表示 -> Cur/Max:Percentage %
# x : 表示開始位置 x
# y : 表示開始位置 y
# crr : 現在の値
# max : 最大値
# rate : 現在の値 * 100 / 最大値
#--------------------------------------------------------------------------
def draw_sc_rep_rslt(x, y, crr, max, rate, floor = false)
font_name = self.contents.font.name
self.contents.font.name = DRAWFONT2
draw_color = crr <= max / 8 ? knockout_color :
crr <= max / 4 ? crisis_color : normal_color
rectr1 = [x, y, 48, 32]
rectr2 = [x + 48, y, 12, rectr1[3]]
rectr3 = [x + 60, y, rectr1[2], rectr1[3]]
rectr4 = [x + 100, y, rectr2[2], rectr1[3]]
rectr5 = [x + 100, y, 64, rectr1[3]]
rectr6 = [x + 175, y, rectr1[2], rectr1[3]]
draw_shadow_text(rectr1, crr.to_s, draw_color, 2)
draw_shadow_text(rectr2, Vocab::SLASH_WORD, system_color, 1)
draw_shadow_text(rectr3, max.to_s)
draw_shadow_text(rectr4, ":", system_color, 1)
if floor
draw_shadow_text(rectr5, rate.to_s, draw_color ,2)
else
draw_shadow_text(rectr5, sprintf("%3.02f", rate), draw_color ,2)
end
draw_shadow_text(rectr6, Vocab::PERCENT_WORD, system_color)
self.contents.font.name = font_name
end
end
class Window_Title2_SC_Rep < Window_Base
include RUBY_SYS
include TITLE_BM
include SC_REP
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(100, 0, 440, 64)
refresh(@text)
if USE_TITLE_BG && $OuterFlgs["Window_BG"]
@bg_sprite = nil
make_bg(TITLE_BACK, 220)
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(text)
clear
update_bg
rectr = [4, 0, 440 - 32 - 8, 32]
draw_shadow_text(rectr, text, DRAW_COLOR, 1)
end
end
class Scene_Score_Repoat
include BM
include SC_REP
#--------------------------------------------------------------------------
# ○ キーヘルプを設定
#--------------------------------------------------------------------------
def set_keyhelp1
@bottomkeyhelp_window.clear
@bottomkeyhelp_window.set_bottom_help({"B"=>"レポート終了"})
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def initialize
@bottomkeyhelp_window = Window_BottomKeyHelp.new
set_keyhelp1
end
def main
# ウィンドウを作成
@title_window = Window_Title2_SC_Rep.new
@score_window = Window_Score_Rep.new
# 第2部END
if $game_switches[EP_SW[2]]
sc = "弐"
# 第1部END
elsif $game_switches[EP_SW[1]]
sc = "壱"
# 初期設定
else
sc = "零"
end
text = "第" + sc + "部・スコアレポート"
@title_window.refresh(text)
@score_window.refresh
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@title_window.dispose
@score_window.dispose
@bottomkeyhelp_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
update_main
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_main
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
Sound.play_cancel
$scene = Scene_Map.new
return
end
end
end
|