1584 lines
44 KiB
JavaScript
1584 lines
44 KiB
JavaScript
/*:
|
||
* @plugindesc TimingGame Plugin
|
||
* @author cube
|
||
*
|
||
* @help
|
||
* Plugin Command:
|
||
* TimingGame play x
|
||
*
|
||
* xは自分で作成した設定名称
|
||
*
|
||
* 設定の作製は必須
|
||
* 識別名はプラグイン引数でxとして使う自由文字列
|
||
* ヒットポイントはそのまま
|
||
* 判定の設定はどの位置にどのサイズの判定で成功時のダメージ
|
||
*
|
||
* 画像とラベルは共通と個別設定で2種類配置
|
||
* 共通は必ず配置するが、
|
||
* 個別設定は引数にした設定時だけ表示する。
|
||
*
|
||
* 速度
|
||
* 1回の更新でビートの移動する距離
|
||
*
|
||
* ゲージの設定
|
||
* 指定位置に指定したサイズの長方形を作成する
|
||
* その上にビートを動かすのでそれを踏まえて作成
|
||
*
|
||
* ビートの設定
|
||
* 初期位置とサイズと色の指定
|
||
*
|
||
* 各種音
|
||
* 判定の上でビートを叩いた音、
|
||
* 判定外で叩いた音
|
||
* ゲージ右端に着いた際にダメージがある音
|
||
* ゲージ右端に着いた際にダメージがない音
|
||
* 防御時成功音
|
||
* 防御失敗音
|
||
*
|
||
* アニメーション
|
||
* 自分と敵の攻撃時アニメーション
|
||
* 防御時アニメーション
|
||
* 不必要な場合0指定
|
||
*
|
||
* 敵HPラベルと実数値
|
||
* ラベル表示法と同じ
|
||
*
|
||
* 自分のライフ設定
|
||
* 指定した画像を指定した変数の数値だけ右向きに配置する
|
||
* 幅は画像左端からの距離なので画像サイズに注意
|
||
*
|
||
* ログ
|
||
* 新しいログは上
|
||
* 一度に出て見にくいかもしれない
|
||
*
|
||
* スキル1~3 登録したスイッチがONの時指定の確率で発動する
|
||
* SEの再生タイミングは各スキル発動のタイミング
|
||
* アニメーションは終了待ちしない
|
||
* 1:回復
|
||
* 自ターン終了時発動、自分のHPを1増やす
|
||
* 2:減速
|
||
* 自ターン開始時、相手ターン開始時発動 そのターンの速度を指定数値だけ遅くする
|
||
* 3:加算
|
||
* 自ターン開始時発動、そのターンの攻撃ダメージに指定数値だけ加算する
|
||
*
|
||
*
|
||
* @param Basic
|
||
* @text 基本設定
|
||
*
|
||
* @param speed
|
||
* @parent Basic
|
||
* @text 速度
|
||
* @desc 必須項目 ビートが一回の更新で移動する距離
|
||
* @type number
|
||
* @min 1
|
||
* @max 1000
|
||
* @default 10
|
||
*
|
||
* @param frame
|
||
* @parent Basic
|
||
* @text ゲージの設定
|
||
* @desc 必須項目 ビートが左から右に移動する場所のためx座標と横幅は必須 非表示には高さを0に
|
||
* @type struct<Rect>
|
||
* @default {"acolor":"#0096c2","dacolor":"#dada00","pointX":"0","pointY":"500","width":"680","height":"100"}
|
||
*
|
||
* @param beatSetting
|
||
* @parent Basic
|
||
* @text ビート
|
||
* @desc ビートの初期位置とサイズと色設定 この位置から右に移動する
|
||
* @type struct<Rect>
|
||
* @default {"acolor":"#0000ff","dacolor":"#00575a","pointX":"0","pointY":"500","width":"20","height":"50"}
|
||
*
|
||
* @param tapSe
|
||
* @parent Basic
|
||
* @text 判定成功の音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Attack2
|
||
*
|
||
* @param missSe
|
||
* @parent Basic
|
||
* @text 判定失敗の音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Blind
|
||
*
|
||
* @param successSe
|
||
* @parent Basic
|
||
* @text ダメージ音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Attack3
|
||
*
|
||
* @param blindSe
|
||
* @parent Basic
|
||
* @text スカ音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Absorb1
|
||
*
|
||
* @param attackAnime
|
||
* @parent Basic
|
||
* @text 攻撃時のアニメーション
|
||
* @desc 非必須項目 ダメージ音以外に再生するアニメーションを指定する
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"1","anime_sec":"500","pointX":"0","pointY":"0"}
|
||
*
|
||
* @param guardSe
|
||
* @parent Basic
|
||
* @text 防御音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Attack3
|
||
*
|
||
* @param guardAnime
|
||
* @parent Basic
|
||
* @text 防御時のアニメーション
|
||
* @desc 非必須項目 ダメージ音以外に再生するアニメーションを指定する
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"2","anime_sec":"500","pointX":"0","pointY":"0"}
|
||
*
|
||
* @param enemyHPLabelSetting
|
||
* @parent Basic
|
||
* @text 敵HPラベル表示設定
|
||
* @desc 非必須項目 使用しない場合表示文字列を空白にすること
|
||
* @type struct<TextBox>
|
||
* @default {"word":"HP","pointX":"320","pointY":"0","width":"300","height":"50","fontSize":"30"}
|
||
*
|
||
* @param enemyHPSetting
|
||
* @parent Basic
|
||
* @text 敵HP表示設定
|
||
* @desc 必須項目 相手のHPとして数値を表示する場所の設定
|
||
* @type struct<NumberBox>
|
||
* @default {"pointX":"420","pointY":"100","width":"200","height":"30","fontSize":"30"}
|
||
*
|
||
* @param myHPSetting
|
||
* @parent Basic
|
||
* @text 自分のライフ設定
|
||
* @desc 必須項目 指定した位置に指定した画像を指定した変数の数値分指定した間隔で表示する
|
||
* @type struct<LifeResource>
|
||
* @default {"imageFile":"scale","pointX":"4","pointY":"137","varHP":"10","space":"20"}
|
||
*
|
||
* @param imageList
|
||
* @parent Basic
|
||
* @text 基本使用画像
|
||
* @desc 非必須項目 共通で使用する画像 上から順に使用する
|
||
* @type struct<Resource>[]
|
||
*
|
||
* @param labelList
|
||
* @parent Basic
|
||
* @text 基本使用ラベル
|
||
* @desc 非必須項目 共通で使用する文字列 上から順に使用する
|
||
* @type struct<TextBox>[]
|
||
*
|
||
* @param logSetting
|
||
* @parent Basic
|
||
* @text ログ設定
|
||
* @desc ログ表示位置、行数設定
|
||
* @type struct<LogBox>
|
||
*
|
||
* @param targetSetting
|
||
* @text 設定の作製
|
||
* @desc 必須項目 ここで作成した設定を引数で指定して開始する
|
||
* @type struct<TargetSetting>[]
|
||
* @default {"name":"test","HP":"100","sw":"1","emSe":"Attack3","emAnime":"{\"anime\":\"0\",\"anime_sec\":\"500\",\"pointX\":\"0\",\"pointY\":\"0\"}","atkSetting":"[\"[\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#0000ff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\",\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#0000ff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"400\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\",\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#0000ff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"600\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\"]\",\"[\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#0000ff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"50\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"300\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"400\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\"]\"]","defSetting":"[\"[\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#00ffff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"10\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"300\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"200\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\"]\",\"[\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#00ffff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"10\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"200\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\",\\\"{\\\\\\\"color\\\\\\\":\\\\\\\"#00ffff\\\\\\\",\\\\\\\"score\\\\\\\":\\\\\\\"10\\\\\\\",\\\\\\\"pointX\\\\\\\":\\\\\\\"400\\\\\\\",\\\\\\\"pointY\\\\\\\":\\\\\\\"500\\\\\\\",\\\\\\\"width\\\\\\\":\\\\\\\"100\\\\\\\",\\\\\\\"height\\\\\\\":\\\\\\\"100\\\\\\\"}\\\"]\"]","imageList":"","labelList":""}
|
||
*
|
||
* @param Skill1
|
||
* @text 回復スキル
|
||
*
|
||
* @param skill1User
|
||
* @parent Skill1
|
||
* @text スキル使用者名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default てん
|
||
*
|
||
* @param skill1Name
|
||
* @parent Skill1
|
||
* @text スキル名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default 回復スキル
|
||
*
|
||
* @param skill1Words
|
||
* @parent Skill1
|
||
* @text スキル台詞
|
||
* @desc 必須項目 スキル使用時にログに出力する台詞集
|
||
* @type string[]
|
||
*
|
||
* @param skill1Switch
|
||
* @parent Skill1
|
||
* @text 回復スキル発動スイッチ
|
||
* @desc 必須項目 登録したスイッチのいずれかがONの場合発動する
|
||
* @type switch[]
|
||
*
|
||
* @param skill1Chance
|
||
* @parent Skill1
|
||
* @text 回復スキル発動率
|
||
* @desc 必須項目 1~100の発動率を指定する
|
||
* @type number
|
||
* @min 1
|
||
* @max 100
|
||
* @default 50
|
||
*
|
||
* @param skill1Se
|
||
* @parent Skill1
|
||
* @text 回復音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Heal1
|
||
*
|
||
* @param skill1Anime
|
||
* @parent Skill1
|
||
* @text 回復アニメ
|
||
* @desc 非必須項目
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"41","anime_sec":"500","pointX":"500","pointY":"100"}
|
||
*
|
||
* @param Skill2
|
||
* @text 減速スキル
|
||
*
|
||
* @param skill2User
|
||
* @parent Skill2
|
||
* @text スキル使用者名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default ろぼ
|
||
*
|
||
* @param skill2Name
|
||
* @parent Skill2
|
||
* @text スキル名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default 減速スキル
|
||
*
|
||
* @param skill2Words
|
||
* @parent Skill2
|
||
* @text スキル台詞
|
||
* @desc 必須項目 スキル使用時にログに出力する台詞集
|
||
* @type string[]
|
||
*
|
||
* @param skill2Number
|
||
* @parent Skill2
|
||
* @text 減速スキル実数値
|
||
* @desc 必須項目 減速させる数値 通常速度から引くこの数値だけ引く 1より小さくならない
|
||
* @type number
|
||
* @min 1
|
||
* @default 5
|
||
*
|
||
* @param skill2Switch
|
||
* @parent Skill2
|
||
* @text 減速スキル発動スイッチ
|
||
* @desc 必須項目 登録したスイッチのいずれかがONの場合発動する
|
||
* @type switch[]
|
||
*
|
||
* @param skill2Chance
|
||
* @parent Skill2
|
||
* @text 減速スキル発動率
|
||
* @desc 必須項目 1~100の発動率を指定する
|
||
* @type number
|
||
* @min 1
|
||
* @max 100
|
||
* @default 50
|
||
*
|
||
* @param skill2Se
|
||
* @parent Skill2
|
||
* @text 減速音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Flash2
|
||
*
|
||
* @param skill2Anime
|
||
* @parent Skill2
|
||
* @text 減速アニメ
|
||
* @desc 非必須項目
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"54","anime_sec":"500","pointX":"500","pointY":"100"}
|
||
*
|
||
* @param Skill3
|
||
* @text 加算スキル
|
||
*
|
||
* @param skill3User
|
||
* @parent Skill3
|
||
* @text スキル使用者名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default けも
|
||
*
|
||
* @param skill3Name
|
||
* @parent Skill3
|
||
* @text スキル名
|
||
* @desc 必須項目 ログで使用する名称
|
||
* @type string
|
||
* @default 攻撃スキル
|
||
*
|
||
* @param skill3Words
|
||
* @parent Skill3
|
||
* @text スキル台詞
|
||
* @desc 必須項目 スキル使用時にログに出力する台詞集
|
||
* @type string[]
|
||
*
|
||
* @param skill3Number
|
||
* @parent Skill3
|
||
* @text 加算スキル実数値
|
||
* @desc 必須項目 加算させる数値 攻撃の合計に数値分加算する
|
||
* @type number
|
||
* @min 1
|
||
* @default 10
|
||
*
|
||
* @param skill3Switch
|
||
* @parent Skill3
|
||
* @text 加算スキル発動スイッチ
|
||
* @desc 必須項目 登録したスイッチのいずれかがONの場合発動する
|
||
* @type switch[]
|
||
*
|
||
* @param skill3Chance
|
||
* @parent Skill3
|
||
* @text 加算スキル発動率
|
||
* @desc 必須項目 1~100の発動率を指定する
|
||
* @type number
|
||
* @min 1
|
||
* @max 100
|
||
* @default 50
|
||
*
|
||
* @param skill3Se
|
||
* @parent Skill3
|
||
* @text 加算音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Sword4
|
||
*
|
||
* @param skill3Anime
|
||
* @parent Skill3
|
||
* @text 加算アニメ
|
||
* @desc 非必須項目
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"51","anime_sec":"500","pointX":"500","pointY":"100"}
|
||
*
|
||
* @param endSetting
|
||
* @text 終了待ち設定
|
||
*
|
||
* @param end1Sec
|
||
* @parent endSetting
|
||
* @text 勝利後待機秒数
|
||
* @desc 必須項目 勝利後に何秒待つか 単位は1/1000秒
|
||
* @type number
|
||
* @default 1000
|
||
*
|
||
* @param end2Sec
|
||
* @parent endSetting
|
||
* @text 自傷敗北後待機秒数
|
||
* @desc 必須項目 ミスが死因で敗北した際の待機秒数 単位は1/1000秒
|
||
* @type number
|
||
* @default 1000
|
||
*
|
||
* @param end3Sec
|
||
* @parent endSetting
|
||
* @text 敵攻撃敗北後待機秒数
|
||
* @desc 必須項目 敵の攻撃が死因で敗北した際の待機秒数 単位は1/1000秒
|
||
* @type number
|
||
* @default 1000
|
||
*/
|
||
|
||
/*~struct~TargetSetting:
|
||
* @param name
|
||
* @text 識別名
|
||
* @desc 必須項目 設定の識別用 引数として使用する
|
||
* @type string
|
||
*
|
||
* @param logName
|
||
* @text ログ出力名
|
||
* @desc 必須項目 ログで出力する名称
|
||
* @type string
|
||
*
|
||
* @param popWords
|
||
* @text 出現時台詞集
|
||
* @desc 必須項目 戦闘開始時の台詞
|
||
* @type string[]
|
||
*
|
||
* @param atkWords
|
||
* @text 攻撃台詞集
|
||
* @desc 必須項目 防御失敗時の台詞
|
||
* @type string[]
|
||
*
|
||
* @param HP
|
||
* @text 敵ヒットポイント
|
||
* @desc 必須項目 0になった際クリア
|
||
* @type number
|
||
* @min 1
|
||
* @default 1000
|
||
*
|
||
* @param sw
|
||
* @text 勝敗スイッチ
|
||
* @desc 必須項目 勝利時に指定したスイッチをON敗北でOFFに
|
||
* @type switch
|
||
*
|
||
* @param emSe
|
||
* @parent Basic
|
||
* @text 防御失敗音
|
||
* @desc 非必須項目 audio/seフォルダに存在するSEのみ指定可能
|
||
* @type file
|
||
* @require 1
|
||
* @dir audio/se
|
||
* @default Attack3
|
||
*
|
||
* @param emAnime
|
||
* @parent Basic
|
||
* @text 防御失敗時のアニメ
|
||
* @desc 非必須項目 ダメージ音以外に再生するアニメーションを指定する
|
||
* @type struct<AnimeSetting>
|
||
* @default {"anime":"0","anime_sec":"500"}
|
||
*
|
||
* @param atkSetting
|
||
* @text 攻撃判定の設定
|
||
* @desc 必須項目 最低一つは必要
|
||
* @type struct<Target>[][]
|
||
*
|
||
* @param defSetting
|
||
* @text 防御判定の設定
|
||
* @desc 必須項目 最低一つは必要 点数は
|
||
* @type struct<Target>[][]
|
||
*
|
||
* @param imageList
|
||
* @text 個別使用画像
|
||
* @desc 非必須項目 個別で使用する画像 上から順に使用する
|
||
* @type struct<Resource>[]
|
||
*
|
||
* @param labelList
|
||
* @text 個別使用ラベル
|
||
* @desc 非必須項目 個別で使用する文字列 上から順に使用する
|
||
* @type struct<TextBox>[]
|
||
*/
|
||
/*~struct~LifeResource:
|
||
* @param imageFile
|
||
* @text 画像素材
|
||
* @desc ライフの画像
|
||
* @type file
|
||
* @require 1
|
||
* @dir img/pictures
|
||
* @default file
|
||
*
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc 最初のライフを配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc 最初のライフを配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param varHP
|
||
* @text 変数
|
||
* @desc ここで設定した変数の値だけ画像を右に配置します。変数の値が0で始めないように、その場合ライフ1で開始します。
|
||
* @type variable
|
||
*
|
||
* @param space
|
||
* @text 行間
|
||
* @desc 画像の左端からどれだけ離れた位置に次の画像を配置するかの値
|
||
* @type number
|
||
* @default 0
|
||
*/
|
||
/*~struct~Resource:
|
||
* @param imageFile
|
||
* @text 画像素材
|
||
* @type file
|
||
* @require 1
|
||
* @dir img/pictures
|
||
* @default file
|
||
*
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc 素材を配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc 素材を配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*/
|
||
/*~struct~Rect:
|
||
* @param acolor
|
||
* @text 攻撃時色
|
||
* @desc 16進数でRGBを指定 例:#0000ff
|
||
* @type string
|
||
* @default #0000ff
|
||
*
|
||
* @param dcolor
|
||
* @text 防御時色
|
||
* @desc 16進数でRGBを指定 例:#0000ff
|
||
* @type string
|
||
* @default #0000ff
|
||
*
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc 配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc 配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param height
|
||
* @text 高さ
|
||
* @type number
|
||
* @default 0
|
||
*/
|
||
/*~struct~Target:
|
||
* @param color
|
||
* @text 色
|
||
* @desc 16進数でRGBを指定 例:#0000ff
|
||
* @type string
|
||
* @default #0000ff
|
||
*
|
||
* @param score
|
||
* @text 得点
|
||
* @desc 判定成功時の得点
|
||
* @type number
|
||
* @min 1
|
||
* @default 10
|
||
*
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc 配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc 配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param height
|
||
* @text 高さ
|
||
* @type number
|
||
* @default 0
|
||
*/
|
||
/*~struct~TextBox:
|
||
* @param word
|
||
* @text 表示文字列
|
||
* @desc テキストボックスに記載する文字列
|
||
* @type string
|
||
* @default
|
||
*
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc テキストボックスを配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc テキストボックスを配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @desc 作製するテキストボックスの横幅
|
||
* @type number
|
||
* @default 20
|
||
*
|
||
* @param height
|
||
* @text 高さ
|
||
* @desc 作製するテキストボックスの高さ
|
||
* @type number
|
||
* @default 20
|
||
*
|
||
* @param fontSize
|
||
* @text フォントサイズ
|
||
* @desc 表示するテキストのフォントサイズ
|
||
* @type number
|
||
* @default 10
|
||
*/
|
||
/*~struct~NumberBox:
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc テキストボックスを配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc テキストボックスを配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @desc 作製するテキストボックスの横幅
|
||
* @type number
|
||
* @default 20
|
||
*
|
||
* @param height
|
||
* @text 高さ
|
||
* @desc 作製するテキストボックスの高さ
|
||
* @type number
|
||
* @default 20
|
||
*
|
||
* @param fontSize
|
||
* @text フォントサイズ
|
||
* @desc 表示するテキストのフォントサイズ
|
||
* @type number
|
||
* @default 10
|
||
*/
|
||
/*~struct~AnimeSetting:
|
||
* @param anime
|
||
* @text 再生するアニメーション
|
||
* @desc 非必須項目 0の場合再生しない
|
||
* @type animation
|
||
* @require 1
|
||
* @default 0
|
||
*
|
||
* @param pointX
|
||
* @text 表示位置X座標
|
||
* @desc アニメの中心位置を示す座標X
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text 表示位置Y座標
|
||
* @desc アニメの中心位置を示す座標y
|
||
* @type number 0
|
||
* @default 0
|
||
*/
|
||
/*~struct~LogBox:
|
||
* @param pointX
|
||
* @text X座標
|
||
* @desc ログを配置するX座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param pointY
|
||
* @text Y座標
|
||
* @desc ログを配置するY座標
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @desc 作製するログボックスの横幅
|
||
* @type number
|
||
* @default 100
|
||
*
|
||
* @param height
|
||
* @text 高さ
|
||
* @desc 作製するログボックスの高さ
|
||
* @type number
|
||
* @default 100
|
||
*
|
||
* @param fontSize
|
||
* @text フォントサイズ
|
||
* @desc 表示するテキストのフォントサイズ
|
||
* @type number
|
||
* @default 15
|
||
*
|
||
* @param lineHeight
|
||
* @text 行高さ
|
||
* @desc 文字の高さ 行と行の幅調整も兼ねている
|
||
* @type number
|
||
* @default 15
|
||
* @min 1
|
||
*
|
||
* @param rows
|
||
* @text 表示行数
|
||
* @desc 一度に表示するログの数 ボックスサイズと合わせて調整すること
|
||
* @type number
|
||
* @default 5
|
||
* @min 1
|
||
*/
|
||
|
||
//初期設定
|
||
function TimingGame() {
|
||
this.initialize.apply(this, arguments);
|
||
}
|
||
TimingGame.prototype = Object.create(Scene_Base.prototype);
|
||
TimingGame.prototype.constructor = TimingGame;
|
||
|
||
TimingGame.prototype.initialize = function () {
|
||
Scene_Base.prototype.initialize.call(this);
|
||
};
|
||
|
||
TimingGame.prototype.create = function () {
|
||
Scene_Base.prototype.create.call(this);
|
||
};
|
||
|
||
//開始処理
|
||
TimingGame.prototype.start = function () {
|
||
Scene_Base.prototype.start.call(this);
|
||
//パラメータ関連
|
||
var parameters = PluginManager.parameters("TimingGame");
|
||
var speed = JSON.parse(parameters.speed);
|
||
var frame = JSON.parse(parameters.frame);
|
||
var beatSetting = JSON.parse(parameters.beatSetting);
|
||
var tapSe = parameters.tapSe;
|
||
var successSe = parameters.successSe;
|
||
var missSe = parameters.missSe;
|
||
var blindSe = parameters.blindSe;
|
||
var guardSe = parameters.guardSe;
|
||
var attackAnime = JSON.parse(parameters.attackAnime);
|
||
var guardAnime = JSON.parse(parameters.guardAnime);
|
||
var enemyHPLabelSetting = JSON.parse(parameters.enemyHPLabelSetting);
|
||
var enemyHPSetting = JSON.parse(parameters.enemyHPSetting);
|
||
var myHPSetting = JSON.parse(parameters.myHPSetting);
|
||
var imageList = null;
|
||
if (parameters.imageList) {
|
||
imageList = JSON.parse(parameters.imageList);
|
||
}
|
||
var labelList = null;
|
||
if (parameters.labelList) {
|
||
labelList = JSON.parse(parameters.labelList);
|
||
}
|
||
var logSetting = JSON.parse(parameters.logSetting);
|
||
var targetSetting = JSON.parse(parameters.targetSetting);
|
||
var skill1User = parameters.skill1User;
|
||
var skill1Name = parameters.skill1Name;
|
||
var skill1Words = JSON.parse(parameters.skill1Words);
|
||
var skill1Se = parameters.skill1Se;
|
||
var skill1Chance = parameters.skill1Chance;
|
||
var skill1Switch = null;
|
||
var skill1Anime = JSON.parse(parameters.skill1Anime);
|
||
if (parameters.skill1Switch) {
|
||
skill1Switch = JSON.parse(parameters.skill1Switch);
|
||
}
|
||
var skill2User = parameters.skill2User;
|
||
var skill2Name = parameters.skill2Name;
|
||
var skill2Words = JSON.parse(parameters.skill2Words);
|
||
var skill2Se = parameters.skill2Se;
|
||
var skill2Chance = parameters.skill2Chance;
|
||
var skill2Switch = null;
|
||
if (parameters.skill2Switch) {
|
||
skill2Switch = JSON.parse(parameters.skill2Switch);
|
||
}
|
||
var skill2Number = parameters.skill2Number;
|
||
var skill2Anime = JSON.parse(parameters.skill2Anime);
|
||
var skill3User = parameters.skill3User;
|
||
var skill3Name = parameters.skill3Name;
|
||
var skill3Words = JSON.parse(parameters.skill3Words);
|
||
var skill3Se = parameters.skill3Se;
|
||
var skill3Chance = parameters.skill3Chance;
|
||
var skill3Switch = null;
|
||
if (parameters.skill3Switch) {
|
||
skill3Switch = JSON.parse(parameters.skill3Switch);
|
||
}
|
||
var skill3Number = parameters.skill3Number;
|
||
var skill3Anime = JSON.parse(parameters.skill3Anime);
|
||
var end1Sec = parameters.end1Sec;
|
||
var end2Sec = parameters.end2Sec;
|
||
var end3Sec = parameters.end3Sec;
|
||
//背景透過処理
|
||
this._backgroundSprite = new Sprite();
|
||
this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
|
||
this.addChild(this._backgroundSprite);
|
||
//基本設定読み込み
|
||
this._speed = parseInt(speed);
|
||
//ゲージ設定
|
||
this._frameSetting = frame;
|
||
this._frame = this.factory_frame(frame);
|
||
//右辺設定
|
||
this._maxX = parseInt(frame.pointX) + parseInt(frame.width);
|
||
//ビート設定
|
||
this._beatSetting = beatSetting;
|
||
|
||
//自分のHP配置
|
||
this._lifeResource = myHPSetting;
|
||
var _hp = $gameVariables.value(myHPSetting.varHP);
|
||
//変数未設定で0以下の場合は1とする
|
||
if (_hp <= 0) {
|
||
_hp = 1;
|
||
}
|
||
//自分のHP表示
|
||
this._myHP = this.factory_myHP(myHPSetting, _hp);
|
||
this._myMaxHP = _hp;
|
||
//音声設定
|
||
this._tapSe = tapSe;
|
||
this._successSe = successSe;
|
||
this._missSe = missSe;
|
||
this._blindSe = blindSe;
|
||
this._guardSe = guardSe;
|
||
//アニメ設定
|
||
this._attackAnime = attackAnime;
|
||
this._guardAnime = guardAnime;
|
||
//共通画像配置
|
||
if (imageList) {
|
||
imageList.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
this.factory_imageFile(
|
||
ImageManager.loadPicture(tmp.imageFile),
|
||
tmp.pointX,
|
||
tmp.pointY
|
||
);
|
||
});
|
||
}
|
||
//共通ラベル配置
|
||
if (labelList) {
|
||
labelList.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
this.factory_label(tmp);
|
||
});
|
||
}
|
||
//ログ設定
|
||
this._logS = logSetting;
|
||
this._logStack = new Array();
|
||
//設定読み込み
|
||
var ts;
|
||
targetSetting.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
if (tmp.name == $gameSystem.SettingName) {
|
||
ts = tmp;
|
||
}
|
||
});
|
||
//勝敗スイッチ
|
||
this._sw = ts.sw;
|
||
//固有画像配置
|
||
if (ts.imageList) {
|
||
var iL = JSON.parse(ts.imageList);
|
||
iL.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
this.factory_imageFile(
|
||
ImageManager.loadPicture(tmp.imageFile),
|
||
tmp.pointX,
|
||
tmp.pointY
|
||
);
|
||
});
|
||
}
|
||
//固有ラベル配置
|
||
if (ts.labelList) {
|
||
var lL = JSON.parse(ts.labelList);
|
||
lL.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
this.factory_label(tmp);
|
||
});
|
||
}
|
||
//音声
|
||
this._emSe = ts.emSe;
|
||
//アニメ
|
||
this._emAnime = JSON.parse(ts.emAnime);
|
||
//敵HPラベル配置
|
||
this.factory_label(enemyHPLabelSetting);
|
||
//敵HP配置
|
||
this._emHp = this.factory_score(enemyHPSetting);
|
||
this._emHpWidth = enemyHPSetting.width;
|
||
this._emHpHeight = enemyHPSetting.height;
|
||
//HP設定
|
||
this._emHpNum = ts.HP;
|
||
//HP描画
|
||
this._emHp.bitmap.drawText(
|
||
this._emHpNum,
|
||
0,
|
||
0,
|
||
this._emHpWidth,
|
||
this._emHpHeight
|
||
);
|
||
//ログ描画
|
||
this.factory_logBox();
|
||
//判定作製
|
||
this._targetArray = new Array();
|
||
this._tsG = new Array();
|
||
var targetG = JSON.parse(ts.atkSetting);
|
||
targetG.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
var tmpArray = new Array();
|
||
tmp.forEach((el) => {
|
||
var elTmp = JSON.parse(el);
|
||
tmpArray.push(elTmp);
|
||
});
|
||
this._tsG.push(tmpArray);
|
||
});
|
||
//防御用判定準備
|
||
this._tsDG = new Array();
|
||
var targetG = JSON.parse(ts.defSetting);
|
||
targetG.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
var tmpArray = new Array();
|
||
tmp.forEach((el) => {
|
||
var elTmp = JSON.parse(el);
|
||
tmpArray.push(elTmp);
|
||
});
|
||
this._tsDG.push(tmpArray);
|
||
});
|
||
//敵台詞
|
||
this._emName = ts.logName;
|
||
this._emPopWords = JSON.parse(ts.popWords);
|
||
this._emAtkWords = JSON.parse(ts.atkWords);
|
||
//スキル準備
|
||
this._skill1Name = skill1Name;
|
||
this._skill1User = skill1User;
|
||
this._skill1Words = skill1Words;
|
||
this._skill1Se = skill1Se;
|
||
this._skill1Chance = Number(skill1Chance);
|
||
this._skill1Anime = skill1Anime;
|
||
this._skill2Name = skill2Name;
|
||
this._skill2User = skill2User;
|
||
this._skill2Words = skill2Words;
|
||
this._skill2Se = skill2Se;
|
||
this._skill2Chance = Number(skill2Chance);
|
||
this._skill2Number = Number(skill2Number);
|
||
this._skill2Anime = skill2Anime;
|
||
this._skill3Name = skill3Name;
|
||
this._skill3User = skill3User;
|
||
this._skill3Words = skill3Words;
|
||
this._skill3Se = skill3Se;
|
||
this._skill3Chance = Number(skill3Chance);
|
||
this._skill3Number = Number(skill3Number);
|
||
this._skill3Anime = skill3Anime;
|
||
this._skill1F = false;
|
||
this._skill2F = false;
|
||
this._skill3F = false;
|
||
//発動中のフラグ
|
||
this._skill2RunF = false;
|
||
this._skill3RunF = false;
|
||
if (skill1Switch) {
|
||
skill1Switch.forEach((element) => {
|
||
if ($gameSwitches.value(Number(element)) == true) {
|
||
this._skill1F = true;
|
||
}
|
||
});
|
||
}
|
||
if (skill2Switch) {
|
||
skill2Switch.forEach((element) => {
|
||
if ($gameSwitches.value(Number(element)) == true) {
|
||
this._skill2F = true;
|
||
}
|
||
});
|
||
}
|
||
if (skill3Switch) {
|
||
skill3Switch.forEach((element) => {
|
||
if ($gameSwitches.value(Number(element)) == true) {
|
||
this._skill3F = true;
|
||
}
|
||
});
|
||
}
|
||
//秒数読み込み
|
||
this._end1Sec = end1Sec;
|
||
this._end2Sec = end2Sec;
|
||
this._end3Sec = end3Sec;
|
||
//スキル2計算
|
||
this._skill2Speed = 0;
|
||
if (this._speed - this._skill2Number < 1) {
|
||
this._skill2Speed = 1;
|
||
} else {
|
||
this._skill2Speed = this._speed - this._skill2Number;
|
||
}
|
||
//一時得点
|
||
this._tmpScore = 0;
|
||
//ブレイクフラグ
|
||
this._breakF = false;
|
||
//クリアフラグ
|
||
this._clearF = false;
|
||
//攻守フラグ
|
||
this._aordF = true;
|
||
//終了待ちフラグ
|
||
this._wait_endF = false;
|
||
//ミス終了フラグ
|
||
this._missF = false;
|
||
//開始時台詞
|
||
this.log_output("[\'" + this._emName + "\']");
|
||
this.log_output(
|
||
this._emPopWords[Math.floor(Math.random() * this._emPopWords.length)]
|
||
);
|
||
};
|
||
|
||
//フレーム動作
|
||
TimingGame.prototype.update = function () {
|
||
Scene_Base.prototype.update.call(this);
|
||
//終了フラグがあれば何もしない
|
||
if (!this._breakF) {
|
||
//ビート有る無し分岐
|
||
if (this._beat) {
|
||
//有れば速度分移動
|
||
if (this._skill2RunF) {
|
||
//スキル2発動時処理
|
||
this._beat.x = parseInt(this._beat.x) + this._skill2Speed;
|
||
} else {
|
||
//通常時処理
|
||
this._beat.x = parseInt(this._beat.x) + this._speed;
|
||
}
|
||
//ゲージ超えた場合の処理
|
||
if (this.get_right(this._beat) > this._maxX) {
|
||
//ビート削除
|
||
this.removeChild(this._beat);
|
||
this._beat = null;
|
||
//点数計算
|
||
this.cal_score();
|
||
//判定削除
|
||
this.clear_Target();
|
||
//攻守交替
|
||
this._aordF = !this._aordF;
|
||
//フラグリセット
|
||
this._skill2RunF = false;
|
||
this._skill3RunF = false;
|
||
}
|
||
} else {
|
||
//ターン開始処理
|
||
if (this._aordF) {
|
||
this.log_output("◇◇◇ Attack Turn! ◇◇◇");
|
||
} else {
|
||
this.log_output("◆◆◆ Defense Turn! ◆◆◆");
|
||
}
|
||
//スキル3
|
||
if (this._aordF && this._skill3F) {
|
||
//攻撃Tのみ発動
|
||
if (Number(Math.ceil(Math.random() * 100) <= this._skill3Chance)) {
|
||
if (this._skill3Se) {
|
||
AudioManager.playSe({
|
||
name: this._skill3Se,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._skill3Anime.anime) {
|
||
this.start_anime(this._skill3Anime);
|
||
}
|
||
this.log_output("[\'" + this._skill3User + "\']");
|
||
this.log_output(
|
||
this._skill3Words[
|
||
Math.floor(Math.random() * this._skill3Words.length)
|
||
]
|
||
);
|
||
this.log_output(this._skill3Name + " Triggered!");
|
||
this._skill3RunF = true;
|
||
}
|
||
}
|
||
//スキル2
|
||
if (this._skill2F) {
|
||
//攻防どちらでも発動
|
||
if (Number(Math.ceil(Math.random() * 100) <= this._skill2Chance)) {
|
||
if (this._skill2Se) {
|
||
AudioManager.playSe({
|
||
name: this._skill2Se,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._skill2Anime.anime) {
|
||
this.start_anime(this._skill2Anime);
|
||
}
|
||
this.log_output("[\'" + this._skill2User + "\']");
|
||
this.log_output(
|
||
this._skill2Words[
|
||
Math.floor(Math.random() * this._skill2Words.length)
|
||
]
|
||
);
|
||
this.log_output(this._skill2Name + " Triggered!");
|
||
this._skill2RunF = true;
|
||
}
|
||
}
|
||
//スキル1
|
||
if (!this._aordF && this._skill1F && this._myHP.length < this._myMaxHP) {
|
||
//防御Tのみ、HPが減ってる時発動
|
||
if (Number(Math.ceil(Math.random() * 100) <= this._skill1Chance)) {
|
||
this.log_output("[\'" + this._skill1User + "\']");
|
||
this.log_output(
|
||
this._skill1Words[
|
||
Math.floor(Math.random() * this._skill1Words.length)
|
||
]
|
||
);
|
||
this.log_output(this._skill1Name + " Triggered!");
|
||
//即時発動
|
||
this.skill1_func();
|
||
}
|
||
}
|
||
//枠色変更
|
||
this.switch_frame();
|
||
//判定作成
|
||
this.make_Target();
|
||
//ビート作成
|
||
this._beat = this.factory_beat(this._beatSetting);
|
||
}
|
||
//決定ボタン押下時処理
|
||
if (Input.isTriggered("ok")) {
|
||
//ビート存在チェック
|
||
if (this._beat) {
|
||
//線内なら加点
|
||
if (this.check_target() == true) {
|
||
//タップ音再生
|
||
if (this._tapSe) {
|
||
AudioManager.playSe({
|
||
name: this._tapSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
} else {
|
||
//ミス音再生
|
||
if (this._missSe) {
|
||
AudioManager.playSe({
|
||
name: this._missSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
this.log_output("Miss! Took damage.");
|
||
//HPを1減らす
|
||
this.cut_HP(false);
|
||
}
|
||
}
|
||
}
|
||
//クリア判定
|
||
this.check_clear();
|
||
} else {
|
||
//終了待ちフラグがOFFになるまで待機
|
||
if (this._wait_endF) {
|
||
//クリア分岐
|
||
if (this._clearF) {
|
||
$gameSwitches.setValue(Number(this._sw), true);
|
||
} else {
|
||
$gameSwitches.setValue(Number(this._sw), false);
|
||
}
|
||
SceneManager.pop();
|
||
}
|
||
}
|
||
};
|
||
//画面上の指定位置に指定画像を作成する関数
|
||
TimingGame.prototype.factory_imageFile = function (file, x, y) {
|
||
var _image = new Sprite();
|
||
//使用画像、X座標、Y座標
|
||
_image.bitmap = file;
|
||
_image.x = x;
|
||
_image.y = y;
|
||
|
||
_image.visible = true;
|
||
//画面上に表示
|
||
this.addChild(_image);
|
||
};
|
||
//ゲージ作成
|
||
TimingGame.prototype.factory_frame = function (rect) {
|
||
var _sp = new Sprite();
|
||
var _bmp = new Bitmap(rect.width, rect.height);
|
||
//色塗り
|
||
_bmp.fillAll(rect.acolor);
|
||
//配置
|
||
_sp.bitmap = _bmp;
|
||
_sp.x = rect.pointX;
|
||
_sp.y = rect.pointY;
|
||
//画面上に表示
|
||
_sp.visible = true;
|
||
this.addChild(_sp);
|
||
return _sp;
|
||
};
|
||
//ログ箱作成
|
||
TimingGame.prototype.factory_logBox = function () {
|
||
var _sprite = new Sprite();
|
||
_sprite.bitmap = new Bitmap(this._logS.width, this._logS.height);
|
||
_sprite.x = this._logS.pointX;
|
||
_sprite.y = this._logS.pointY;
|
||
_sprite.bitmap.fontSize = this._logS.fontSize;
|
||
this.addChild(_sprite);
|
||
this._logBox = _sprite;
|
||
};
|
||
//ゲージ切り替え
|
||
TimingGame.prototype.switch_frame = function () {
|
||
if (this._aordF) {
|
||
this._frame.bitmap.fillAll(this._frameSetting.acolor);
|
||
} else {
|
||
this._frame.bitmap.fillAll(this._frameSetting.dcolor);
|
||
}
|
||
};
|
||
//ラベル作製
|
||
TimingGame.prototype.factory_label = function (textBox) {
|
||
var _sprite = new Sprite();
|
||
_sprite.bitmap = new Bitmap(textBox.width, textBox.height);
|
||
_sprite.x = textBox.pointX;
|
||
_sprite.y = textBox.pointY;
|
||
_sprite.bitmap.fontSize = textBox.fontSize;
|
||
_sprite.bitmap.drawText(textBox.word, 0, 0, textBox.width, textBox.height);
|
||
this.addChild(_sprite);
|
||
};
|
||
//スコア作成
|
||
TimingGame.prototype.factory_score = function (numberBox) {
|
||
var _sprite = new Sprite();
|
||
_sprite.bitmap = new Bitmap(numberBox.width, numberBox.height);
|
||
_sprite.x = numberBox.pointX;
|
||
_sprite.y = numberBox.pointY;
|
||
_sprite.bitmap.fontSize = numberBox.fontSize;
|
||
this.addChild(_sprite);
|
||
return _sprite;
|
||
};
|
||
//自分のHP作成
|
||
TimingGame.prototype.factory_myHP = function (LifeResource, hp) {
|
||
var _hpArray = new Array();
|
||
for (let i = 0; i < hp; i++) {
|
||
var _hpImage = new Sprite();
|
||
|
||
//使用画像、X座標、Y座標
|
||
_hpImage.bitmap = ImageManager.loadPicture(LifeResource.imageFile);
|
||
_hpImage.x = Number(LifeResource.pointX) + Number(LifeResource.space) * i;
|
||
_hpImage.y = Number(LifeResource.pointY);
|
||
|
||
_hpImage.visible = true;
|
||
//画面上に表示
|
||
this.addChild(_hpImage);
|
||
_hpArray.push(_hpImage);
|
||
}
|
||
|
||
return _hpArray;
|
||
};
|
||
//判定作成
|
||
TimingGame.prototype.factory_target = function (target) {
|
||
var _frame = new Sprite();
|
||
var _bmp = new Bitmap(target.width, target.height);
|
||
//色塗り
|
||
_bmp.fillAll(target.color);
|
||
//配置
|
||
_frame.bitmap = _bmp;
|
||
_frame.x = target.pointX;
|
||
_frame.y = target.pointY;
|
||
//画面上に表示
|
||
_frame.visible = true;
|
||
this.addChild(_frame);
|
||
return _frame;
|
||
};
|
||
//ビート作成
|
||
TimingGame.prototype.factory_beat = function (rect) {
|
||
var _beat = new Sprite();
|
||
var _bmp = new Bitmap(rect.width, rect.height);
|
||
//色塗り
|
||
if (this._aordF) {
|
||
_bmp.fillAll(rect.acolor);
|
||
} else {
|
||
_bmp.fillAll(rect.dcolor);
|
||
}
|
||
//配置
|
||
_beat.bitmap = _bmp;
|
||
_beat.x = rect.pointX;
|
||
_beat.y = rect.pointY;
|
||
//画面上に表示
|
||
_beat.visible = true;
|
||
this.addChild(_beat);
|
||
return _beat;
|
||
};
|
||
//ビートの右辺取得関数
|
||
TimingGame.prototype.get_right = function (beat) {
|
||
if (beat) {
|
||
return Number(beat.x) + Number(beat.bitmap.width);
|
||
} else {
|
||
return 0;
|
||
}
|
||
};
|
||
//点数計算
|
||
TimingGame.prototype.cal_score = function () {
|
||
if (this._aordF) {
|
||
//攻撃時
|
||
if (this._tmpScore > 0) {
|
||
if (this._successSe) {
|
||
AudioManager.playSe({
|
||
name: this._successSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._attackAnime.anime != 0) {
|
||
this.start_anime(this._attackAnime);
|
||
}
|
||
var tmpHp = 0;
|
||
if (this._skill3RunF) {
|
||
//スキル3発動処理
|
||
this._tmpScore += this._skill3Number;
|
||
}
|
||
tmpHp = this._emHpNum - this._tmpScore;
|
||
if (tmpHp < 0) {
|
||
tmpHp = 0;
|
||
}
|
||
this._emHpNum = tmpHp;
|
||
this._emHp.bitmap.clear();
|
||
this._emHp.bitmap.drawText(
|
||
this._emHpNum,
|
||
0,
|
||
0,
|
||
this._emHpWidth,
|
||
this._emHpHeight
|
||
);
|
||
this.log_output("Attack successful! Dealt \'" + this._tmpScore + "\' damage.");
|
||
this._tmpScore = 0;
|
||
} else {
|
||
this.log_output("Attack failed! 0 damage");
|
||
AudioManager.playSe({
|
||
name: this._blindSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
} else {
|
||
//防御時
|
||
var sumScore = 0;
|
||
this._targetArray.forEach((element) => {
|
||
sumScore += Number(element.score);
|
||
});
|
||
//全て防げたか
|
||
if (sumScore == this._tmpScore) {
|
||
//防御成功
|
||
if (this._guardSe) {
|
||
AudioManager.playSe({
|
||
name: this._guardSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._guardAnime.anime != 0) {
|
||
this.start_anime(this._guardAnime);
|
||
}
|
||
this.log_output("Defense successful!");
|
||
} else {
|
||
//相手の攻撃
|
||
if (this._emSe) {
|
||
AudioManager.playSe({
|
||
name: this._emSe,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._emAnime.anime != 0) {
|
||
this.start_anime(this._emAnime);
|
||
}
|
||
this.log_output("Opponent\'s attack! Took\ndamage.");
|
||
this.log_output("[\'" + this._emName + "\']");
|
||
this.log_output(
|
||
this._emAtkWords[Math.floor(Math.random() * this._emAtkWords.length)]
|
||
);
|
||
//ダメージ
|
||
this.cut_HP(true);
|
||
}
|
||
this._tmpScore = 0;
|
||
}
|
||
|
||
//this.init_target();
|
||
};
|
||
//判定確認
|
||
TimingGame.prototype.check_target = function () {
|
||
var ret = false;
|
||
this._targetArray.forEach((element) => {
|
||
if (element.enable) {
|
||
if (
|
||
(this._beat.x >= element.target.x &&
|
||
this._beat.x <= this.get_right(element.target)) ||
|
||
(this.get_right(this._beat) >= element.target.x &&
|
||
this.get_right(this._beat) <= this.get_right(element.target))
|
||
) {
|
||
//判定内なら一時スコア加算
|
||
this._tmpScore += parseInt(element.score);
|
||
//判定を無効化する
|
||
element.enable = false;
|
||
//成功フラグ
|
||
ret = true;
|
||
}
|
||
}
|
||
});
|
||
return ret;
|
||
};
|
||
//アニメ再生
|
||
TimingGame.prototype.start_anime = function (animeS) {
|
||
var sprite = new Sprite_Base();
|
||
sprite.x = Number(animeS.pointX);
|
||
sprite.y = Number(animeS.pointY);
|
||
sprite.bitmap = new Bitmap(100, 100);
|
||
var animation = $dataAnimations[Number(animeS.anime)];
|
||
this.addChild(sprite);
|
||
sprite.startAnimation(animation, false, 0);
|
||
this.del_sprite_waitS(sprite);
|
||
};
|
||
//指定時間後にspriteを削除する関数(メモリ用)
|
||
TimingGame.prototype.del_sprite_waitS = async function (sprite) {
|
||
//10秒後に削除
|
||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||
this.removeChild(sprite);
|
||
};
|
||
//クリア判定関数
|
||
TimingGame.prototype.check_clear = function () {
|
||
if (this._myHP.length == 0) {
|
||
//$gameMessage.add("失敗");
|
||
this._breakF = true;
|
||
this._clearF = false;
|
||
//SceneManager.pop();
|
||
this.log_output("HP reached 0...");
|
||
if (this._missF) {
|
||
//自傷END
|
||
this.wait_end_func(this._end2Sec);
|
||
} else {
|
||
//敵の攻撃END
|
||
this.wait_end_func(this._end3Sec);
|
||
}
|
||
}
|
||
if (this._emHpNum <= 0) {
|
||
this._breakF = true;
|
||
this._clearF = true;
|
||
//$gameMessage.add("クリア");
|
||
//SceneManager.pop();
|
||
this.log_output("Defeated the enemy!");
|
||
//倒したEND
|
||
this.wait_end_func(this._end1Sec);
|
||
}
|
||
};
|
||
//終了待ちフラグ操作関数
|
||
TimingGame.prototype.wait_end_func = async function (sec) {
|
||
await new Promise((resolve) => setTimeout(resolve, sec));
|
||
this._wait_endF = true;
|
||
};
|
||
//判定初期化
|
||
TimingGame.prototype.init_target = function () {
|
||
//できなければforで回す
|
||
this._targetArray.forEach((element) => {
|
||
element.enable = true;
|
||
});
|
||
};
|
||
//HP削除 trueなら攻撃によるダメージ
|
||
TimingGame.prototype.cut_HP = function (myF) {
|
||
this.removeChild(this._myHP[this._myHP.length - 1]);
|
||
this._myHP.pop();
|
||
if (this._myHP.length == 0) {
|
||
if (myF) {
|
||
this._missF = false;
|
||
} else {
|
||
this._missF = true;
|
||
}
|
||
}
|
||
};
|
||
//判定削除
|
||
TimingGame.prototype.clear_Target = function () {
|
||
this._targetArray.forEach((element) => {
|
||
this.removeChild(element.target);
|
||
});
|
||
this._targetArray.length = 0;
|
||
};
|
||
//判定生成
|
||
TimingGame.prototype.make_Target = function () {
|
||
if (this._aordF) {
|
||
var ts = this._tsG[Math.floor(Math.random() * this._tsG.length)];
|
||
ts.forEach((element) => {
|
||
var tag = this.factory_target(element);
|
||
this._targetArray.push({
|
||
target: tag,
|
||
score: element.score,
|
||
enable: true,
|
||
});
|
||
});
|
||
} else {
|
||
var ts = this._tsDG[Math.floor(Math.random() * this._tsDG.length)];
|
||
ts.forEach((element) => {
|
||
var tag = this.factory_target(element);
|
||
this._targetArray.push({
|
||
target: tag,
|
||
score: element.score,
|
||
enable: true,
|
||
});
|
||
});
|
||
}
|
||
};
|
||
//スキル1処理
|
||
TimingGame.prototype.skill1_func = function () {
|
||
if (this._skill1Se) {
|
||
AudioManager.playSe({
|
||
name: this._skill1Se,
|
||
volume: 90,
|
||
pitch: 100,
|
||
pan: 0,
|
||
});
|
||
}
|
||
if (this._skill1Anime.anime) {
|
||
this.start_anime(this._skill1Anime);
|
||
}
|
||
var _addHp = new Sprite();
|
||
_addHp.bitmap = ImageManager.loadPicture(this._lifeResource.imageFile);
|
||
_addHp.x =
|
||
Number(this._lifeResource.pointX) +
|
||
Number(this._lifeResource.space) * this._myHP.length;
|
||
_addHp.y = Number(this._lifeResource.pointY);
|
||
_addHp.visible = true;
|
||
this.addChild(_addHp);
|
||
this._myHP.push(_addHp);
|
||
};
|
||
//ログ出力
|
||
TimingGame.prototype.log_output = function (text) {
|
||
var cnt = 0;
|
||
this._logStack.push(text);
|
||
if (this._logStack.length > this._logS.rows) {
|
||
this._logStack.shift();
|
||
}
|
||
this._logBox.bitmap.clear();
|
||
var h = Number(this._logS.lineHeight);
|
||
this._logStack.forEach((element) => {
|
||
this._logBox.bitmap.drawText(
|
||
element,
|
||
0,
|
||
h * cnt,
|
||
Number(this._logS.width),
|
||
h
|
||
);
|
||
cnt++;
|
||
});
|
||
};
|
||
//実関数
|
||
(function () {
|
||
"use strict";
|
||
//コマンド関連
|
||
var _Game_Interpreter_pluginCommand =
|
||
Game_Interpreter.prototype.pluginCommand;
|
||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||
//プラグインコマンドTestに対応
|
||
if (command === "TimingGame") {
|
||
//引数1
|
||
switch (args[0]) {
|
||
case "play":
|
||
var existFlag = false;
|
||
var setting = JSON.parse(
|
||
PluginManager.parameters("TimingGame").targetSetting
|
||
);
|
||
setting.forEach((element) => {
|
||
var tmp = JSON.parse(element);
|
||
if (tmp.name == args[1]) {
|
||
existFlag = true;
|
||
}
|
||
});
|
||
if (existFlag == true) {
|
||
Game_System.prototype.SettingName = args[1];
|
||
SceneManager.push(TimingGame);
|
||
} else {
|
||
$gameMessage.add("識別名がついた設定ではありません。");
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
};
|
||
})();
|