设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 6067|回复: 13
打印 上一主题 下一主题

[交流讨论] Yanfly的新插件YEP_GridFreeDoodads.js(連素材8.6M)

[复制链接]

Lv5.捕梦者

梦石
0
星屑
21977
在线时间
8570 小时
注册时间
2011-12-31
帖子
3362
跳转到指定楼层
1
发表于 2016-9-19 10:14:33 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 tseyik 于 2016-9-19 10:25 编辑

http://yanfly.moe/2016/09/17/yep ... odads-rpg-maker-mv/
使用本插件需RPG MAKER MV 1.3.0以上
自由地在地圖上加上修飾品(光影花草………(最大十圖層))
在測試按F10即可進入編輯畫面
附8.6M圖象
https://yunpan.cn/ckqSwsCZfr4x4  访问密码 4cf8


Lv1.梦旅人

梦石
0
星屑
112
在线时间
376 小时
注册时间
2015-1-26
帖子
203
2
发表于 2016-9-19 14:25:46 | 只看该作者
这个大赞,终于不用在PS里折腾了
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4583
在线时间
1205 小时
注册时间
2016-4-7
帖子
982

开拓者

3
发表于 2016-9-19 17:18:19 | 只看该作者
raketenfaust02 发表于 2016-9-19 14:25
这个大赞,终于不用在PS里折腾了

类似效果的脚本有https://taroxd.github.io/rpgmv-plugins/ULDS.html
虽然各有所侧重,但主体功能还是差不多的。
相比yangfly的插件,td君的ULDS,从VA起就有,论坛上有着不少的教程,以及多个正式发布的使用了该系统的游戏。
如果你需要类似效果,个人比较推荐ULDS。
附庸的附庸不是我的附庸,女儿的女儿还是我的女儿。CK2沉迷ing
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
131
在线时间
122 小时
注册时间
2010-11-28
帖子
47
4
发表于 2016-9-20 21:54:44 | 只看该作者
/E:/%E5%90%9E%E9%A3%9F%E5%A4%A9%E5%9C%B0GO/%E5%8B%87%E8%80%85/www/js/plugins/YEP_GridFreeDoodads.js:3377 You are getting this error because you are trying to run Grid-Free Doodads while your project files are lower than version 1.3.0.

Please visit this thread for instructions on how to update your project files to 1.3.0 or higher:

http://forums.rpgmakerweb.com/in ... aker-mv-v131-fixes/





出现这样错误是什么原因呢?  求大大指导下& 而且按f10 没反应

点评

使用本插件需RPG MAKER MV 1.3.0以上  发表于 2016-9-20 22:27
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
131
在线时间
122 小时
注册时间
2010-11-28
帖子
47
5
发表于 2016-9-21 00:24:09 | 只看该作者
伊湛 发表于 2016-9-20 21:54
/E:/%E5%90%9E%E9%A3%9F%E5%A4%A9%E5%9C%B0GO/%E5%8B%87%E8%80%85/www/js/plugins/YEP_GridFreeDoodads.js: ...

我的版本是1.3.0  还是不行吗?   要升1.3.1+吗?

点评

方法是升級1.30前建立,還是之後建立?  发表于 2016-9-21 10:36
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
131
在线时间
122 小时
注册时间
2010-11-28
帖子
47
6
发表于 2016-9-21 17:28:08 | 只看该作者
伊湛 发表于 2016-9-21 00:24
我的版本是1.3.0  还是不行吗?   要升1.3.1+吗?

游戏是之前建立的,后来才升级1.30的……  

有什么方法可以在原来的工程上加这个插件?
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
21977
在线时间
8570 小时
注册时间
2011-12-31
帖子
3362
7
 楼主| 发表于 2016-9-21 17:55:00 | 只看该作者
本帖最后由 tseyik 于 2016-9-21 18:02 编辑
伊湛 发表于 2016-9-21 17:28
游戏是之前建立的,后来才升级1.30的……  

有什么方法可以在原来的工程上加这个插件? ...


■制作中的工程
[Windows版の例]
C:\Program Files (x86)\KADOKAWA\RPGMV\NewData\内
index.html
C:\Program Files (x86)\KADOKAWA\RPGMV\NewData\js\内
plugins.js和plugins文件夾以外所有文件

copy到旧工程
注意:更新旧工程後一些插件可能不能在1.30以後使用
所以応先備份上述文件,以備還原
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
15561
在线时间
3957 小时
注册时间
2015-9-14
帖子
1335

开拓者

8
发表于 2016-9-21 22:18:01 | 只看该作者
大如城堡也可以加載.
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
9
发表于 2016-9-22 18:29:40 | 只看该作者
好厉害,能做到xp的地图那种效果吗?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1390
在线时间
231 小时
注册时间
2017-10-24
帖子
209
10
发表于 2017-11-19 16:03:25 | 只看该作者
tseyik 发表于 2016-9-21 17:55
■制作中的工程
[Windows版の例]
C:\Program Files (x86)\KADOKAWA\RPGMV\NewData\内

