Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 124.79 KB | None | 0 0
  1. //=============================================================================
  2. // TMPlugin - ジャンプアクション
  3. // バージョン: 1.0.1
  4. // 最終更新日: 2017/07/28
  5. // 配布元 : http://hikimoki.sakura.ne.jp/
  6. //-----------------------------------------------------------------------------
  7. // Copyright (c) 2015 tomoaky
  8. // Released under the MIT license.
  9. // http://opensource.org/licenses/mit-license.php
  10. //=============================================================================
  11.  
  12. /*:
  13. * @plugindesc マップシーンをそれっぽいアクションゲームにします。
  14. * 使用方法などは配布サイトを参照してください。
  15. * @author tomoaky (http://hikimoki.sakura.ne.jp/)
  16. *
  17. * @param gravity
  18. * @type string
  19. * @desc 重力の強さ。
  20. * 初期値: 0.004
  21. * @default 0.004
  22. *
  23. * @param friction
  24. * @type string
  25. * @desc 通常の地形とイベントの摩擦の強さ。
  26. * 初期値: 0.001
  27. * @default 0.001
  28. *
  29. * @param tileMarginTop
  30. * @type string
  31. * @desc 地形との接触判定に使う座標をどれだけ上へずらすか。
  32. * 初期値: 0.5
  33. * @default 0.5
  34. *
  35. * @param stepsForTurn
  36. * @type number
  37. * @desc 何マスの移動で1ターン経過するか。
  38. * 初期値: 20
  39. * @default 20
  40. *
  41. * @param allDeadEvent
  42. * @type number
  43. * @desc 全滅時に起動するコモンイベント番号。
  44. * 初期値: 0
  45. * @default 0
  46. *
  47. * @param guardState
  48. * @type state
  49. * @desc 防御状態として扱うステート番号
  50. * 初期値: 2
  51. * @default 2
  52. *
  53. * @param guardMoveRate
  54. * @type number
  55. * @desc 防御状態の移動速度補正(%)
  56. * 初期値: 25
  57. * @default 25
  58. *
  59. * @param eventCollapse
  60. * @type boolean
  61. * @desc イベント戦闘不能時に崩壊エフェクトを使う。
  62. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  63. * @default true
  64. *
  65. * @param hpGauge
  66. * @type boolean
  67. * @desc 足元にHPゲージを表示する機能を利用する。
  68. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  69. * @default true
  70. *
  71. * @param floorDamage
  72. * @type number
  73. * @desc ダメージ床から受けるダメージ。
  74. * 初期値: 10
  75. * @default 10
  76. *
  77. * @param damageFallRate
  78. * @type number
  79. * @desc 落下ダメージの倍率。
  80. * 初期値: 10
  81. * @default 10
  82. *
  83. * @param damageFallHeight
  84. * @type number
  85. * @desc 落下ダメージを受ける高さ。
  86. * 初期値: 5
  87. * @default 5
  88. *
  89. * @param flickWeight
  90. * @type number
  91. * @desc はじき飛ばせる重さの差。
  92. * 初期値: 1( 0 なら同じ重さではじき飛ばせる )
  93. * @default 1
  94. *
  95. * @param flickSkill
  96. * @type skill
  97. * @desc はじき飛ばしのダメージ計算に使うスキル番号。
  98. * 初期値: 1( 0 ならダメージなし )
  99. * @default 1
  100. *
  101. * @param stageRegion
  102. * @type number
  103. * @desc 足場として扱うリージョン番号。
  104. * 初期値: 60
  105. * @default 60
  106. *
  107. * @param wallRegion
  108. * @type number
  109. * @desc 壁として扱うリージョン番号。
  110. * 初期値: 61
  111. * @default 61
  112. *
  113. * @param slipWallRegion
  114. * @type number
  115. * @desc 壁ジャンプができない壁として扱うリージョン番号。
  116. * 初期値: 62
  117. * @default 62
  118. *
  119. * @param slipFloorRegion
  120. * @type number
  121. * @desc すべる床として扱うリージョン番号。
  122. * 初期値: 63
  123. * @default 63
  124. *
  125. * @param roughFloorRegion
  126. * @type number
  127. * @desc 移動速度半減の床として扱うリージョン番号。
  128. * 初期値: 64
  129. * @default 64
  130. *
  131. * @param marshFloorRegion
  132. * @type number
  133. * @desc 移動できない床として扱うリージョン番号。
  134. * 初期値: 65
  135. * @default 65
  136. *
  137. * @param waterTerrainTag
  138. * @type number
  139. * @desc 水中として扱う地形タグ番号。
  140. * 初期値: 1
  141. * @default 1
  142. *
  143. * @param levelupPopup
  144. * @type string
  145. * @desc レベルアップ時に表示するポップアップ。
  146. * 初期値: LEVEL UP!!
  147. * @default LEVEL UP!!
  148. *
  149. * @param levelupAnimationId
  150. * @desc レベルアップ時に表示するアニメーション番号。
  151. * 初期値: 46
  152. * @default 46
  153. * @require 1
  154. * @type animation
  155. *
  156. * @param attackToOk
  157. * @type boolean
  158. * @desc 攻撃ボタンをメニューの決定ボタンとしても使うかどうか
  159. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  160. * @default true
  161. *
  162. * @param jumpToCancel
  163. * @type boolean
  164. * @desc ジャンプボタンをメニューのキャンセルボタンとしても使うかどうか
  165. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  166. * @default true
  167. *
  168. * @param useEventSeSwim
  169. * @type boolean
  170. * @desc 水に入ったときの効果音をイベントに適用する。
  171. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  172. * @default true
  173. *
  174. * @param jumpSe
  175. * @desc ジャンプ効果音のファイル名。
  176. * 初期値: Crossbow
  177. * @default Crossbow
  178. * @require 1
  179. * @dir audio/se/
  180. * @type file
  181. *
  182. * @param jumpSeParam
  183. * @type string
  184. * @desc ジャンプ効果音のパラメータ。
  185. * 初期値: {"volume":90, "pitch":100, "pan":0}
  186. * @default {"volume":90, "pitch":100, "pan":0}
  187. *
  188. * @param dashSe
  189. * @desc ダッシュ効果音のファイル名。
  190. * 初期値: Wind4
  191. * @default Wind4
  192. * @require 1
  193. * @dir audio/se/
  194. * @type file
  195. *
  196. * @param dashSeParam
  197. * @type string
  198. * @desc ダッシュ効果音のパラメータ。
  199. * 初期値: {"volume":90, "pitch":50, "pan":0}
  200. * @default {"volume":90, "pitch":50, "pan":0}
  201. *
  202. * @param flickSe
  203. * @desc ダッシュはじき効果音のファイル名。
  204. * 初期値: Damage1
  205. * @default Damage1
  206. * @require 1
  207. * @dir audio/se/
  208. * @type file
  209. *
  210. * @param flickSeParam
  211. * @type string
  212. * @desc ダッシュはじき効果音のパラメータ。
  213. * 初期値: {"volume":90, "pitch":100, "pan":0}
  214. * @default {"volume":90, "pitch":100, "pan":0}
  215. *
  216. * @param swimSe
  217. * @desc 入水効果音のファイル名。
  218. * 初期値: Water1
  219. * @default Water1
  220. * @require 1
  221. * @dir audio/se/
  222. * @type file
  223. *
  224. * @param swimSeParam
  225. * @type string
  226. * @desc 入水効果音のパラメータ。
  227. * 初期値: {"volume":90, "pitch":100, "pan":0}
  228. * @default {"volume":90, "pitch":100, "pan":0}
  229. *
  230. * @param changeSe
  231. * @desc 操作キャラ切り替え効果音のファイル名。
  232. * 初期値: Sword1
  233. * @default Sword1
  234. * @require 1
  235. * @dir audio/se/
  236. * @type file
  237. *
  238. * @param changeSeParam
  239. * @type string
  240. * @desc 操作キャラ切り替え効果音のパラメータ。
  241. * 初期値: {"volume":90, "pitch":100, "pan":0}
  242. * @default {"volume":90, "pitch":100, "pan":0}
  243. *
  244. * @param carrySe
  245. * @desc イベント持ち上げ効果音のファイル名。
  246. * 初期値: Cancel1
  247. * @default Cancel1
  248. * @require 1
  249. * @dir audio/se/
  250. * @type file
  251. *
  252. * @param carrySeParam
  253. * @type string
  254. * @desc イベント持ち上げ効果音のパラメータ。
  255. * 初期値: {"volume":90, "pitch":70, "pan":0}
  256. * @default {"volume":90, "pitch":70, "pan":0}
  257. *
  258. * @param hurlSe
  259. * @desc イベント投げ効果音のファイル名。
  260. * 初期値: Evasion1
  261. * @default Evasion1
  262. * @require 1
  263. * @dir audio/se/
  264. * @type file
  265. *
  266. * @param hurlSeParam
  267. * @type string
  268. * @desc イベント投げ効果音のパラメータ。
  269. * 初期値: {"volume":90, "pitch":70, "pan":0}
  270. * @default {"volume":90, "pitch":70, "pan":0}
  271. *
  272. * @param guardSe
  273. * @desc 防御効果音のファイル名。
  274. * 初期値: Equip1
  275. * @default Equip1
  276. * @require 1
  277. * @dir audio/se/
  278. * @type file
  279. *
  280. * @param guardSeParam
  281. * @type string
  282. * @desc 防御効果音のパラメータ。
  283. * 初期値: {"volume":90, "pitch":150, "pan":0}
  284. * @default {"volume":90, "pitch":150, "pan":0}
  285. *
  286. * @param playerBulletsMax
  287. * @type number
  288. * @desc プレイヤーの弾の最大数。
  289. * 初期値: 32
  290. * @default 32
  291. *
  292. * @param enemyBulletsMax
  293. * @type number
  294. * @desc イベントの弾の最大数。
  295. * 初期値: 256
  296. * @default 256
  297. *
  298. * @param weaponSprite
  299. * @type boolean
  300. * @desc 弾発射時に武器画像を表示する。
  301. * 初期値: ON ( false = OFF 無効 / true = ON 有効 )
  302. * @default true
  303. *
  304. * @param autoDamageSe
  305. * @type boolean
  306. * @desc 着弾時に自動で効果音を再生する。
  307. * 初期値: ON (false = OFF 無効 / true = ON 有効 )
  308. * @default true
  309. *
  310. * @param bulletTypeName1
  311. * @desc 弾タイプ 1 の画像ファイル名。
  312. * 初期値: Bullet1
  313. * @default Bullet1
  314. * @require 1
  315. * @dir img/system/
  316. * @type file
  317. *
  318. * @param bulletTypeName2
  319. * @desc 弾タイプ 2 の画像ファイル名。
  320. * 初期値: Bullet1
  321. * @default Bullet1
  322. * @require 1
  323. * @dir img/system/
  324. * @type file
  325. *
  326. * @param bulletTypeName3
  327. * @desc 弾タイプ 3 の画像ファイル名。
  328. * 初期値: Bullet1
  329. * @default Bullet1
  330. * @require 1
  331. * @dir img/system/
  332. * @type file
  333. *
  334. * @param bulletTypeName4
  335. * @desc 弾タイプ 4 の画像ファイル名。
  336. * 初期値: Bullet1
  337. * @default Bullet1
  338. * @require 1
  339. * @dir img/system/
  340. * @type file
  341. *
  342. * @param bulletTypeSize
  343. * @type string
  344. * @desc 弾タイプごとの当たり判定のサイズ。
  345. * 初期値: 6,6,6,6
  346. * @default 6,6,6,6
  347. *
  348. * @param attackKey
  349. * @type string
  350. * @desc プレイヤーの弾発射に使用するキー
  351. * 初期値: Z
  352. * @default Z
  353. *
  354. * @param jumpKey
  355. * @type string
  356. * @desc プレイヤーのジャンプに使用するキー
  357. * 初期値: X
  358. * @default X
  359. *
  360. * @param dashKey
  361. * @type string
  362. * @desc プレイヤーのダッシュに使用するキー
  363. * 初期値: C
  364. * @default C
  365. *
  366. * @param padButtons
  367. * @type string
  368. * @desc 利用するパッドボタンのコード
  369. * 初期値: ok,cancel,menu,shift,attack,jump,pageup,pagedown
  370. * @default ok,cancel,menu,shift,attack,jump,pageup,pagedown
  371. *
  372. * @param padButtonNames
  373. * @type string
  374. * @desc パッドボタンの名前
  375. * padButtonsと同じ並び順でボタンの名前を設定してください
  376. * @default 決定,キャンセル,メニュー,ダッシュ,アタック,ジャンプ,キャラ変更(前),キャラ変更(次)
  377.  
  378. * @param defaultPadButtons
  379. * @type string
  380. * @desc パッドボタンの初期配置
  381. * 初期値: ボタン 1 ~ 12 に対応するコードを設定してください
  382. * @default cancel,ok,shift,jump,pageup,pagedown,attack,menu,menu,menu,menu,menu
  383. *
  384. * @param padConfigCommand
  385. * @type string
  386. * @desc パッドボタン配置のコマンド名 (空にすると機能を無効化)
  387. * 初期値: パッドボタン配置
  388. * @default パッドボタン配置
  389. *
  390. * @param stepAnimeConstantA
  391. * @type string
  392. * @desc 足踏み速度定数A
  393. * 初期値: 0.1
  394. * @default 0.1
  395. *
  396. * @param stepAnimeConstantB
  397. * @type string
  398. * @desc 足踏み速度定数B
  399. * 初期値: 300
  400. * @default 300
  401. *
  402. * @noteParam shot_se_name
  403. * @noteRequire 1
  404. * @noteDir audio/se/
  405. * @noteType file
  406. * @noteData weapons
  407. *
  408. * @requiredAssets img/system/TMJumpActionShield
  409. *
  410. * @help
  411. * TMPlugin - ジャンプアクション ver1.0.1
  412. *
  413. * 使い方:
  414. *
  415. * 詳細は配布サイトを参照してください。
  416. *
  417. * このプラグインは RPGツクールMV Version 1.5.0 で動作確認をしています。
  418. *
  419. * このプラグインはMITライセンスのもとに配布しています、商用利用、
  420. * 改造、再配布など、自由にお使いいただけます。
  421. *
  422. *
  423. * メモ欄タグ(アクター、装備、ステート):
  424. *
  425. * <move_speed:0.05> # 歩行速度
  426. * <jump_speed:0.14> # ジャンプ力
  427. * <swim_speed:0.02> # 泳ぐ速度
  428. * <ladder_speed:0.04> # はしご移動速度
  429. * <accele:0.003> # 歩行加速度
  430. * <ladder_accele:0.003> # はしご移動加速度
  431. * <jump_input:0> # ジャンプ追加入力時間
  432. * <swim_jump:0.1> # 水中ジャンプ力
  433. * <mulch_jump:1> # 連続ジャンプ回数
  434. * <weight:2> # 重さ
  435. * <gravity:0.0045> # 重力
  436. * <friction:0> # 摩擦
  437. * <wall_jump> # 壁ジャンプ
  438. * <dash_speed_x:0.14> # ダッシュ速度(横方向)
  439. * <dash_speed_y:0.03> # ダッシュ速度(縦方向)
  440. * <dash_count:15> # ダッシュ時間
  441. * <dash_delay:30> # ダッシュ後硬直時間
  442. * <dash_mp_cost:0> # ダッシュに必要なMP
  443. * <fall_guard:50> # 落下ダメージ耐性
  444. * <guard_speed:15> # 防御状態への移行速度
  445. * <invincible_time:30> # 被ダメージ後の無敵時間
  446. * <shot_way:1> # 同時に発射する弾の数
  447. * <shot_space:0.2> # 弾同士の間隔(ラジアン)
  448. * <shot_speed:0.07> # 弾の移動速度
  449. * <shot_count:30> # 弾の寿命
  450. * <shot_type:1> # 弾のタイプ
  451. * <shot_index:0> # 弾画像のインデックス
  452. * <shot_skill:1> # 弾のスキル番号
  453. * <shot_delay:10> # 発射後の硬直時間
  454. * <shot_se_name:Attack2> # 弾発射効果音のファイル名
  455. * <shot_se_volume:90> # 弾発射効果音のボリューム
  456. * <shot_se_pitch:150> # 弾発射効果音のピッチ
  457. *
  458. *
  459. * メモ欄タグ(イベント):
  460. *
  461. * <w:0.375> # 当たり判定(中心から左右の端までのサイズ)
  462. * <h:0.75> # 当たり判定(足元から頭までのサイズ)
  463. * <enemy:1> # バトラー(敵番号)
  464. * <dead:A> # バトラー戦闘不能時セルフスイッチ
  465. * <repop:300> # 再出現までの時間(フレーム)
  466. * <lift> # リフト属性
  467. * <weight:1> # 重さ
  468. * <gravity:0.004> # 重力
  469. *
  470. *
  471. * メモ欄タグ(スキル):
  472. *
  473. * <bullet_anime:67> # 着弾時に再生するアニメーション
  474. * <map_through> # 弾が地形を無視して貫通する
  475. * <map_reflect> # 弾が地形に当たると消えずに跳ね返る
  476. *
  477. * <time_bomb:6 0 0.2 45 1 0 1>
  478. * 弾が時間切れで削除される際に新しく弾を発射する。
  479. * パラメータはプラグインコマンド『nallShot』の n ~ skillId までを
  480. * 設定します。
  481. *
  482. *
  483. * プラグインコマンド:
  484. *
  485. * actGainHp -1 -5 # プレイヤーに 5 ダメージを与える。
  486. * actGainHp 1 -100 # イベント 1 番に 100 ダメージを与える。
  487. * actHp 1 2 # イベント 1 番のHPをゲーム変数 2 番に代入。
  488. * actForceX -1 0.1 # プレイヤーの X 速度を 0.1 に強制変更。
  489. * actForceY 1 -0.15 # イベント 1 番の Y 速度を -0.15 に強制変更。
  490. * actForceStop -1 # プレイヤーの速度を 0 に強制変更。
  491. * actChangeActor 2 # 操作キャラクターをアクター 2 番に変更。
  492. * actHideHpGauge # 足元HPゲージを隠す
  493. * actShowHpGauge # 足元HPゲージを表示する
  494. *
  495. * actPopup -1 テキスト #ff0000
  496. * プレイヤーに赤色のテキストをポップアップ
  497. *
  498. * nwayShot eventId n space angle speed count type index skillId
  499. * eventId: 弾を発射するイベントの番号( -1 でプレイヤー)
  500. * n: 同時に発射する弾の数
  501. * space: 弾同士の間隔(ラジアン)
  502. * angle: 発射する方向(ラジアン)
  503. * speed: 弾の移動速度
  504. * count: 弾の寿命
  505. * type: 弾のタイプ
  506. * index: 弾画像のインデックス
  507. * skillId: 弾のスキル(ダメージ計算用、省略可)
  508. *
  509. * nwayAim eventId n space angle speed count type index skillId
  510. * nway_shot と同様ですが、angleにプレイヤーがいる方向(ラジアン)を
  511. * 自動的に加算します。angleが 0 なら自機狙いになります。
  512. *
  513. * nallShot eventId n angle speed count type index skillId
  514. * 全方位に向けて弾を発射します、弾同士の間隔は自動で設定されます。
  515. *
  516. * nallAim eventId n space angle speed count type index skillId
  517. * nall_shot の自機狙い版です。
  518. */
  519. var Jif_interpreterCommand = Game_Interpreter.prototype.pluginCommand;
  520. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  521. Jif_interpreterCommand.apply(this);
  522.  
  523. if (command === 'platform'){
  524. var Imported = Imported || {};
  525. Imported.TMJumpAction = true;
  526.  
  527. if (!Imported.TMEventBase) {
  528. Imported.TMEventBase = true;
  529. (function() {
  530.  
  531. //-----------------------------------------------------------------------------
  532. // Game_Event
  533. //
  534.  
  535. var _Game_Event_setupPage = Game_Event.prototype.setupPage;
  536. Game_Event.prototype.setupPage = function() {
  537. _Game_Event_setupPage.call(this);
  538. if (this._pageIndex >= 0) this.loadCommentParams();
  539. };
  540.  
  541. Game_Event.prototype.loadCommentParams = function() {
  542. this._commentParams = {};
  543. var re = /<([^<>:]+)(:?)([^>]*)>/g;
  544. var list = this.list();
  545. for (var i = 0; i < list.length; i++) {
  546. var command = list[i];
  547. if (command && command.code == 108 || command.code == 408) {
  548. for (;;) {
  549. var match = re.exec(command.parameters[0]);
  550. if (match) {
  551. this._commentParams[match[1]] = match[2] === ':' ? match[3] : true;
  552. } else {
  553. break;
  554. }
  555. }
  556. } else {
  557. break;
  558. }
  559. }
  560. };
  561.  
  562. Game_Event.prototype.loadTagParam = function(paramName) {
  563. return this._commentParams[paramName] || this.event().meta[paramName] || null;
  564. };
  565.  
  566. })();
  567. }
  568.  
  569. function Game_Bullet() {
  570. this.initialize.apply(this, arguments);
  571. }
  572.  
  573. (function() {
  574.  
  575. var parameters = PluginManager.parameters('TMJumpAction');
  576.  
  577. var actGravity = +(parameters['gravity'] || 0.004);
  578. var actFriction = +(parameters['friction'] || 0.001);
  579. var actTileMarginTop = +(parameters['tileMarginTop'] || 0.5);
  580. var actStepsForTurn = +(parameters['stepsForTurn'] || 20);
  581. var actAllDeadEvent = +(parameters['allDeadEvent'] || 0);
  582. var actGuardStateId = +(parameters['guardState'] || 2);
  583. var actGuardMoveRate = +(parameters['guardMoveRate'] || 25);
  584. var actEventCollapse = JSON.parse(parameters['eventCollapse']);
  585. var actHpGauge = JSON.parse(parameters['hpGauge']);
  586. var actFloorDamage = +(parameters['floorDamage'] || 10);
  587. var actDamageFallRate = +(parameters['damageFallRate'] || 10);
  588. var actDamageFallHeight = +(parameters['damageFallHeight'] || 5);
  589. var actFlickWeight = +(parameters['flickWeight'] || 1);
  590. var actFlickSkill = +(parameters['flickSkill'] || 1);
  591. var actStageRegion = +(parameters['stageRegion'] || 60);
  592. var actWallRegion = +(parameters['wallRegion'] || 61);
  593. var actSlipWallRegion = +(parameters['slipWallRegion'] || 62);
  594. var actSlipFloorRegion = +(parameters['slipFloorRegion'] || 63);
  595. var actRoughFloorRegion = +(parameters['roughFloorRegion'] || 64);
  596. var actMarshFloorRegion = +(parameters['marshFloorRegion'] || 65);
  597. var actWaterTerrainTag = +(parameters['waterTerrainTag'] || 1);
  598. var actLevelupPopup = parameters['levelupPopup'];
  599. var actLevelupAnimationId = +(parameters['levelupAnimationId'] || 0);
  600. var actAttackToOk = JSON.parse(parameters['attackToOk']);
  601. var actJumpToCancel = JSON.parse(parameters['jumpToCancel']);
  602. var actUseEventSeSwim = JSON.parse(parameters['useEventSeSwim']);
  603. var actSeJump = JSON.parse(parameters['jumpSeParam'] || '{}');
  604. actSeJump.name = parameters['jumpSe'] || '';
  605. var actSeDash = JSON.parse(parameters['dashSeParam'] || '{}');
  606. actSeDash.name = parameters['dashSe'] || '';
  607. var actSeFlick = JSON.parse(parameters['flickSeParam'] || '{}');
  608. actSeFlick.name = parameters['flickSe'] || '';
  609. var actSeSwim = JSON.parse(parameters['swimSeParam'] || '{}');
  610. actSeSwim.name = parameters['swimSe'] || '';
  611. var actSeChange = JSON.parse(parameters['changeSeParam'] || '{}');
  612. actSeChange.name = parameters['changeSe'] || '';
  613. var actSeCarry = JSON.parse(parameters['carrySeParam'] || '{}');
  614. actSeCarry.name = parameters['carrySe'] || '';
  615. var actSeHurl = JSON.parse(parameters['hurlSeParam'] || '{}');
  616. actSeHurl.name = parameters['hurlSe'] || '';
  617. var actSeGuard = JSON.parse(parameters['guardSeParam'] || '{}');
  618. actSeGuard.name = parameters['guardSe'] || '';
  619. var actPlayerBulletsMax = +(parameters['playerBulletsMax'] || 32);
  620. var actEnemyBulletsMax = +(parameters['enemyBulletsMax'] || 256);
  621. var actWeaponSprite = JSON.parse(parameters['weaponSprite']);
  622. var actAutoDamageSe = JSON.parse(parameters['autoDamageSe']);
  623. var actBulletNames = [];
  624. actBulletNames[1] = parameters['bulletTypeName1'];
  625. actBulletNames[2] = parameters['bulletTypeName2'];
  626. actBulletNames[3] = parameters['bulletTypeName3'];
  627. actBulletNames[4] = parameters['bulletTypeName4'];
  628. var actBulletSizes = parameters['bulletTypeSize'].split(',').map(function(n) {
  629. return +n / 48;
  630. });
  631. actBulletSizes.unshift(0);
  632. var padButtons = parameters['padButtons'].split(',');
  633. var padButtonNames = parameters['padButtonNames'].split(',');
  634. var defaultPadButtons = parameters['defaultPadButtons'].split(',');
  635. var padConfigCommand = parameters['padConfigCommand'];
  636. var actStepAnimeConstantA = +(parameters['stepAnimeConstantA'] || 0.1);
  637. var actStepAnimeConstantB = +(parameters['stepAnimeConstantB'] || 300);
  638.  
  639. //-----------------------------------------------------------------------------
  640. // Input
  641. //
  642.  
  643. if (parameters['attackKey']) {
  644. Input.keyMapper[parameters['attackKey'].charCodeAt()] = 'attack';
  645. }
  646. if (parameters['jumpKey']) {
  647. Input.keyMapper[parameters['jumpKey'].charCodeAt()] = 'jump';
  648. }
  649. if (parameters['dashKey']) {
  650. Input.keyMapper[parameters['dashKey'].charCodeAt()] = 'dash';
  651. }
  652.  
  653. //-----------------------------------------------------------------------------
  654. // ConfigManager
  655. //
  656.  
  657. ConfigManager.getPadButton = function(id) {
  658. return Input.gamepadMapper[id];
  659. };
  660.  
  661. ConfigManager.setPadButton = function(id, code) {
  662. Input.gamepadMapper[id] = code;
  663. };
  664.  
  665. var _ConfigManager_makeData = ConfigManager.makeData;
  666. ConfigManager.makeData = function() {
  667. var config = _ConfigManager_makeData.call(this);
  668. for (var i = 0; i < 12; i++) {
  669. config['padButton' + i] = this.getPadButton(i);
  670. }
  671. return config;
  672. };
  673.  
  674. var _ConfigManager_applyData = ConfigManager.applyData;
  675. ConfigManager.applyData = function(config) {
  676. _ConfigManager_applyData.call(this, config);
  677. for (var i = 0; i < 12; i++) {
  678. this.setPadButton(i, this.readPadButton(config, i));
  679. }
  680. };
  681.  
  682. ConfigManager.readPadButton = function(config, id) {
  683. return config['padButton' + id] || defaultPadButtons[id];
  684. };
  685.  
  686. //-----------------------------------------------------------------------------
  687. // Game_System
  688. //
  689.  
  690. var _Game_System_initialize = Game_System.prototype.initialize;
  691. Game_System.prototype.initialize = function() {
  692. _Game_System_initialize.call(this);
  693. this._actHpGaugeVisible = true;
  694. };
  695.  
  696. Game_System.prototype.isActHpGaugeVisible = function() {
  697. return this._actHpGaugeVisible;
  698. };
  699.  
  700. Game_System.prototype.setActHpGaugeVisible = function(flag) {
  701. this._actHpGaugeVisible = flag;
  702. };
  703.  
  704. //-----------------------------------------------------------------------------
  705. // Game_Action
  706. //
  707.  
  708. var _Game_Action_setSubject = Game_Action.prototype.setSubject;
  709. Game_Action.prototype.setSubject = function(subject) {
  710. if (!subject.isActor() && !$gameParty.inBattle()) {
  711. this._subjectEnemyIndex = subject._screenX;
  712. this._subjectActorId = 0;
  713. } else {
  714. _Game_Action_setSubject.call(this, subject);
  715. }
  716. };
  717.  
  718. var _Game_Action_subject = Game_Action.prototype.subject;
  719. Game_Action.prototype.subject = function() {
  720. if (this._subjectActorId == 0 && !$gameParty.inBattle()) {
  721. return $gameMap.event(this._subjectEnemyIndex).battler();
  722. } else {
  723. return _Game_Action_subject.call(this);
  724. }
  725. };
  726.  
  727. //-----------------------------------------------------------------------------
  728. // Game_Battler
  729. //
  730.  
  731. // メンバ変数の初期化
  732. var _Game_Battler_initMembers = Game_Battler.prototype.initMembers;
  733. Game_Battler.prototype.initMembers = function() {
  734. _Game_Battler_initMembers.call(this);
  735. this._actionResult = new Game_ActionResult();
  736. };
  737.  
  738. // リザルトのクリア
  739. var _Game_Battler_clearResult = Game_Battler.prototype.clearResult;
  740. Game_Battler.prototype.clearResult = function() {
  741. this._actionResult.hpDamage += this._result.hpDamage;
  742. this._actionResult.missed |= this._result.missed;
  743. this._actionResult.evaded |= this._result.evaded;
  744. this._actionResult.critical |= this._result.critical;
  745. this._actionResult.addedStates = this._actionResult.addedStates.concat(this._result.addedStates);
  746. this._actionResult.removedStates = this._actionResult.removedStates.concat(this._result.removedStates);
  747. _Game_Battler_clearResult.call(this);
  748. };
  749.  
  750. // バトル終了処理
  751. var _Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
  752. Game_Battler.prototype.onBattleEnd = function() {
  753. _Game_Battler_onBattleEnd.call(this);
  754. this.clearActionResult();
  755. };
  756.  
  757. // ジャンプアクションリザルトのクリア
  758. Game_Battler.prototype.clearActionResult = function() {
  759. this._actionResult.clear();
  760. };
  761.  
  762. // ダメージ効果音の再生
  763. Game_Battler.prototype.playDamageSe = function() {
  764. if (!actAutoDamageSe) return;
  765. SoundManager.playEnemyDamage();
  766. };
  767.  
  768. // 回復効果音の再生
  769. Game_Battler.prototype.playRecovarySe = function() {
  770. if (!actAutoDamageSe) return;
  771. SoundManager.playRecovery();
  772. };
  773.  
  774. // ミス効果音の再生
  775. Game_Battler.prototype.playMissSe = function() {
  776. if (!actAutoDamageSe) return;
  777. SoundManager.playMiss();
  778. };
  779.  
  780. //-----------------------------------------------------------------------------
  781. // Game_Actor
  782. //
  783.  
  784. // ダメージ床から受けるダメージ
  785. Game_Actor.prototype.basicFloorDamage = function() {
  786. return actFloorDamage;
  787. };
  788.  
  789. // 何マスの移動で1ターン経過するか
  790. Game_Actor.prototype.stepsForTurn = function() {
  791. return actStepsForTurn;
  792. };
  793.  
  794. // 付加されたステートの表示
  795. var _Game_Actor_showAddedStates = Game_Actor.prototype.showAddedStates;
  796. Game_Actor.prototype.showAddedStates = function() {
  797. if ($gameParty.inBattle()) {
  798. _Game_Actor_showAddedStates.call(this);
  799. }
  800. };
  801.  
  802. // レベルアップの表示
  803. var _Game_Actor_displayLevelUp = Game_Actor.prototype.displayLevelUp;
  804. Game_Actor.prototype.displayLevelUp = function(newSkills) {
  805. if ($gameParty.inBattle()) {
  806. _Game_Actor_displayLevelUp.call(this, newSkills);
  807. } else {
  808. $gamePlayer.setMapPopup(actLevelupPopup, '#ffffff');
  809. $gamePlayer.requestAnimation(actLevelupAnimationId);
  810. }
  811. };
  812.  
  813. // 解除されたステートの表示
  814. var _Game_Actor_showRemovedStates = Game_Actor.prototype.showRemovedStates;
  815. Game_Actor.prototype.showRemovedStates = function() {
  816. if ($gameParty.inBattle()) {
  817. _Game_Actor_showRemovedStates.call(this);
  818. }
  819. };
  820.  
  821. // アクター(+装備、ステート)のタグからパラメータ(数値)をロード
  822. Game_Actor.prototype.loadTagParam = function(param_name, default_value) {
  823. var result = +(this.actor().meta[param_name] || default_value);
  824. var equips = this.equips().concat(this.states());
  825. for (var i = 0; i < equips.length; i++) {
  826. if (equips[i] && equips[i].meta[param_name]) {
  827. result += +equips[i].meta[param_name];
  828. }
  829. }
  830. return result;
  831. };
  832.  
  833. // アクター(+装備、ステート)のタグからパラメータ(真偽値)をロード
  834. Game_Actor.prototype.loadTagBool = function(param_name) {
  835. var equips = this.equips().concat(this.states(), this.actor());
  836. for (var i = 0; i < equips.length; i++) {
  837. if (equips[i] && equips[i].meta[param_name]) return true;
  838. }
  839. return false;
  840. };
  841.  
  842. // アクター(+装備、ステート)のタグからパラメータ(文字列)をロード
  843. Game_Actor.prototype.loadTagString = function(param_name, default_value) {
  844. var equips = this.states().concat(this.equips(), this.actor());
  845. for (var i = equips.length - 1; i >= 0; i--) {
  846. if (equips[i] && equips[i].meta[param_name]) {
  847. return equips[i].meta[param_name];
  848. }
  849. }
  850. return default_value;
  851. };
  852.  
  853. // ダメージ効果音の再生
  854. Game_Actor.prototype.playDamageSe = function() {
  855. if (!actAutoDamageSe) return;
  856. SoundManager.playActorDamage();
  857. };
  858.  
  859. //-----------------------------------------------------------------------------
  860. // Game_Party
  861. //
  862.  
  863. Game_Party.prototype.frontSlideActor = function() {
  864. for (var i = 0; i < this.size(); i++) {
  865. this._actors.push(this._actors.shift());
  866. if (!this.leader().isDead()) break;
  867. }
  868. $gamePlayer.refresh();
  869. };
  870.  
  871. Game_Party.prototype.backSlideActor = function() {
  872. for (var i = 0; i < this.size(); i++) {
  873. this._actors.unshift(this._actors.pop());
  874. if (!this.leader().isDead()) break;
  875. }
  876. $gamePlayer.refresh();
  877. };
  878.  
  879. Game_Party.prototype.sortActor = function(actorId) {
  880. for (var i = 0; i < this.size(); i++) {
  881. this._actors.push(this._actors.shift());
  882. if (this._actors[0] === actorId) break;
  883. }
  884. $gamePlayer.refresh();
  885. };
  886.  
  887. //-----------------------------------------------------------------------------
  888. // Game_Map
  889. //
  890.  
  891. // セットアップ
  892. var _Game_Map_setup = Game_Map.prototype.setup;
  893. Game_Map.prototype.setup = function(mapId) {
  894. _Game_Map_setup.call(this, mapId);
  895. this.setupBullets();
  896. };
  897.  
  898. // 弾のセットアップ
  899. Game_Map.prototype.setupBullets = function() {
  900. this._playerBullets = [];
  901. this._alivePlayerBullets = [];
  902. this._blankPlayerBullets = [];
  903. for (var i = 0; i < actPlayerBulletsMax; i++) {
  904. this._playerBullets.push(new Game_Bullet());
  905. this._blankPlayerBullets.push(i);
  906. }
  907. this._enemyBullets = [];
  908. this._aliveEnemyBullets = [];
  909. this._blankEnemyBullets = [];
  910. for (var i = 0; i < actEnemyBulletsMax; i++) {
  911. this._enemyBullets.push(new Game_Bullet());
  912. this._blankEnemyBullets.push(i);
  913. }
  914. };
  915.  
  916. // 自機弾を返す
  917. Game_Map.prototype.playerBullets = function() {
  918. return this._playerBullets;
  919. };
  920.  
  921. // 敵機弾を返す
  922. Game_Map.prototype.enemyBullets = function() {
  923. return this._enemyBullets;
  924. };
  925.  
  926. // 乗り物は作らない
  927. Game_Map.prototype.createVehicles = function() {
  928. this._vehicles = [];
  929. };
  930.  
  931. // 壁ジャンプが可能か判定する
  932. Game_Map.prototype.canWallJump = function(x, y, d) {
  933. if (!this.isValid(x, y)) return false;
  934. if (this.tileId(x, y, 5) === actSlipWallRegion) return false;
  935. return !this.isPassable(x, y, d);
  936. };
  937.  
  938. // 通行チェック
  939. Game_Map.prototype.checkPassage = function(x, y, bit) {
  940. if (!this.isValid(x, y)) return false;
  941. var rg = this.tileId(x, y, 5);
  942. if (rg === actWallRegion || rg === actSlipWallRegion) return false;
  943. var flags = this.tilesetFlags();
  944. var tiles = this.allTiles(x, y);
  945. for (var i = 0; i < tiles.length; i++) {
  946. var flag = flags[tiles[i]];
  947. if (rg === actStageRegion) flag |= 1;
  948. if ((flag & 0x10) !== 0) continue; // [*] No effect on passage
  949. if ((flag & bit) === 0) return true; // [o] Passable
  950. if ((flag & bit) === bit) return false; // [x] Impassable
  951. }
  952. return false;
  953. };
  954.  
  955. // 弾の通行チェック
  956. Game_Map.prototype.checkPassageBullet = function(x, y) {
  957. if (!this.isValid(x, y)) return false;
  958. var rg = this.tileId(x, y, 5);
  959. if (rg === actWallRegion || rg === actSlipWallRegion) return false;
  960. var flags = this.tilesetFlags();
  961. var tiles = this.layeredTiles(x, y);
  962. for (var i = 0; i < tiles.length; i++) {
  963. var flag = flags[tiles[i]];
  964. if ((flag & 0x10) !== 0) continue;
  965. if ((flag & 0x0f) !== 0x0f) return true;
  966. if ((flag & 0x0f) !== 0) return false;
  967. }
  968. return false;
  969. };
  970.  
  971. // フレーム更新
  972. var _Game_Map_update = Game_Map.prototype.update;
  973. Game_Map.prototype.update = function(sceneActive) {
  974. _Game_Map_update.call(this, sceneActive);
  975. this.updateBullets();
  976. };
  977.  
  978. // 弾の更新
  979. Game_Map.prototype.updateBullets = function() {
  980. for (var i = this._alivePlayerBullets.length - 1; i >= 0; i--) {
  981. var bi = this._alivePlayerBullets[i];
  982. if (!this._playerBullets[bi].update()) {
  983. this._alivePlayerBullets.splice(i, 1);
  984. this._blankPlayerBullets.push(bi);
  985. }
  986. }
  987. for (var i = this._aliveEnemyBullets.length - 1; i >= 0; i--) {
  988. var bi = this._aliveEnemyBullets[i];
  989. if (!this._enemyBullets[bi].update()) {
  990. this._aliveEnemyBullets.splice(i, 1);
  991. this._blankEnemyBullets.push(bi);
  992. }
  993. }
  994. };
  995.  
  996. // 弾の追加
  997. Game_Map.prototype.addBullet = function(x, y, z, vx, vy, angle, count, type, index, enemyFlag, skillId, owner) {
  998. if (enemyFlag) {
  999. if (this._blankEnemyBullets.length > 0) {
  1000. var bi = this._blankEnemyBullets.shift();
  1001. this._enemyBullets[bi].setup(x, y, z, vx, vy, angle, count, type, index, true, skillId, owner);
  1002. this._aliveEnemyBullets.push(bi);
  1003. }
  1004. } else {
  1005. if (this._blankPlayerBullets.length > 0) {
  1006. var bi = this._blankPlayerBullets.shift();
  1007. this._playerBullets[bi].setup(x, y, z, vx, vy, angle, count, type, index, false, skillId, owner);
  1008. this._alivePlayerBullets.push(bi);
  1009. }
  1010. }
  1011. };
  1012.  
  1013. // 自機弾の全削除
  1014. Game_Map.prototype.clearPlayerBullets = function() {
  1015. for (var i = 0; i < this._alivePlayerBullets.length; i++) {
  1016. this._playerBullets[this._alivePlayerBullets[i]].erase();
  1017. }
  1018. this._blankPlayerBullets.concat(this._alivePlayerBullets);
  1019. this._alivePlayerBullets = [];
  1020. };
  1021.  
  1022. // 敵機弾の全削除
  1023. Game_Map.prototype.clearEnemyBullets = function() {
  1024. for (var i = 0; i < this._aliveEnemyBullets.length; i++) {
  1025. this._enemyBullets[this._aliveEnemyBullets[i]].erase();
  1026. }
  1027. this._blankEnemyBullets.concat(this._aliveEnemyBullets);
  1028. this._aliveEnemyBullets = [];
  1029. };
  1030.  
  1031. // すべての弾を削除
  1032. Game_Map.prototype.clearAllBullets = function() {
  1033. this.clearPlayerBullets();
  1034. this.clearEnemyBullets();
  1035. };
  1036.  
  1037. //-----------------------------------------------------------------------------
  1038. // Game_Bullet
  1039. //
  1040.  
  1041. // 初期化
  1042. Game_Bullet.prototype.initialize = function() {
  1043. this._opacity = 0;
  1044. };
  1045.  
  1046. // セットアップ
  1047. Game_Bullet.prototype.setup = function(x, y, z, vx, vy, angle, count, type, index, enemyFlag, skillId, owner) {
  1048. this._opacity = 255;
  1049. this._x = x;
  1050. this._y = y;
  1051. this._z = z;
  1052. this._vx = vx;
  1053. this._vy = vy;
  1054. this._angle = angle;
  1055. this._count = count;
  1056. this._type = type;
  1057. this._characterName = actBulletNames[this._type];
  1058. this._characterIndex = index;
  1059. this._enemyFlag = enemyFlag;
  1060. this._skillId = skillId;
  1061. this._owner = owner;
  1062. this._collideSize = actBulletSizes[this._type];
  1063. this._mapCollide = !$dataSkills[this._skillId].meta['map_through'];
  1064. this._gravity = +$dataSkills[this._skillId].meta['gravity'];
  1065. };
  1066.  
  1067. // 存在状態判定
  1068. Game_Bullet.prototype.isExist = function() {
  1069. return this._characterName !== '';
  1070. };
  1071.  
  1072. // 敵機の弾判定
  1073. Game_Bullet.prototype.isEnemy = function() {
  1074. return this._enemyFlag;
  1075. };
  1076.  
  1077. // 弾タイプの取得
  1078. Game_Bullet.prototype.type = function() {
  1079. return this._type;
  1080. };
  1081.  
  1082. // 角度の取得
  1083. Game_Bullet.prototype.angle = function() {
  1084. return this._angle;
  1085. };
  1086.  
  1087. // 画面 X 座標の取得
  1088. Game_Bullet.prototype.screenX = function() {
  1089. var tw = $gameMap.tileWidth();
  1090. return Math.round($gameMap.adjustX(this._x) * tw);
  1091. };
  1092.  
  1093. // 画面 Y 座標の取得
  1094. Game_Bullet.prototype.screenY = function() {
  1095. var th = $gameMap.tileHeight();
  1096. return Math.round($gameMap.adjustY(this._y) * th);
  1097. };
  1098.  
  1099. // キャラクターがいる方向(角度)を取得
  1100. Game_Bullet.prototype.angleToCharacter = function(character) {
  1101. return Math.atan2(character._realY - character.collideH / 2 - this._y, character._realX - this._x);
  1102. };
  1103.  
  1104. // プレイヤーがいる方向(角度)を取得
  1105. Game_Bullet.prototype.angleToPlayer = function() {
  1106. return this.angleToCharacter($gamePlayer);
  1107. };
  1108.  
  1109. // フレーム更新
  1110. Game_Bullet.prototype.update = function() {
  1111. this._x += this._vx;
  1112. this._y += this._vy;
  1113. this._count--;
  1114. if (this._count <= 0) {
  1115. if ($dataSkills[this._skillId].meta['time_bomb']) this.timeBomb();
  1116. this.erase();
  1117. } else if (this.updateCollide()) {
  1118. this.erase();
  1119. }
  1120. if (this._gravity) this._vy = Math.min(this._vy + this._gravity, 0.6);
  1121. return this.isExist();
  1122. };
  1123.  
  1124. // 削除
  1125. Game_Bullet.prototype.erase = function() {
  1126. this._characterName = '';
  1127. this._opacity = 0;
  1128. };
  1129.  
  1130. // 地形反射
  1131. Game_Bullet.prototype.reflect = function() {
  1132. this._x -= this._vx;
  1133. if (this.collideMap()) {
  1134. this._y -= this._vy;
  1135. this._vy = 0 - this._vy;
  1136. } else {
  1137. this._y -= this._vy;
  1138. this._vx = 0 - this._vx;
  1139. }
  1140. };
  1141.  
  1142. // 時限爆弾
  1143. Game_Bullet.prototype.timeBomb = function() {
  1144. var a = $dataSkills[this._skillId].meta['time_bomb'].split(' ').map(Number);
  1145. var space = Math.PI * 2 / a[0];
  1146. for (var i = 0; i < a[0]; i++) {
  1147. $gameMap.addBullet(this._x, this._y, 200 + i, Math.cos(a[1]) * a[2],
  1148. Math.sin(a[1]) * a[2], a[1], a[3], a[4], a[5],
  1149. this._enemyFlag, a[6], this._owner);
  1150. a[1] += space;
  1151. }
  1152. };
  1153.  
  1154. // 接触判定
  1155. Game_Bullet.prototype.updateCollide = function() {
  1156. if (this._mapCollide && this.collideMap()) {
  1157. if ($dataSkills[this._skillId].meta['map_reflect']) { // 弾反射の処理
  1158. this.reflect();
  1159. return false;
  1160. } else {
  1161. return true;
  1162. }
  1163. }
  1164. if (this._enemyFlag) {
  1165. if (this.collideCharacter($gamePlayer)) {
  1166. this.executeDamage($gamePlayer);
  1167. return true;
  1168. }
  1169. } else {
  1170. var targets = $gameMap.events();
  1171. for (i = 0; i < targets.length; i++) {
  1172. var character = targets[i];
  1173. if (this.collideCharacter(character)) {
  1174. this.executeDamage(character);
  1175. return true;
  1176. }
  1177. }
  1178. }
  1179. return false;
  1180. };
  1181.  
  1182. // 弾によるダメージ処理
  1183. Game_Bullet.prototype.executeDamage = function(character) {
  1184. if (character.isBattler() && this._owner.isBattler() && !character.isInvincible()) {
  1185. character.applySkill(this._owner, this._skillId);
  1186. if (character.battler()._result.isHit()) {
  1187. character.setupInvincible();
  1188. var animeId = $dataSkills[this._skillId].meta.bulletAnime;
  1189. if (!animeId) animeId = $dataSkills[this._skillId].meta.bullet_anime;
  1190. if (animeId) character.requestAnimation(+animeId);
  1191. }
  1192. }
  1193. };
  1194.  
  1195. // キャラクターと接触しているかどうかを返す
  1196. Game_Bullet.prototype.collideCharacter = function(character) {
  1197. if (!character.isNormalPriority()) return false;
  1198. return this._x - this._collideSize <= character._realX + character._collideW &&
  1199. this._x + this._collideSize >= character._realX - character._collideW &&
  1200. this._y - this._collideSize <= character._realY &&
  1201. this._y + this._collideSize >= character._realY - character._collideH;
  1202. };
  1203.  
  1204. // マップと接触しているかどうかを返す
  1205. Game_Bullet.prototype.collideMap = function() {
  1206. var x = Math.floor(this._x);
  1207. var y = Math.floor(this._y);
  1208. return !$gameMap.checkPassageBullet(x, y);
  1209. }
  1210.  
  1211. //-----------------------------------------------------------------------------
  1212. // Game_CharacterBase
  1213. //
  1214.  
  1215. // メンバ変数の初期化
  1216. var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
  1217. Game_CharacterBase.prototype.initMembers = function() {
  1218. _Game_CharacterBase_initMembers.call(this);
  1219. this._needsRefresh = false;
  1220. this._mapPopups = [];
  1221. this._vx = 0;
  1222. this._vy = 0;
  1223. this._vxPlus = 0;
  1224. this._lastY = 0;
  1225. this._lastSwim = false;
  1226. this._collideW = 0.375;
  1227. this._collideH = 0.75;
  1228. this._collideIds = [];
  1229. this._landingObject = null;
  1230. this._landingRegion = 0;
  1231. this._ladder = false;
  1232. this._lift = false;
  1233. this._lockCount = 0;
  1234. this._moveCount = 0;
  1235. this._jumpInput = 0;
  1236. this._dashCount = 0;
  1237. this._friction = 0;
  1238. this._moveSpeed = 0.05;
  1239. this._jumpSpeed = 0.14;
  1240. this._swimSpeed = 0.02;
  1241. this._dashSpeedX = 0.1;
  1242. this._dashSpeedY = 0.03;
  1243. this._ladderSpeed = 0.04;
  1244. this._accele = 0.003
  1245. this._ladderAccele = 0.003;
  1246. this._jumpInputTime = 0;
  1247. this._dashCountTime = 30;
  1248. this._swimJump = 0.1;
  1249. this._mulchJump = 1;
  1250. this._weight = 0;
  1251. this._gravity = actGravity;
  1252. this._fallGuard = 0;
  1253. this._invincibleCount = 0;
  1254. this._invincibleTime = 10;
  1255. this._carried = false;
  1256. this._carryingObject = null;
  1257. };
  1258.  
  1259. // バトラーの取得
  1260. Game_CharacterBase.prototype.battler = function() {
  1261. return null;
  1262. };
  1263.  
  1264. // バトラーが設定されているか
  1265. Game_CharacterBase.prototype.isBattler = function() {
  1266. return this.battler() !== null;
  1267. };
  1268.  
  1269. // 移動状態判定
  1270. Game_CharacterBase.prototype.isMoving = function() {
  1271. return this._moveCount > 0;
  1272. };
  1273.  
  1274. // ダッシュ状態判定
  1275. Game_CharacterBase.prototype.isDashing = function() {
  1276. return this._dashCount > 0;
  1277. };
  1278.  
  1279. // 地面に立っているか
  1280. Game_CharacterBase.prototype.isLanding = function() {
  1281. return this._landingObject !== null;
  1282. };
  1283.  
  1284. // およぎ状態判定
  1285. Game_CharacterBase.prototype.isSwimming = function() {
  1286. return this.terrainTag() === actWaterTerrainTag;
  1287. };
  1288.  
  1289. // 持ち上げられ状態判定
  1290. Game_CharacterBase.prototype.isCarried = function() {
  1291. return this._carried;
  1292. };
  1293.  
  1294. // ガード状態判定
  1295. Game_CharacterBase.prototype.isGuarding = function() {
  1296. if (!this.isBattler()) return false;
  1297. return this.battler().isStateAffected(actGuardStateId);
  1298. };
  1299.  
  1300. // ロック状態判定
  1301. Game_CharacterBase.prototype.isLocking = function() {
  1302. return this._lockCount > 0;
  1303. };
  1304.  
  1305. // 自分の重さで相手をはじき飛ばせるかチェック
  1306. Game_CharacterBase.prototype.checkFlickWeight = function(weight) {
  1307. return this._weight >= weight + actFlickWeight;
  1308. };
  1309.  
  1310. // 被弾後の無敵状態判定
  1311. Game_CharacterBase.prototype.isInvincible = function() {
  1312. return this._invincibleCount > 0;
  1313. };
  1314.  
  1315. // リフレッシュフラグを立てる
  1316. Game_CharacterBase.prototype.requestRefresh = function() {
  1317. this._needsRefresh = true;
  1318. };
  1319.  
  1320. // 移動速度のセット
  1321. Game_CharacterBase.prototype.setMoveSpeed = function(moveSpeed) {
  1322. this._moveSpeed = moveSpeed / 100 + 0.02;
  1323. };
  1324.  
  1325. // 無敵状態のセット
  1326. Game_CharacterBase.prototype.setupInvincible = function() {
  1327. this._invincibleCount = this._invincibleTime;
  1328. this.battler().requestEffect('blink');
  1329. };
  1330.  
  1331. // アニメーション間隔
  1332. Game_CharacterBase.prototype.animationWait = function() {
  1333. return (actStepAnimeConstantA - this._moveSpeed -
  1334. (this.isDashing() ? 0.01 : 0)) * actStepAnimeConstantB;
  1335. };
  1336.  
  1337. // フレーム更新
  1338. Game_CharacterBase.prototype.update = function() {
  1339. this.updateMove();
  1340. this.updateAnimation();
  1341. this.updateCollideIds();
  1342. if (this.isDashing()) this.updateDashCount();
  1343. if (this.isMoving()) {
  1344. this.updateMoveCount();
  1345. } else {
  1346. this.updateStop();
  1347. }
  1348. if (this.isSwimming() !== this._lastSwim) this.updateSwiming();
  1349. if (this._needsRefresh) this.refresh();
  1350. if (this.isInvincible()) this._invincibleCount--;
  1351. };
  1352.  
  1353. // 画面 X 座標の取得
  1354. Game_CharacterBase.prototype.screenX = function() {
  1355. var tw = $gameMap.tileWidth();
  1356. return Math.round(this.scrolledX() * tw);
  1357. };
  1358.  
  1359. // 画面 Y 座標の取得
  1360. Game_CharacterBase.prototype.screenY = function() {
  1361. var th = $gameMap.tileHeight();
  1362. return Math.round(this.scrolledY() * th);
  1363. };
  1364.  
  1365. // 移動の処理
  1366. Game_CharacterBase.prototype.updateMove = function() {
  1367. this.updateGravity();
  1368. this.updateFriction();
  1369. if (this._vx !== 0 || this._vxPlus !== 0) {
  1370. this._realX += this._vx + this._vxPlus;
  1371. if (this._through) {
  1372. this._realX = this._realX.clamp(0, $gameMap.width());
  1373. } else {
  1374. if (this._vx > 0) {
  1375. this.collideMapRight();
  1376. this.collideCharacterRight();
  1377. } else {
  1378. this.collideMapLeft();
  1379. this.collideCharacterLeft();
  1380. }
  1381. }
  1382. this._x = Math.floor(this._realX);
  1383. }
  1384. if (this._vy !== 0) {
  1385. this._landingObject = null;
  1386. this._realY += this._vy;
  1387. if (this._through) {
  1388. this._realY = this._realY.clamp(0, $gameMap.height());
  1389. } else {
  1390. if (this._vy > 0) {
  1391. this.collideMapDown();
  1392. this.collideCharacterDown();
  1393. } else {
  1394. this.collideMapUp();
  1395. this.collideCharacterUp();
  1396. }
  1397. }
  1398. this._y = Math.floor(this._realY);
  1399. this._lastY = Math.floor(this._realY + actTileMarginTop);
  1400. }
  1401. };
  1402.  
  1403. // 重力の処理
  1404. Game_CharacterBase.prototype.updateGravity = function() {
  1405. if (this._jumpPeak > this._realY && this._gravity > 0) {
  1406. this.resetPeak();
  1407. }
  1408. this._vy = Math.min(this._vy + this._gravity, this.maxFallSpeed());
  1409. };
  1410.  
  1411. // 最大落下速度の取得
  1412. Game_CharacterBase.prototype.maxFallSpeed = function() {
  1413. return this.isSwimming() ? 0.04 : 0.6;
  1414. };
  1415.  
  1416. // 摩擦の処理
  1417. Game_CharacterBase.prototype.updateFriction = function() {
  1418. if (this.isLanding()) {
  1419. if (Object.prototype.toString.call(this._landingObject) !== '[object Array]' &&
  1420. this._landingObject._lift) {
  1421. this._vxPlus = this._landingObject._vx;
  1422. }
  1423. } else {
  1424. this._vxPlus = 0;
  1425. }
  1426. };
  1427.  
  1428. // 移動カウントの処理
  1429. Game_CharacterBase.prototype.updateMoveCount = function() {
  1430. this._moveCount--;
  1431. if (this._moveCount == 0 && !this.isDashing()) {
  1432. this._vx = 0;
  1433. if (this._gravity == 0) this._vy = 0;
  1434. }
  1435. };
  1436.  
  1437. // ダッシュカウントの処理
  1438. Game_CharacterBase.prototype.updateDashCount = function() {
  1439. this._dashCount--;
  1440. };
  1441.  
  1442. // 衝突しているキャラクターの処理
  1443. Game_CharacterBase.prototype.updateCollideIds = function() {
  1444. for(var i = this._collideIds.length - 1; i >= 0; i--) {
  1445. var id = this._collideIds[i];
  1446. var character = id < 0 ? $gamePlayer : $gameMap.event(id);
  1447. if (!this.isCollide(character)) {
  1448. this._collideIds.splice(i, 1);
  1449. }
  1450. }
  1451. };
  1452.  
  1453. // キャラクターとの直線距離を返す
  1454. Game_CharacterBase.prototype.distFromCharacter = function(character) {
  1455. var x = this._realX - character._realX;
  1456. var y = this._realY - character._realY;
  1457. return Math.sqrt(x * x + y * y);
  1458. };
  1459.  
  1460. // マップとの衝突判定(上方向)
  1461. Game_CharacterBase.prototype.collideMapUp = function() {
  1462. var lx = Math.floor(this._realX - this._collideW);
  1463. var rx = Math.floor(this._realX + this._collideW);
  1464. var y = Math.floor(this._realY - this._collideH);
  1465. for (var x = lx; x <= rx; x++) {
  1466. if (!$gameMap.isPassable(x, y, 8)) {
  1467. this._realY = y + 1.001 + this._collideH;
  1468. this._vy = 0;
  1469. this._jumpInput = 0;
  1470. return;
  1471. }
  1472. }
  1473. };
  1474.  
  1475. // マップとの衝突判定(下方向)
  1476. Game_CharacterBase.prototype.collideMapDown = function() {
  1477. var y = Math.floor(this._realY + actTileMarginTop);
  1478. if (y === this._lastY) return;
  1479. var lx = Math.floor(this._realX - this._collideW);
  1480. var rx = Math.floor(this._realX + this._collideW);
  1481. for (var x = lx; x <= rx; x++) {
  1482. if (!$gameMap.isPassable(x, y, 2)) {
  1483. if (this._ladder && $gameMap.isLadder(x, y)) continue;
  1484. this._landingObject = [x, y];
  1485. this._landingRegion = $gameMap.regionId(x, y);
  1486. this.getLand(y - actTileMarginTop - 0.001);
  1487. return;
  1488. }
  1489. }
  1490. };
  1491.  
  1492. // マップとの衝突判定(左方向)
  1493. Game_CharacterBase.prototype.collideMapLeft = function() {
  1494. var ty = Math.floor(this._realY - this._collideH);
  1495. var by = Math.floor(this._realY + actTileMarginTop);
  1496. var x = Math.floor(this._realX - this._collideW);
  1497. for (var y = ty; y <= by; y++) {
  1498. if (!$gameMap.isPassable(x, y, 4)) {
  1499. this._realX = x + 1.001 + this._collideW;
  1500. this._vx = 0;
  1501. return;
  1502. }
  1503. }
  1504. };
  1505.  
  1506. // マップとの衝突判定(右方向)
  1507. Game_CharacterBase.prototype.collideMapRight = function() {
  1508. var ty = Math.floor(this._realY - this._collideH);
  1509. var by = Math.floor(this._realY + actTileMarginTop);
  1510. var x = Math.floor(this._realX + this._collideW);
  1511. for (var y = ty; y <= by; y++) {
  1512. if (!$gameMap.isPassable(x, y, 6)) {
  1513. this._realX = x - 0.001 - this._collideW;
  1514. this._vx = 0;
  1515. return;
  1516. }
  1517. }
  1518. };
  1519.  
  1520. // キャラクターとの衝突判定(上方向)
  1521. Game_CharacterBase.prototype.collideCharacterUp = function() {
  1522. var targets = this.collideTargets();
  1523. for (var i = 0; i < targets.length; i++) {
  1524. var character = targets[i];
  1525. if (this.isCollide(character) && !character.isCarried()) {
  1526. this.addCollideId(character.eventId());
  1527. if (this.isNormalPriority() && character.isNormalPriority()) {
  1528. if (this._lift) {
  1529. character._realY = this._realY - this._collideH - 0.001;
  1530. character._vy = this._vy;
  1531. character._landingObject = this;
  1532. character.resetJump();
  1533. } else {
  1534. this._realY = character._realY + this._collideH + 0.001;
  1535. this._vy = 0;
  1536. this._jumpInput = 0;
  1537. }
  1538. }
  1539. }
  1540. }
  1541. };
  1542.  
  1543. // キャラクターとの衝突判定(下方向)
  1544. Game_CharacterBase.prototype.collideCharacterDown = function() {
  1545. var targets = this.collideTargets();
  1546. for (var i = 0; i < targets.length; i++) {
  1547. var character = targets[i];
  1548. if (this.isCollide(character) && !character.isCarried()) {
  1549. this.addCollideId(character.eventId());
  1550. if (this.isNormalPriority() && character.isNormalPriority()) {
  1551. if (this._lift) {
  1552. character._realY = this._realY + character._collideH + 0.001;
  1553. character._jumpInput = 0;
  1554. character._vy = this._vy;
  1555. } else {
  1556. this._landingObject = character;
  1557. this._landingRegion = -1;
  1558. this.getLand(character._realY - character._collideH - 0.001);
  1559. }
  1560. }
  1561. }
  1562. }
  1563. };
  1564.  
  1565. // キャラクターとの衝突判定(左方向)
  1566. Game_CharacterBase.prototype.collideCharacterLeft = function() {
  1567. var targets = this.collideTargets();
  1568. for (var i = 0; i < targets.length; i++) {
  1569. var character = targets[i];
  1570. if (this.isCollide(character) && !character.isCarried()) {
  1571. this.addCollideId(character.eventId());
  1572. if (this.isNormalPriority() && character.isNormalPriority()) {
  1573. if (this._lift || this._ladder) {
  1574. character._realX = this._realX - this._collideW - 0.001 - character._collideW;
  1575. character._vx = this._vx;
  1576. } else {
  1577. if (this.isDashing() && this.checkFlickWeight(character._weight)) {
  1578. character.flick(this);
  1579. }
  1580. this._realX = character._realX + character._collideW + 0.001 + this._collideW;
  1581. this._vx = 0;
  1582. }
  1583. }
  1584. }
  1585. }
  1586. };
  1587.  
  1588. // キャラクターとの衝突判定(右方向)
  1589. Game_CharacterBase.prototype.collideCharacterRight = function() {
  1590. var targets = this.collideTargets();
  1591. for (var i = 0; i < targets.length; i++) {
  1592. var character = targets[i];
  1593. if (this.isCollide(character) && !character.isCarried()) {
  1594. this.addCollideId(character.eventId());
  1595. if (this.isNormalPriority() && character.isNormalPriority()) {
  1596. if (this._lift || this._ladder) {
  1597. character._realX = this._realX + this._collideW + 0.001 + character._collideW;
  1598. character._vx = this._vx;
  1599. } else {
  1600. if (this.isDashing() && this.checkFlickWeight(character._weight)) {
  1601. character.flick(this);
  1602. }
  1603. this._realX = character._realX - character._collideW - 0.001 - this._collideW;
  1604. this._vx = 0;
  1605. }
  1606. }
  1607. }
  1608. }
  1609. };
  1610.  
  1611. // キャラクターとの衝突判定
  1612. Game_CharacterBase.prototype.isCollide = function(character) {
  1613. if (this.eventId() === character.eventId()) return false;
  1614. return this._realX - this._collideW <= character._realX + character._collideW &&
  1615. this._realX + this._collideW >= character._realX - character._collideW &&
  1616. this._realY - this._collideH <= character._realY &&
  1617. this._realY >= character._realY - character._collideH;
  1618. };
  1619.  
  1620. // 衝突判定を行う対象を返す
  1621. Game_CharacterBase.prototype.collideTargets = function() {
  1622. return $gameMap.events().concat($gamePlayer);
  1623. };
  1624.  
  1625. // 衝突している対象を追加する
  1626. Game_CharacterBase.prototype.addCollideId = function(id) {
  1627. if (this._collideIds.indexOf(id) == -1) {
  1628. this._collideIds.push(id);
  1629. this.checkEventTriggerCollide(id);
  1630. }
  1631. };
  1632.  
  1633. // 地面に降りる
  1634. Game_CharacterBase.prototype.getLand = function(y) {
  1635. this._realY = y;
  1636. this._vy = 0;
  1637. this.resetJump();
  1638. if (this._ladder) this.getOffLadder();
  1639. this.updateDamageFall();
  1640. };
  1641.  
  1642. // ジャンプカウントのリセット
  1643. Game_CharacterBase.prototype.resetJump = function() {
  1644. this._jumpCount = this._mulchJump;
  1645. this._jumpInput = 0;
  1646. };
  1647.  
  1648. // 落下ダメージの処理
  1649. Game_CharacterBase.prototype.updateDamageFall = function() {
  1650. if (this.isBattler() && this._fallGuard < 100) {
  1651. var n = this._realY - this._jumpPeak - actDamageFallHeight;
  1652. if (n > 0 && !this.isSwimming()) {
  1653. var rate = 100 - this._fallGuard;
  1654. var damage = Math.floor(Math.max(n * actDamageFallRate * rate / 100), 1);
  1655. this.battler().clearResult();
  1656. this.battler().gainHp(-damage);
  1657. }
  1658. }
  1659. this.resetPeak();
  1660. };
  1661.  
  1662. // 最高到達点のリセット
  1663. Game_CharacterBase.prototype.resetPeak = function() {
  1664. this._jumpPeak = this._realY;
  1665. };
  1666.  
  1667. // 泳ぎ状態の更新
  1668. Game_CharacterBase.prototype.updateSwiming = function() {
  1669. this._lastSwim = !this._lastSwim;
  1670. };
  1671.  
  1672. // まっすぐに移動
  1673. Game_CharacterBase.prototype.moveStraight = function(d) {
  1674. this.setDirection(d);
  1675. this._moveCount = Math.floor(1 / this._moveSpeed);
  1676. if (d === 2) {
  1677. this._vy = this._moveSpeed;
  1678. } else if (d === 4) {
  1679. this._vx = -this._moveSpeed;
  1680. } else if (d === 6) {
  1681. this._vx = this._moveSpeed;
  1682. } else {
  1683. this._vy = -this._moveSpeed;
  1684. }
  1685. };
  1686.  
  1687. // ななめに移動
  1688. Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
  1689. this.setDirection(horz);
  1690. this._moveCount = Math.floor(1 / this._moveSpeed);
  1691. this._vx = horz === 4 ? -this._moveSpeed : this._moveSpeed;
  1692. this._vy = vert === 8 ? -this._moveSpeed : this._moveSpeed;
  1693. };
  1694.  
  1695. // ジャンプ
  1696. Game_CharacterBase.prototype.jump = function(xPlus, yPlus) {
  1697. if (this._jumpCount <= 0) return;
  1698. this._jumpCount--;
  1699. if (xPlus < 0) {
  1700. this.setDirection(4);
  1701. var speed = this._moveSpeed / 100 + 0.02;
  1702. this._moveCount = Math.floor(1 / speed);
  1703. this._vx = -speed;
  1704. } else if (xPlus > 0) {
  1705. this.setDirection(6);
  1706. var speed = this._moveSpeed / 100 + 0.02;
  1707. this._moveCount = Math.floor(1 / speed);
  1708. this._vx = speed;
  1709. }
  1710. if (yPlus != 0) {
  1711. this._vy = yPlus / 100;
  1712. } else {
  1713. this._vy = this.isSwimming() ? -this._swimJump : -this._jumpSpeed;
  1714. }
  1715. this.resetStopCount();
  1716. this.straighten();
  1717. };
  1718.  
  1719. // ダッシュ(方向指定)
  1720. Game_CharacterBase.prototype.dashFromDirection = function(direction) {
  1721. var vx = direction === 4 ? -this._dashSpeedX : this._dashSpeedX;
  1722. var vy = -this._dashSpeedY;
  1723. this.dash(vx, vy);
  1724. };
  1725.  
  1726. // ダッシュ(速度指定)
  1727. Game_CharacterBase.prototype.dash = function(vx, vy) {
  1728. this._vx = vx;
  1729. this._vy = vy;
  1730. this._dashCount = this._dashCountTime;
  1731. this._moveCount = this._dashCount / 2;
  1732. this.resetStopCount();
  1733. this.straighten();
  1734. };
  1735.  
  1736. // はじかれ
  1737. Game_CharacterBase.prototype.flick = function(user) {
  1738. if (actFlickSkill > 0 && user.isBattler() && this.isBattler()) {
  1739. this.applySkill(user, actFlickSkill);
  1740. }
  1741. this._vx = user._vx;
  1742. var n = 1 + (user._weight - this._weight - actFlickWeight) / 2;
  1743. this._moveCount = Math.floor(n / Math.abs(this._vx));
  1744. AudioManager.playSe(actSeFlick);
  1745. };
  1746.  
  1747. // 持ち上げられる
  1748. Game_CharacterBase.prototype.carry = function() {
  1749. this._carried = true;
  1750. this._through = true;
  1751. };
  1752.  
  1753. // 投げられる
  1754. Game_CharacterBase.prototype.hurl = function() {
  1755. this._carried = false;
  1756. this._through = false;
  1757. this._lastSwim = this.isSwimming();
  1758. };
  1759.  
  1760. // スキルの適用
  1761. Game_CharacterBase.prototype.applySkill = function(user, skillId) {
  1762. user.battler().clearActions();
  1763. var action = new Game_Action(user.battler());
  1764. action.setSkill(skillId);
  1765. user.battler().setAction(0, action);
  1766. user.battler().action(0).apply(this.battler());
  1767. };
  1768.  
  1769. // ダメージの処理
  1770. Game_CharacterBase.prototype.updateDamage = function() {
  1771. var battler = this.battler();
  1772. battler.clearResult();
  1773. if (battler._actionResult.hpDamage != 0) {
  1774. battler._actionResult.hpAffected = true;
  1775. battler._actionResult.missed = false;
  1776. battler._actionResult.evaded = false;
  1777. this.damaged();
  1778. if (battler._actionResult.hpDamage > 0) {
  1779. battler.playDamageSe();
  1780. } else {
  1781. battler.playRecovarySe();
  1782. }
  1783. } else if (battler._actionResult.missed ||
  1784. battler._actionResult.evaded) {
  1785. this.damaged();
  1786. battler.playMissSe();
  1787. }
  1788. if (battler._actionResult.isStatusAffected()) {
  1789. this.requestRefresh();
  1790. }
  1791. };
  1792.  
  1793. // ダメージ後の処理
  1794. Game_CharacterBase.prototype.damaged = function() {
  1795. var battler = this.battler();
  1796. // if (this.isLocking()) {
  1797. // return;
  1798. // }
  1799. battler.startDamagePopup();
  1800. if (battler._actionResult.isStateAdded(battler.deathStateId())) {
  1801. this.battlerDead();
  1802. }
  1803. };
  1804.  
  1805. // 座標のセット
  1806. Game_CharacterBase.prototype.setPosition = function(x, y) {
  1807. this._x = Math.floor(x);
  1808. this._y = Math.floor(y);
  1809. this._realX = x;
  1810. this._realY = y;
  1811. };
  1812.  
  1813. // 指定位置へ移動
  1814. var _Game_CharacterBase_locate = Game_CharacterBase.prototype.locate;
  1815. Game_CharacterBase.prototype.locate = function(x, y) {
  1816. _Game_CharacterBase_locate.call(this, x, y);
  1817. this._vx = 0;
  1818. this._vy = 0;
  1819. this._lastY = -1;
  1820. this._lastSwim = this.isSwimming();
  1821. this._collideIds = [];
  1822. this.resetPeak();
  1823. this._carried = false;
  1824. this._carryingObject = null;
  1825. };
  1826.  
  1827. // マップ用ポップアップのセット
  1828. Game_CharacterBase.prototype.setMapPopup = function(text, color, ry, dy, g) {
  1829. var popup = {};
  1830. popup.text = text;
  1831. popup.color = color;
  1832. popup.ry = ry == null ? -40 : ry;
  1833. popup.dy = dy == null ? -4 : dy;
  1834. popup.g = g == null ? 0.5 : g;
  1835. this._mapPopups.push(popup);
  1836. };
  1837.  
  1838. // マップ用ポップアップがたまっているかどうかを返す
  1839. Game_CharacterBase.prototype.isMapPopupExist = function() {
  1840. return this._mapPopups.length > 0;
  1841. };
  1842.  
  1843. // マップ用ポップアップをひとつ返す
  1844. Game_CharacterBase.prototype.getMapPopup = function() {
  1845. return this._mapPopups.shift();
  1846. };
  1847.  
  1848. //-----------------------------------------------------------------------------
  1849. // Game_Character
  1850. //
  1851.  
  1852. // ランダムに移動
  1853. Game_Character.prototype.moveRandom = function() {
  1854. if (this._gravity == 0) {
  1855. this.moveStraight(2 + Math.randomInt(4) * 2);
  1856. } else {
  1857. this.moveStraight(4 + Math.randomInt(2) * 2);
  1858. }
  1859. };
  1860.  
  1861. // キャラクターの方を向く
  1862. Game_Character.prototype.turnTowardCharacter = function(character) {
  1863. var sx = this._realX - character._realX;
  1864. var sy = this._realY - character._realY;
  1865. if (Math.abs(sx) > Math.abs(sy)) {
  1866. this.setDirection(sx > 0 ? 4 : 6);
  1867. } else if (sy !== 0) {
  1868. this.setDirection(sy > 0 ? 8 : 2);
  1869. }
  1870. };
  1871.  
  1872. // キャラクターの反対を向く
  1873. Game_Character.prototype.turnAwayFromCharacter = function(character) {
  1874. var sx = this._realX - character._realX;
  1875. var sy = this._realY - character._realY;
  1876. if (Math.abs(sx) > Math.abs(sy)) {
  1877. this.setDirection(sx > 0 ? 6 : 4);
  1878. } else if (sy !== 0) {
  1879. this.setDirection(sy > 0 ? 2 : 8);
  1880. }
  1881. };
  1882.  
  1883. // キャラクターのいる方向(角度)を取得
  1884. Game_Character.prototype.angleToCharacter = function(character) {
  1885. return Math.atan2(character._realY - character._collideH / 2 - (this._realY - this._collideH / 2), character._realX - this._realX);
  1886. };
  1887.  
  1888. // プレイヤーのいる方向(角度)を取得
  1889. Game_Character.prototype.angleToPlayer = function() {
  1890. return this.angleToCharacter($gamePlayer);
  1891. };
  1892.  
  1893. // n方向ショット
  1894. Game_Character.prototype.nwayShot = function(n, space, angle, speed, count, type, index, skillId) {
  1895. angle = angle - (space * (n - 1) / 2);
  1896. for (var i = 0; i < n; i++) {
  1897. $gameMap.addBullet(this._realX, this._realY - this._collideH / 2, 200 + i,
  1898. Math.cos(angle) * speed, Math.sin(angle) * speed, angle, count, type, index,
  1899. this.battler().isEnemy(), skillId, this);
  1900. angle += space;
  1901. }
  1902. };
  1903.  
  1904. // 自機狙いn方向ショット
  1905. Game_Character.prototype.nwayAim = function(n, space, angle, speed, count, type, index, skillId) {
  1906. var a = angle + this.angleToPlayer();
  1907. this.nwayShot(n, space, a, speed, count, type, index, skillId);
  1908. };
  1909.  
  1910. // 全方位ショット
  1911. Game_Character.prototype.nallShot = function(n, angle, speed, count, type, index, skillId) {
  1912. var space = Math.PI * 2 / n;
  1913. for (var i = 0; i < n; i++) {
  1914. $gameMap.addBullet(this._realX, this._realY - this._collideH / 2, 200 + i,
  1915. Math.cos(angle) * speed, Math.sin(angle) * speed, angle, count, type, index,
  1916. this.battler().isEnemy(), skillId, this);
  1917. angle += space;
  1918. }
  1919. };
  1920.  
  1921. // 自機狙い全方位ショット
  1922. Game_Character.prototype.nallAim = function(n, angle, speed, count, type, index, skillId) {
  1923. var a = angle + this.angleToPlayer()
  1924. this.nallShot(n, a, speed, count, type, index, skillId);
  1925. };
  1926.  
  1927. //-----------------------------------------------------------------------------
  1928. // Game_Player
  1929. //
  1930.  
  1931. // メンバ変数の初期化
  1932. var _Game_Player_initMembers = Game_Player.prototype.initMembers;
  1933. Game_Player.prototype.initMembers = function() {
  1934. _Game_Player_initMembers.call(this);
  1935. this._realSteps = 0;
  1936. this._carryPower = 0;
  1937. this._wallJump = false;
  1938. this._dashDelay = 0;
  1939. this._dashDelayTime = 30;
  1940. this._dashMpCost = 0;
  1941. this._guardInput = 0;
  1942. this._guardSpeed = 0;
  1943. this._shotWay = 0;
  1944. this._shotSpace = 0.2;
  1945. this._shotSpeed = 0.1;
  1946. this._shotCountTime = 30;
  1947. this._shotDelayTime = 10;
  1948. this._shotType = 1;
  1949. this._shotIndex = 0;
  1950. this._shotSkillId = 0;
  1951. this._shotSeName = "";
  1952. this._shotSeVolume = 0;
  1953. this._shotSePitch = 0;
  1954. this._carryingObject = null;
  1955. };
  1956.  
  1957. // 画面中央の X 座標
  1958. Game_Player.prototype.centerX = function() {
  1959. return (Graphics.width / $gameMap.tileWidth() - 1) / 2.0 + 0.5;
  1960. };
  1961.  
  1962. // 画面中央の Y 座標
  1963. Game_Player.prototype.centerY = function() {
  1964. return (Graphics.height / $gameMap.tileHeight() - 1) / 2.0 + 0.5;
  1965. };
  1966.  
  1967. // イベントIDを返す
  1968. Game_Player.prototype.eventId = function() {
  1969. return -1;
  1970. };
  1971.  
  1972. // アクターの取得
  1973. Game_Player.prototype.actor = function() {
  1974. return $gameParty.leader();
  1975. };
  1976.  
  1977. // バトラーを返す
  1978. Game_Player.prototype.battler = function() {
  1979. return this.actor();
  1980. };
  1981.  
  1982. // バトラーが設定されているか
  1983. Game_Player.prototype.isBattler = function() {
  1984. return this.actor() ? true : false;
  1985. };
  1986.  
  1987. // ダッシュ状態判定
  1988. Game_Player.prototype.isDashing = function() {
  1989. return this._dashCount > 0;
  1990. };
  1991.  
  1992. // 持ち上げ状態の取得
  1993. Game_Player.prototype.isCarrying = function() {
  1994. return this._carryingObject !== null;
  1995. };
  1996.  
  1997. // 衝突判定を行う対象を返す
  1998. Game_Player.prototype.collideTargets = function() {
  1999. return $gameMap.events();
  2000. };
  2001.  
  2002. // はしごにつかまる
  2003. Game_Player.prototype.getOnLadder = function(downFlag) {
  2004. this._ladder = true;
  2005. this._landingObject = null;
  2006. this.setDirection(8);
  2007. var lastRealX = this._realX;
  2008. this._realX = Math.floor(this._realX) + 0.5;
  2009. if (downFlag) this._realY += 0.04;
  2010. this._lastY = Math.floor(this._realY + actTileMarginTop);
  2011. if (lastRealX < this._realX) {
  2012. this.collideCharacterLeft();
  2013. } else if (lastRealX > this._realX) {
  2014. this.collideCharacterRight();
  2015. }
  2016. this._vx = 0;
  2017. this._vy = 0;
  2018. this.resetJump();
  2019. this.resetPeak();
  2020. };
  2021.  
  2022. // はしごから降りる
  2023. Game_Player.prototype.getOffLadder = function() {
  2024. this._ladder = false;
  2025. this.setDirection(Input.isPressed('left') ? 4 : 6);
  2026. };
  2027.  
  2028. // 衝突したイベントの起動
  2029. Game_Player.prototype.checkEventTriggerCollide = function(id) {
  2030. if (!$gameMap.isEventRunning()) {
  2031. var event = $gameMap.event(id);
  2032. // if (event.isTriggerIn([1, 2]) && event.isNormalPriority() === normal) {
  2033. if (event.isTriggerIn([1, 2])) {
  2034. event.start();
  2035. }
  2036. }
  2037. };
  2038.  
  2039. // フレーム更新
  2040. Game_Player.prototype.update = function(sceneActive) {
  2041. var lastScrolledX = this.scrolledX();
  2042. var lastScrolledY = this.scrolledY();
  2043. if (this.isLocking()) {
  2044. this.updateLock();
  2045. } else {
  2046. if (sceneActive && this.canMove()) this.updateInput();
  2047. var lastRealX = this._realX;
  2048. var lastRealY = this._realY;
  2049. Game_Character.prototype.update.call(this);
  2050. this.updateSteps(lastRealX, lastRealY);
  2051. }
  2052. this.updateScroll(lastScrolledX, lastScrolledY);
  2053. if (this.isBattler()) this.updateDamage();
  2054. // this._followers.update();
  2055. };
  2056.  
  2057. // 入力の処理
  2058. Game_Player.prototype.updateInput = function() {
  2059. this.carryByInput();
  2060. if (this.isCarrying()) this._shotDelay = 1;
  2061. this.attackByInput();
  2062. this.changeByInput();
  2063. this.moveByInput();
  2064. this.jumpByInput();
  2065. this.dashByInput();
  2066. this.guardByInput();
  2067. this.triggerButtonAction();
  2068. };
  2069.  
  2070. // 重力の処理
  2071. Game_Player.prototype.updateGravity = function() {
  2072. if (this._ladder || (this._jumpPeak > this._realY && this._gravity > 0)) {
  2073. this.resetPeak();
  2074. if (this._ladder) return;
  2075. }
  2076. Game_Character.prototype.updateGravity.call(this);
  2077. };
  2078.  
  2079. // 摩擦の処理
  2080. Game_Player.prototype.updateFriction = function() {
  2081. Game_Character.prototype.updateFriction.call(this);
  2082. this._friction = 0;
  2083. if (this._ladder) {
  2084. var n = this.isMoving() ? 0 : actFriction;
  2085. if (this._vy !== 0) {
  2086. this._vy = this._vy > 0 ? Math.max(this._vy - n, 0) : Math.min(this._vy + n, 0);
  2087. }
  2088. } else {
  2089. // ダッシュ状態でなければ移動速度を超えないように調整する
  2090. if (!this.isDashing()) {
  2091. var n = this.isSwimming() ? this._swimSpeed : this._moveSpeed;
  2092. if (this._vx < -n) {
  2093. this._vx = Math.min(this._vx + 0.005, -n);
  2094. } else if (this._vx > n) {
  2095. this._vx = Math.max(this._vx - 0.005, n);
  2096. }
  2097. }
  2098. if (this.isLanding()) {
  2099. var n = actFriction;
  2100. var speed = this._moveSpeed;
  2101. if (this.isGuarding()) speed = speed * actGuardMoveRate / 100;
  2102. switch (this._landingRegion) {
  2103. case actSlipFloorRegion:
  2104. this._friction = 0.0025;
  2105. return;
  2106. case actRoughFloorRegion:
  2107. if (Math.abs(this._vx) > speed / 2) {
  2108. this._vx = this._vx > 0 ? speed / 2 : -speed / 2;
  2109. }
  2110. break;
  2111. case actMarshFloorRegion:
  2112. this._vx = 0;
  2113. return;
  2114. default:
  2115. if (this.isGuarding() && Math.abs(this._vx) > speed) {
  2116. this._vx = this._vx > 0 ? speed : -speed;
  2117. }
  2118. break;
  2119. }
  2120. if (!this.isMoving()) {
  2121. if (this._vx > 0) {
  2122. this._vx = Math.max(this._vx - n, 0);
  2123. } else if (this._vx < 0) {
  2124. this._vx = Math.min(this._vx + n, 0);
  2125. }
  2126. }
  2127. }
  2128. }
  2129. };
  2130.  
  2131. // 移動カウントの処理
  2132. Game_Player.prototype.updateMoveCount = function() {
  2133. this._moveCount--;
  2134. };
  2135.  
  2136. // ロック状態の処理
  2137. Game_Player.prototype.updateLock = function() {
  2138. this._lockCount--;
  2139. if (this._lockCount === 0 && this.battler().isDead()) {
  2140. this.changeMember();
  2141. }
  2142. };
  2143.  
  2144. // ボタン操作による持ち上げ(投げ)
  2145. Game_Player.prototype.carryByInput = function() {
  2146. if (this.isCarrying()) {
  2147. if (Input.isTriggered('attack')) {
  2148. var target = this._carryingObject;
  2149. var lastRealX = target._realX;
  2150. target.collideMapLeft();
  2151. if (lastRealX !== target._realX) {
  2152. target._realX = lastRealX;
  2153. return;
  2154. }
  2155. target.collideMapRight();
  2156. if (lastRealX !== target._realX) {
  2157. target._realX = lastRealX;
  2158. return;
  2159. }
  2160. var lastRealY = target._realY;
  2161. target.collideMapUp();
  2162. if (lastRealY !== target._realY) {
  2163. target._realY = lastRealY;
  2164. return;
  2165. }
  2166. target.collideMapDown();
  2167. if (lastRealY !== target._realY) {
  2168. target._realY = lastRealY;
  2169. return;
  2170. }
  2171. var targets = target.collideTargets();
  2172. for (var i = 0; i < targets.length; i++) {
  2173. var character = targets[i];
  2174. if (!character._through && target.isCollide(character)) return;
  2175. }
  2176. this.executeHurl();
  2177. }
  2178. } else {
  2179. if (Input.isTriggered('attack') && Input.isPressed('down') &&
  2180. this.isLanding() && !this.isGuarding() &&
  2181. Object.prototype.toString.call(this._landingObject) !== '[object Array]') {
  2182. if (this._carryPower >= this._landingObject._weight) {
  2183. this.executeCarry();
  2184. } else {
  2185. this._shotDelay = 1;
  2186. }
  2187. }
  2188. }
  2189. };
  2190.  
  2191. // 持ち上げる
  2192. Game_Player.prototype.executeCarry = function() {
  2193. this._carryingObject = $gameMap.event(this._landingObject.eventId());
  2194. this._carryingObject.carry();
  2195. this._landingObject = null;
  2196. AudioManager.playSe(actSeCarry);
  2197. };
  2198.  
  2199. // 投げる
  2200. Game_Player.prototype.executeHurl = function() {
  2201. this._carryingObject.hurl();
  2202. if (Input.isPressed('up')) { // 上を押しながら投げた
  2203. this._carryingObject.dash(this._vx, -0.14);
  2204. } else if (Input.isPressed('down')) { // 下を押しながら投げた
  2205. if (this._direction === 4) {
  2206. this._carryingObject.dash(-0.05, -0.02);
  2207. } else if (this._direction === 6) {
  2208. this._carryingObject.dash(0.05, -0.02);
  2209. } else {
  2210. this._carryingObject.dash(0, -0.02);
  2211. }
  2212. } else { // 左右いずれかを押しながら、またはどちらも押さずに投げた
  2213. if (this._direction === 4 || Input.isPressed('left')) {
  2214. this._carryingObject.dash(-0.14, -0.03)
  2215. } else if (this._direction === 6 || Input.isPressed('right')) {
  2216. this._carryingObject.dash(0.14, -0.03)
  2217. } else {
  2218. this._carryingObject.dash(0, 0);
  2219. }
  2220. }
  2221. this._carryingObject = null;
  2222. this._shotDelay = 1;
  2223. AudioManager.playSe(actSeHurl);
  2224. };
  2225.  
  2226. // ボタン入力による攻撃
  2227. Game_Player.prototype.attackByInput = function() {
  2228. if (this._shotDelay > 0) {
  2229. this._shotDelay--;
  2230. this.removeGuard(); // 防御状態の解除
  2231. } else {
  2232. var n = this._shotWay;
  2233. if (Input.isTriggered('attack') && n > 0) {
  2234. var space = this._shotSpace;
  2235. var speed = this._shotSpeed;
  2236. var count = this._shotCountTime;
  2237. var type = this._shotType;
  2238. var index = this._shotIndex;
  2239. if (this._shotSkillId > 0) {
  2240. var skillId = this._shotSkillId;
  2241. } else {
  2242. var skillId = this.battler().attackSkillId();
  2243. }
  2244. if (this._ladder) {
  2245. if (Input.isPressed('left')) {
  2246. this.setDirection(4);
  2247. } else if (Input.isPressed('right')) {
  2248. this.setDirection(6);
  2249. }
  2250. }
  2251. var pan = 0;
  2252. if (this._direction == 4) {
  2253. this.nwayShot(n, space, Math.PI, speed, count, type, index, skillId)
  2254. pan = -10;
  2255. } else if (this._direction == 6){
  2256. this.nwayShot(n, space, 0, speed, count, type, index, skillId)
  2257. pan = 10;
  2258. } else {
  2259. this.nwayShot(n, space, Math.PI * 1.5, speed, count, type, index, skillId)
  2260. }
  2261. this._shotDelay = this._shotDelayTime;
  2262. if (actWeaponSprite) this.battler().performAttack();
  2263. AudioManager.playSe({name:this._shotSeName, pitch:this._shotSePitch,
  2264. volume:this._shotSeVolume, pan:pan});
  2265. this.removeGuard(); // 防御状態の解除
  2266. }
  2267. }
  2268. };
  2269.  
  2270. // ボタン入力による操作アクター変更
  2271. Game_Player.prototype.changeByInput = function() {
  2272. if (this._carryingObject) return;
  2273. if (Input.isTriggered('pageup')) {
  2274. this.changeMember(true);
  2275. } else if (Input.isTriggered('pagedown')) {
  2276. this.changeMember(false);
  2277. }
  2278. };
  2279.  
  2280. // 操作メンバーの切り替え
  2281. Game_Player.prototype.changeMember = function(reverse) {
  2282. var startActorId = this.actor().actorId();
  2283. if (reverse) {
  2284. $gameParty.backSlideActor();
  2285. } else {
  2286. $gameParty.frontSlideActor();
  2287. }
  2288. if (!this.isChangeMemberEnable()) $gameParty.sortActor(startActorId);
  2289. if (startActorId !== this.actor().actorId()) {
  2290. this.removeGuard(); // 防御状態の解除
  2291. this.battler().requestEffect('appear');
  2292. AudioManager.playSe(actSeChange);
  2293. $gameMap.requestRefresh();
  2294. }
  2295. };
  2296.  
  2297. // 指定したアクターに切り替えが可能かどうか
  2298. Game_Player.prototype.isChangeMemberEnable = function() {
  2299. var actor = this.actor();
  2300. if (actor.isDead()) return false;
  2301. var targets = this.collideTargets();
  2302. for (var i = 0; i < targets.length; i++) {
  2303. var character = targets[i];
  2304. if (character.isNormalPriority() && this.isCollide(character)) return false;
  2305. }
  2306. var lx = Math.floor(this._realX - this._collideW);
  2307. var rx = Math.floor(this._realX + this._collideW);
  2308. var ty = Math.floor(this._realY - this._collideH);
  2309. var by = Math.floor(this._realY + actTileMarginTop);
  2310. for (var x = lx; x <= rx; x++) {
  2311. if (!$gameMap.isPassable(x, ty, 8)) return false;
  2312. if (!$gameMap.isPassable(x, by, 2)) return false;
  2313. }
  2314. for (var y = ty; y <= by; y++) {
  2315. if (!$gameMap.isPassable(lx, y, 4)) return false;
  2316. if (!$gameMap.isPassable(rx, y, 6)) return false;
  2317. }
  2318. return true;
  2319. };
  2320.  
  2321. // 方向ボタン入力による移動処理
  2322. Game_Player.prototype.moveByInput = function() {
  2323. if (this._ladder) {
  2324. if (Input.isPressed('up')) {
  2325. this.setDirection(8);
  2326. this._vy = Math.max(this._vy - this._ladderAccele, -this._ladderSpeed);
  2327. this._moveCount = 4;
  2328. this.resetStopCount();
  2329. } else if (Input.isPressed('down')) {
  2330. this.setDirection(8);
  2331. this._vy = Math.min(this._vy + this._ladderAccele, this._ladderSpeed);
  2332. this._moveCount = 4;
  2333. this.resetStopCount();
  2334. }
  2335. if (!this.isCollideLadder(false)) {
  2336. this.getOffLadder();
  2337. }
  2338. } else {
  2339. if (!this.isDashing()) {
  2340. if (Input.isPressed('left')) {
  2341. var speed = this.isGuarding() ? -this._moveSpeed * actGuardMoveRate / 100 : -this._moveSpeed;
  2342. this.setDirection(4);
  2343. if (this._vx > speed) {
  2344. var accele = Math.max(this._accele - this._friction, 0);
  2345. this._vx = Math.max(this._vx - accele, speed);
  2346. }
  2347. this._moveCount = 4;
  2348. } else if (Input.isPressed('right')) {
  2349. var speed = this.isGuarding() ? this._moveSpeed * actGuardMoveRate / 100 : this._moveSpeed;
  2350. this.setDirection(6);
  2351. if (this._vx < speed) {
  2352. var accele = Math.max(this._accele - this._friction, 0);
  2353. this._vx = Math.min(this._vx + accele, speed);
  2354. }
  2355. this._moveCount = 4;
  2356. }
  2357. }
  2358. if (Input.isPressed('up')) {
  2359. if (this.isCollideLadder(false)) this.getOnLadder(false);
  2360. } else if (Input.isPressed('down')) {
  2361. if (this.isCollideLadder(true)) this.getOnLadder(true);
  2362. }
  2363. }
  2364. };
  2365.  
  2366. // ボタン入力によるジャンプ処理
  2367. Game_Player.prototype.jumpByInput = function() {
  2368. if (this._jumpInput > 0) {
  2369. this._jumpInput--;
  2370. if (Input.isPressed('jump')) {
  2371. this._vy = -this._jumpSpeed;
  2372. } else {
  2373. this._jumpInput = 0;
  2374. }
  2375. }
  2376. if (Input.isTriggered('jump')) {
  2377. if (this.isSwimming()) {
  2378. this.resetJump();
  2379. this._jumpCount--;
  2380. } else if (this._jumpCount > 0) {
  2381. this._jumpCount--;
  2382. } else {
  2383. if (!this._wallJump) return;
  2384. if (this._direction == 4) {
  2385. var x = Math.floor(this._realX - this._collideW - 0.16);
  2386. } else {
  2387. var x = Math.floor(this._realX + this._collideW + 0.16);
  2388. }
  2389. var y = Math.floor(this._realY);
  2390. if (!$gameMap.canWallJump(x, y, this._direction)) return;
  2391. this.wallJump();
  2392. }
  2393. if (this._ladder) {
  2394. this.getOffLadder();
  2395. if (Input.isPressed('down')) return;
  2396. }
  2397. this._jumpInput = this._jumpInputTime;
  2398. if (this.isDashing()) {
  2399. this._dashCount = this._dashCountTime;
  2400. this._vx = this._direction == 4 ? -this._dashSpeedX : this._dashSpeedX
  2401. }
  2402. this._vy = this.isSwimming() ? -this._swimJump : -this._jumpSpeed;
  2403. this.resetStopCount();
  2404. this.straighten();
  2405. AudioManager.playSe(actSeJump);
  2406. }
  2407. };
  2408.  
  2409. // 壁ジャンプの X 方向処理
  2410. Game_Player.prototype.wallJump = function() {
  2411. this._vx = this._direction == 4 ? this._moveSpeed : -this._moveSpeed;
  2412. this.setDirection(this.reverseDir(this._direction));
  2413. this.resetPeak();
  2414. };
  2415.  
  2416. // ボタン入力によるダッシュ処理
  2417. Game_Player.prototype.dashByInput = function() {
  2418. if (this._dashDelay > 0) {
  2419. this._dashDelay--;
  2420. this.removeGuard(); // 防御状態の解除
  2421. } else {
  2422. var battler = this.actor();
  2423. if (Input.isTriggered('dash') && !this.isSwimming() &&
  2424. !$gameMap.isDashDisabled() && battler.mp >= this._dashMpCost) {
  2425. if (this._ladder) {
  2426. this.getOffLadder()
  2427. if (Input.isPressed('left')) {
  2428. this.setDirection(4);
  2429. } else if (Input.isPressed('right')) {
  2430. this.setDirection(6);
  2431. }
  2432. } else {
  2433. if (!this._direction == 4) {
  2434. this.setDirection(6);
  2435. }
  2436. }
  2437. this.dashFromDirection(this._direction);
  2438. this._dashDelay = this._dashDelayTime;
  2439. AudioManager.playSe(actSeDash);
  2440. this.removeGuard(); // 防御状態の解除
  2441. if (this._dashMpCost > 0) battler.gainMp(-this._dashMpCost);
  2442. }
  2443. }
  2444. };
  2445.  
  2446. // ボタン入力によるガード処理
  2447. Game_Player.prototype.guardByInput = function() {
  2448. if (!actGuardStateId) return;
  2449. if (Input.isPressed('down')) {
  2450. if (this.isCarrying() || this._ladder || !this.isLanding() || this.isSwimming()) {
  2451. this.removeGuard();
  2452. return;
  2453. }
  2454. var battler = this.actor();
  2455. if (battler && !battler.isStateAffected(actGuardStateId)) {
  2456. this._guardInput += this._guardSpeed;
  2457. if (this._guardInput > 600) {
  2458. battler.addState(actGuardStateId);
  2459. AudioManager.playSe(actSeGuard);
  2460. }
  2461. }
  2462. } else {
  2463. this.removeGuard();
  2464. }
  2465. };
  2466.  
  2467. // ガードの解除
  2468. Game_Player.prototype.removeGuard = function() {
  2469. var battler = this.actor();
  2470. this._guardInput = 0;
  2471. if (battler) battler.removeState(actGuardStateId);
  2472. };
  2473.  
  2474. // 歩数の処理
  2475. Game_Player.prototype.updateSteps = function(lastRealX, lastRealY) {
  2476. this._realSteps += Math.max(Math.abs(this._realX - lastRealX), Math.abs(this._realY - lastRealY));
  2477. if (this._realSteps >= 1) {
  2478. if (this.isNormal()) {
  2479. $gameParty.increaseSteps();
  2480. if (this.actor()) this.actor().onPlayerWalk();
  2481. }
  2482. this._realSteps = 0;
  2483. }
  2484. };
  2485.  
  2486. // 泳ぎ状態の更新
  2487. Game_Player.prototype.updateSwiming = function() {
  2488. Game_Character.prototype.updateSwiming.call(this);
  2489. AudioManager.playSe(actSeSwim);
  2490. this.resetPeak();
  2491. };
  2492.  
  2493. // マップイベントの起動
  2494. Game_Player.prototype.startMapEvent = function(triggers, normal) {
  2495. if (!$gameMap.isEventRunning()) {
  2496. var targets = this.collideTargets();
  2497. for (var i = 0; i < targets.length; i++) {
  2498. var character = targets[i];
  2499. if (this.isCollide(character)) {
  2500. if (character.isTriggerIn(triggers) && character.isNormalPriority() === normal) {
  2501. if (character.isBattler() && character.battler().isDead()) continue;
  2502. character.start();
  2503. }
  2504. }
  2505. }
  2506. }
  2507. };
  2508.  
  2509. // 接触しているイベントの起動判定
  2510. Game_Player.prototype.checkEventTriggerHere = function(triggers) {
  2511. if (this.canStartLocalEvents()) this.startMapEvent(triggers, false);
  2512. };
  2513.  
  2514. // 正面のイベント起動判定
  2515. Game_Player.prototype.checkEventTriggerThere = function(triggers) {
  2516. var lastRealX = this._realX;
  2517. this._realX += this._direction == 4 ? -this._collideW : this._collideW
  2518. this.startMapEvent(triggers, true);
  2519. this._realX += this._direction == 4 ? -0.5 : 0.5;
  2520. if (!$gameMap.isAnyEventStarting() && $gameMap.isCounter(Math.floor(this._realX), this._y)) {
  2521. this._realX += this._direction == 4 ? -0.5 : 0.5;
  2522. this.startMapEvent(triggers, true);
  2523. }
  2524. this._realX = lastRealX;
  2525. };
  2526.  
  2527. // はしごと接触しているか
  2528. Game_Player.prototype.isCollideLadder = function(downFlag) {
  2529. var x = Math.floor(this._realX);
  2530. if (downFlag) {
  2531. if (!this.isLanding()) return false;
  2532. var y = Math.floor(this._realY + actTileMarginTop + 0.1);
  2533. return $gameMap.isLadder(x, y);
  2534. } else {
  2535. var ty = Math.floor(this._realY - this._collideH);
  2536. var by = Math.floor(this._realY + actTileMarginTop);
  2537. for (var y = ty; y <= by; y++) {
  2538. if ($gameMap.isLadder(x, y)) return true;
  2539. }
  2540. return false;
  2541. }
  2542. };
  2543.  
  2544. // 場所移動の実行
  2545. Game_Player.prototype.performTransfer = function() {
  2546. if (this.isTransferring()) {
  2547. this.setDirection(this._newDirection);
  2548. if (this._newMapId !== $gameMap.mapId() || this._needsMapReload) {
  2549. $gameMap.setup(this._newMapId);
  2550. this._needsMapReload = false;
  2551. }
  2552. this.locate(this._newX + 0.5, this._newY + 0.99 - actTileMarginTop);
  2553. this.refresh();
  2554. this.clearTransferInfo();
  2555. }
  2556. };
  2557.  
  2558. // リフレッシュ
  2559. Game_Player.prototype.refresh = function() {
  2560. var actor = this.actor();
  2561. if (actor) {
  2562. var characterName = actor.characterName();
  2563. var characterIndex = actor.characterIndex();
  2564. var data = actor.actor();
  2565. this._moveSpeed = +(data.meta['move_speed'] || 0.05);
  2566. this._jumpSpeed = +(data.meta['jump_speed'] || 0.14);
  2567. this._swimSpeed = +(data.meta['swim_speed'] || 0.02);
  2568. this._ladderSpeed = +(data.meta['ladder_speed'] || 0.04);
  2569. this._accele = +(data.meta['accele'] || 0.003);
  2570. this._ladderAccele = +(data.meta['ladder_accele'] || 0.003);
  2571. this._jumpInputTime = +(data.meta['jump_input'] || 0);
  2572. this._swimJump = +(data.meta['swim_jump'] || 0.1);
  2573. this._mulchJump = +(data.meta['mulch_jump'] || 1);
  2574. this._weight = +(data.meta['weight'] || 0);
  2575. this._carryPower = +(data.meta['carry_power'] || 0);
  2576. this._gravity = +(data.meta['gravity'] || 0.0045);
  2577. this._dashSpeedX = +(data.meta['dash_speed_x'] || 0.14);
  2578. this._dashSpeedY = +(data.meta['dash_speed_y'] || 0.03);
  2579. this._dashCountTime = +(data.meta['dash_count'] || 15);
  2580. this._dashDelayTime = +(data.meta['dash_delay'] || 30);
  2581. this._dashMpCost = +(data.meta['dash_mp_cost'] || 0);
  2582. this._collideW = +(data.meta['w'] || 0.375);
  2583. this._collideH = +(data.meta['h'] || 0.75);
  2584. this._fallGuard = +(data.meta['fall_guard'] || 0);
  2585. this._guardSpeed = +(data.meta['guard_speed'] || 0);
  2586. this._invincibleTime = +(data.meta['invincible_time'] || 30);
  2587. this._shotWay = +(data.meta['shot_way'] || 0);
  2588. this._shotSpace = +(data.meta['shot_space'] || 0.2);
  2589. this._shotSpeed = +(data.meta['shot_speed'] || 0.1);
  2590. this._shotCountTime = +(data.meta['shot_count'] || 30);
  2591. this._shotDelayTime = +(data.meta['shot_delay'] || 10);
  2592. var traitObjects = actor.equips().concat(actor.states());
  2593. for (var i = 0; i < traitObjects.length; i++) {
  2594. var obj = traitObjects[i];
  2595. if (obj) {
  2596. if (obj.meta['move_speed']) this._moveSpeed += +obj.meta['move_speed'];
  2597. if (obj.meta['jump_speed']) this._jumpSpeed += +obj.meta['jump_speed'];
  2598. if (obj.meta['swim_speed']) this._swimSpeed += +obj.meta['swim_speed'];
  2599. if (obj.meta['ladder_speed']) this._ladderSpeed += +obj.meta['ladder_speed'];
  2600. if (obj.meta['accele']) this._accele += +obj.meta['accele'];
  2601. if (obj.meta['ladder_accele']) this._ladderAccele += +obj.meta['ladder_accele'];
  2602. if (obj.meta['jump_input']) this._jumpInputTime += +obj.meta['jump_input'];
  2603. if (obj.meta['swim_jump']) this._swimJump += +obj.meta['swim_jump'];
  2604. if (obj.meta['mulch_jump']) this._mulchJump += +obj.meta['mulch_jump'];
  2605. if (obj.meta['weight']) this._weight += +obj.meta['weight'];
  2606. if (obj.meta['carry_power']) this._carryPower += +obj.meta['carry_power'];
  2607. if (obj.meta['gravity']) this._gravity += +obj.meta['gravity'];
  2608. if (obj.meta['dash_speed_x']) this._dashSpeedX += +obj.meta['dash_speed_x'];
  2609. if (obj.meta['dash_speed_y']) this._dashSpeedY += +obj.meta['dash_speed_y'];
  2610. if (obj.meta['dash_count']) this._dashCountTime += +obj.meta['dash_count'];
  2611. if (obj.meta['dash_delay']) this._dashDelayTime += +obj.meta['dash_delay'];
  2612. if (obj.meta['dash_mp_cost']) this._dashMpCost += +obj.meta['dash_mp_cost'];
  2613. if (obj.meta['w']) this._collideW += +obj.meta['w'];
  2614. if (obj.meta['h']) this._collideH += +obj.meta['h'];
  2615. if (obj.meta['fall_guard']) this._fallGuard += +obj.meta['fall_guard'];
  2616. if (obj.meta['guard_speed']) this._guardSpeed += +obj.meta['guard_speed'];
  2617. if (obj.meta['invincible_time']) this._invincibleTime += +obj.meta['invincible_time'];
  2618. if (obj.meta['shot_way']) this._shotWay += +obj.meta['shot_way'];
  2619. if (obj.meta['shot_space']) this._shotSpace += +obj.meta['shot_space'];
  2620. if (obj.meta['shot_speed']) this._shotSpeed += +obj.meta['shot_speed'];
  2621. if (obj.meta['shot_count']) this._shotCountTime += +obj.meta['shot_count'];
  2622. if (obj.meta['shot_delay']) this._shotDelayTime += +obj.meta['shot_delay'];
  2623. }
  2624. }
  2625. this._wallJump = actor.loadTagBool('wall_jump');
  2626. this._shotType = +actor.loadTagString('shot_type', 1);
  2627. this._shotIndex = +actor.loadTagString('shot_index', 0);
  2628. this._shotSkillId = +actor.loadTagString('shot_skill', 0);
  2629. this._shotSeName = actor.loadTagString('shot_se_name', '');
  2630. this._shotSeVolume = +actor.loadTagString('shot_se_volume', 90);
  2631. this._shotSePitch = +actor.loadTagString('shot_se_pitch', 100);
  2632. } else {
  2633. var characterName = '';
  2634. var characterIndex = 0;
  2635. }
  2636. this.setImage(characterName, characterIndex);
  2637. this._followers.refresh();
  2638. this._needsRefresh = false;
  2639. };
  2640.  
  2641. // 飛行船の乗り降り
  2642. Game_Player.prototype.getOnOffVehicle = function() {
  2643. return false;
  2644. };
  2645.  
  2646. // まっすぐに移動
  2647. Game_Player.prototype.moveStraight = function(d) {
  2648. Game_Character.prototype.moveStraight.call(this, d);
  2649. };
  2650.  
  2651. // バトラーが戦闘不能になったときの処理
  2652. Game_Player.prototype.battlerDead = function() {
  2653. this._lockCount = 32;
  2654. this.battler().requestEffect('collapse');
  2655. SoundManager.playActorCollapse();
  2656. if ($gameParty.isAllDead()) {
  2657. $gameTemp.reserveCommonEvent(actAllDeadEvent);
  2658. }
  2659. };
  2660.  
  2661. //-----------------------------------------------------------------------------
  2662. // Game_Event
  2663. //
  2664.  
  2665. // 初期化
  2666. Game_Event.prototype.initialize = function(mapId, eventId) {
  2667. Game_Character.prototype.initialize.call(this);
  2668. this._mapId = mapId;
  2669. this._eventId = eventId;
  2670. this._repopCount = 0;
  2671. this.locate(this.event().x + 0.5, this.event().y + 1);
  2672. this.refresh();
  2673. };
  2674.  
  2675. // メンバ変数の初期化
  2676. var _Game_Event_initMembers = Game_Event.prototype.initMembers;
  2677. Game_Event.prototype.initMembers = function() {
  2678. _Game_Event_initMembers.call(this);
  2679. this._enemyId = 0;
  2680. this._battler = null;
  2681. this._deadSelfSwitch = null;
  2682. this._commentParams = {};
  2683. };
  2684.  
  2685. // バトラーの取得
  2686. Game_Event.prototype.battler = function() {
  2687. return this._battler;
  2688. };
  2689.  
  2690. // 衝突したイベントの起動
  2691. Game_Event.prototype.checkEventTriggerCollide = function(id) {
  2692. if (!$gameMap.isEventRunning() && id < 0) {
  2693. // if (this.isTriggerIn([1, 2]) && this.isNormalPriority() === normal) {
  2694. if (this.isTriggerIn([1, 2])) this.start();
  2695. }
  2696. };
  2697.  
  2698. // リフレッシュ
  2699. var _Game_Event_refresh = Game_Event.prototype.refresh;
  2700. Game_Event.prototype.refresh = function() {
  2701. _Game_Event_refresh.call(this);
  2702. this._needsRefresh = false;
  2703. };
  2704.  
  2705. // イベントページのセットアップ
  2706. var _Game_Event_setupPage = Game_Event.prototype.setupPage;
  2707. Game_Event.prototype.setupPage = function() {
  2708. _Game_Event_setupPage.call(this);
  2709. if (this._pageIndex >= 0) {
  2710. this._enemyId = +this.loadTagParam('enemy') || 0;
  2711. this._collideW = +this.loadTagParam('w') || 0.375;
  2712. this._collideH = +this.loadTagParam('h') || 0.75;
  2713. this._weight = +this.loadTagParam('weight') || 0;
  2714. this._deadSelfSwitch = this.loadTagParam('dead');
  2715. this._repopTimer = +this.loadTagParam('repop') || 0;
  2716. if (this._repopTimer > 0) {
  2717. this._repopCount = this._repopTimer;
  2718. }
  2719. var param = this.loadTagParam('gravity');
  2720. this._gravity = param ? +param : actGravity;
  2721. this._lift = this.loadTagParam('lift') || false;
  2722. this.setupBattler();
  2723. }
  2724. };
  2725.  
  2726. // バトラーのセットアップ
  2727. Game_Event.prototype.setupBattler = function() {
  2728. if (this._enemyId > 0) {
  2729. this._battler = new Game_Enemy(this._enemyId, this.eventId(), 0);
  2730. } else {
  2731. this._battler = null;
  2732. }
  2733. };
  2734.  
  2735. // フレーム更新
  2736. var _Game_Event_update = Game_Event.prototype.update;
  2737. Game_Event.prototype.update = function() {
  2738. if (this._carried) {
  2739. this._realX = $gamePlayer._realX;
  2740. this._realY = $gamePlayer._realY - $gamePlayer._collideH - 0.001;
  2741. this._x = Math.floor(this._realX);
  2742. this._y = Math.floor(this._realY);
  2743. } else {
  2744. if (this.isLocking()) {
  2745. this.updateLock();
  2746. } else {
  2747. _Game_Event_update.call(this);
  2748. if (this._repopCount > 0) this.updateRepop();
  2749. }
  2750. if (this.isBattler()) this.updateDamage();
  2751. }
  2752. };
  2753.  
  2754. // 摩擦の処理
  2755. Game_Event.prototype.updateFriction = function() {
  2756. Game_Character.prototype.updateFriction.call(this);
  2757. if (!this.isMoving() && this._vx != 0) {
  2758. if (!this.isDashing()) {
  2759. var n = this.isSwimming() ? this._swimSpeed : this._moveSpeed;
  2760. if (this._vx < -n) {
  2761. this._vx = Math.min(this._vx + 0.005, -n);
  2762. }
  2763. if (this._vx > n) {
  2764. this._vx = Math.max(this._vx - 0.005, n);
  2765. }
  2766. }
  2767. if (this.isLanding()) {
  2768. var n = actFriction;
  2769. switch (this._landingRegion) {
  2770. case actSlipFloorRegion:
  2771. return;
  2772. case actRoughFloorRegion:
  2773. if (Math.abs(this._vx) > this._moveSpeed / 2) {
  2774. this._vx = this._vx > 0 ? this._moveSpeed / 2 : -this._moveSpeed / 2;
  2775. }
  2776. break;
  2777. case actMarshFloorRegion:
  2778. this._vx = 0;
  2779. return;
  2780. }
  2781. if (this._vx > 0) {
  2782. this._vx = Math.max(this._vx - n, 0);
  2783. } else {
  2784. this._vx = Math.min(this._vx + n, 0);
  2785. }
  2786. }
  2787. }
  2788. };
  2789.  
  2790. // リポップカウントの処理
  2791. Game_Event.prototype.updateRepop = function() {
  2792. this._repopCount--;
  2793. if (this._repopCount === 0) {
  2794. var key = [$gameMap.mapId(), this._eventId, this._deadSelfSwitch];
  2795. if ($gameSelfSwitches.value(key)) {
  2796. $gameSelfSwitches.setValue(key, false);
  2797. this.refresh();
  2798. this.requestAppear();
  2799. }
  2800. }
  2801. };
  2802.  
  2803. // 出現エフェクトのリクエスト
  2804. Game_Event.prototype.requestAppear = function() {
  2805. if (this.isBattler()) {
  2806. if (actEventCollapse) this.battler().requestEffect('appear');
  2807. }
  2808. };
  2809.  
  2810. // バトラーが戦闘不能になったときの処理
  2811. Game_Event.prototype.battlerDead = function() {
  2812. if (actEventCollapse) {
  2813. this._lockCount = 32;
  2814. this.battler().requestEffect('collapse');
  2815. SoundManager.playEnemyCollapse();
  2816. } else {
  2817. this._lockCount = 1;
  2818. }
  2819. };
  2820.  
  2821. // ロック状態の処理
  2822. Game_Event.prototype.updateLock = function() {
  2823. this._lockCount--;
  2824. if (this._lockCount == 0) {
  2825. if (this.battler().isDead()) {
  2826. this.gainRewards();
  2827. if (this._deadSelfSwitch !== null) {
  2828. var key = [$gameMap.mapId(), this._eventId, this._deadSelfSwitch];
  2829. $gameSelfSwitches.setValue(key, true);
  2830. this.refresh();
  2831. this.requestAppear();
  2832. } else {
  2833. this.erase();
  2834. }
  2835. }
  2836. }
  2837. };
  2838.  
  2839. // 撃破報酬の獲得
  2840. Game_Event.prototype.gainRewards = function() {
  2841. var exp = this.battler().exp();
  2842. if (exp > 0) this.gainRewardExp(exp);
  2843. var gold = this.battler().gold();
  2844. if (gold > 0) this.gainRewardGold(gold);
  2845. var items = this.battler().makeDropItems();
  2846. for (var i = 0; i < items.length; i++) {
  2847. this.gainRewardItem(items[i], -16 - (items.length - i) * 24);
  2848. }
  2849. };
  2850.  
  2851. // 撃破報酬(経験値)の獲得
  2852. Game_Event.prototype.gainRewardExp = function(exp) {
  2853. $gameParty.allMembers().forEach(function(actor) {
  2854. actor.gainExp(exp);
  2855. });
  2856. this.setMapPopup('' + exp + TextManager.exp, '#ffe0ff', -40, -0.2, 0);
  2857. };
  2858.  
  2859. // 撃破報酬(お金)の獲得
  2860. Game_Event.prototype.gainRewardGold = function(gold) {
  2861. $gameParty.gainGold(gold);
  2862. this.setMapPopup('' + gold + TextManager.currencyUnit, '#ffffe0', -64, -0.2, 0);
  2863. };
  2864.  
  2865. // 撃破報酬(アイテム)の獲得
  2866. Game_Event.prototype.gainRewardItem = function(item, y) {
  2867. $gameParty.gainItem(item, 1);
  2868. this.setMapPopup('\\I[' + item.iconIndex + ']', '#000000', y, -4, 0.5);
  2869. };
  2870.  
  2871. // 泳ぎ状態の更新
  2872. Game_Event.prototype.updateSwiming = function() {
  2873. Game_Character.prototype.updateSwiming.call(this);
  2874. if (actUseEventSeSwim) {
  2875. var origin_volume = actSeSwim.volume;
  2876. var volume = Math.floor(origin_volume * ((15 - this.distFromCharacter($gamePlayer))) / 15);
  2877. var se = {};
  2878. se.name = actSeSwim.name;
  2879. se.volume = Math.min(Math.max(volume, 0), 100);
  2880. se.pitch = actSeSwim.pitch;
  2881. if (this._realX < $gamePlayer._realX) {
  2882. se.pan = Math.max(Math.floor((this._realX - $gamePlayer._realX) * 10, -100));
  2883. } else {
  2884. se.pan = Math.min(Math.floor((this._realX - $gamePlayer._realX) * 10, 100));
  2885. }
  2886. AudioManager.playSe(se);
  2887. }
  2888. };
  2889.  
  2890. //-----------------------------------------------------------------------------
  2891. // Game_Interpreter
  2892. //
  2893.  
  2894. // イベントの位置変更
  2895. Game_Interpreter.prototype.command203 = function() {
  2896. var character = this.character(this._params[0]);
  2897. if (character) {
  2898. if (this._params[1] === 0) { // Direct designation
  2899. character.locate(this._params[2] + 0.5, this._params[3] + 1);
  2900. } else if (this._params[1] === 1) { // Designation with variables
  2901. var x = $gameVariables.value(this._params[2] + 0.5);
  2902. var y = $gameVariables.value(this._params[3] + 1);
  2903. character.locate(x, y);
  2904. } else { // Exchange with another event
  2905. var character2 = this.character(this._params[2]);
  2906. if (character2) character.swap(character2);
  2907. }
  2908. if (this._params[4] > 0) character.setDirection(this._params[4]);
  2909. }
  2910. return true;
  2911. };
  2912.  
  2913. // 装備の変更
  2914. var _Game_Interpreter_command319 = Game_Interpreter.prototype.command319;
  2915. Game_Interpreter.prototype.command319 = function() {
  2916. _Game_Interpreter_command319.call(this);
  2917. if (!$gameParty.inBattle()) $gamePlayer.requestRefresh();
  2918. return true;
  2919. };
  2920.  
  2921. // プラグインコマンド
  2922. var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  2923. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  2924. _Game_Interpreter_pluginCommand.call(this, command, args);
  2925. if (command === 'actGainHp') {
  2926. var character = this.character(args[0]);
  2927. if (character && character.isBattler()) {
  2928. character.battler().clearResult();
  2929. character.battler().gainHp(+args[1]);
  2930. }
  2931. } else if (command === 'actHp') {
  2932. var character = this.character(args[0]);
  2933. if (character && character.isBattler()) {
  2934. $gameVariables.setValue(+args[1], character.battler().hp);
  2935. }
  2936. } else if (command === 'actForceX') {
  2937. var character = this.character(args[0]);
  2938. if (character) character._vx = +args[1];
  2939. } else if (command === 'actForceY') {
  2940. var character = this.character(args[0]);
  2941. if (character) character._vy = +args[1];
  2942. } else if (command === 'actForceStop') {
  2943. var character = this.character(args[0]);
  2944. if (character) {
  2945. character._vx = 0;
  2946. character._vy = 0;
  2947. }
  2948. } else if (command === 'actChangeActor') {
  2949. var actor = $gameActors.actor(+args[0]);
  2950. if (actor && actor.isAlive() && $gameParty.members().contains(actor)) {
  2951. var currentActorId = $gamePlayer.actor().actorId();
  2952. $gameParty.sortActor(+args[0]);
  2953. if (currentActorId !== $gamePlayer.actor().actorId()) {
  2954. $gamePlayer.refresh();
  2955. $gamePlayer.battler().requestEffect('appear');
  2956. }
  2957. }
  2958. } else if (command === 'actPopup') {
  2959. var character = this.character(args[0]);
  2960. if (character) character.setMapPopup(args[1], args[2]);
  2961. } else if (command === 'nwayShot') {
  2962. var character = this.character(args[0]);
  2963. if (character && character.isBattler()) {
  2964. if (!args[8]) args[8] = character.battler().attackSkillId();
  2965. character.nwayShot(+args[1], +args[2], +args[3], +args[4],
  2966. +args[5], +args[6], +args[7], +args[8]);
  2967. }
  2968. } else if (command === 'nwayAim') {
  2969. var character = this.character(args[0]);
  2970. if (character && character.isBattler()) {
  2971. if (!args[8]) args[8] = character.battler().attackSkillId();
  2972. character.nwayAim(+args[1], +args[2], +args[3], +args[4],
  2973. +args[5], +args[6], +args[7], +args[8]);
  2974. }
  2975. } else if (command === 'nallShot') {
  2976. var character = this.character(args[0]);
  2977. if (character && character.isBattler()) {
  2978. if (!args[7]) args[7] = character.battler().attackSkillId();
  2979. character.nallShot(+args[1], +args[2], +args[3], +args[4],
  2980. +args[5], +args[6], +args[7]);
  2981. }
  2982. } else if (command === 'nallAim') {
  2983. var character = this.character(args[0]);
  2984. if (character && character.isBattler()) {
  2985. if (!args[7]) args[7] = character.battler().attackSkillId();
  2986. character.nallAim(+args[1], +args[2], +args[3], +args[4],
  2987. +args[5], +args[6], +args[7]);
  2988. }
  2989. } else if (command === 'actShowHpGauge') {
  2990. $gameSystem.setActHpGaugeVisible(true);
  2991. } else if (command === 'actHideHpGauge') {
  2992. $gameSystem.setActHpGaugeVisible(false);
  2993. }
  2994. };
  2995.  
  2996. //-----------------------------------------------------------------------------
  2997. // Sprite_Bullet
  2998. //
  2999.  
  3000. function Sprite_Bullet() {
  3001. this.initialize.apply(this, arguments);
  3002. }
  3003.  
  3004. Sprite_Bullet.prototype = Object.create(Sprite.prototype);
  3005. Sprite_Bullet.prototype.constructor = Sprite_Bullet;
  3006.  
  3007. // 初期化
  3008. Sprite_Bullet.prototype.initialize = function(bullet) {
  3009. Sprite.prototype.initialize.call(this);
  3010. this.anchor.x = 0.5;
  3011. this.anchor.y = 0.5;
  3012. this._bullet = bullet;
  3013. this._characterName = '';
  3014. this._characterIndex = 0;
  3015. };
  3016.  
  3017. // フレーム更新
  3018. Sprite_Bullet.prototype.update = function() {
  3019. Sprite.prototype.update.call(this);
  3020. this.opacity = this._bullet._opacity;
  3021. if (this.opacity > 0) {
  3022. this.updateBitmap();
  3023. this.x = this._bullet.screenX();
  3024. this.y = this._bullet.screenY();
  3025. this.z = this._bullet._z;
  3026. this.rotation = this._bullet.angle();
  3027. }
  3028. };
  3029.  
  3030. // 転送元ビットマップの更新
  3031. Sprite_Bullet.prototype.updateBitmap = function() {
  3032. if (this.isImageChanged()) {
  3033. this._characterName = this._bullet._characterName;
  3034. this._characterIndex = this._bullet._characterIndex;
  3035. this.setCharacterBitmap();
  3036. }
  3037. };
  3038.  
  3039. // グラフィックの変更判定
  3040. Sprite_Bullet.prototype.isImageChanged = function() {
  3041. return this._characterName !== this._bullet.characterName ||
  3042. this._characterIndex !== this._bullet.characterIndex;
  3043. };
  3044.  
  3045. // ビットマップの設定
  3046. Sprite_Bullet.prototype.setCharacterBitmap = function() {
  3047. this.bitmap = ImageManager.loadSystem(this._characterName);
  3048. var pw = Math.floor(this.bitmap.width / 8);
  3049. var sx = this._characterIndex * pw;
  3050. this.setFrame(sx, 0, pw, this.bitmap.height);
  3051. this.blendMode = this._characterName.charAt(0) === '!' ? 1 : 0;
  3052. };
  3053.  
  3054. //-----------------------------------------------------------------------------
  3055. // Sprite_Shield
  3056. //
  3057.  
  3058. function Sprite_Shield() {
  3059. this.initialize.apply(this, arguments);
  3060. }
  3061.  
  3062. Sprite_Shield.prototype = Object.create(Sprite.prototype);
  3063. Sprite_Shield.prototype.constructor = Sprite_Shield;
  3064.  
  3065. // 初期化
  3066. Sprite_Shield.prototype.initialize = function() {
  3067. Sprite.prototype.initialize.call(this);
  3068. this.anchor.x = 0.5;
  3069. this.anchor.y = 1.0;
  3070. this.bitmap = ImageManager.loadSystem('TMJumpActionShield');
  3071. };
  3072.  
  3073. //-----------------------------------------------------------------------------
  3074. // Sprite_Character
  3075. //
  3076.  
  3077. // メンバ変数の初期化
  3078. var _Sprite_Character_initMembers = Sprite_Character.prototype.initMembers;
  3079. Sprite_Character.prototype.initMembers = function() {
  3080. _Sprite_Character_initMembers.call(this);
  3081. this._damages = [];
  3082. this._popups = [];
  3083. this._effectType = null;
  3084. this._effectDuration = 0;
  3085. this._shake = 0;
  3086. this.createWeaponSprite();
  3087. };
  3088.  
  3089. // 武器スプライトの作成
  3090. Sprite_Character.prototype.createWeaponSprite = function() {
  3091. this._weaponSprite = new Sprite_Weapon();
  3092. this.addChild(this._weaponSprite);
  3093. };
  3094.  
  3095. // 武器アニメーションのセットアップ
  3096. Sprite_Character.prototype.setupWeaponAnimation = function() {
  3097. if (this._character.battler().isWeaponAnimationRequested()) {
  3098. this._weaponSprite.setup(this._character.battler().weaponImageId());
  3099. this._character.battler().clearWeaponAnimation();
  3100. }
  3101. };
  3102.  
  3103. // フレーム更新
  3104. var _Sprite_Character_update = Sprite_Character.prototype.update;
  3105. Sprite_Character.prototype.update = function() {
  3106. _Sprite_Character_update.call(this);
  3107. this.updateDamagePopup();
  3108. this.updateMapPopup();
  3109. if (this._character.isBattler()) {
  3110. this.updateEffect();
  3111. this.updateMotion();
  3112. this.updateShield();
  3113. if (actHpGauge) this.updateHpGauge();
  3114. }
  3115. };
  3116.  
  3117. // その他の更新
  3118. var _Sprite_Character_updateOther = Sprite_Character.prototype.updateOther;
  3119. Sprite_Character.prototype.updateOther = function() {
  3120. if (!this.isEffecting()) _Sprite_Character_updateOther.call(this);
  3121. };
  3122.  
  3123. // ダメージポップアップの更新
  3124. Sprite_Character.prototype.updateDamagePopup = function() {
  3125. if (this._character.isBattler()) this.setupDamagePopup();
  3126. if (this._damages.length > 0) {
  3127. for (var i = 0; i < this._damages.length; i++) {
  3128. this._damages[i].update();
  3129. this._damages[i].x = this.x;
  3130. this._damages[i].y = this.y;
  3131. }
  3132. if (!this._damages[0].isPlaying()) {
  3133. this.parent.removeChild(this._damages[0]);
  3134. this._damages.shift();
  3135. }
  3136. }
  3137. };
  3138.  
  3139. // ダメージポップアップのセット
  3140. Sprite_Character.prototype.setupDamagePopup = function() {
  3141. var battler = this._character.battler();
  3142. if (battler.isDamagePopupRequested()) {
  3143. var sprite = new Sprite_MapDamage();
  3144. sprite.x = this.x;
  3145. sprite.y = this.y;
  3146. sprite.z = this.z + 1;
  3147. sprite.setup(battler);
  3148. this._damages.push(sprite);
  3149. this.parent.addChild(sprite);
  3150. battler.clearDamagePopup();
  3151. battler.clearActionResult();
  3152. }
  3153. };
  3154.  
  3155. // マップ用ポップアップの更新
  3156. Sprite_Character.prototype.updateMapPopup = function() {
  3157. this.setupMapPopup();
  3158. if (this._popups.length > 0) {
  3159. for (var i = this._popups.length - 1; i >= 0; i--) {
  3160. this._popups[i].update();
  3161. this._popups[i].x = this.x;
  3162. this._popups[i].y = this.y;
  3163. if (!this._popups[i].isPlaying()) {
  3164. this.parent.removeChild(this._popups[i]);
  3165. this._popups.splice(i, 1);
  3166. }
  3167. }
  3168. }
  3169. };
  3170.  
  3171. // マップ用ポップアップのセット
  3172. Sprite_Character.prototype.setupMapPopup = function() {
  3173. while (this._character.isMapPopupExist()) {
  3174. var sprite = new Sprite_MapPopup();
  3175. sprite.x = this.x;
  3176. sprite.y = this.y;
  3177. var popup = this._character.getMapPopup();
  3178. var re = /\\I\[(\d+)\]/i;
  3179. var match = re.exec(popup.text);
  3180. if (match) {
  3181. sprite.z = this.z + 1;
  3182. sprite.setup(popup, Number(match[1]));
  3183. } else {
  3184. sprite.z = this.z + 2;
  3185. sprite.setup(popup, -1);
  3186. }
  3187. this._popups.push(sprite);
  3188. this.parent.addChild(sprite);
  3189. }
  3190. };
  3191.  
  3192. // エフェクトのセット
  3193. Sprite_Character.prototype.setupEffect = function() {
  3194. if (this._character.battler().isEffectRequested()) {
  3195. this.startEffect(this._character.battler().effectType());
  3196. this._character.battler().clearEffect();
  3197. }
  3198. };
  3199.  
  3200. // エフェクトの開始
  3201. Sprite_Character.prototype.startEffect = function(effectType) {
  3202. this._effectType = effectType;
  3203. switch (this._effectType) {
  3204. case 'appear':
  3205. this.startAppear();
  3206. break;
  3207. case 'whiten':
  3208. this.startWhiten();
  3209. break;
  3210. case 'blink':
  3211. this.startBlink();
  3212. break;
  3213. case 'collapse':
  3214. this.startCollapse();
  3215. break;
  3216. case 'bossCollapse':
  3217. this.startBossCollapse();
  3218. break;
  3219. }
  3220. this.revertToNormal();
  3221. };
  3222.  
  3223. // 出現エフェクトの開始
  3224. Sprite_Character.prototype.startAppear = function() {
  3225. this._effectDuration = 16;
  3226. };
  3227.  
  3228. // 白フラッシュエフェクトの開始
  3229. Sprite_Character.prototype.startWhiten = function() {
  3230. this._effectDuration = 16;
  3231. };
  3232.  
  3233. // 点滅エフェクトの開始
  3234. Sprite_Character.prototype.startBlink = function() {
  3235. this._effectDuration = this._character._invincibleTime;
  3236. };
  3237.  
  3238. // 崩壊エフェクトの開始
  3239. Sprite_Character.prototype.startCollapse = function() {
  3240. this._effectDuration = 32;
  3241. this._appeared = false;
  3242. };
  3243.  
  3244. // ボス崩壊エフェクトの開始
  3245. Sprite_Character.prototype.startBossCollapse = function() {
  3246. this._effectDuration = this.bitmap.height;
  3247. this._appeared = false;
  3248. };
  3249.  
  3250. // エフェクトの更新
  3251. Sprite_Character.prototype.updateEffect = function() {
  3252. this.setupEffect();
  3253. if (this._effectDuration > 0) {
  3254. this._effectDuration--;
  3255. switch (this._effectType) {
  3256. case 'appear':
  3257. this.updateAppear();
  3258. break;
  3259. case 'whiten':
  3260. this.updateWhiten();
  3261. break;
  3262. case 'blink':
  3263. this.updateBlink();
  3264. break;
  3265. case 'collapse':
  3266. this.updateCollapse();
  3267. break;
  3268. case 'bossCollapse':
  3269. this.updateBossCollapse();
  3270. break;
  3271. }
  3272. if (this._effectDuration === 0) {
  3273. this._effectType = null;
  3274. this.setBlendColor([0, 0, 0, 0]);
  3275. }
  3276. }
  3277. };
  3278.  
  3279. // エフェクトが実行中かどうか
  3280. Sprite_Character.prototype.isEffecting = function() {
  3281. return this._effectType !== null;
  3282. };
  3283.  
  3284. // スプライトのエフェクト設定を元に戻す
  3285. Sprite_Character.prototype.revertToNormal = function() {
  3286. this._shake = 0;
  3287. this.blendMode = 0;
  3288. this.opacity = 255;
  3289. this.setBlendColor([0, 0, 0, 0]);
  3290. };
  3291.  
  3292. // 出現エフェクトの更新
  3293. Sprite_Character.prototype.updateAppear = function() {
  3294. this.opacity = (16 - this._effectDuration) * 16;
  3295. };
  3296.  
  3297. // 白フラッシュエフェクトの更新
  3298. Sprite_Character.prototype.updateWhiten = function() {
  3299. var alpha = 128 - (16 - this._effectDuration) * 10;
  3300. this.setBlendColor([255, 255, 255, alpha]);
  3301. };
  3302.  
  3303. // 点滅エフェクトの更新
  3304. Sprite_Character.prototype.updateBlink = function() {
  3305. this.opacity = (this._effectDuration % 10 < 5) ? 255 : 0;
  3306. };
  3307.  
  3308. // 崩壊エフェクトの更新
  3309. Sprite_Character.prototype.updateCollapse = function() {
  3310. this.blendMode = Graphics.BLEND_ADD;
  3311. this.setBlendColor([255, 128, 128, 128]);
  3312. this.opacity *= this._effectDuration / (this._effectDuration + 1);
  3313. };
  3314.  
  3315. // ボス崩壊エフェクトの更新
  3316. Sprite_Character.prototype.updateBossCollapse = function() {
  3317. this._shake = this._effectDuration % 2 * 4 - 2;
  3318. this.blendMode = Graphics.BLEND_ADD;
  3319. this.opacity *= this._effectDuration / (this._effectDuration + 1);
  3320. this.setBlendColor([255, 255, 255, 255 - this.opacity]);
  3321. if (this._effectDuration % 20 === 19) {
  3322. SoundManager.playBossCollapse2();
  3323. }
  3324. };
  3325.  
  3326. // モーションの更新
  3327. Sprite_Character.prototype.updateMotion = function() {
  3328. this.setupWeaponAnimation();
  3329. if (this._weaponSprite.isPlaying()) {
  3330. if (this._character._direction == 4) {
  3331. this._weaponSprite.scale.x = 1;
  3332. this._weaponSprite.x = -16;
  3333. } else {
  3334. this._weaponSprite.scale.x = -1;
  3335. this._weaponSprite.x = 16;
  3336. }
  3337. }
  3338. };
  3339.  
  3340. // HPゲージの更新
  3341. Sprite_Character.prototype.updateHpGauge = function() {
  3342. if (!this._hpGaugeSprite) {
  3343. this._hpGaugeSprite = new Sprite_HpGauge(this._character);
  3344. this._hpGaugeSprite.y = -2;
  3345. this.addChild(this._hpGaugeSprite);
  3346. }
  3347. };
  3348.  
  3349. // シールドの更新
  3350. Sprite_Character.prototype.updateShield = function() {
  3351. var battler = this._character.battler();
  3352. if (this._shieldSprite) {
  3353. this._shieldSprite.visible = battler.isStateAffected(actGuardStateId);
  3354. } else {
  3355. if (battler.isStateAffected(actGuardStateId)) {
  3356. this._shieldSprite = new Sprite_Shield();
  3357. this.addChild(this._shieldSprite);
  3358. }
  3359. }
  3360. };
  3361.  
  3362. // HPゲージとシールドのbushDepth対応
  3363. var _Sprite_Character_createHalfBodySprites = Sprite_Character.prototype.createHalfBodySprites;
  3364. Sprite_Character.prototype.createHalfBodySprites = function() {
  3365. var flag = !this._upperBody;
  3366. _Sprite_Character_createHalfBodySprites.call(this);
  3367. if (flag) {
  3368. if (this._hpGaugeSprite) this.addChild(this.removeChild(this._hpGaugeSprite));
  3369. if (this._shieldSprite) this.addChild(this.removeChild(this._shieldSprite));
  3370. }
  3371. };
  3372.  
  3373. //-----------------------------------------------------------------------------
  3374. // Sprite_MapDamage
  3375. //
  3376.  
  3377. function Sprite_MapDamage() {
  3378. this.initialize.apply(this, arguments);
  3379. }
  3380.  
  3381. Sprite_MapDamage.prototype = Object.create(Sprite_Damage.prototype);
  3382. Sprite_MapDamage.prototype.constructor = Sprite_MapDamage;
  3383.  
  3384. // セットアップ
  3385. Sprite_MapDamage.prototype.setup = function(target) {
  3386. var result = target._actionResult;
  3387. if (result.missed || result.evaded) {
  3388. this.createMiss();
  3389. } else if (result.hpAffected) {
  3390. this.createDigits(0, result.hpDamage);
  3391. } else if (target.isAlive() && result.mpDamage !== 0) {
  3392. this.createDigits(2, result.mpDamage);
  3393. }
  3394. if (result.critical) {
  3395. this.setupCriticalEffect();
  3396. }
  3397. };
  3398.  
  3399. //-----------------------------------------------------------------------------
  3400. // Sprite_MapPopup
  3401. //
  3402.  
  3403. function Sprite_MapPopup() {
  3404. this.initialize.apply(this, arguments);
  3405. }
  3406.  
  3407. Sprite_MapPopup.prototype = Object.create(Sprite.prototype);
  3408. Sprite_MapPopup.prototype.constructor = Sprite_MapPopup;
  3409.  
  3410. Sprite_MapPopup.prototype.initialize = function() {
  3411. Sprite.prototype.initialize.call(this);
  3412. this._duration = 150;
  3413. };
  3414.  
  3415. Sprite_MapPopup.prototype.setup = function(popup, iconIndex) {
  3416. var sprite = new Sprite();
  3417. if (iconIndex >= 0) {
  3418. sprite.bitmap = ImageManager.loadSystem('IconSet');
  3419. var pw = Window_Base._iconWidth;
  3420. var ph = Window_Base._iconHeight;
  3421. var sx = iconIndex % 16 * pw;
  3422. var sy = Math.floor(iconIndex / 16) * ph;
  3423. sprite.setFrame(sx, sy, pw, ph);
  3424. } else {
  3425. sprite.bitmap = new Bitmap(160, 32);
  3426. sprite.bitmap.outlineColor = 'black';
  3427. sprite.bitmap.outlineWidth = 5;
  3428. sprite.bitmap.fontSize = 28;
  3429. sprite.bitmap.textColor = popup.color;
  3430. sprite.bitmap.drawText(popup.text, 0, 0, 160, 32, 'center');
  3431. }
  3432. sprite.anchor.x = 0.5;
  3433. sprite.anchor.y = 1;
  3434. sprite.y = popup.ry;
  3435. sprite.ry = sprite.y;
  3436. sprite.by = sprite.y + 40;
  3437. sprite.dy = popup.dy;
  3438. sprite.g = popup.g;
  3439. this.addChild(sprite);
  3440. };
  3441.  
  3442. Sprite_MapPopup.prototype.update = function() {
  3443. Sprite.prototype.update.call(this);
  3444. if (this._duration > 0) {
  3445. this._duration--;
  3446. for (var i = 0; i < this.children.length; i++) {
  3447. var sprite = this.children[i];
  3448. sprite.dy += sprite.g;
  3449. sprite.ry += sprite.dy;
  3450. if (sprite.ry >= sprite.by) {
  3451. sprite.ry = sprite.by;
  3452. sprite.dy *= -0.6;
  3453. }
  3454. sprite.y = Math.round(sprite.ry);
  3455. }
  3456. }
  3457. this.updateOpacity();
  3458. };
  3459.  
  3460. Sprite_MapPopup.prototype.updateOpacity = function() {
  3461. if (this._duration < 10) {
  3462. this.opacity = 255 * this._duration / 10;
  3463. }
  3464. };
  3465.  
  3466. Sprite_MapPopup.prototype.isPlaying = function() {
  3467. return this._duration > 0;
  3468. };
  3469.  
  3470. //-----------------------------------------------------------------------------
  3471. // Sprite_HpGauge
  3472. //
  3473.  
  3474. function Sprite_HpGauge() {
  3475. this.initialize.apply(this, arguments);
  3476. }
  3477.  
  3478. Sprite_HpGauge.prototype = Object.create(Sprite.prototype);
  3479. Sprite_HpGauge.prototype.constructor = Sprite_HpGauge;
  3480.  
  3481. Sprite_HpGauge.prototype.initialize = function(character) {
  3482. this._character = character;
  3483. this._battler = this._character.battler();
  3484. Sprite.prototype.initialize.call(this);
  3485. this.bitmap = new Bitmap(32, 4);
  3486. this.z = 9;
  3487. this.anchor.x = 0.5;
  3488. this.anchor.y = 1;
  3489. };
  3490.  
  3491. Sprite_HpGauge.prototype.update = function() {
  3492. Sprite.prototype.update.call(this);
  3493. this.visible = $gameSystem.isActHpGaugeVisible();
  3494. if (this._battler !== this._character.battler()) {
  3495. this._battler = this._character.battler();
  3496. if (!this._battler) { // バトラーが削除された場合はゲージを消去
  3497. this._hp = 0;
  3498. this.refresh();
  3499. }
  3500. }
  3501. if (this._battler) {
  3502. if (this._hp !== this._battler.hp || this._mhp !== this._battler.mhp) {
  3503. this._hp = this._battler.hp;
  3504. this._mhp = this._battler.mhp;
  3505. this.refresh();
  3506. }
  3507. }
  3508. };
  3509.  
  3510. Sprite_HpGauge.prototype.refresh = function() {
  3511. this.bitmap.clear();
  3512. if (this._hp === 0) return;
  3513. this.bitmap.fillRect(0, 0, 32, 4, '#000000');
  3514. var w = Math.floor(this._hp / this._mhp * 30);
  3515. this.bitmap.fillRect(1, 1, w, 2, this._hp === this._mhp ? '#fff060' : '#ffa030');
  3516. };
  3517.  
  3518. //-----------------------------------------------------------------------------
  3519. // Spriteset_Map
  3520. //
  3521.  
  3522. var _Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
  3523. Spriteset_Map.prototype.createLowerLayer = function() {
  3524. _Spriteset_Map_createLowerLayer.call(this);
  3525. this.createBullets();
  3526. };
  3527.  
  3528. // 弾スプライトの作成
  3529. Spriteset_Map.prototype.createBullets = function() {
  3530. this._bulletSprites = [];
  3531. $gameMap.playerBullets().forEach(function(bullet) {
  3532. this._bulletSprites.push(new Sprite_Bullet(bullet));
  3533. this._baseSprite.addChild(this._bulletSprites[this._bulletSprites.length - 1]);
  3534. }, this);
  3535. $gameMap.enemyBullets().forEach(function(bullet) {
  3536. this._bulletSprites.push(new Sprite_Bullet(bullet));
  3537. this._baseSprite.addChild(this._bulletSprites[this._bulletSprites.length - 1]);
  3538. }, this);
  3539. };
  3540.  
  3541. // 飛行船の影の作成
  3542. Spriteset_Map.prototype.createShadow = function() {
  3543. };
  3544.  
  3545. // 飛行船の影の更新
  3546. Spriteset_Map.prototype.updateShadow = function() {
  3547. };
  3548.  
  3549. //-----------------------------------------------------------------------------
  3550. // Window_Selectable
  3551. //
  3552.  
  3553. var _Window_Selectable_isOkTriggered = Window_Selectable.prototype.isOkTriggered;
  3554. Window_Selectable.prototype.isOkTriggered = function() {
  3555. return _Window_Selectable_isOkTriggered.call(this) ||
  3556. (actAttackToOk && Input.isRepeated('attack'));
  3557. };
  3558.  
  3559. var _Window_Selectable_isCancelTriggered = Window_Selectable.prototype.isCancelTriggered;
  3560. Window_Selectable.prototype.isCancelTriggered = function() {
  3561. return _Window_Selectable_isCancelTriggered.call(this) ||
  3562. (actJumpToCancel && Input.isRepeated('jump'));
  3563. };
  3564.  
  3565. //-----------------------------------------------------------------------------
  3566. // Window_Option
  3567. //
  3568.  
  3569. var _Window_Option_makeCommandList = Window_Options.prototype.makeCommandList;
  3570. Window_Options.prototype.makeCommandList = function() {
  3571. _Window_Option_makeCommandList.call(this);
  3572. if (padConfigCommand) this.addCommand(padConfigCommand, 'padConfig');
  3573. // 常にダッシュは不要なので削除してしまう。
  3574. for (var i = 0; i < this._list.length; i++) {
  3575. if (this._list[i].symbol === 'alwaysDash') {
  3576. this._list.splice(i, 1);
  3577. break;
  3578. }
  3579. }
  3580. };
  3581.  
  3582. var _Window_Options_statusText = Window_Options.prototype.statusText;
  3583. Window_Options.prototype.statusText = function(index) {
  3584. var symbol = this.commandSymbol(index);
  3585. if (symbol === 'padConfig') return '';
  3586. return _Window_Options_statusText.call(this, index);
  3587. };
  3588.  
  3589. Window_Options.prototype.isPadSymbol = function(symbol) {
  3590. return symbol.contains('padButton');
  3591. };
  3592.  
  3593. var _Window_Options_processOk = Window_Options.prototype.processOk;
  3594. Window_Options.prototype.processOk = function() {
  3595. var index = this.index();
  3596. var symbol = this.commandSymbol(index);
  3597. if (symbol === 'padConfig') {
  3598. this.playOkSound();
  3599. this.updateInputData();
  3600. this.deactivate();
  3601. this.callHandler('padConfig');
  3602. } else {
  3603. _Window_Options_processOk.call(this);
  3604. }
  3605. };
  3606.  
  3607. var _Window_Options_cursorRight = Window_Options.prototype.cursorRight;
  3608. Window_Options.prototype.cursorRight = function(wrap) {
  3609. var index = this.index();
  3610. var symbol = this.commandSymbol(index);
  3611. if (symbol !== 'padConfig') {
  3612. _Window_Options_cursorRight.call(this, wrap);
  3613. }
  3614. };
  3615.  
  3616. var _Window_Options_cursorLeft = Window_Options.prototype.cursorLeft;
  3617. Window_Options.prototype.cursorLeft = function(wrap) {
  3618. var index = this.index();
  3619. var symbol = this.commandSymbol(index);
  3620. if (symbol !== 'padConfig') {
  3621. _Window_Options_cursorLeft.call(this, wrap);
  3622. }
  3623. };
  3624.  
  3625. //-----------------------------------------------------------------------------
  3626. // Window_PadOptions
  3627. //
  3628.  
  3629. function Window_PadOptions() {
  3630. this.initialize.apply(this, arguments);
  3631. }
  3632.  
  3633. Window_PadOptions.prototype = Object.create(Window_Options.prototype);
  3634. Window_PadOptions.prototype.constructor = Window_PadOptions;
  3635.  
  3636. Window_PadOptions.prototype.initialize = function() {
  3637. Window_Options.prototype.initialize.call(this, 0, 0);
  3638. this.hide();
  3639. this.deactivate();
  3640. };
  3641.  
  3642. Window_PadOptions.prototype.makeCommandList = function() {
  3643. for (var i = 1; i <= 12; i++) {
  3644. this.addCommand('パッドボタン' + i, 'padButton' + i);
  3645. }
  3646. };
  3647.  
  3648. Window_PadOptions.prototype.statusWidth = function() {
  3649. return 120;
  3650. };
  3651.  
  3652. Window_PadOptions.prototype.statusText = function(index) {
  3653. var value = this.getConfigValue(index);
  3654. return value ? padButtonNames[padButtons.indexOf(value)] : '';
  3655. };
  3656.  
  3657. Window_PadOptions.prototype.processOk = function() {
  3658. var index = this.index();
  3659. var value = this.getConfigValue(index);
  3660. value = padButtons.indexOf(value);
  3661. value = (value + 1) % padButtons.length;
  3662. this.changeValue(index, padButtons[value]);
  3663. };
  3664.  
  3665. Window_PadOptions.prototype.cursorRight = function(wrap) {
  3666. var index = this.index();
  3667. var value = this.getConfigValue(index);
  3668. value = padButtons.indexOf(value);
  3669. value = (value + 1).clamp(0, padButtons.length - 1);
  3670. this.changeValue(index, padButtons[value]);
  3671. };
  3672.  
  3673. Window_PadOptions.prototype.cursorLeft = function(wrap) {
  3674. var index = this.index();
  3675. var value = this.getConfigValue(index);
  3676. value = padButtons.indexOf(value);
  3677. value = (value - 1).clamp(0, padButtons.length - 1);
  3678. this.changeValue(index, padButtons[value]);
  3679. };
  3680.  
  3681. Window_PadOptions.prototype.changeValue = function(index, value) {
  3682. var lastValue = this.getConfigValue(index);
  3683. if (lastValue !== value) {
  3684. this.setConfigValue(index, value);
  3685. this.redrawItem(index);
  3686. SoundManager.playCursor();
  3687. }
  3688. };
  3689.  
  3690. Window_PadOptions.prototype.getConfigValue = function(index) {
  3691. return ConfigManager.getPadButton(index);
  3692. };
  3693.  
  3694. Window_PadOptions.prototype.setConfigValue = function(index, value) {
  3695. ConfigManager.setPadButton(index, value);
  3696. };
  3697.  
  3698. //-----------------------------------------------------------------------------
  3699. // Scene_Map
  3700. //
  3701.  
  3702. var _Scene_Map_start = Scene_Map.prototype.start;
  3703. Scene_Map.prototype.start = function() {
  3704. _Scene_Map_start.call(this);
  3705. $gamePlayer.refresh();
  3706. };
  3707.  
  3708. Scene_Base.prototype.checkGameover = function() {
  3709. };
  3710.  
  3711. Scene_Map.prototype.processMapTouch = function() {
  3712. };
  3713.  
  3714. //-----------------------------------------------------------------------------
  3715. // Scene_Options
  3716. //
  3717.  
  3718. var _Scene_Options_create = Scene_Options.prototype.create;
  3719. Scene_Options.prototype.create = function() {
  3720. _Scene_Options_create.call(this);
  3721. this.createPadOptionsWindow();
  3722. };
  3723.  
  3724. var _Scene_Options_createOptionsWindow = Scene_Options.prototype.createOptionsWindow;
  3725. Scene_Options.prototype.createOptionsWindow = function() {
  3726. _Scene_Options_createOptionsWindow.call(this);
  3727. this._optionsWindow.setHandler('padConfig', this.onPadConfig.bind(this));
  3728. };
  3729.  
  3730. Scene_Options.prototype.createPadOptionsWindow = function() {
  3731. this._padOptionsWindow = new Window_PadOptions();
  3732. this._padOptionsWindow.setHandler('cancel', this.cancelPadConfig.bind(this));
  3733. this.addWindow(this._padOptionsWindow);
  3734. };
  3735.  
  3736. Scene_Options.prototype.onPadConfig = function() {
  3737. this._optionsWindow.hide();
  3738. this._padOptionsWindow.show();
  3739. this._padOptionsWindow.activate();
  3740. };
  3741.  
  3742. Scene_Options.prototype.cancelPadConfig = function() {
  3743. this._padOptionsWindow.hide();
  3744. this._optionsWindow.show();
  3745. this._optionsWindow.activate();
  3746. };
  3747.  
  3748. })();
  3749. }
  3750. }
  3751.  
  3752. if (command === platformOFF){
  3753.  
  3754. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement