module BMSP
@@includes ||= {}
@@includes[:KoyomiSystem] = 1.00
module KoyomiSystem
#▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
#詳細設定
# ランクの設定
RANKS = {
:sec => 0...60,
:min => 0...60,
:hour => 0...24,
:day => 1..30,
:mon => 1..12,
:year => 1..9999
}
#------------------------------------------------------------
# ランク以外の暦情報の設定
SPECIAL_EXP = {}
SPECIAL_EXP[:timezone] = ->(cal){
case cal.hour
when 4,5
0 # 早朝は0を返す
when 6,7,8
1 # 朝は1を返す
when 9...16
2 # 昼は2を返す
when 16,17
3 # 夕方は3を返す
when 18...22
4 # 夜は4を返す
when 22...24,0...4
5 # 深夜は5を返す
end
}
#------------------------------------------------------------
# 表示変換の設定
TRANSFORM = {}
TRANSFORM[:mon] = ->(cal){
["Jan", "Fab", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Seq", "Oct", "Nov", "Dec"][cal.mon]
}
TRANSFORM[:timezone] = ->(cal){
case cal.timezone # 上で設定した時間帯で条件分岐
when 0
"清晨"
when 1
"上午"
when 2
"中午"
when 3
"下午"
when 4
"夜晚"
when 5
"深夜"
end
}
#------------------------------------------------------------
# ゲーム開始時の暦
INITIAL_CAL = {
:sec => 0,
:min => 0,
:hour => 0,
:day => 1,
:mon => 12,
:year => 2015
}
#------------------------------------------------------------
# マップで暦ウインドウを表示するか
MAP_WINDOW = true
# マップでの暦ウインドウをフェードするか(falseで常に表示)
MAP_WINDOW_FADE = false
# マップでの暦ウインドウの表示内容
MAP_WINDOW_FORMAT = [
"<<4#year>>年<<2#mon>>月<<2#day>>日",
"<<02#hour>>:<<02#min>>:<<02#sec>> [<<timezone>>]"
]
# メニューで暦ウインドウを表示するか
MENU_WINDOW = true
# メニューでの暦ウインドウの表示内容
MENU_WINDOW_FORMAT = [
"<<4#year>>-<<2#mon>>-<<2#day>>",
"<<02#hour>>:<<02#min>>:<<02#sec>>"
]
#------------------------------------------------------------
# 暦による画面の色調の自動変更
AUTO_TONE = true
# デフォルト色調変更時間
AUTO_TONE_DURATION = 120
# 色調変更の条件
AUTO_TONE_COND = {
{:hour => 16...18} => Tone.new(68,-34,-34,0),
{:hour => 18...22} => Tone.new(-34,-34,0,34),
{:hour => 22...4} => Tone.new(-68,-68,0,68),
{:hour => 4...6} => Tone.new(-34,-34,-34,34),
{:hour => 6...9} => Tone.new(34,34,34,34)
}
# バトル画面では色調を変更しない
FIX_TONE_ON_BATTLE = false
#------------------------------------------------------------
# 時間が自動経過するか
AUTO_TIME_PASS = true
# 時間の自動経過間隔
AUTO_TIME_PASS_DURATION = 120
# 時間の自動経過量
TIME_PASSING = {:min => 1}
# イベント中は自動経過を停止するか
STOP_ON_EVENT = true
# バトル中は自動経過を停止するか
STOP_ON_BATTLE = false
#------------------------------------------------------------
# 場所移動による時間経過
MOVE_TIME_PASS = {:min => 5}
# 戦闘開始による時間経過
BATTLE_START_TIME_PASS = {}
# 戦闘終了による時間経過
BATTLE_END_TIME_PASS = {}
#▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
end
#--------------------------------------------------------------------------
# ● 導入スクリプトのチェック
#--------------------------------------------------------------------------
class << self
if method_defined?(:check_script)
alias koyomisystem_check_script check_script
end
end
def self.check_script(script, version)
if methods.include?(:koyomisystem_check_script)
koyomisystem_check_script(script, version)
end
@@includes[script] && @@includes[script] >= version
end
end
#==============================================================================
# ■ RPG::Map
#==============================================================================
class RPG::Map
#--------------------------------------------------------------------------
# ● 暦ウインドウ表示のマップか
#--------------------------------------------------------------------------
def bmsp_koyomisystem_display_koyomi_on_map?
return @bmsp_koyomi_display if @bmsp_koyomi_display
@bmsp_koyomi_display = !self.note.include?('==暦非表示==')
end
#--------------------------------------------------------------------------
# ● 色調固定
#--------------------------------------------------------------------------
def bmsp_koyomisystem_fix_tone
return @bmsp_fix_tone unless @bmsp_fix_tone.nil?
if self.note =~ /==色調固定\[(\d+),(\d+),(\d+),(\d+)\]==/
r,g,b,g = $1.to_i,$2.to_i,$3.to_i,$4.to_i
@bmsp_fix_tone = Tone.new(r,g,b,g)
else
@bmsp_fix_tone = false
end
end
#--------------------------------------------------------------------------
# ● 暦停止のマップか
#--------------------------------------------------------------------------
def bmsp_koyomisystem_koyomi_stop?
return @bmsp_koyomi_stop if @bmsp_koyomi_stop
@bmsp_koyomi_stop = self.note.include?('==暦停止==')
end
end
#==============================================================================
# ■ Game_Koyomi
#==============================================================================
class Game_Koyomi
#============================================================================
# ■ Ranks
#============================================================================
module Ranks
#--------------------------------------------------------------------------
# ● モジュール変数
#--------------------------------------------------------------------------
@@ranks = BMSP::KoyomiSystem::RANKS
@@transform = BMSP::KoyomiSystem::TRANSFORM
#--------------------------------------------------------------------------
# ● ランクの取得
#--------------------------------------------------------------------------
def self.ranks
@@ranks
end
#--------------------------------------------------------------------------
# ● 表示変換
#--------------------------------------------------------------------------
def self.transform(label)
@@transform[label]
end
#--------------------------------------------------------------------------
# ● ランクの取得(順位指定)
#--------------------------------------------------------------------------
def self.rank(i)
r = @@ranks.to_a[i]
return nil if r.nil?
r.first
end
#--------------------------------------------------------------------------
# ● ノーマライズ
#--------------------------------------------------------------------------
def self.normalize(i, rank)
i - @@ranks[rank].min
end
#--------------------------------------------------------------------------
# ● 指定した範囲の値か
#--------------------------------------------------------------------------
def self.include_range?(rank, range, value)
rank_min = @@ranks[rank].min
rank_max = @@ranks[rank].max
range_min = range.min
range_max = range.max
unless range_min.nil? || range_max.nil? # 有効なRange
min = [[range_min, rank_min].max, rank_max].min
max = [[range_max, rank_min].max, rank_max].min
(min..max).include?(value)
else # 無効なRange
first = range.first
last = range.last
nf = [[first, rank_min].max, rank_max].min
nl = [[last, rank_min].max, rank_max].min
range1 = (nf..rank_max)
range2 = nl <= last && range.exclude_end? ? (rank_min...nl) : (rank_min..nl)
range1.include?(value) || range2.include?(value)
end
end
#--------------------------------------------------------------------------
# ● ランクを一つ進める
#--------------------------------------------------------------------------
def self.succ(rank)
find = false
@@ranks.each do |r,|
return r if find
find = true if r == rank
end
return nil
end
end
#============================================================================
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :auto_tone # 画面の色調自動変更フラグ
attr_accessor :tone_temp_duration # 画面の色調時間一時変更フラグ
attr_accessor :move_temp_time_pass # 場所移動による時間経過一時変更フラグ
attr_accessor :battle_start_temp_time_pass # 戦闘開始による時間経過一時変更フラグ
attr_accessor :battle_end_temp_time_pass # 戦闘終了による時間経過一時変更フラグ
attr_accessor :auto_time_pass # 時間自動経過フラグ
attr_accessor :stop_auto_time_pass_on_event # イベント中時間自動経過停止フラグ
attr_accessor :stop_auto_time_pass_on_battle # バトル中時間自動経過停止フラグ
attr_reader :fix_tone_on_battle # バトル画面色調固定フラグ
#--------------------------------------------------------------------------
# ● ランクアクセサの定義
#--------------------------------------------------------------------------
Ranks.ranks.each_key do |rank|
reader = rank
writer = :"#{rank}="
define_method(reader){ @calendar[rank] }
define_method(writer){ |value| @calendar[rank] = value; fit; value }
end
#--------------------------------------------------------------------------
# ● 特別表現リーダーの定義
#--------------------------------------------------------------------------
BMSP::KoyomiSystem::SPECIAL_EXP.each do |special, exp|
define_method(special){ exp.call(self) }
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(init= {})
# 各種設定の初期化
@auto_tone = BMSP::KoyomiSystem::AUTO_TONE
@tone_temp_duration = 0
@default_tone = Tone.new(0,0,0,0)
@auto_time_pass = BMSP::KoyomiSystem::AUTO_TIME_PASS
@auto_time_pass_amount = {
:duration => BMSP::KoyomiSystem::AUTO_TIME_PASS_DURATION,
:amount => BMSP::KoyomiSystem::TIME_PASSING
}
@move_time_pass = BMSP::KoyomiSystem::MOVE_TIME_PASS
@battle_start_time_pass = BMSP::KoyomiSystem::BATTLE_START_TIME_PASS
@battle_end_time_pass = BMSP::KoyomiSystem::BATTLE_END_TIME_PASS
@stop_auto_time_pass_on_event = BMSP::KoyomiSystem::STOP_ON_EVENT
@stop_auto_time_pass_on_battle = BMSP::KoyomiSystem::STOP_ON_BATTLE
@fix_tone_on_battle = BMSP::KoyomiSystem::FIX_TONE_ON_BATTLE
# 暦の初期化
set(init)
end
#--------------------------------------------------------------------------
# ● 範囲外の暦を修正
#--------------------------------------------------------------------------
def fit
carry = 0
@calendar.each_key do |rank|
@calendar[rank] += carry
value = @calendar[rank]
if Ranks.ranks[rank].include?(value)
carry = 0
else
n_value = Ranks.normalize(value, rank)
card = Ranks.ranks[rank].count
carry = n_value / card
@calendar[rank] = n_value % card + Ranks.ranks[rank].min
end
end
@int = calc_to_i
end
#--------------------------------------------------------------------------
# ● 暦のセット
#--------------------------------------------------------------------------
def set(init)
@calendar = {}
ini_h = init.is_a?(Hash) ? init : {}
Ranks.ranks.each_key do |rank|
@calendar[rank] =
ini_h[rank] ? ini_h[rank] : Ranks.ranks[rank].min
end
@calendar[Ranks.rank(0)] += init if init.is_a?(Integer)
fit
end
#--------------------------------------------------------------------------
# ● 時間自動経過の設定
#--------------------------------------------------------------------------
def set_auto_time_pass(passing)
@auto_time_pass_amount[:duration] = passing[:duration] if passing[:duration]
@auto_time_pass_amount[:amount] = passing[:amount] if passing[:amount]
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update(screen)
update_auto_time_pass
update_auto_tone(screen)
end
#--------------------------------------------------------------------------
# ● 時間経過
#--------------------------------------------------------------------------
def time_pass(amount)
amount.each do |rank, value|
next unless @calendar[rank]
@calendar[rank] += value
end
fit
end
#--------------------------------------------------------------------------
# ● イベント中判定
#--------------------------------------------------------------------------
def check_event_running?
if $game_party.in_battle
$game_troop.interpreter.running?
elsif !$BTEST
$game_map.interpreter.running?
end
end
#--------------------------------------------------------------------------
# ● 時間自動経過
#--------------------------------------------------------------------------
def update_auto_time_pass
return unless @auto_time_pass
return if @stop_auto_time_pass_on_event && check_event_running?
return if @stop_auto_time_pass_on_battle && $game_party.in_battle
return if !$BTEST && $game_map.map.bmsp_koyomisystem_koyomi_stop?
if @auto_time_pass_amount[:duration] > 0
return if Graphics.frame_count % @auto_time_pass_amount[:duration] != 0
time_pass(@auto_time_pass_amount[:amount])
end
end
#--------------------------------------------------------------------------
# ● 場所移動による時間経過
#--------------------------------------------------------------------------
def move_time_pass
unless @move_temp_time_pass
time_pass(@move_time_pass)
else
time_pass(@move_temp_time_pass)
@move_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 戦闘開始による時間経過
#--------------------------------------------------------------------------
def battle_start_time_pass
unless @battle_start_temp_time_pass
time_pass(@battle_start_time_pass)
else
time_pass(@battler_start_temp_time_pass)
@battle_start_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 戦闘終了による時間経過
#--------------------------------------------------------------------------
def battle_end_time_pass
unless @battle_end_temp_time_pass
time_pass(@battle_end_time_pass)
else
time_pass(@battler_end_temp_time_pass)
@battle_end_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 画面の色調自動変更
#--------------------------------------------------------------------------
def update_auto_tone(screen)
return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
return if $game_party.in_battle && @fix_tone_on_battle
target_tone,duration = get_match_tone
return if target_tone.nil? || screen.tone_target == target_tone
# 変更時間の設定
duration = BMSP::KoyomiSystem::AUTO_TONE_DURATION if duration.nil?
duration = @tone_temp_duration ? @tone_temp_duration : duration
@tone_temp_duration = nil
# 色調変更
screen.start_tone_change(target_tone, duration)
end
#--------------------------------------------------------------------------
# ● 条件にマッチする色調の取得
#--------------------------------------------------------------------------
def get_match_tone
BMSP::KoyomiSystem::AUTO_TONE_COND.each do |cond, (tone,duration)|
next unless cond.each { |rank, range|
case range
when Range
break unless Ranks.include_range?(rank, range, @calendar[rank])
else # それ以外(整数指定)
break if @calendar[rank] != range
end
}
return tone,duration
end
@default_tone
end
#--------------------------------------------------------------------------
# ● 暦を一つ進める
#--------------------------------------------------------------------------
def succ
rank0 = Ranks.rank(0)
@calendar[rank0] += 1
fit
end
#--------------------------------------------------------------------------
# ● 文字列フォーマット
#--------------------------------------------------------------------------
def strftime(format)
format = format.dup
Ranks.ranks.each_key do |rank|
pattern = /<<(-?)(0?)(\d)#(#{rank.to_s})>>/
format.gsub!(pattern){
left,zero,digit,r = $1,$2,$3,$4
sprintf("%#{left + zero + digit}d", @calendar[rank])
}
end
format.gsub!(/<<(.+?)>>/){
trans = Ranks.transform($1.to_sym)
trans.nil? ? "###" : trans.call(self)
}
format
end
#--------------------------------------------------------------------------
# ● オブジェクト複製
#--------------------------------------------------------------------------
def dup
Marshal.load(Marshal.dump self)
end
#--------------------------------------------------------------------------
# ● 起算時からのランク0からみた経過時間の計算
#--------------------------------------------------------------------------
def calc_to_i
@int = @calendar.each.reverse_each.inject(0) { |sum, (rank, value)|
sum * Ranks.ranks[rank].count + Ranks.normalize(value, rank)
}
end
#--------------------------------------------------------------------------
# ● 起算時からのランク0からみた経過時間の取得
#--------------------------------------------------------------------------
def to_i
@int
end
#--------------------------------------------------------------------------
# ● 比較演算子
#--------------------------------------------------------------------------
def ==(koyomi)
self.to_i == koyomi.to_i
end
def !=(koyomi)
self.to_i != koyomi.to_i
end
def <(koyomi)
self.to_i < koyomi.to_i
end
def <=(koyomi)
self.to_i <= koyomi.to_i
end
def >(koyomi)
self.to_i > koyomi.to_i
end
def >=(koyomi)
self.to_i >= koyomi.to_i
end
def <=>(koyomi)
self.to_i <=> koyomi.to_i
end
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# ● 各種ゲームオブジェクトの作成
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_create_game_objects create_game_objects }
def self.create_game_objects
bmsp_koyomisystem_create_game_objects
$game_koyomi = Game_Koyomi.new(BMSP::KoyomiSystem::INITIAL_CAL)
end
#--------------------------------------------------------------------------
# ● セーブ内容の作成
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_make_save_contents make_save_contents }
def self.make_save_contents
contents = bmsp_koyomisystem_make_save_contents
contents[:koyomi] = $game_koyomi
contents
end
#--------------------------------------------------------------------------
# ● セーブ内容の展開
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_extract_save_contents extract_save_contents }
def self.extract_save_contents(contents)
bmsp_koyomisystem_extract_save_contents(contents)
$game_koyomi = contents[:koyomi]
end
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :map # 現在のマップデータ
attr_accessor :koyomi_display # 暦表示フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias bmsp_koyomisytem_initialize initialize
def initialize
bmsp_koyomisytem_initialize
@koyomi_display = BMSP::KoyomiSystem::MAP_WINDOW
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_start start
def start
bmsp_koyomisystem_start
bmsp_koyomisystem_create_koyomi_window if BMSP::KoyomiSystem::MENU_WINDOW
end
#--------------------------------------------------------------------------
# ● 暦ウィンドウの作成
#--------------------------------------------------------------------------
def bmsp_koyomisystem_create_koyomi_window
@bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MenuKoyomi.new
@bmsp_koyomi_window.x = 0
@bmsp_koyomi_window.y = Graphics.height - @gold_window.height - @bmsp_koyomi_window.height
if BMSP.check_script(:EXPDistribution, 1.00) && BMSP::EXPDistribution::EXP_WINDOW
@bmsp_koyomi_window.y -= @bmsp_koyomi_window.fitting_height(1)
end
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_create_all_windows create_all_windows
def create_all_windows
bmsp_koyomisystem_create_all_windows
bmsp_koyomisystem_create_koyomi_window
end
#--------------------------------------------------------------------------
# ● 暦ウィンドウの作成
#--------------------------------------------------------------------------
def bmsp_koyomisystem_create_koyomi_window
@bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MapKoyomi.new
end
#--------------------------------------------------------------------------
# ● 場所移動前の処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_pre_transfer pre_transfer
def pre_transfer
@bmsp_koyomi_window.close
bmsp_koyomisystem_pre_transfer
bmsp_koyomisystem_move_time_pass
end
#--------------------------------------------------------------------------
# ● 場所移動後の処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_post_transfer post_transfer
def post_transfer
bmsp_koyomisystem_change_fix_tone
@bmsp_koyomi_window.open unless BMSP::KoyomiSystem::MAP_WINDOW_FADE
bmsp_koyomisystem_post_transfer
@bmsp_koyomi_window.open if BMSP::KoyomiSystem::MAP_WINDOW_FADE
end
#--------------------------------------------------------------------------
# ● 場所移動による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_move_time_pass
$game_koyomi.move_time_pass
end
#--------------------------------------------------------------------------
# ● 色調固定マップの処理
#--------------------------------------------------------------------------
def bmsp_koyomisystem_change_fix_tone
tone = $game_map.map.bmsp_koyomisystem_fix_tone
if tone # 色調固定
$game_map.screen.start_tone_change(tone, 0)
else # それ以外
if $game_koyomi.auto_tone
tone,duration = $game_koyomi.get_match_tone
$game_map.screen.start_tone_change(tone, 0)
else
$game_map.screen.start_tone_change(Tone.new(0,0,0,0), 0)
end
end
end
end
#==============================================================================
# ■ BMSP::KoyomiSystem::Window_MenuKoyomi
#==============================================================================
class BMSP::KoyomiSystem::Window_MenuKoyomi < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
line_number = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT.size
super(0, 0, window_width, fitting_height(line_number))
@time = $game_koyomi.to_i
@formats = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
refresh if redraw?
end
#--------------------------------------------------------------------------
# ● 再描画するか
#--------------------------------------------------------------------------
def redraw?
if $game_koyomi.to_i != @time
@time = $game_koyomi.to_i
return true
end
false
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_background(contents.rect)
rect = contents.rect
rect.height = line_height
rect.y = 0
@formats.each do |format|
draw_text(rect, $game_koyomi.strftime(format), 1)
rect.y += line_height
end
end
#--------------------------------------------------------------------------
# ● 背景の描画
#--------------------------------------------------------------------------
def draw_background(rect)
end
end
#==============================================================================
# ■ BMSP::KoyomiSystem::Window_MapKoyomi
#==============================================================================
class BMSP::KoyomiSystem::Window_MapKoyomi < BMSP::KoyomiSystem::Window_MenuKoyomi
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
line_number = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT.size
x= Graphics.width - window_width
move(x, 0, window_width, fitting_height(line_number))
self.opacity = 0
self.contents_opacity = 0 if BMSP::KoyomiSystem::MAP_WINDOW_FADE
@show_count = BMSP::KoyomiSystem::MAP_WINDOW_FADE ? 0 : 1
@time = $game_koyomi.to_i
@formats = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 320
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @show_count > 0 && $game_map.koyomi_display && BMSP::KoyomiSystem::MAP_WINDOW_FADE
update_fadein
@show_count -= 1
elsif @show_count == 0
update_fadeout
end
end
#--------------------------------------------------------------------------
# ● フェードインの更新
#--------------------------------------------------------------------------
def update_fadein
self.contents_opacity += 16
end
#--------------------------------------------------------------------------
# ● フェードアウトの更新
#--------------------------------------------------------------------------
def update_fadeout
self.contents_opacity -= 16
end
#--------------------------------------------------------------------------
# ● ウィンドウを開く
#--------------------------------------------------------------------------
def open
refresh
if $game_map.map.bmsp_koyomisystem_display_koyomi_on_map?
if BMSP::KoyomiSystem::MAP_WINDOW_FADE || !$game_map.koyomi_display
@show_count = 150
self.contents_opacity = 0
else
@show_count = 1
self.contents_opacity = 255
end
else
@show_count = 0
self.contents_opacity = 0
end
self
end
#--------------------------------------------------------------------------
# ● ウィンドウを閉じる
#--------------------------------------------------------------------------
def close
@show_count = 0 if BMSP::KoyomiSystem::MAP_WINDOW_FADE
self
end
#--------------------------------------------------------------------------
# ● 背景の描画
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# ● 背景色 1 の取得
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# ● 背景色 2 の取得
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
#==============================================================================
# ■ Game_Screen
#==============================================================================
class Game_Screen
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :tone_target
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_update update
def update
bmsp_koyomisystem_update
bmsp_koyomisystem_update_koyomi
end
#--------------------------------------------------------------------------
# ● 暦の更新
#--------------------------------------------------------------------------
def bmsp_koyomisystem_update_koyomi
$game_koyomi.update(self)
end
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
def setup(troop_id)
clear
@troop_id = troop_id
@enemies = []
troop.members.each do |member|
next unless $data_enemies[member.enemy_id]
enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
enemy.hide if member.hidden
enemy.screen_x = member.x
enemy.screen_y = member.y
@enemies.push(enemy)
end
init_screen_tone
make_unique_names
end
#--------------------------------------------------------------------------
# ● 画面の色調を初期化
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_init_screen_tone init_screen_tone
def init_screen_tone
bmsp_koyomisystem_init_screen_tone
bmsp_koyomisystem_battle_start_time_pass
bmsp_koyomisystem_fix_tone_on_battle
end
#--------------------------------------------------------------------------
# ● 戦闘開始による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_battle_start_time_pass
$game_koyomi.battle_start_time_pass
return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
tone,duration = $game_koyomi.get_match_tone
$game_troop.screen.start_tone_change(tone, 0)
end
#--------------------------------------------------------------------------
# ● バトル中の色調固定
#--------------------------------------------------------------------------
def bmsp_koyomisystem_fix_tone_on_battle
return unless $game_koyomi.fix_tone_on_battle
$game_troop.screen.start_tone_change(Tone.new(0,0,0,0), 0)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_terminate terminate
def terminate
bmsp_koyomisystem_terminate
bmsp_koyomisystem_battle_end_time_pass
end
#--------------------------------------------------------------------------
# ● 戦闘終了による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_battle_end_time_pass
$game_koyomi.battle_end_time_pass
return if !$game_koyomi.auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
tone,duration = $game_koyomi.get_match_tone
$game_map.screen.start_tone_change(tone, 0)
end
end