接一下楼大神,回复里放不下一下脚本,我用了C_SHOW 但是还是没有效果,求解答大神
//=============================================================================
// Chronus.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015-2017 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.9.3 2017/11/18 マップロード時に色調を時間に合わせて瞬間変更していた仕様を撤廃
// 1.9.2 2017/11/02 イベント実行中に時間を変更した場合にアナログ時計の表示が変更されない問題を修正
// 1.9.1 2017/11/02 時間経過の初期状態を「停止」から「開始」に変更
// 1.9.0 2017/10/05 アナログ時計の画像を変更できる機能を追加
//                  カレンダーウィンドウのフォントサイズと不透明度を変更できる機能を追加
// 1.8.3 2017/07/18 タイマーの機能のプラグインコマンドに関する説明が一部間違っていた問題を修正
// 1.8.2 2017/07/05 時間変動間隔を変更したときにアナログ時計が正しく表示されない問題を修正
// 1.8.1 2017/06/29 1.8.0で追加した累計時間の初期化機能で、現在時間まで初期化されてしまう問題を修正
// 1.8.0 2017/06/28 累計経過日数を格納するパラメータと、累計時間および日数を初期化できるプラグインコマンドを追加
//                  パラメータの型指定に対応
// 1.7.0 2017/06/01 実時間およびゲーム内時間と連動するタイマー機能を追加
//                  時間が変動する間隔を自由に指定できる機能を追加
// 1.6.0 2017/04/23 降雪マップをマップ単位でタイルセット単位で設定する機能を追加、降水確率を調整できる機能を追加
// 1.5.0 2017/01/23 カレンダーに月名を表記する書式「MON」を追加
// 1.4.0 2017/01/07 ゲーム開始からの累計時間(分単位)を指定したゲーム変数に格納する機能を追加
// 1.3.3 2017/01/02 色調変更を禁止しているときにイベントで色調変更した場合、すぐにリセットされてしまう問題を修正
// 1.3.2 2016/07/24 1.3.1でロード時にエラーになる問題の修正
// 1.3.1 2016/07/23 イベント処理中の時間経過有無をイベントごとに設定できるよう変更
//                  一部コードのリファクタリング
// 1.3.0 2016/07/21 イベント処理中も時間が経過する設定を追加
// 1.2.7 2016/07/10 自然時間加算が0の場合に色調や天候の変化が正しく行われない問題を修正
// 1.2.6 2016/05/30 曜日に「Y」を含む文字列を指定できないバグを修正
// 1.2.5 2016/04/29 createUpperLayerによる競合対策
// 1.2.4 2016/03/13 アナログ時計を指定しないで起動した場合にエラーになる現象の修正
// 1.2.3 2016/03/10 時間帯と時間帯ごとの色調をカスタマイズできるようにユーザ書き換え領域を作成
// 1.2.2 2016/03/04 本体バージョン1.1.0の未使用素材の削除機能への対応
// 1.2.1 2016/02/25 実時間表示設定でロードするとエラーが発生する現象の修正
// 1.2.0 2016/02/14 アナログ時計の表示機能を追加
//                  現実の時間を反映させる機能の追加
// 1.1.3 2016/01/21 競合対策(YEP_MessageCore.js)
// 1.1.2 2016/01/10 カレンダーウィンドウの表示位置をカスタマイズできる機能を追加
// 1.1.1 2015/12/29 日の値に「1」を設定した場合に日付の表示がおかしくなる不具合を修正
//                  一部コードのリファクタリング
// 1.1.0 2015/12/01 天候と時間帯をゲーム変数に格納できるよう機能追加
// 1.0.0 2015/11/27 初版
// ----------------------------------------------------------------------------
// [Blog]   : https://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
* @plugindesc ゲーム内時間の導入プラグイン
* @author トリアコンタン
*
* @param 月ごとの日数配列
* @desc 各月の日数の配列です。カンマ区切りで指定してください。個数は自由です。
* @default 31,28,31,30,31,30,31,31,30,31,30,31
*
* @param 月名配列
* @desc 月の名称配列です。カンマ区切りで指定してください。個数は自由です。
* @default Jan.,Feb.,Mar.,Apr.,May.,Jun.,Jul.,Aug.,Sep.,Oct.,Nov.,Dec.
*
* @param 曜日配列
* @desc 曜日の名称配列です。カンマ区切りで指定してください。個数は自由です。
* @default (日),(月),(火),(水),(木),(金),(土)
*
* @param 自然時間加算
* @type number
* @desc 1秒(自然時間加算間隔で指定した間隔)ごとに加算されるゲーム時間(分単位)の値です。イベント処理中は無効です。
* @default 5
*
* @param 自然時間加算間隔
* @type number
* @desc ゲーム時間の自然加算が行われる間隔(フレーム数)です。1F=1/60秒
* @default 60
*
* @param 場所移動時間加算
* @type number
* @desc 1回の場所移動で加算されるゲーム時間(分単位)の値です。
* @default 30
*
* @param 戦闘時間加算(固定)
* @type number
* @desc 1回の戦闘で加算されるゲーム時間(分単位)の値です。
* @default 30
*
* @param 戦闘時間加算(ターン)
* @type number
* @desc 1回の戦闘で消費したターン数ごとに加算されるゲーム時間(分単位)の値です。
* @default 5
*
* @param 年のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「年」の値が自動設定されます。
* @default 0
*
* @param 月のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「月」の値が自動設定されます。
* @default 0
*
* @param 日のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「日」の値が自動設定されます。
* @default 0
*
* @param 曜日IDのゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「曜日」のIDが自動設定されます。
* @default 0
*
* @param 曜日名のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「曜日」の名称が自動設定されます。
* ゲーム変数に文字列が入るので注意してください。
* @default 0
*
* @param 時のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「時」の値が自動設定されます。
* @default 0
*
* @param 分のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「分」の値が自動設定されます。
* @default 0
*
* @param 累計時間のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「累計時間」(分単位)の値が自動設定されます。
* @default 0
*
* @param 累計日数のゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「累計日数」の値が自動設定されます。
* @default 0
*
* @param 時間帯IDのゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「時間帯」のIDが自動設定されます。
* 0:深夜 1:早朝 2:朝 3:昼 4:夕方 5:夜
* @default 0
*
* @param 天候IDのゲーム変数
* @type variable
* @desc 指定した番号のゲーム変数に「天候」のIDが自動設定されます。
* 0:なし 1:雨 2:嵐 3:雪
* @default 0
*
* @param 日時フォーマット1
* @desc マップ上の日付ウィンドウ1行目に表示される文字列です。
* YYYY:年 MON:月名 MM:月 DD:日 HH24:時(24) HH:時(12) AM:午前 or 午後 MI:分 DY:曜日
* @default YYYY年 MM月 DD日 DY
*
* @param 日時フォーマット2
* @desc マップ上の日付ウィンドウ2行目に表示される文字列です。
* YYYY:年 MON:月名 MM:月 DD:日 HH24:時(24) HH:時(12) AM:午前 or 午後 MI:分 DY:曜日
* @default AMHH時 MI分
*
* @param カレンダー表示X座標
* @type number
* @desc カレンダーの表示 X 座標です。
* @default 0
*
* @param カレンダー表示Y座標
* @type number
* @desc カレンダーの表示 Y 座標です。
* @default 0
*
* @param カレンダーフォントサイズ
* @type number
* @desc カレンダーのフォントサイズです。0を指定するとデフォルトとなります。
* @default 0
*
* @param カレンダー不透明度
* @type number
* @desc カレンダーの背景の不透明度(0-255)です。
* @default 192
*
* @param カレンダー余白
* @type number
* @desc カレンダーの余白(8-)です。
* @default 8
*
* @param 文字盤画像ファイル
* @desc アナログ時計を表示する場合の文字盤画像ファイル名(拡張子は不要)です。
* 画像は「img/pictures/」以下に保存してください。
* @default
* @require 1
* @dir img/pictures/
* @type file
*
* @param 長針画像ファイル
* @desc アナログ時計を表示する場合の長針画像ファイル名(拡張子は不要)です。
* 画像は「img/pictures/」以下に保存してください。
* @default
* @require 1
* @dir img/pictures/
* @type file
*
* @param 短針画像ファイル
* @desc アナログ時計を表示する場合の長針画像ファイル名(拡張子は不要)です。
* 画像は「img/pictures/」以下に保存してください。
* @default
* @require 1
* @dir img/pictures/
* @type file
*
* @param 時計X座標
* @type number
* @desc アナログ時計の表示X座標です。画像の中心座標を指定してください。
* @default 84
*
* @param 時計Y座標
* @type number
* @desc アナログ時計の表示Y座標です。画像の中心座標を指定してください。
* @default 156
*
* @param イベント中時間経過
* @desc イベント実行中も時間経過するようになります。(ON/OFF)
* @default false
* @type boolean
*
* @help ゲーム内で時刻と天候の概念を表現できるプラグインです。
* 自動、マップ移動、戦闘で時間が経過し、時間と共に天候と色調が変化します。
* これらの時間は調節可能で、またイベント中は時間の進行が停止します。
*
* さらに、現実の時間をゲーム中に反映させる機能もあります。
* 設定を有効にすると現実の時間がゲーム内とリンクします。
*
* 日付や曜日も記録し、曜日の数や名称を自由に設定できます。
* 現在日付はフォーマットに従って、画面左上に表示されます。
*
* 日付フォーマットには以下を利用できます。
* YYYY:年 MON:月名 MM:月 DD:日 HH24:時(24) HH:時(12)
* AM:午前 or 午後 MI:分 DY:曜日
*
* また、規格に沿った画像を用意すればアナログ時計も表示できます。
* 表示位置は各画像の表示可否は調整できます。
*
* 画像の規格は以下の通りです。
* ・文字盤 : 任意のサイズの正方形画像
* ・長針  : 文字盤と同じサイズの画像で、上(0)を指している針の画像
* ・短針  : 文字盤と同じサイズの画像で、上(0)を指している針の画像
*
* ツクマテにて規格に合った時計画像をリクエストしました。
* 使用する場合は、以下のURLより利用規約を別途確認の上、ご使用ください。
* http://tm.lucky-duet.com/viewtop ... 55&p=1615#p1615
*
* プラグインコマンド詳細
*  イベントコマンド「プラグインコマンド」から実行。
*  指定する値には制御文字\V[n]を使用できます。
*  (引数の間は半角スペースで区切る)
*
* C_ADD_TIME [分] : 指定した値(分単位)だけ時間が経過します。
* C_ADD_DAY [日] : 指定した値(日単位)だけ日数が経過します。
* C_SET_TIME [時] [分] : 指定した時間に変更します。
* C_SET_DAY [年] [月] [日] : 指定した日付に変更します。
* C_STOP : 時間の進行を停止します。
* C_START : 時間の進行を開始します。
* C_SHOW : カレンダーを表示します。
* C_HIDE : カレンダーを非表示にします。
* C_DISABLE_TINT : 時間帯による色調の変更を禁止します。
* C_ENABLE_TINT : 時間帯による色調の変更を許可します。
* C_DISABLE_WEATHER : 時間経過による天候の変化を禁止します。
* C_ENABLE_WEATHER : 時間経過による天候の変化を許可します。
* C_SET_SNOW_LAND : 悪天候時に雪が降るようになります。
* C_RESET_SNOW_LAND : 悪天候時に雨もしくは嵐が降るようになります。
* C_SET_SPEED [分] : 実時間1秒あたりの時間の経過速度を設定します。
* C_SHOW_CLOCK : アナログ時計を表示します。
* C_HIDE_CLOCK : アナログ時計を非表示にします。
* C_SET_TIME_REAL : 時間の取得方法を実時間に変更します。
* C_SET_TIME_VIRTUAL : 時間の取得方法をゲーム内時間に変更します。
* C_SET_RAINY_PERCENT [確率] : 降水確率(0-100)を設定します。
* C_INIT_TOTAL_TIME : 累計時間、累計日数を初期化します。
*
* ・アナログ時計画像変更コマンド
* アナログ時計の画像ファイル名(img/pictures)を変更できます。
* ただし、実際に画像が変更されるのはマップを移動した後になります。
* C_SET_CLOCK_BASE [ファイル名] : 文字盤画像のファイル名を変更します。
* C_SET_HOUR_HAND [ファイル名] : 短針画像のファイル名を変更します。
* C_SET_MINUTE_HAND [ファイル名] : 長針画像のファイル名を変更します。
*
* ・タイマー操作系コマンド
* コマンド実行から指定した時間[分]が経過後にスイッチやセルフスイッチを
* ONにできるコマンドです。
* 実時間連動機能と併せて使用することもできます。
* スイッチの場合はIDを、セルフスイッチの場合は種類(A,B,C,D)を指定します。
*
* C_SET_SWITCH_TIMER [分] [スイッチID] [ループ]
* 指定例(ゲーム内時間で30分経過後する度にスイッチ[10]をONにする)
* C_SET_SWITCH_TIMER 30 10 ON
*
* C_SET_SELF_SWITCH_TIMER [分] [セルフスイッチ種類] [ループ]
* 指定例(ゲーム内時間で3時間過後にセルフスイッチ[B](※)をONにする)
* C_SET_SELF_SWITCH_TIMER 180 B OFF
* ※対象イベントはプラグインコマンドを実行したイベントです。
*
* 途中で解除や一時停止する可能性がある場合は[タイマー名]を指定するコマンドを
* 実行してください。解除などの際にタイマー名を指定する必要があるためです。
*
* C_SET_SWITCH_NAMED_TIMER [タイマー名] [分] [スイッチID] [ループ]
* 指定例(ゲーム内時間で30分経過後する度にスイッチ[10]をONにする)
* C_SET_SWITCH_NAMED_TIMER timer 30 10 ON
*
* C_SET_SELF_SWITCH_NAMED_TIMER [タイマー名] [分] [セルフスイッチ種類] [ループ]
* 指定例(ゲーム内時間で3時間過後にセルフスイッチ[B](※)をONにする)
* C_SET_SELF_SWITCH_NAMED_TIMER timer 180 B OFF
* ※対象イベントはプラグインコマンドを実行したイベントです。
*
* 解除、停止、再開のコマンドは以下の通りです。
* C_CLEAR_TIMER timer # タイマー名「timer」を解除します。
* C_STOP_TIMER timer  # タイマー名「timer」を一時停止します。
* C_START_TIMER timer # タイマー名「timer」を再開します。
*
* メモ欄詳細
*  タイトルセットおよびマップのメモ欄に以下を入力すると、
*  一時的に天候と色調変化を自動で無効化できます。
*  屋内マップやイベントシーンなどで一時的に無効化したい場合に利用できます。
*  設定はマップのメモ欄が優先されます。
*
* <C_Tint:OFF>    # 色調の変更を一時的に無効化します。
* <C_色調:OFF>    # 同上
* <C_Weather:OFF> # 天候を一時的に無効化します。
* <C_天候:OFF>    # 同上
*
* イベント実行中にも時間経過するかどうかをイベントごとに設定できます。
* この設定はパラメータの設定よりも優先されます。
* イベントのメモ欄に以下を入力してください。
* <C_時間経過:ON> # イベント実行中に時間経過します。(ON/OFF)
* <C_NoStop:ON>   # 同上
*
* 高度な設定
* ソースコード中の「ユーザ書き換え領域」を参照すると以下を変更できます。
*  時間帯の情報(朝が何時から何時まで等)
*  時間帯ごとの色調(ただし、悪天候の場合は補正が掛かります)
*
* 利用規約:
*  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
*  についても制限はありません。
*  このプラグインはもうあなたのものです。
*/

function Game_Chronus() {
    this.initialize.apply(this, arguments);
}

function Game_ChronusTimer() {
    this.initialize.apply(this, arguments);
}

(function() {
    'use strict';
    //=============================================================================
    // ユーザ書き換え領域 - 開始 -
    //=============================================================================
    var settings = {
        /* timeZone:時間帯 */
        timeZone: [
            /* name:時間帯名称 start:開始時刻 end:終了時刻 timeId:時間帯ID */
            {name: '深夜', start: 0, end: 4, timeId: 0},
            {name: '早朝', start: 5, end: 6, timeId: 1},
            {name: '朝', start: 7, end: 11, timeId: 2},
            {name: '昼', start: 12, end: 16, timeId: 3},
            {name: '夕方', start: 17, end: 18, timeId: 4},
            {name: '夜', start: 19, end: 21, timeId: 5},
            {name: '深夜', start: 22, end: 24, timeId: 0}
        ],
        /* timeTone:時間帯ごとの色調 */
        timeTone: [
            /* timeId:時間帯ID value:色調[赤(-255...255),緑(-255...255),青(-255...255),グレー(0...255)] */
            {timeId: 0, value: [-102, -102, -68, 102]},
            {timeId: 1, value: [-68, -68, 0, 0]},
            {timeId: 2, value: [0, 0, 0, 0]},
            {timeId: 3, value: [34, 34, 34, 0]},
            {timeId: 4, value: [68, -34, -34, 0]},
            {timeId: 5, value: [-68, -68, 0, 68]}
        ]
    };
    //=============================================================================
    // ユーザ書き換え領域 - 終了 -
    //=============================================================================
    var pluginName    = 'Chronus';
    var metaTagPrefix = 'C_';

    var getParamString = function(paramNames) {
        var value = getParamOther(paramNames);
        return value === null ? '' : value;
    };

    var getParamNumber = function(paramNames, min, max) {
        var value = getParamOther(paramNames);
        if (arguments.length < 2) min = -Infinity;
        if (arguments.length < 3) max = Infinity;
        return (parseInt(value, 10) || 0).clamp(min, max);
    };

    var getParamOther = function(paramNames) {
        if (!Array.isArray(paramNames)) paramNames = [paramNames];
        for (var i = 0; i < paramNames.length; i++) {
            var name = PluginManager.parameters(pluginName)[paramNames];
            if (name) return name;
        }
        return null;
    };

    var getParamBoolean = function(paramNames) {
        var value = (getParamOther(paramNames) || '').toUpperCase();
        return value === 'ON' || value === 'TRUE';
    };

    var isParamExist = function(paramNames) {
        return getParamOther(paramNames) !== null;
    };

    var getParamArrayString = function(paramNames) {
        var values = getParamString(paramNames).split(',');
        for (var i = 0; i < values.length; i++) values = values.trim();
        return values;
    };

    var getParamArrayNumber = function(paramNames, min, max) {
        var values = getParamArrayString(paramNames);
        if (arguments.length < 2) min = -Infinity;
        if (arguments.length < 3) max = Infinity;
        for (var i = 0; i < values.length; i++) values = (parseInt(values, 10) || 0).clamp(min, max);
        return values;
    };

    var getCommandName = function(command) {
        return (command || '').toUpperCase();
    };

    var getArgNumber = function(arg, min, max) {
        if (arguments.length < 2) min = -Infinity;
        if (arguments.length < 3) max = Infinity;
        return parseIntStrict(convertEscapeCharacters(arg)).clamp(min, max);
    };

    var parseIntStrict = function(value, errorMessage) {
        var result = parseInt(value, 10);
        if (isNaN(result)) throw Error('指定した値[' + value + ']が数値ではありません。' + errorMessage);
        return result;
    };

    var convertEscapeCharacters = function(text) {
        if (text == null) text = '';
        var window = SceneManager._scene._windowLayer.children[0];
        return window ? window.convertEscapeCharacters(text) : text;
    };

    var getArgBoolean = function(arg) {
        return (arg || '').toUpperCase() === 'ON' || (arg || '').toUpperCase() === 'TRUE';
    };

    var getMetaValue = function(object, name) {
        var metaTagName = metaTagPrefix + (name ? name : '');
        return object.meta.hasOwnProperty(metaTagName) ? object.meta[metaTagName] : undefined;
    };

    var getMetaValues = function(object, names) {
        if (!Array.isArray(names)) return getMetaValue(object, names);
        for (var i = 0, n = names.length; i < n; i++) {
            var value = getMetaValue(object, names);
            if (value !== undefined) return value;
        }
        return undefined;
    };

    var _DataManager_extractSaveContents = DataManager.extractSaveContents;
    DataManager.extractSaveContents      = function(contents) {
        _DataManager_extractSaveContents.apply(this, arguments);
        $gameSystem.onLoad();
    };

    //=============================================================================
    // パラメータの取得と整形
    //=============================================================================
    var paramAutoAddInterval  = getParamNumber('自然時間加算間隔', 1) || 60;
    var paramCalendarFontSize = getParamNumber('カレンダーフォントサイズ', 0);
    var paramCalendarOpacity  = getParamNumber('カレンダー不透明度', 0);
    var paramCalendarPadding  = getParamNumber('カレンダー余白', 8);
    var paramClockBaseFile    = getParamString('文字盤画像ファイル');
    var paramMinutesHandFile  = getParamString('長針画像ファイル');
    var paramHourHandFile     = getParamString('短針画像ファイル');

    //=============================================================================
    // Game_Interpreter
    //  プラグインコマンド[C_ADD_TIME]などを追加定義します。
    //=============================================================================
    var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.apply(this, arguments);
        var commandPrefix = new RegExp('^' + metaTagPrefix);
        if (!command.match(commandPrefix)) return;
        this.pluginCommandChronus(command.replace(commandPrefix, ''), args);
    };

    Game_Interpreter.prototype.pluginCommandChronus = function(command, args) {
        switch (getCommandName(command)) {
            case 'ADD_TIME' :
                $gameSystem.chronus().addTime(getArgNumber(args[0], 0, 99999));
                break;
            case 'ADD_DAY' :
                $gameSystem.chronus().addDay(getArgNumber(args[0], 0, 99999));
                break;
            case 'SET_TIME' :
                var hour   = getArgNumber(args[0], 0, 23);
                var minute = getArgNumber(args[1], 0, 59);
                $gameSystem.chronus().setTime(hour, minute);
                break;
            case 'SET_DAY' :
                var year  = getArgNumber(args[0], 1, 5000);
                var month = getArgNumber(args[1], 1, $gameSystem.chronus().getMonthOfYear());
                var day   = getArgNumber(args[2], 1, $gameSystem.chronus().getDaysOfMonth(month));
                $gameSystem.chronus().setDay(year, month, day);
                break;
            case 'STOP' :
                $gameSystem.chronus().stop();
                break;
            case 'START' :
                $gameSystem.chronus().start();
                break;
            case 'SHOW' :
                $gameSystem.chronus().showCalendar();
                break;
            case 'HIDE' :
                $gameSystem.chronus().hideCalendar();
                break;
            case 'DISABLE_TINT':
                $gameSystem.chronus().disableTint();
                break;
            case 'ENABLE_TINT':
                $gameSystem.chronus().enableTint();
                break;
            case 'DISABLE_WEATHER':
                $gameSystem.chronus().disableWeather();
                break;
            case 'ENABLE_WEATHER':
                $gameSystem.chronus().enableWeather();
                break;
            case 'SET_SNOW_LAND':
                $gameSystem.chronus().setSnowLand();
                break;
            case 'RESET_SNOW_LAND':
                $gameSystem.chronus().resetSnowLand();
                break;
            case 'SET_SPEED':
                $gameSystem.chronus().setTimeAutoAdd(getArgNumber(args[0], 0, 99));
                break;
            case 'SHOW_CLOCK':
                $gameSystem.chronus().showClock();
                break;
            case 'HIDE_CLOCK':
                $gameSystem.chronus().hideClock();
                break;
            case 'SET_TIME_REAL':
                $gameSystem.chronus().setTimeReal();
                break;
            case 'SET_TIME_VIRTUAL':
                $gameSystem.chronus().setTimeVirtual();
                break;
            case 'SET_RAINY_PERCENT':
                $gameSystem.chronus().setRainyPercent(getArgNumber(args[0], 0, 100));
                break;
            case 'SET_SWITCH_TIMER':
                this.setSwitchTimer(args, false);
                break;
            case 'SET_SWITCH_NAMED_TIMER':
                this.setSwitchTimer(args, true);
                break;
            case 'SET_SELF_SWITCH_TIMER':
                this.setSwitchTimer(args, false, true);
                break;
            case 'SET_SELF_SWITCH_NAMED_TIMER':
                this.setSwitchTimer(args, true, true);
                break;
            case 'STOP_TIMER':
                $gameSystem.chronus().stopTimer(convertEscapeCharacters(args[0]));
                break;
            case 'START_TIMER':
                $gameSystem.chronus().startTimer(convertEscapeCharacters(args[0]));
                break;
            case 'CLEAR_TIMER':
                $gameSystem.chronus().clearTimer(convertEscapeCharacters(args[0]));
                break;
            case 'INIT_TOTAL_TIME':
                $gameSystem.chronus().initTotalTime();
                break;
            case 'SET_CLOCK_BASE':
                $gameSystem.chronus().setClockBaseFile(convertEscapeCharacters(args[0]));
                break;
            case 'SET_MINUTE_HAND':
                $gameSystem.chronus().setMinuteHandFile(convertEscapeCharacters(args[0]));
                break;
            case 'SET_HOUR_HAND':
                $gameSystem.chronus().setHourHandFile(convertEscapeCharacters(args[0]));
                break;
        }
    };

    Game_Interpreter.prototype.setSwitchTimer = function(args, named, selfSwitch) {
        var timerName = named ? convertEscapeCharacters(args.shift()) : null;
        var timeout   = getArgNumber(args.shift(), 0);
        var switchKey = this.getSwitchKey(args.shift(), selfSwitch);
        var loop      = getArgBoolean(args.shift());
        $gameSystem.chronus().makeTimer(timerName, timeout, switchKey, loop);
    };

    Game_Interpreter.prototype.getSwitchKey = function(arg, selfSwitch) {
        return selfSwitch ? [$gameMap.mapId(), this.eventId(), convertEscapeCharacters(arg).toUpperCase()] : getArgNumber(arg);
    };

    var _Game_Interpreter_command236      = Game_Interpreter.prototype.command236;
    Game_Interpreter.prototype.command236 = function() {
        var result = _Game_Interpreter_command236.call(this);
        if (!$gameParty.inBattle()) {
            var chronus = $gameSystem.chronus();
            chronus.setWeatherType(Game_Chronus.weatherTypes.indexOf(this._params[0]));
            chronus.setWeatherPower(this._params[1]);
            chronus.refreshTint(true);
            chronus.forceSetBatWeatherLevel(this._params[0], this._params[1]);
        }
        return result;
    };

    //=============================================================================
    // Game_System
    //  ゲーム内時間を扱うクラス「Game_Chronus」を追加定義します。
    //=============================================================================
    var _Game_System_initialize      = Game_System.prototype.initialize;
    Game_System.prototype.initialize = function() {
        _Game_System_initialize.call(this);
        this._chronus = new Game_Chronus();
    };

    Game_System.prototype.chronus = function() {
        return this._chronus;
    };

    Game_System.prototype.onBattleEnd = function() {
        this.chronus().onBattleEnd();
    };

    var _Game_System_onLoad      = Game_System.prototype.onLoad;
    Game_System.prototype.onLoad = function() {
        if (_Game_System_onLoad) _Game_System_onLoad.apply(this, arguments);
        if (!this.chronus()) this._chronus = new Game_Chronus();
        this._chronus.onLoad();
    };

    //=============================================================================
    // Game_Map
    //  マップ及びタイルセットから、色調変化無効フラグを取得します。
    //=============================================================================
    Game_Map.prototype.isDisableTint = function() {
        return !this.isChronicleMetaInfo(['Tint', '色調'], true);
    };

    Game_Map.prototype.isDisableWeather = function() {
        return !this.isChronicleMetaInfo(['Weather', '天候'], true);
    };

    Game_Map.prototype.isSnowLand = function() {
        return this.isChronicleMetaInfo(['Snow', '雪'], false);
    };

    Game_Map.prototype.isChronicleMetaInfo = function(tagNames, defaultValue) {
        if (DataManager.isBattleTest() || DataManager.isEventTest()) return false;
        var metaValue1 = getMetaValues($dataMap, tagNames);
        if (metaValue1 !== undefined) return getArgBoolean(metaValue1);
        var metaValue2 = getMetaValues($dataTilesets[$dataMap.tilesetId], tagNames);
        if (metaValue2 !== undefined) return getArgBoolean(metaValue2);
        return defaultValue;
    };

    Game_Map.prototype.isTimeStopEventRunning = function() {
        if (this.isEventRunning()) {
            if (!this._isTimeStopEventRunning) this._isTimeStopEventRunning = this.getTimeStopEventRunning();
        } else {
            this._isTimeStopEventRunning = false;
        }
        return this._isTimeStopEventRunning;
    };

    Game_Map.prototype.getTimeStopEventRunning = function() {
        var event = this.event(this._interpreter.eventId());
        if (!event) return false;
        var stop = getMetaValues(event.event(), ['時間経過', 'NoStop']);
        if (stop) {
            return !getArgBoolean(stop);
        } else {
            return !getParamBoolean('イベント中時間経過');
        }
    };

    //=============================================================================
    // Game_Player
    //  場所移動時の時間経過を追加定義します。
    //=============================================================================
    var _Game_Player_performTransfer      = Game_Player.prototype.performTransfer;
    Game_Player.prototype.performTransfer = function() {
        _Game_Player_performTransfer.call(this);
        $gameSystem.chronus().transfer();
    };

    //=============================================================================
    // Scene_Map
    //  Game_Chronusの更新を追加定義します。
    //=============================================================================
    var _Scene_Map_onMapLoaded      = Scene_Map.prototype.onMapLoaded;
    Scene_Map.prototype.onMapLoaded = function() {
        $gameSystem.chronus().onMapLoaded();
        _Scene_Map_onMapLoaded.apply(this, arguments);
    };

    var _Scene_Map_updateMain      = Scene_Map.prototype.updateMain;
    Scene_Map.prototype.updateMain = function() {
        _Scene_Map_updateMain.apply(this, arguments);
        $gameSystem.chronus().update();
    };

    var _Scene_Map_createAllWindows      = Scene_Map.prototype.createAllWindows;
    Scene_Map.prototype.createAllWindows = function() {
        this.createChronusWindow();
        _Scene_Map_createAllWindows.apply(this, arguments);
    };

    Scene_Map.prototype.createChronusWindow = function() {
        this._chronusWindow = new Window_Chronus();
        this.addWindow(this._chronusWindow);
    };

    //=============================================================================
    // BattleManager
    //  戦闘終了時のゲーム内時間経過処理を追加定義します。
    //=============================================================================
    var _BattleManager_endBattle = BattleManager.endBattle;
    BattleManager.endBattle      = function(result) {
        $gameSystem.onBattleEnd();
        _BattleManager_endBattle.call(this, result);
    };

    //=============================================================================
    // Window_Chronus
    //  ゲーム内時間情報を描画するウィンドウです。
    //=============================================================================
    function Window_Chronus() {
        this.initialize.apply(this, arguments);
    }

    Window_Chronus.prototype             = Object.create(Window_Base.prototype);
    Window_Chronus.prototype.constructor = Window_Chronus;

    var _Window_Chronus_initialize      = Window_Chronus.prototype.initialize;
    Window_Chronus.prototype.initialize = function() {
        _Window_Chronus_initialize.call(this, 0, 0, this.getDefaultWidth(), this.getDefaultHeight());
        this.createContents();
        this.x = getParamNumber('カレンダー表示X座標');
        this.y = getParamNumber('カレンダー表示Y座標');
        this.refresh();
    };

    Window_Chronus.prototype.getDefaultWidth = function() {
        var bitmap      = new Bitmap();
        bitmap.fontSize = this.standardFontSize();
        var width1      = bitmap.measureTextWidth(this.getDateFormat(1));
        var width2      = bitmap.measureTextWidth(this.getDateFormat(2));
        return Math.max(width1, width2) + this.standardPadding() * 2;
    };

    Window_Chronus.prototype.getDefaultHeight = function() {
        return this.standardFontSize() * (this.getDateFormat(2) ? 2 : 1) + this.standardPadding() * 2;
    };

    Window_Chronus.prototype.standardPadding = function() {
        return paramCalendarPadding;
    };

    Window_Chronus.prototype.standardBackOpacity = function() {
        return paramCalendarOpacity;
    };

    Window_Chronus.prototype.lineHeight = function() {
        return this.standardFontSize();
    };

    var _Window_Chronus_standardFontSize      = Window_Chronus.prototype.standardFontSize;
    Window_Chronus.prototype.standardFontSize = function() {
        return paramCalendarFontSize || _Window_Chronus_standardFontSize.apply(this, arguments);
    };

    Window_Chronus.prototype.refresh = function() {
        this.contents.clear();
        var width  = this.contents.width;
        var height = this.lineHeight();
        this.contents.drawText(this.getDateFormat(1), 0, 0, width, height, 'left');
        this.contents.drawText(this.getDateFormat(2), 0, height, width, height, 'left');
    };

    Window_Chronus.prototype.update = function() {
        if (this.chronus().isShowingCalendar()) {
            this.show();
            if (this.chronus().isNeedRefresh()) this.refresh();
        } else {
            this.hide();
        }
    };

    Window_Chronus.prototype.chronus = function() {
        return $gameSystem.chronus();
    };

    Window_Chronus.prototype.getDateFormat = function(lineNumber) {
        return this.chronus().getDateFormat(lineNumber);
    };

    //=============================================================================
    // Sprite_Chronicle_Clock
    //  アナログ時計表示スプライトクラスです。
    //=============================================================================
    function Sprite_Chronicle_Clock() {
        this.initialize.apply(this, arguments);
    }

    Sprite_Chronicle_Clock.prototype             = Object.create(Sprite.prototype);
    Sprite_Chronicle_Clock.prototype.constructor = Sprite_Chronicle_Clock;

    var _Sprite_Chronicle_Clock_initialize      = Sprite_Chronicle_Clock.prototype.initialize;
    Sprite_Chronicle_Clock.prototype.initialize = function() {
        _Sprite_Chronicle_Clock_initialize.apply(this, arguments);
        this.x        = getParamNumber('時計X座標');
        this.y        = getParamNumber('時計Y座標');
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
        this.bitmap   = ImageManager.loadPicture(this.chronus().getClockBaseFile());
        this.createHourHandSprite();
        this.createMinuteHandSprite();
    };

    Sprite_Chronicle_Clock.prototype.createHourHandSprite = function() {
        var handName        = this.chronus().getHourHandFile();
        var handSprite      = new Sprite();
        handSprite.anchor.x = 0.5;
        handSprite.anchor.y = 0.5;
        handSprite.bitmap   = handName ? ImageManager.loadPicture(handName) : ImageManager.loadEmptyBitmap();
        handSprite.visible  = !!handName;
        this.hourHandSprite = handSprite;
        this.addChild(this.hourHandSprite);
    };

    Sprite_Chronicle_Clock.prototype.createMinuteHandSprite = function() {
        var handName          = this.chronus().getMinuteHandFile();
        var handSprite        = new Sprite();
        handSprite.anchor.x   = 0.5;
        handSprite.anchor.y   = 0.5;
        handSprite.bitmap     = handName ? ImageManager.loadPicture(handName) : ImageManager.loadEmptyBitmap();
        handSprite.visible    = !!handName;
        this.minuteHandSprite = handSprite;
        this.addChild(this.minuteHandSprite);
    };

    Sprite_Chronicle_Clock.prototype.update = function() {
        this.visible = this.chronus().isShowingClock();
        if (this.visible) {
            this.updateHourHand();
            this.updateMinuteHand();
        }
    };

    Sprite_Chronicle_Clock.prototype.updateHourHand = function() {
        if (!this.hourHandSprite.visible) return;
        this.hourHandSprite.rotation = this.chronus().getRotationHourHand();
    };

    Sprite_Chronicle_Clock.prototype.updateMinuteHand = function() {
        if (!this.minuteHandSprite.visible) return;
        this.minuteHandSprite.rotation = this.chronus().getRotationMinuteHand();
    };

    Sprite_Chronicle_Clock.prototype.chronus = function() {
        return $gameSystem.chronus();
    };

    //=============================================================================
    // Spriteset_Map
    //  アナログ時計の画像を追加定義します。
    //=============================================================================
    var _Spriteset_Base_createUpperLayer      = Spriteset_Base.prototype.createUpperLayer;
    Spriteset_Base.prototype.createUpperLayer = function() {
        _Spriteset_Base_createUpperLayer.apply(this, arguments);
        if (this instanceof Spriteset_Map) this.createClockSprite();
    };

    Spriteset_Map.prototype.createClockSprite = function() {
        if (isParamExist('文字盤画像ファイル')) {
            this._clockSprite = new Sprite_Chronicle_Clock();
            this.addChild(this._clockSprite);
        }
    };

    //=============================================================================
    // Game_Chronus
    //  時の流れを扱うクラスです。このクラスはGame_Systemクラスで生成されます。
    //  セーブデータの保存対象のためグローバル領域に定義します。
    //=============================================================================
    Game_Chronus.prototype             = Object.create(Game_Chronus.prototype);
    Game_Chronus.prototype.constructor = Game_Chronus;
    Game_Chronus.weatherTypes          = ['none', 'rain', 'storm', 'snow'];

    Game_Chronus.prototype.initialize = function() {
        this._stop            = false;        // 停止フラグ(全ての加算に対して有効。ただし手動による加算は例外)
        this._disableTint     = false;        // 色調変更禁止フラグ
        this._calendarVisible = false;        // カレンダー表示フラグ
        this._disableWeather  = false;        // 天候制御禁止フラグ
        this._weatherType     = 0;            // 天候タイプ(0:なし 1:雨 2:嵐 :3雪)
        this._weatherPower    = 0;            // 天候の強さ
        this._weatherCounter  = 0;            // 同一天候の維持時間
        this._weatherSnowLand = false;        // 降雪地帯フラグ
        this._clockVisible    = false;        // アナログ時計表示フラグ
        this._realTime        = false;        // 実時間フラグ
        this._badWeaterLevel  = 0;            // 悪天候の度合い
        this._rainyPercent    = 0;            // 降水確率
        this._frameCount      = 0;
        this._demandRefresh   = false;
        this._prevHour        = -1;
        this._nowDate         = null;
        this._clearTone       = false;
        this._timeAutoAdd     = getParamNumber('自然時間加算', 0, 99);
        this._timeTransferAdd = getParamNumber('場所移動時間加算', 0);
        this._timeBattleAdd   = getParamNumber('戦闘時間加算(固定)', 0);
        this._timeTurnAdd     = getParamNumber('戦闘時間加算(ターン)', 0);
        this._weekNames       = getParamArrayString('曜日配列');
        this._monthNames      = getParamArrayString('月名配列');
        this._daysOfMonth     = getParamArrayNumber('月ごとの日数配列');
        this._clockBaseFile   = null;
        this._minuteHandFile  = null;
        this._hourHandFile    = null;
        this._timeMeter       = 0;
        this._dayMeter        = 0;
        this._initDate        = Date.now();
        this.initTotalTime();
        this.onLoad();
    };

    Game_Chronus.prototype.initTotalTime = function() {
        this._criterionTime = this._timeMeter;
        this._criterionDay  = this._dayMeter;
        this._initDate      = Date.now();
    };

    Game_Chronus.prototype.onLoad = function() {
        this._nowDate = new Date();
        if (!this._frameCount) this._frameCount = 0;
        if (!this._timers) this._timers = [];
        if (!this._namedTimers) this._namedTimers = {};
    };

    Game_Chronus.prototype.onMapLoaded = function() {
        this.updateWeatherType();
        this.updateWeatherPower();
        this.refreshWeather(true);
    };

    Game_Chronus.prototype.update = function() {
        this.updateTimer();
        this.updateEffect();
        if (this.isTimeStop()) return;
        this._frameCount++;
        if (this._frameCount >= paramAutoAddInterval) {
            if (this.isRealTime()) this._nowDate.setTime(Date.now());
            this.addTime();
        }
    };

    Game_Chronus.prototype.updateTimer = function() {
        for (var timerName in this._namedTimers) {
            if (this._namedTimers.hasOwnProperty(timerName)) {
                var valid = this._namedTimers[timerName].update();
                if (!valid) this.clearTimer(timerName);
            }
        }
        this._timers = this._timers.filter(function(timer) {
            return timer.update();
        })
    };

    Game_Chronus.prototype.isRealTime = function() {
        return this._realTime;
    };

    Game_Chronus.prototype.isTimeStop = function() {
        return this.isStop() || $gameMap.isTimeStopEventRunning();
    };

    Game_Chronus.prototype.updateEffect = function() {
        var hour = this.getHour();
        if (this._prevHour !== hour) {
            this.updateWeather();
            this.refreshTint(false);
            this._prevHour = this.getHour();
        }
    };

    Game_Chronus.prototype.refreshTint = function(swift) {
        if (this.isEnableTint()) {
            this.setTint(this.getTimeZone(), swift);
            this._clearTone = false;
        } else if (!this._clearTone) {
            $gameScreen.clearTone();
            this._clearTone = true;
        }
    };

    Game_Chronus.prototype.setTint = function(timeId, swift) {
        var tone = [0, 0, 0, 0];
        settings.timeTone.forEach(function(toneInfo) {
            if (toneInfo.timeId === timeId) {
                tone = toneInfo.value.clone();
                if (tone.length < 4) throw new Error('色調の値が不正です。:' + tone);
            }
        }.bind(this));
        if (this.getWeatherTypeId() !== 0) {
            tone[0] = tone[0] > 0 ? tone[0] / 7 : tone[0] - 14;
            tone[1] = tone[1] > 0 ? tone[1] / 7 : tone[1] - 14;
            tone[2] = tone[2] > 0 ? tone[2] / 7 : tone[1] - 14;
            tone[3] = tone[3] === 0 ? 68 : tone[3] + 14;
        }
        $gameScreen.startTint(tone, swift ? 0 : this.getEffectDuration());
    };

    Game_Chronus.prototype.setWeatherType = function(value) {
        this._weatherType = value.clamp(0, Game_Chronus.weatherTypes.length - 1);
    };

    Game_Chronus.prototype.setWeatherPower = function(value) {
        this._weatherPower = value.clamp(0, 10);
    };

    Game_Chronus.prototype.setTimeAutoAdd = function(value) {
        this._timeAutoAdd = value.clamp(0, 99);
    };

    Game_Chronus.prototype.updateWeather = function() {
        this.updateBatWeatherLevel();
        this.refreshWeather(false);
    };

    Game_Chronus.prototype.updateBatWeatherLevel = function() {
        var frequency = this.getChangeWeatherFrequency();
        var max       = this.getBadWeatherLevelMax();
        var newLevel  = (this._badWeaterLevel || 0).clamp(frequency, max - frequency);
        if (Math.randomInt(10) <= 1) frequency *= 5;
        this._badWeaterLevel = (newLevel + (Math.randomInt(frequency * 2) - frequency)).clamp(0, max);
        this.updateWeatherType();
        this.updateWeatherPower();
    };

    Game_Chronus.prototype.forceSetBatWeatherLevel = function(type, power) {
        var newLevel = 0;
        switch (type) {
            case Game_Chronus.weatherTypes[1]:
                newLevel = this.getBadWeatherLevelRainy() + power;
                break;
            case Game_Chronus.weatherTypes[2]:
                newLevel = this.getBadWeatherLevelHeavyRainy() + power;
                break;
            case Game_Chronus.weatherTypes[3]:
                newLevel = this.getBadWeatherLevelRainy() + power * 2;
                break;
        }
        this._badWeaterLevel = newLevel;
    };

    Game_Chronus.prototype.updateWeatherType = function() {
        var type        = 0;
        var border      = this.getBadWeatherLevelRainy();
        var heavyBorder = this.getBadWeatherLevelHeavyRainy();
        if (this._badWeaterLevel >= border) {
            type = (this.isSnowLand() ? 3 : this._badWeaterLevel >= heavyBorder ? 2 : 1);
        }
        this.setWeatherType(type);
    };

    Game_Chronus.prototype.updateWeatherPower = function() {
        var power  = 0;
        var border = this.getBadWeatherLevelRainy();
        if (this._badWeaterLevel >= border) {
            power = Math.floor((this._badWeaterLevel - border) / 2);
        }
        this.setWeatherPower(power);
    };

    Game_Chronus.prototype.getBadWeatherLevelMax = function() {
        return this._badWeaterLevelMax || 40;
    };

    Game_Chronus.prototype.getBadWeatherLevelRainy = function() {
        return this.getBadWeatherLevelMax() - 20;
    };

    Game_Chronus.prototype.getBadWeatherLevelHeavyRainy = function() {
        return this.getBadWeatherLevelMax() - 10;
    };

    Game_Chronus.prototype.getChangeWeatherFrequency = function() {
        return 4;
    };

    Game_Chronus.prototype.refreshWeather = function(swift) {
        if (this.isEnableWeather()) {
            this.setScreenWeather(swift);
        } else {
            $gameScreen.changeWeather(0, 0, 0);
        }
    };

    Game_Chronus.prototype.setScreenWeather = function(swift) {
        $gameScreen.changeWeather(this.getWeatherType(), this._weatherPower, swift ? 0 : this.getEffectDuration());
    };

    Game_Chronus.prototype.getEffectDuration = function() {
        if (this.isRealTime()) {
            return 600;
        }
        return this._timeAutoAdd === 0 ? 1 : Math.floor(60 * 5 / (this.getRealAddSpeed() / 10));
    };

    Game_Chronus.prototype.getRealAddSpeed = function() {
        return this._timeAutoAdd * 60 / paramAutoAddInterval;
    };

    Game_Chronus.prototype.disableTint = function() {
        this._disableTint = true;
        this.refreshTint(true);
    };

    Game_Chronus.prototype.enableTint = function() {
        this._disableTint = false;
        this.refreshTint(true);
    };

    Game_Chronus.prototype.isEnableTint = function() {
        return !this._disableTint && !$gameMap.isDisableTint();
    };

    Game_Chronus.prototype.disableWeather = function() {
        this._disableWeather = true;
        this.refreshWeather(true);
    };

    Game_Chronus.prototype.enableWeather = function() {
        this._disableWeather = false;
        this.refreshWeather(true);
    };

    Game_Chronus.prototype.isEnableWeather = function() {
        return !this._disableWeather && !$gameMap.isDisableWeather();
    };

    Game_Chronus.prototype.setSnowLand = function() {
        this._weatherSnowLand = true;
        this.updateWeatherType();
        this.refreshWeather(true);
    };

    Game_Chronus.prototype.resetSnowLand = function() {
        this._weatherSnowLand = false;
        this.updateWeatherType();
        this.refreshWeather(true);
    };

    Game_Chronus.prototype.setRainyPercent = function(value) {
        this._badWeaterLevelMax = (value > 0 ? 2000 / value : Infinity);
        this.updateWeather();
    };

    Game_Chronus.prototype.setTimeReal = function() {
        this._realTime = true;
    };

    Game_Chronus.prototype.setTimeVirtual = function() {
        this._realTime = false;
    };

    Game_Chronus.prototype.onBattleEnd = function() {
        if (this.isStop()) return;
        this.addTime(this._timeBattleAdd + this._timeTurnAdd * $gameTroop.turnCount());
    };

    Game_Chronus.prototype.transfer = function() {
        if (this.isStop()) return;
        this.addTime(this._timeTransferAdd);
    };

    Game_Chronus.prototype.stop = function() {
        this._stop = true;
    };

    Game_Chronus.prototype.start = function() {
        this._stop = false;
    };

    Game_Chronus.prototype.isStop = function() {
        return this._stop;
    };

    Game_Chronus.prototype.showCalendar = function() {
        this._calendarVisible = true;
    };

    Game_Chronus.prototype.hideCalendar = function() {
        this._calendarVisible = false;
    };

    Game_Chronus.prototype.isShowingCalendar = function() {
        return this._calendarVisible;
    };

    Game_Chronus.prototype.isSnowLand = function() {
        return this._weatherSnowLand || $gameMap.isSnowLand();
    };

    Game_Chronus.prototype.showClock = function() {
        this._clockVisible = true;
    };

    Game_Chronus.prototype.hideClock = function() {
        this._clockVisible = false;
    };

    Game_Chronus.prototype.isShowingClock = function() {
        return this._clockVisible;
    };

    Game_Chronus.prototype.addTime = function(value) {
        if (arguments.length === 0) value = this._timeAutoAdd;
        this._timeMeter += value;
        while (this._timeMeter >= 60 * 24) {
            this.addDay();
            this._timeMeter -= 60 * 24;
        }
        this.demandRefresh(false);
    };

    Game_Chronus.prototype.setTime = function(hour, minute) {
        var time = hour * 60 + minute;
        if (this._timeMeter > time) this.addDay();
        this._timeMeter = time;
        this.demandRefresh(true);
    };

    Game_Chronus.prototype.addDay = function(value) {
        if (arguments.length === 0) value = 1;
        this._dayMeter += value;
        this.demandRefresh(false);
    };

    Game_Chronus.prototype.setDay = function(year, month, day) {
        var newDay = (year - 1) * this.getDaysOfYear();
        for (var i = 0; i < month - 1; i++) {
            newDay += this._daysOfMonth;
        }
        newDay += day - 1;
        this._dayMeter = newDay;
        this.demandRefresh(true);
    };

    Game_Chronus.prototype.demandRefresh = function(effectRefreshFlg) {
        this._demandRefresh = true;
        this._frameCount    = 0;
        this.setGameVariable();
        if (effectRefreshFlg) {
            this.refreshTint(true);
            this.updateWeather();
        }
    };

    Game_Chronus.prototype.isNeedRefresh = function() {
        var needRefresh     = this._demandRefresh;
        this._demandRefresh = false;
        return needRefresh;
    };

    Game_Chronus.prototype.getDaysOfWeek = function() {
        return this._weekNames.length;
    };

    Game_Chronus.prototype.getDaysOfMonth = function(month) {
        return this._daysOfMonth[month - 1];
    };

    Game_Chronus.prototype.getDaysOfYear = function() {
        var result = 0;
        this._daysOfMonth.forEach(function(days) {
            result += days;
        });
        return result;
    };

    Game_Chronus.prototype.setGameVariable = function() {
        this.setGameVariableSub('年のゲーム変数', this.getYear.bind(this));
        this.setGameVariableSub('月のゲーム変数', this.getMonth.bind(this));
        this.setGameVariableSub('日のゲーム変数', this.getDay.bind(this));
        this.setGameVariableSub('曜日IDのゲーム変数', this.getWeekIndex.bind(this));
        this.setGameVariableSub('曜日名のゲーム変数', this.getWeekName.bind(this));
        this.setGameVariableSub('時のゲーム変数', this.getHour.bind(this));
        this.setGameVariableSub('分のゲーム変数', this.getMinute.bind(this));
        this.setGameVariableSub('時間帯IDのゲーム変数', this.getTimeZone.bind(this));
        this.setGameVariableSub('天候IDのゲーム変数', this.getWeatherTypeId.bind(this));
        this.setGameVariableSub('累計時間のゲーム変数', this.getTotalTime.bind(this));
        this.setGameVariableSub('累計日数のゲーム変数', this.getTotalDay.bind(this));
    };

    Game_Chronus.prototype.setGameVariableSub = function(paramName, callBack) {
        var index = getParamNumber(paramName, 0);
        if (index !== 0) {
            $gameVariables.setValue(index, callBack());
        }
    };

    Game_Chronus.prototype.getMonthOfYear = function() {
        return this._daysOfMonth.length;
    };

    Game_Chronus.prototype.getWeekName = function() {
        return this._weekNames[this.getWeekIndex()];
    };

    Game_Chronus.prototype.getWeekIndex = function() {
        return this.isRealTime() ? this._nowDate.getDay() : this._dayMeter % this.getDaysOfWeek();
    };

    Game_Chronus.prototype.getYear = function() {
        return this.isRealTime() ? this._nowDate.getFullYear() : Math.floor(this._dayMeter / this.getDaysOfYear()) + 1;
    };

    Game_Chronus.prototype.getMonth = function() {
        if (this.isRealTime()) return this._nowDate.getMonth() + 1;
        var days = this._dayMeter % this.getDaysOfYear();
        for (var i = 0; i < this._daysOfMonth.length; i++) {
            days -= this._daysOfMonth;
            if (days < 0) return i + 1;
        }
        return null;
    };

    Game_Chronus.prototype.getDay = function() {
        if (this.isRealTime()) return this._nowDate.getDate();
        var days = this._dayMeter % this.getDaysOfYear();
        for (var i = 0; i < this._daysOfMonth.length; i++) {
            if (days < this._daysOfMonth) return days + 1;
            days -= this._daysOfMonth;
        }
        return null;
    };

    Game_Chronus.prototype.getHour = function() {
        return this.isRealTime() ? this._nowDate.getHours() : Math.floor(this._timeMeter / 60);
    };

    Game_Chronus.prototype.getMinute = function() {
        return this.isRealTime() ? this._nowDate.getMinutes() : this._timeMeter % 60;
    };

    Game_Chronus.prototype.getDateFormat = function(index) {
        var format = getParamString('日時フォーマット' + String(index));
        format     = format.replace(/(YYYY)/gi, function() {
            return this.getValuePadding(this.getYear(), arguments[1].length);
        }.bind(this));
        format     = format.replace(/MON/gi, function() {
            return this._monthNames[this.getMonth() - 1];
        }.bind(this));
        format     = format.replace(/MM/gi, function() {
            return this.getValuePadding(this.getMonth(), String(this.getMonthOfYear()).length);
        }.bind(this));
        format     = format.replace(/DD/gi, function() {
            return this.getValuePadding(this.getDay(),
                String(this.getDaysOfMonth(this.getMonth())).length);
        }.bind(this));
        format     = format.replace(/HH24/gi, function() {
            return this.getValuePadding(this.getHour(), 2);
        }.bind(this));
        format     = format.replace(/HH/gi, function() {
            return this.getValuePadding(this.getHour() % 12, 2);
        }.bind(this));
        format     = format.replace(/AM/gi, function() {
            return Math.floor(this.getHour() / 12) === 0 ?
                $gameSystem.isJapanese() ? '午前' : 'Morning  ' :
                $gameSystem.isJapanese() ? '午後' : 'Afternoon';
        }.bind(this));
        format     = format.replace(/MI/gi, function() {
            return this.getValuePadding(this.getMinute(), 2);
        }.bind(this));
        format     = format.replace(/DY/gi, function() {
            return this.getWeekName();
        }.bind(this));
        return format;
    };

    Game_Chronus.prototype.getTimeZone = function() {
        var timeId = 0;
        settings.timeZone.forEach(function(zoneInfo) {
            if (this.isHourInRange(zoneInfo.start, zoneInfo.end)) timeId = zoneInfo.timeId;
        }.bind(this));
        return timeId;
    };

    Game_Chronus.prototype.getWeatherTypeId = function() {
        return this._weatherType;
    };

    Game_Chronus.prototype.getWeatherType = function() {
        return Game_Chronus.weatherTypes[this.getWeatherTypeId()];
    };

    Game_Chronus.prototype.getValuePadding = function(value, digit, padChar) {
        if (arguments.length === 2) padChar = '0';
        var result = "";
        for (var i = 0; i < digit; i++) result += padChar;
        result += value;
        return result.substr(-digit);
    };

    Game_Chronus.prototype.isHourInRange = function(min, max) {
        var hour = this.getHour();
        return hour >= min && hour <= max;
    };

    Game_Chronus.prototype.getAnalogueHour = function() {
        return this.getHour() + (this.getAnalogueMinute() / 60);
    };

    Game_Chronus.prototype.getAnalogueMinute = function() {
        return this.getMinute() + (this.isRealTime() ? 0 : this._frameCount / paramAutoAddInterval * this._timeAutoAdd);
    };

    Game_Chronus.prototype.getRotationHourHand = function() {
        return (this.getAnalogueHour() % 12) * (360 / 12) * Math.PI / 180;
    };

    Game_Chronus.prototype.getRotationMinuteHand = function() {
        return this.getAnalogueMinute() * (360 / 60) * Math.PI / 180;
    };

    Game_Chronus.prototype.getTotalTime = function() {
        if (this.isRealTime()) {
            return (this._nowDate - this._initDate) / (1000 * 60);
        } else {
            var dayMeter  = this._dayMeter - (this._criterionDay || 0);
            var timeMeter = this._timeMeter - (this._criterionTime || 0);
            return dayMeter * 24 * 60 + timeMeter;
        }
    };

    Game_Chronus.prototype.getTotalDay = function() {
        return this.getTotalTime() / (24 * 60);
    };

    Game_Chronus.prototype.makeTimer = function(timerName, timeout, switchKey, loop) {
        var timer = new Game_ChronusTimer(timeout, switchKey, loop);
        if (timerName) {
            this._namedTimers[timerName] = timer;
        } else {
            this._timers.push(timer);
        }
    };

    Game_Chronus.prototype.clearTimer = function(timerName) {
        delete this._namedTimers[timerName];
    };

    Game_Chronus.prototype.stopTimer = function(timerName) {
        var timer = this._namedTimers[timerName];
        if (timer) {
            timer.stop();
        }
    };

    Game_Chronus.prototype.startTimer = function(timerName) {
        var timer = this._namedTimers[timerName];
        if (timer) {
            timer.start();
        }
    };

    Game_Chronus.prototype.getClockBaseFile = function() {
        return this._clockBaseFile || paramClockBaseFile;
    };

    Game_Chronus.prototype.getMinuteHandFile = function() {
        return this._minuteHandFile || paramMinutesHandFile;
    };

    Game_Chronus.prototype.getHourHandFile = function() {
        return this._hourHandFile || paramHourHandFile;
    };

    Game_Chronus.prototype.setClockBaseFile = function(name) {
        this._clockBaseFile = name;
    };

    Game_Chronus.prototype.setMinuteHandFile = function(name) {
        this._minuteHandFile = name;
    };

    Game_Chronus.prototype.setHourHandFile = function(name) {
        this._hourHandFile = name;
    };

    //=============================================================================
    // Game_ChronusTimer
    //  ゲーム内時間のタイマーを扱うクラスです。このクラスはGame_Chronusクラスで生成されます。
    //  セーブデータの保存対象のためグローバル領域に定義します。
    //=============================================================================
    Game_ChronusTimer.prototype             = Object.create(Game_ChronusTimer.prototype);
    Game_ChronusTimer.prototype.constructor = Game_ChronusTimer;

    Game_ChronusTimer.prototype.initialize = function(timeout, switchKey, loop) {
        this._timeout = timeout;
        this._loop    = loop || false;
        this.setBaseTime();
        if (Array.isArray(switchKey)) {
            this.setCallBackSelfSwitch(switchKey);
        } else {
            this.setCallBackSwitch(switchKey);
        }
        this.start();
    };

    Game_ChronusTimer.prototype.start = function() {
        this._start = true;
    };

    Game_ChronusTimer.prototype.stop = function() {
        this._start = false;
    };

    Game_ChronusTimer.prototype.getTotalTime = function() {
        return $gameSystem.chronus().getTotalTime();
    };

    Game_ChronusTimer.prototype.setBaseTime = function() {
        this._baseTime = this.getTotalTime();
    };

    Game_ChronusTimer.prototype.setCallBackSwitch = function(switchId) {
        this._callBackSwitchId = switchId;
    };

    Game_ChronusTimer.prototype.setCallBackSelfSwitch = function(selfSwitchKey) {
        this._callBackSelfSwitchKey = selfSwitchKey;
    };

    Game_ChronusTimer.prototype.update = function() {
        if (!this._start || !this.isTimeout()) return true;
        this.onTimeout();
        if (this._loop) {
            this.setBaseTime();
            return true;
        } else {
            return false;
        }
    };

    Game_ChronusTimer.prototype.isTimeout = function() {
        return this._baseTime + this._timeout <= this.getTotalTime();
    };

    Game_ChronusTimer.prototype.onTimeout = function() {
        if (this._callBackSwitchId) {
            $gameSwitches.setValue(this._callBackSwitchId, true);
        }
        if (this._callBackSelfSwitchKey) {
            $gameSelfSwitches.setValue(this._callBackSelfSwitchKey, true);
        }
    };
})();
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 05:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表