查看: 1845|回复: 5

[已经过期] 请教下脚本问题

[复制链接]
梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
发表于 2016-10-2 11:26:41 | 显示全部楼层 |阅读模式

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

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

×
下面是一个阵形脚本, 我想问下该怎么设定新的阵形和效果

  1. //
  2. //  陣形 ver1.03
  3. //
  4. // ------------------------------------------------------
  5. // Copyright (c) 2016 Yana
  6. // Released under the MIT license
  7. // [url]http://opensource.org/licenses/mit-license.php[/url]
  8. // ------------------------------------------------------
  9. //
  10. // author Yana
  11. //

  12. var Imported = Imported || {};
  13. Imported['BattleFormation'] = 1.03;
  14. /*:
  15. * @plugindesc ver1.03/陣形の仕組みを追加します。
  16. * @author Yana
  17. *
  18. * @param
  19. * @param 【基本設定】
  20. *
  21. * @param BasicFormationText
  22. * @desc 基本陣形の名称です。
  23. * @default 基本陣形
  24. *
  25. * @param BasicFormationHelp
  26. * @desc 基本陣形に表示するヘルプです。
  27. * @default もっとも基本となる陣形。特に特別な効果はない。
  28. *
  29. * @param
  30. * @param 【メニューの設定】
  31. *
  32. * @param AddMenuBattleFormation
  33. * @desc メニューに陣形の項目を追加するかの設定です。
  34. * @default true
  35. *
  36. * @param MenuBattleFormationTitle
  37. * @desc メニューに表示する陣形の名称です。
  38. * @default 陣形
  39. *
  40. * @param BattleFormationInfoX
  41. * @desc 陣形を表示するウィンドウのX座標です。evalで評価されます。
  42. * cw:commandW sw:statusW gw:goldW h:height w:width
  43. * @default 0
  44. *
  45. * @param BattleFormationInfoY
  46. * @desc 陣形を表示するウィンドウのY座標です。evalで評価されます。
  47. * cw:commandW sw:statusW gw:goldW h:height w:width
  48. * @default Graphics.boxHeight - (gw.height + h)
  49. *
  50. * @param
  51. * @param 【シーンの設定】
  52. *
  53. * @param FormationListWidth
  54. * @desc 陣形シーン時のリスト部分の横幅です。
  55. * @default 320
  56. *
  57. * @param LevelSymbol
  58. * @desc レベルを示すシンボルです。
  59. * 2文字以上でx:1のようなテキスト、数値でゲージ表示になります。
  60. * @default ★
  61. *
  62. * @param LevelColor
  63. * @desc レベルを示すシンボルの色です。
  64. * Window.pngの右下のカラーのインデックスで指定してください。
  65. * @default 6
  66. *
  67. * @param ExpGaugeColor1
  68. * @desc 経験値ゲージの色1です。rgba(r,g,b,a)で指定してください。
  69. * r,g,bは0~255の数値、aは0~1.0の数値です。
  70. * @default rgba(128,128,255,1.0)
  71. *
  72. * @param ExpGaugeColor2
  73. * @desc 経験値ゲージの色2です。rgba(r,g,b,a)で指定してください。
  74. * r,g,bは0~255の数値、aは0~1.0の数値です。
  75. * @default rgba(0,0,255,1.0)
  76. *
  77. * @param ShowParamWindow
  78. * @desc 陣形の詳細を表示するためのウィンドウを使用するかの設定です。
  79. * @default true
  80. *
  81. * @param ParamColor
  82. * @desc 詳細ウィンドウに表示する特徴の色設定です。
  83. * 順番に基本色、システム色、上昇色、下降色です。
  84. * @default 6,4,24,2
  85. *
  86. * @param AddSkillText
  87. * @desc 詳細ウィンドウに表示するクラスで習得するスキルの項目名です。
  88. * @default スキル追加:
  89. *
  90. * @param ParamText1
  91. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  92. * 1は有効度と無効化です。
  93. * @default  有効度,弱体有効度,無効化
  94. *
  95. * @param ParamText2
  96. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  97. * 2は追加能力値です。
  98. * @default 命中率,回避率,会心率,会心回避,魔法回避,魔法反射率,反撃率,再生率
  99. *
  100. * @param ParamText3
  101. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  102. * 3は特殊能力値です。
  103. * @default 狙われ率,防御効果率,回復効果率,薬の知識,消費率,チャージ率,物理ダメージ率,魔法ダメージ率,床ダメージ率,経験値獲得率
  104. *
  105. * @param ParamText4
  106. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  107. * 4は攻撃タブです。
  108. * @default 攻撃属性付与:,攻撃時ステート付与:,攻撃速度,攻撃回数
  109. *
  110. * @param ParamText5
  111. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  112. * 5はスキルタブです。
  113. * @default スキルタイプ追加:,スキルタイプ封印:,スキル追加:,スキル封印:
  114. *
  115. * @param ParamText6
  116. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  117. * 6は装備タブです。
  118. * @default 武器タイプ追加:,防具タイプ追加:,装備固定:,装備封印:,二刀流
  119. *
  120. * @param ParamText7
  121. * @desc 詳細ウィンドウに表示する特徴の表示名です。
  122. * 7はその他タブです。
  123. * @default 行動回数追加,自動戦闘,防御,身代わり,持越し,消滅エフェクト,エンカウント半減,エンカウント無効,不意打ち無効,先制率アップ,取得金額倍化,アイテム取得率倍化
  124. *
  125. * @param DefeatText
  126. * @desc 消滅エフェクトで使用するサブテキストです。基本使用しません。
  127. * @default 通常,ボス,瞬間消去,消えない
  128. *
  129. * @param ParamWindowWidth
  130. * @desc 陣形の詳細を表示するためのウィンドウの横幅です。
  131. * @default 220
  132. *
  133. * @param BasicWinExp
  134. * @desc 勝利時に加算される陣形経験値の基本値です。
  135. * @default 1
  136. *
  137. * @param MasterText
  138. * @desc 陣形をマスターした時にNext欄に表示されるテキストです。
  139. * @default Master!
  140. *
  141. * @param LevelUpText
  142. * @desc 陣形のレベルが上がった時に表示されるテキストです。
  143. * @default _nameの熟練度が上がった!
  144. *
  145. * @param MasterFormText
  146. * @desc 陣形のレベルが最高値に達した時に表示されるテキストです。
  147. * @default _nameをマスターした!
  148. *
  149. * @param ActiveHelpText
  150. * @desc ステータスがアクティブなときに表示される操作ヘルプです。
  151. * @default 決定:並び替え ←,キャンセル:リストに戻る
  152. *
  153. * @param DeactiveHelpText
  154. * @desc ステータスが非アクティブなときに表示される操作ヘルプです。
  155. * @default 決定:陣形を変更 →:陣形の詳細を確認,並び替え
  156. *
  157. * @param
  158. * @param 【ホームの設定】
  159. *
  160. * @param HomePosition1
  161. * @desc メンバーが1人の時のアクターのホームポジションです。
  162. * x,yで記述してください。
  163. * @default 700,267
  164. *
  165. * @param HomePosition2
  166. * @desc メンバーが2人の時のアクターのホームポジションです。
  167. * x,y x,yで記述してください。
  168. * @default 640,242 700,292
  169. *
  170. * @param HomePosition3
  171. * @desc メンバーが3人の時のアクターのホームポジションです。
  172. * x,y x,y x,yで記述してください。
  173. * @default 640,217 670,267 700,317
  174. *
  175. * @param HomePosition4
  176. * @desc メンバーが4人の時のアクターのホームポジションです。
  177. * x,y x,y x,y x,yで記述してください。
  178. * @default 640,192 660,242 680,292 700,342
  179. *
  180. * @param HomePosition5
  181. * @desc メンバーが5人の時のアクターのホームポジションです。
  182. * x,y x,y x,y x,y x,yで記述してください。
  183. * @default 630,187 650,227 670,267 690,307 710,347
  184. *
  185. * @param HomePosition6
  186. * @desc メンバーが6人の時のアクターのホームポジションです。
  187. * x,y x,y x,y x,y x,y x,yで記述してください。
  188. * @default 620,167 640,207 660,247 680,287 700,327 720,367
  189. *
  190. * @param HomePosition7
  191. * @desc メンバーが7人の時のアクターのホームポジションです。
  192. * x,y x,y x,y x,y x,y x,y x,yで記述してください。
  193. * @default 610,177 630,207 650,237 670,267 690,297 710,327 730,357
  194. *
  195. * @param HomePosition8
  196. * @desc メンバーが8人の時のアクターのホームポジションです。
  197. * x,y x,y x,y x,y x,y x,y x,y x,yで記述してください。
  198. * @default 600,162 620,192 640,222 660,252 680,282 700,312 720,342 740,372
  199. *
  200. * @param HomePosition9
  201. * @desc メンバーが9人の時のアクターのホームポジションです。
  202. * x,y x,y x,y x,y x,y x,y x,y x,y x,yで記述してください。
  203. * @default 590,167 610,192 630,217 650,242 670,267 690,292 710,317 730,342 750,367
  204. *
  205. * @param HomePosition10
  206. * @desc メンバーが10人の時のアクターのホームポジションです。
  207. * x,y x,y x,y x,y x,y x,y x,y x,y x,y x,yで記述してください。
  208. * @default 580,159 600,183 620,207 640,231 660,255 680,279 700,303 720,327 740,351 760,375
  209. *
  210. * @help ------------------------------------------------------
  211. * プラグインコマンド
  212. * ------------------------------------------------------
  213. * このプラグインには、以下のプラグインコマンドがあります。
  214. *
  215. * 陣形 シーン呼び出し
  216. * BattleFormation callScene
  217. * ・陣形シーンを呼び出します。
  218. *
  219. * 陣形 設定 アイテムID
  220. * BattleFormation Set アイテムID
  221. * ・陣形をアイテムIDに設定します。
  222. *
  223. * ------------------------------------------------------
  224. * 使用方法
  225. * ------------------------------------------------------
  226. * ―――基本的なこと―――
  227. * 陣形とは、アクターの位置を特定の位置に設定して、場所によってアクターの能力を強化する機能です。
  228. * この際一人でも戦闘不能者がいると、陣形崩壊となり陣形効果は無効になります。
  229. * いずれかの戦闘メンバーの特徴オブジェクトのメモに
  230. * <陣形無効>
  231. * <InvalidFormation>
  232. * のいずれかが記述されている場合、陣形効果は無効となります。
  233. * また、上記いずれかの要因で陣形が無効化された状態で戦闘が終了すると、陣形経験値は入手できません。
  234. *
  235. * ―――陣形を作る―――
  236. * ・陣形の基本設定
  237. * アイテムのメモ欄で設定します。
  238. * 設定したアイテムを入手することで、その陣形が使用可能になります。
  239. *
  240. * 以下の設定がある場合、そのアイテムは陣形アイテムとして扱われます。
  241. * アイテムのメモに
  242. * <陣形設定>
  243. * 一人目のX座標,Y座標,使用するクラスID[,配置条件]
  244. * 二人目のX座標,Y座標,使用するクラスID[,配置条件]
  245. * 三人目のX座標,Y座標,使用するクラスID[,配置条件]
  246. * ・・・
  247. * </陣形設定>
  248. * と記述します。
  249. *
  250. * 一人目までなら一人陣形、二人目までなら二人、三人目までなら三人陣形・・・となります。
  251. * クラスIDはこの位置に配置されたアクターの能力や特徴にそのクラスで設定したものが追加される設定です。
  252. * 配置条件の記述は任意です。この部分がevalで判定され、全員がtrueの場合は陣形が有効になります。
  253. * 省略した場合は、常にtrueとして扱われます。
  254. *
  255. * また、アイテム名はそのまま陣形の名前として、アイテムの説明は陣形の説明として使用されます。
  256. *
  257. * ・陣形経験値の設定
  258. * 同じように、アイテムのメモに
  259. * <陣形経験値設定:Lv2までの必要値,Lv3までの必要値,Lv4までの必要値…>
  260. * <FormationExpSetting:Lv2までの必要値,Lv3までの必要値,Lv4までの必要値…>
  261. * と記述することで、陣形にレベルを設定することができます。
  262. *
  263. * レベルの最大値は設定した個数+1となります。
  264. * 陣形の経験値は戦闘に勝利することで蓄積されていきます。
  265. * 陣形のレベルは、以下で解説するクラスの設定でのレベルによるステータスの補正や、習得スキルで使用されます。
  266. *
  267. * ―――陣形の中身を設定する―――
  268. * 陣形の各ポジションによる補正はクラスを使用して行います。
  269. * クラスに設定した特徴やステータス値、更に習得するスキルがそのポジションにいるアクターに追加されます。
  270. * この際、このクラスのレベルの値は、陣形レベルが使用されます。
  271. *
  272. * このクラスに設定した名前は、陣形シーンで各ポジションの特徴などを確認するウィンドウに表示されます。
  273. *
  274. * 以下のいずれかを記述をすることで、クラスの詳細を確認するウィンドウにテキストを追加することができます。
  275. *
  276. * <陣形効果テキスト追加:前:表示したいテキスト>
  277. * <陣形効果テキスト追加:後:表示したいテキスト>
  278. * <AddFormationEffectText:F:表示したいテキスト>
  279. * <AddFormationEffectText:L:表示したいテキスト>
  280. *
  281. * この際、前やFを指定した場合はほかの効果よりも前に、
  282. * 後やLを指定した場合は他の効果より後にテキストが追加されます。
  283. * また、
  284. * <陣形効果テキスト追加:前:Lv2:表示したいテキスト>
  285. * のように、前後の指定の後にLv○:を追加することで、そのレベル以上で追加されるテキストとなります。
  286. *
  287. * それに加えて、陣形で設定されたクラスの習得スキルのメモに
  288. * <陣形非表示>
  289. * <HideFormation>
  290. * のいずれかの記述があると、そのスキルは詳細ウィンドウに表示されなくなります。
  291. *
  292. * ―――陣形経験値について―――
  293. * 陣形経験値は基本的には勝利することで1ポイント追加されます。
  294. * このポイントは、エネミーのメモに
  295. * <陣形経験値:x>
  296. * <BattleFormationExp:x>
  297. * のいずれかを記述することで、そのエネミーを倒した際に追加でxポイントの陣形経験値を加算します。
  298. *
  299. * また、アクターやクラス等特徴を持ったオブジェクトのメモ欄に
  300. * <陣形経験値倍率:x>
  301. * <BattleFormationExpRate:x>
  302. * のいずれかを記述すると、最終的に得られる陣形経験値がx倍になります。
  303. * これらは全てのアクターで個別に反映され、重複して乗算されていくので、設定には注意してください。
  304. * (アクター5人がそれぞれ2倍の設定を持っていると、最終的に32倍になる)
  305. *
  306. * ―――リストの表示について―――
  307. * 陣形リストで表示される経験値の表記は、アイテムのメモを使ってカスタマイズできます。
  308. * アイテムのメモに
  309. * <レベルシンボル:x>
  310. * <LevelSymbol:x>
  311. * のいずれかを記述すると、その陣形の経験値のシンボルをxに指定します。
  312. * この時、xに2文字以上を指定すると、x:1のような数値表示に、
  313. * xに数値を指定すると、それを目盛りの幅として、||||||||のようなゲージ表示になります。
  314. *
  315. * 同じようにアイテムのメモに
  316. * <シンボルカラー:x>
  317. * <SymbolColor:x>
  318. * と記述すると、そのシンボルやゲージ、テキストの色をxに設定します。
  319. * xはWindow.pngの右下に並んでいるカラーのインデックスで指定してください。
  320. *
  321. * 更に、
  322. * <経験値ゲージカラー1:rgba(r,g,b,a)>
  323. * <ExpGaugeColor1:rgba(r,g,b,a)>
  324. * のいずれかを記述することで、経験値カラーの左側をrgbaのカラーに、
  325. *
  326. * <経験値ゲージカラー2:rgba(r,g,b,a)>
  327. * <ExpGaugeColor2:rgba(r,g,b,a)>
  328. * のいずれかを記述することで、経験値カラーの右側をrgbaのカラーに変更します。
  329. * r,g,bはそれぞれ、赤、緑、青で0~255の数値を、aは透明度で0~1.0の数値を指定してください。
  330. *
  331. * ------------------------------------------------------
  332. * 利用規約
  333. * ------------------------------------------------------
  334. * 当プラグインはMITライセンスで公開されています。
  335. * 使用に制限はありません。商用、アダルト、いずれにも使用できます。
  336. * 二次配布も制限はしませんが、サポートは行いません。
  337. * 著作表示は任意です。行わなくても利用できます。
  338. * 要するに、特に規約はありません。
  339. * バグ報告や使用方法等のお問合せはネ実ツクールスレ、または、Twitterにお願いします。
  340. * [url]https://twitter.com/yanatsuki_[/url]
  341. * 素材利用は自己責任でお願いします。
  342. * ------------------------------------------------------
  343. * 更新履歴:
  344. * ver1.03:
  345. * 詳細ウィンドウに表示する項目名を設定できるように変更。
  346. * 経験値のレイアウトに関する設定を追加。
  347. * ver1.02:
  348. * 陣形で設定したクラスのパラメータが正常に反映されていないバグを修正。
  349. * メニュー画面の現在の陣形を表示するウィンドウの座標を設定する項目を追加。
  350. * ver1.01:
  351. * 陣形の種類が増えた時、ウィンドウが画面外にはみ出すバグを修正。
  352. * ver1.00:
  353. * 公開
  354. */

  355. (function() {
  356.     ////////////////////////////////////////////////////////////////////////////////////

  357.     var parameters = PluginManager.parameters('BattleFormation');
  358.     var basicFormationText = parameters['BasicFormationText'] || '基本陣形';
  359.     var basicFormationHelp = parameters['BasicFormationHelp'] || '';
  360.     var addMenuBattleFormation = parameters['AddMenuBattleFormation'] === 'true';
  361.     var battleFormationInfoX = parameters['BattleFormationInfoX'];
  362.     var battleFormationInfoY = parameters['BattleFormationInfoY'];
  363.     var formationListWidth = Number(parameters['FormationListWidth']) || 320;
  364.     var showParamWindow = parameters['ShowParamWindow'] === 'true';
  365.     var paramWindowWidth = Number(parameters['ParamWindowWidth']) || 220;
  366.     var menuBattleFormationTitle = parameters['MenuBattleFormationTitle'];
  367.     var basicWinExp = parseInt(parameters['BasicWinExp'],10);
  368.     var masterText = parameters['MasterText'];
  369.     var levelUpText = parameters['LevelUpText'];
  370.     var masterFormText = parameters['MasterFormText'];
  371.     var activeHelpText = parameters['ActiveHelpText'];
  372.     var deactiveHelpText = parameters['DeactiveHelpText'];
  373.     var addSkillText = parameters['AddSkillText'];
  374.     var levelSymbol = parameters['LevelSymbol'];
  375.     var levelColor = Number(parameters['LevelColor']);
  376.     var defeatText = parameters['DefeatText'].split(',');
  377.     var paramColor = parameters['ParamColor'].split(',');
  378.     var expGaugeColor1 = parameters['ExpGaugeColor1'] || 'rgba(128,128,255,1.0)';
  379.     var expGaugeColor2 = parameters['ExpGaugeColor2'] || 'rgba(0,0,255,1.0)';
  380.     var basicFormations = [];
  381.     var paramVocab = [];

  382.     for (var i=1;i<=10;i++) {
  383.         var key = 'HomePosition' + i;
  384.         basicFormations[i-1] = parameters[key].split(' ');
  385.     }

  386.     for (var i=1;i<=7;i++) {
  387.         var key = 'ParamText' + i;
  388.         paramVocab[i-1] = parameters[key].split(',');
  389.     }

  390.     ////////////////////////////////////////////////////////////////////////////////////

  391.     DataManager.formationStatus = function(item) {
  392.         if (!item) return this.basicFormation();
  393.         if (item._formationStatus) return item._formationStatus;
  394.         item._formationStatus = [];
  395.         var texts = item.note.split('\n');
  396.         for (var i=0,max=texts.length;i<max;i++) {
  397.             var text = texts[i];
  398.             if (text.match(/^<陣形設定>/)) {
  399.                 for (var j=i;j<max;j++) {
  400.                     var stext = texts[j];
  401.                     if (stext.match(/<\/陣形設定>/)) {
  402.                         i = j;
  403.                         break;
  404.                     }
  405.                     if (stext.match(/(\d+),(\d+),(\d+),?(.+)?/)) {
  406.                         var obj = {
  407.                             x:parseInt(RegExp.$1,10),
  408.                             y:parseInt(RegExp.$2,10),
  409.                             classId:parseInt(RegExp.$3,10),
  410.                             cond:RegExp.$4
  411.                         };
  412.                         item._formationStatus.push(obj);
  413.                     }
  414.                 }
  415.             }
  416.         }
  417.         return item._formationStatus;
  418.     };

  419.     DataManager.bfExps = function(item) {
  420.         if (!item) return [];
  421.         var ary = [];
  422.         if (item && item.meta['陣形経験値設定'] || item.meta['FormationExpSetting']) {
  423.             if (item.meta['陣形経験値設定']) {
  424.                 ary = item.meta['陣形経験値設定'].split(',').map(function (n) {
  425.                     return parseInt(n, 10)
  426.                 });
  427.             } else if (item.meta['FormationExpSetting']) {
  428.                 ary = item.meta['FormationExpSetting'].split(',').map(function(n){
  429.                     return parseInt(n,10)
  430.                 });
  431.             }
  432.         }
  433.         return ary;
  434.     };

  435.     DataManager.basicFormation = function() {
  436.         var size = $gameParty.battleMembers().length;
  437.         var homes = basicFormations[size-1];
  438.         var ary = [];
  439.         for (var i=0;i<size;i++) {
  440.             var home = homes[i].split(',').map(function(n){ return parseInt(n,10) });
  441.             ary.push({x:home[0],y:home[1],classId:0});
  442.         }
  443.         return ary;
  444.     };

  445.     ////////////////////////////////////////////////////////////////////////////////////

  446.     var __BManager_startBattle = BattleManager.startBattle;
  447.     BattleManager.startBattle = function() {
  448.         __BManager_startBattle.call(this);
  449.     };

  450.     var __BManager_startInput = BattleManager.startInput;
  451.     BattleManager.startInput = function() {
  452.         __BManager_startInput.call(this);
  453.         $gameParty.checkBattleFormation();
  454.     };

  455.     var __BManager_processVictory = BattleManager.processVictory;
  456.     BattleManager.processVictory = function() {
  457.         var lv = $gameParty.currentBfLevel();
  458.         $gameParty.increaseFormationExp();
  459.         this._upBfLevel = lv < $gameParty.currentBfLevel();
  460.         __BManager_processVictory.call(this);
  461.     };

  462.     var __BManager_displayRewards = BattleManager.displayRewards;
  463.     BattleManager.displayRewards = function() {
  464.         __BManager_displayRewards.call(this);
  465.         if (this._upBfLevel) this.displayBfLevel();
  466.     };

  467.     BattleManager.displayBfLevel = function() {
  468.         var item = $gameParty.battleFormation();
  469.         var text = '';
  470.         if ($gameParty.isMaxBfLevel(item.id)) {
  471.             text = masterFormText.replace(/_name/,item.name);
  472.         } else {
  473.             text = levelUpText.replace(/_name/,item.name);
  474.         }
  475.         $gameMessage.add('\\.' + text);
  476.     };


  477.     ////////////////////////////////////////////////////////////////////////////////////

  478.     var __GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  479.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  480.         __GInterpreter_pluginCommand.call(this, command, args);
  481.         if (command === '陣形' || command === 'BattleFormation') {
  482.             switch (args[0]) {
  483.                 case 'シーン呼び出し':
  484.                 case 'callScene':
  485.                     this.callSceneBattleFormation();
  486.                     break;
  487.                 case '設定':
  488.                 case 'Set':
  489.                     var id = parseInt(args[1],10);
  490.                     var item = $dataItems[id];
  491.                     $gameParty.setBattleFormation(item);
  492.             }
  493.         }
  494.     };

  495.     Game_Interpreter.prototype.callSceneBattleFormation = function() {
  496.         SceneManager.push(Scene_BattleFormation);
  497.     };

  498.     ////////////////////////////////////////////////////////////////////////////////////

  499.     var __GActor_paramPlus = Game_Actor.prototype.paramPlus;
  500.     Game_Actor.prototype.paramPlus = function(paramId) {
  501.         var value = __GActor_paramPlus.call(this, paramId);
  502.         if ($gameParty.formationEnable() && this._bfClass) {
  503.             var cl = $dataClasses[this._bfClass];
  504.             if (cl.params[paramId][$gameParty.currentBfLevel()] > 1) {
  505.                 value += cl.params[paramId][$gameParty.currentBfLevel()];
  506.             }
  507.         }
  508.         return value;
  509.     };

  510.     var __GActor_traitObjects = Game_Actor.prototype.traitObjects;
  511.     Game_Actor.prototype.traitObjects = function() {
  512.         var result = __GActor_traitObjects.call(this);
  513.         if ($gameParty.formationEnable() && this._bfClass) {
  514.             var cl = $dataClasses[this._bfClass];
  515.             result.push(cl);
  516.         }
  517.         return result;
  518.     };

  519.     var __GActor_skills = Game_Actor.prototype.skills;
  520.     Game_Actor.prototype.skills = function() {
  521.         var result = __GActor_skills.call(this);
  522.         return result.concat(this.bfClassSkills());
  523.     };

  524.     Game_Actor.prototype.bfClassSkills = function() {
  525.         var result = [];
  526.         if ($gameParty.formationEnable() && this._bfClass) {
  527.             var cl = $dataClasses[this._bfClass];
  528.             for (var i=0,max=cl.learnings.length;i<max;i++) {
  529.                 var l = cl.learnings[i];
  530.                 if ($gameParty.currentBfLevel() >= l.level) {
  531.                     result.push($dataSkills[l.skillId]);
  532.                 }
  533.             }
  534.         }
  535.         return result;
  536.     };

  537.     Game_Actor.prototype.checkFormationEnable = function(cond, id) {
  538.         if (this.isDead()) return false;
  539.         if (this.traitObjects().some(function(t){
  540.             return (t.meta['陣形無効'] || t.meta['InvalidFormation']) })) return false;
  541.         var pf = $gameParty.battleFormation();
  542.         if (pf && id === pf.id) cond = this._bfCond;
  543.         if (!cond) return true;
  544.         var a = $gameActors.actor(this.actorId());
  545.         var v = $gameVariables._data;
  546.         return eval(cond);
  547.     };

  548.     if (Imported['yPassiveSkill']) {
  549.         var __GActor_enableSkills = Game_Actor.prototype.enableSkills;
  550.         Game_Actor.prototype.enableSkills = function() {
  551.             var skills = __GActor_enableSkills.call(this);
  552.             return skills.concat(this.bfClassSkills());
  553.         }
  554.     }

  555.     ////////////////////////////////////////////////////////////////////////////////////

  556.     Game_Party.prototype.refreshBattleFormation = function() {
  557.         var formation = this.battleFormation();
  558.         this.setBattleFormation(formation);
  559.         this.checkBattleFormation();
  560.     };

  561.     Game_Party.prototype.battleFormation = function() {
  562.         if (!this._battleFormation) this._battleFormation = [];
  563.         var id = this._battleFormation[this.battleMembers().length];
  564.         return $dataItems[id];
  565.     };

  566.     Game_Party.prototype.setBattleFormation = function(formation) {
  567.         if (!this._battleFormation) this._battleFormation = [];
  568.         var members = this.battleMembers();
  569.         var size = members.length;
  570.         var id = 0;
  571.         var data = DataManager.formationStatus(formation);
  572.         if (formation) id = formation.id;
  573.         if (id) size = data.length;
  574.         this._battleFormation[size] = id;
  575.         if (size === members.length) {
  576.             for (var i = 0; i < size; i++) {
  577.                 var member = members[i];
  578.                 var d = data[i];
  579.                 member._bfHome = [d.x, d.y];
  580.                 member._bfClass = d.classId;
  581.                 member._bfCond = d.cond;
  582.             }
  583.         }
  584.     };

  585.     Game_Party.prototype.checkBattleFormation = function() {
  586.         this._formationEnable = this.isEnableBattleFormation();
  587.     };

  588.     Game_Party.prototype.isEnableBattleFormation = function(id) {
  589.         var members = this.battleMembers();
  590.         var status = DataManager.formationStatus($dataItems[id]);
  591.         for (var i=0,max=members.length;i<max;i++) {
  592.             var member = members[i];
  593.             if (!member.checkFormationEnable(status[i].cond, id)) {
  594.                 return false;
  595.             }
  596.         }
  597.         return true;
  598.     };

  599.     Game_Party.prototype.formationEnable = function() {
  600.         return this.inBattle() && this._formationEnable;
  601.     };

  602.     Game_Party.prototype.bfLevel = function(id) {
  603.         if (!this._bfExps) return 1;
  604.         if (!this._bfExps[id]) return 1;
  605.         return this.levelForBfExp(id);
  606.     };

  607.     Game_Party.prototype.currentBfLevel = function() {
  608.         var item = this.battleFormation();
  609.         if (!item) return 1;
  610.         return this.bfLevel(item.id);
  611.     };

  612.     Game_Party.prototype.levelForBfExp = function(id) {
  613.         var item = $dataItems[id];
  614.         var exps = DataManager.bfExps(item);
  615.         var exp = this._bfExps[item.id];
  616.         var value = 0;
  617.         for (var i=0,max=exps.length;i<max;i++) {
  618.             value += exps[i];
  619.             if (exp < value) return i+1;
  620.         }
  621.         return i+1;
  622.     };

  623.     Game_Party.prototype.bfExpForLevel = function(id, level) {
  624.         var item = $dataItems[id];
  625.         var exps = DataManager.bfExps(item);
  626.         var value = 0;
  627.         var max = Math.min(level-1, exps.length);
  628.         for (var i=0;i<max;i++) value += exps[i];
  629.         return value;
  630.     };

  631.     Game_Party.prototype.increaseFormationExp = function() {
  632.         if (!this.battleFormation()) return;
  633.         var id = this.battleFormation().id;
  634.         var count = this.winExp();
  635.         var bfExp = this.bfExp(id);
  636.         this._bfExps[id] = bfExp + count;
  637.     };

  638.     Game_Party.prototype.bfExp = function(id) {
  639.         if (!this._bfExps) this._bfExps = {};
  640.         if (!this._bfExps[id]) this._bfExps[id] = 0;
  641.         return this._bfExps[id];
  642.     };

  643.     Game_Party.prototype.isMaxBfLevel = function(id) {
  644.         var item = $dataItems[id];
  645.         var exps = DataManager.bfExps(item);
  646.         var maxLevel = exps.length + 1;
  647.         return this.bfLevel(id) >= maxLevel;
  648.     };

  649.     Game_Party.prototype.winExp = function() {
  650.         if (!this.isEnableBattleFormation(this.battleFormation().id)) return 0;
  651.         var value = basicWinExp;
  652.         $gameTroop.members().forEach(function(e){
  653.             if (e.enemy().meta['陣形経験値']) value += parseInt(e.enemy().meta['陣形経験値'],10);
  654.             if (e.enemy().meta['BattleFormationExp']) value += parseInt(e.enemy().meta['BattleFormationExp'],10);
  655.         }.bind(this));
  656.         $gameParty.battleMembers().forEach(function(m){
  657.             m.traitObjects().forEach(function(t){
  658.                 if (t.meta['陣形経験値倍率'] !== undefined) value *= Number(t.meta['陣形経験値倍率']);
  659.                 if (t.meta['BattleFormationExpRate'] !== undefined) value *= Number(t.meta['BattleFormationExpRate']);
  660.             }.bind(this));
  661.         }.bind(this));
  662.         return value;
  663.     };

  664.     ////////////////////////////////////////////////////////////////////////////////////

  665.     var __SActor_setActorHome = Sprite_Actor.prototype.setActorHome;
  666.     Sprite_Actor.prototype.setActorHome = function(index) {
  667.         __SActor_setActorHome.call(this, index);
  668.         if (!this._actor._bfHome) $gameParty.setBattleFormation(null);
  669.         var home = this._actor._bfHome;
  670.         this.setHome(home[0], home[1] + 80);
  671.         if (this._actor._home) {
  672.             this._actor._home = this._actor._bfHome;
  673.         }
  674.     };

  675.     ////////////////////////////////////////////////////////////////////////////////////

  676.     function Window_BFFormationList() {
  677.         this.initialize.apply(this, arguments);
  678.     }

  679.     Window_BFFormationList.prototype = Object.create(Window_Command.prototype);
  680.     Window_BFFormationList.prototype.constructor = Window_BFFormationList;

  681.     Window_BFFormationList.prototype.initialize = function(y) {
  682.         if ($gameParty.battleFormation() === undefined) $gameParty.setBattleFormation(null);
  683.         //this._oy = y;
  684.         Window_Command.prototype.initialize.call(this, 0, y);
  685.         this.openness = 0;
  686.         //var yy = (Graphics.boxHeight - this._oy) / 2 - (this.windowHeight() / 2) + this._oy;
  687.         //this.y = yy;
  688.         this.selectExt($gameParty.battleFormation());
  689.     };

  690.     Window_BFFormationList.prototype.windowWidth = function() {
  691.         return formationListWidth;
  692.     };

  693.     Window_BFFormationList.prototype.makeCommandList = function() {
  694.         this.addCommand(basicFormationText,'set',true);
  695.         var items = $gameParty.items();
  696.         for (var i=0,max=items.length;i<max;i++) {
  697.             var item = items[i];
  698.             if (item.meta['陣形設定']) {
  699.                 var data = DataManager.formationStatus(item);
  700.                 if (data.length === $gameParty.battleMembers().length) {
  701.                     this.addCommand(item.name,'set',true,item);
  702.                 }
  703.             }
  704.         }
  705.     };

  706.     Window_BFFormationList.prototype.lineHeight = function() {
  707.         return 48;
  708.     };

  709.     Window_BFFormationList.prototype.offsetHeight = function() {
  710.         return 0;
  711.     };

  712.     Window_BFFormationList.prototype.maxPageItems = function() {
  713.         var hw = this._helpWindow ? this._helpWindow.height : 108;
  714.         var max = ((Graphics.boxHeight - hw) - this.standardPadding() * 2) / this.lineHeight();
  715.         return Math.floor(max);
  716.     };

  717.     Window_BFFormationList.prototype.refresh = function() {
  718.         this.clearCommandList();
  719.         this.makeCommandList();
  720.         var l = Math.min(this._list.length,this.maxPageRows());
  721.         var mh = this.lineHeight() * this.maxPageItems() + this.standardPadding() * 2;
  722.         this.height = Math.min(l * this.lineHeight() + this.standardPadding() * 2 + this.offsetHeight(),mh);
  723.         this._upArrowSprite.y += this.offsetHeight();
  724.         this.createContents();
  725.         Window_Selectable.prototype.refresh.call(this);
  726.     };

  727.     Window_BFFormationList.prototype.drawItem = function(index) {
  728.         var rect = this.itemRectForText(index);
  729.         var align = this.itemTextAlign();
  730.         var item = this._list[index].ext;
  731.         var exps = DataManager.bfExps(item);
  732.         var enable = !(item && !$gameParty.isEnableBattleFormation(item.id));
  733.         this.contents.fontSize = 24;
  734.         this.resetTextColor();
  735.         if (exps.length > 0) rect.y -= 8;
  736.         if (this._list[index].ext === $gameParty.battleFormation()) this.changeTextColor('rgba(128,255,128,1.0)');
  737.         this.changePaintOpacity(enable);
  738.         this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
  739.         if (!enable) {
  740.             this.changeTextColor(this.textColor(2));
  741.             this.drawText('×', rect.x, rect.y, rect.width, 'right');
  742.         }
  743.         if (exps.length > 0) {
  744.             this.resetTextColor();
  745.             this.contents.fontSize = 16;
  746.             var id = item.id;
  747.             var exp = $gameParty.bfExp(id);
  748.             var lv = $gameParty.bfLevel(id);
  749.             var next = $gameParty.bfExpForLevel(id, lv + 1);
  750.             var crt = $gameParty.bfExpForLevel(id, lv);
  751.             var max = exps.length + 1;
  752.             var rate = next - crt > 0 ? Math.min((exp - crt) / (next - crt),1.0) : 1.0;
  753.             this.drawFormationLevel(rect,lv,max,item);
  754.             var gc1 = item.meta['経験値ゲージカラー1'] || item.meta['ExpGaugeColor1'] || expGaugeColor1;
  755.             var gc2 = item.meta['経験値ゲージカラー2'] || item.meta['ExpGaugeColor2'] || expGaugeColor2;
  756.             this.drawGauge(rect.x + 172, rect.y + 8, rect.width - 168, rate, gc1,gc2);
  757.             if ($gameParty.isMaxBfLevel(id)) {
  758.                 this.drawText(masterText,rect.x + 172, rect.y + 22, rect.width - 168, 'center');
  759.             } else {
  760.                 this.changeTextColor('rgba(180,180,255,1.0)');
  761.                 this.drawText('Next',rect.x + 172, rect.y + 22, rect.width - 168);
  762.                 this.resetTextColor();
  763.                 this.drawText((exp-crt)+'/'+(next-crt),rect.x + 172, rect.y + 22, rect.width - 168, 'right');
  764.             }
  765.         }
  766.     };

  767.     Window_BFFormationList.prototype.drawFormationLevel = function(rect, lv, max, item) {
  768.         var symbol = item.meta['LevelSymbol'] || item.meta['レベルシンボル'] || levelSymbol;
  769.         var color = Number(item.meta['SymbolColor'] || item.meta['シンボルカラー'] || levelColor);
  770.         color = this.textColor(color);
  771.         if (isNaN(symbol)) {
  772.             if (symbol.length > 1) {
  773.                 this.changeTextColor(color);
  774.                 this.drawText(symbol + ':' + lv, rect.x, rect.y + 22, rect.width - 120);
  775.             } else {
  776.                 if (symbol) {
  777.                     this.changeTextColor(color);
  778.                     var text = '';
  779.                     for (var i = 0; i < lv; i++) text += symbol;
  780.                     this.drawText(text, rect.x, rect.y + 22, rect.width - 120);
  781.                     var tw = this.textWidth(text);
  782.                     this.changeTextColor('rgba(128,128,128,0.5)');
  783.                     text = '';
  784.                     for (var i = 0; i < max - lv; i++) text += symbol;
  785.                     this.drawText(text, rect.x + tw, rect.y + 22, rect.width - 120);
  786.                 }
  787.             }
  788.         } else {
  789.             var w = Number(symbol);
  790.             for (var i = 0; i < lv; i++) this.contents.fillRect(rect.x + (w + 1) * i, rect.y + 38, w, 16, color);
  791.             for (var i = lv; i < max; i++) this.contents.fillRect(rect.x + (w + 1) * i, rect.y + 38, w, 16, 'rgba(0,0,0,0.5)');
  792.         }
  793.         this.resetTextColor();
  794.     };

  795.     Window_BFFormationList.prototype.formation = function() {
  796.         return DataManager.formationStatus(this.currentExt());
  797.     };

  798.     Window_BFFormationList.prototype.updateHelp = function() {
  799.         var item = this.currentExt();
  800.         if (item) {
  801.             this.setHelpWindowItem(item);
  802.         } else {
  803.             this._helpWindow.setText(basicFormationHelp);
  804.         }
  805.     };


  806.     Window_BFFormationList.prototype.cursorRight = function(wrap) {
  807.         if (this.currentExt()) {
  808.             SoundManager.playOk();
  809.             this.callHandler('right');
  810.         } else {
  811.             SoundManager.playBuzzer();
  812.         }
  813.     };

  814.     ////////////////////////////////////////////////////////////////////////////////////


  815.     function Window_BFStatus() {
  816.         this.initialize.apply(this, arguments);
  817.     }

  818.     Window_BFStatus.prototype = Object.create(Window_Selectable.prototype);
  819.     Window_BFStatus.prototype.constructor = Window_BFStatus;

  820.     Window_BFStatus.prototype.initialize = function(x,y) {
  821.         this._frameCount = 0;
  822.         this._lockIndex = -1;
  823.         var w = Graphics.boxWidth - x;
  824.         var h = Graphics.boxHeight - y + 4;
  825.         Window_Selectable.prototype.initialize.call(this, x, y, w, h);
  826.         this._actorSprites = [];
  827.         var members = $gameParty.battleMembers();
  828.         for (var i=0,max=members.length;i<max;i++) {
  829.             var actor = members[i];
  830.             var bitmap = ImageManager.loadSvActor(actor._battlerName);
  831.             var sprite = new Sprite(bitmap);
  832.             sprite.setFrame(0,0,64,64);
  833.             sprite._actor = actor;
  834.             sprite.ox = 0;
  835.             sprite.oy = 0;
  836.             this.addChild(sprite);
  837.             this._actorSprites.push(sprite);
  838.         }
  839.         this.opacity = 0;
  840.         //this.openness = 0;
  841.     };

  842.     Window_BFStatus.prototype.standardFontSize = function() {
  843.         return 20;
  844.     };

  845.     Window_BFStatus.prototype.standardPadding = function() {
  846.         return 8;
  847.     };

  848.     Window_BFStatus.prototype.maxItems = function() {
  849.         return $gameParty.battleMembers().length;
  850.     };

  851.     Window_BFStatus.prototype.itemRect = function(index) {
  852.         var fr = this._commandWindow.formation()[index];
  853.         var xx = fr.x - 420;
  854.         var yy = fr.y - 48;
  855.         return { x:xx, y:yy, width:64, height:64 };
  856.     };

  857.     Window_BFStatus.prototype.refresh = function() {
  858.         Window_Selectable.prototype.refresh.call(this);
  859.         var text = this.active ? activeHelpText : deactiveHelpText;
  860.         this.resetTextColor();
  861.         this.drawTextEx(text, 0, this.contentsHeight() - 28, this.contentsWidth(),'right');
  862.     };

  863.     Window_BFStatus.prototype.drawItem  = function(index) {
  864.         if (this._commandWindow) {
  865.             this.resetTextColor();
  866.             var rect = this.itemRect(index);
  867.             var item = this._commandWindow.currentExt();
  868.             if (index === this._lockIndex) {
  869.                 var color = 'rgba(180,180,180,0.5)';
  870.                 this.contents.fillRect(rect.x,rect.y,rect.width,rect.height,color);
  871.             }
  872.             if (this.isFixed(index)) {
  873.                 var color = 'rgba(255,128,128,0.5)';
  874.                 this.contents.fillRect(rect.x,rect.y,rect.width,rect.height,color);
  875.             }
  876.             var actor = this._actorSprites[index]._actor;
  877.             var status = DataManager.formationStatus(item);
  878.             if (item && !actor.checkFormationEnable(status[index].cond)){
  879.                 this.changeTextColor(this.textColor(2));
  880.                 this.drawText('×',rect.x + 64, rect.y + 32);
  881.                 this._actorSprites[index].ox = 6;
  882.                 this._actorSprites[index].oy = 2;
  883.             } else {
  884.                 this._actorSprites[index].ox = 0;
  885.                 this._actorSprites[index].oy = 0;
  886.             }
  887.             this._actorSprites[index].x = rect.x + 8;
  888.             this._actorSprites[index].y = rect.y + 8;
  889.             this.drawText(index+1,rect.x + 64, rect.y);
  890.         }
  891.     };

  892.     Window_BFStatus.prototype.setCommandWindow = function(window) {
  893.         this._commandWindow = window;
  894.         this.refresh();
  895.     };

  896.     Window_BFStatus.prototype.update = function() {
  897.         Window_Selectable.prototype.update.call(this);
  898.         if (this._frameCount % 12 === 0) this.updateSprite();
  899.         this._frameCount++;
  900.     };

  901.     Window_BFStatus.prototype.updateSprite = function() {
  902.         for (var i=0,max=this._actorSprites.length;i<max;i++) {
  903.             var sprite = this._actorSprites[i];
  904.             var frame = Math.floor(this._frameCount / 12) % 3;
  905.             var sw = sprite.bitmap.width / 9;
  906.             var sh = sprite.bitmap.height / 6;
  907.             var ox = sprite.ox;
  908.             var oy = sprite.oy;
  909.             if (sprite._actor.isDead()) { ox = 6; oy = 5; }
  910.             sprite.setFrame(sw * frame + ox * sw, oy * sh, sw, sh);
  911.         }
  912.     };

  913.     Window_BFStatus.prototype.isLock = function() {
  914.         return this._lockIndex >= 0;
  915.     };

  916.     Window_BFStatus.prototype.setLock = function() {
  917.         this._lockIndex = this._index;
  918.         this.refresh();
  919.     };

  920.     Window_BFStatus.prototype.clearLock = function() {
  921.         this._lockIndex = -1;
  922.         this.refresh();
  923.     };

  924.     Window_BFStatus.prototype.changeActorFormation = function() {
  925.         if (!this.isLock()) return;
  926.         $gameParty.swapOrder(this._index, this._lockIndex);
  927.         var ary = [];
  928.         var members = $gameParty.battleMembers();
  929.         for (var i=0,max=members.length;i<max;i++) {
  930.             for (var j=0,jmax=this._actorSprites.length;j<jmax;j++) {
  931.                 if (this._actorSprites[j]._actor === members[i]) {
  932.                     ary.push(this._actorSprites[j]);
  933.                     break;
  934.                 }
  935.             }
  936.         }
  937.         this._actorSprites = ary;
  938.     };

  939.     Window_BFStatus.prototype.cursorLeft = function(wrap) {
  940.         SoundManager.playCancel();
  941.         this.callHandler('cancel');
  942.     };

  943.     Window_BFStatus.prototype.isCurrentItemEnabled = function() {
  944.         return !this.isFixed(this._index);
  945.     };

  946.     Window_BFStatus.prototype.isFixed = function(index) {
  947.         if (Imported['SceneFormation']) {
  948.             var actor = $gameParty.battleMembers()[index];
  949.             if (actor._fixed === undefined) actor._fixed = actor.initFixed();
  950.             if (actor._fixed) return true;
  951.         }
  952.         return false;
  953.     };

  954.     ////////////////////////////////////////////////////////////////////////////////////

  955.     function Window_BFParameter() {
  956.         this.initialize.apply(this, arguments);
  957.     }

  958.     Window_BFParameter.prototype = Object.create(Window_Base.prototype);
  959.     Window_BFParameter.prototype.constructor = Window_BFParameter;

  960.     Window_BFParameter.prototype.initialize = function() {
  961.         Window_Selectable.prototype.initialize.call(this, 0,0,144,50);
  962.         this.openness = 0;
  963.     };

  964.     Window_BFParameter.prototype.standardPadding = function() {
  965.         return 6;
  966.     };

  967.     Window_BFParameter.prototype.standardFontSize = function() {
  968.         return 16;
  969.     };

  970.     Window_BFParameter.prototype.setStatusWindow = function(window) {
  971.         this._statusWindow = window;
  972.     };

  973.     Window_BFParameter.prototype.setCommandWindow = function(window) {
  974.         this._commandWindow = window;
  975.     };

  976.     Window_BFParameter.prototype.lineHeight = function() {
  977.         return 24;
  978.     };

  979.     Window_BFParameter.prototype.refresh = function() {
  980.         if (showParamWindow && this._commandWindow && this._statusWindow) {
  981.             var item = this._commandWindow.currentExt();
  982.             var status = DataManager.formationStatus(item);
  983.             var index = this._statusWindow._index;
  984.             var c = $dataClasses[status[index].classId];
  985.             var color = paramColor;
  986.             var id = item.id;
  987.             var ary = [];
  988.             var ary2 = [];
  989.             var texts = c.note.split(',');
  990.             var level = $gameParty.bfLevel(id);
  991.             for (var i=0,max=texts.length;i<max;i++) {
  992.                 var text = texts[i];
  993.                 if (text.match(/<(?:陣形効果テキスト追加|AddFormationEffectText):([前後FL]):?(?:Lv(\d+))?:(.+)>/)) {
  994.                     if (!RegExp.$2 || Number(RegExp.$2) <= level) {
  995.                         if (['前', 'F'].contains(RegExp.$1)) {
  996.                             ary.push(RegExp.$3);
  997.                         } else {
  998.                             ary2.push(RegExp.$3);
  999.                         }
  1000.                     }
  1001.                 }
  1002.             }
  1003.             for (var i=0,max=c.learnings.length;i<max;i++) {
  1004.                 var l = c.learnings[i];
  1005.                 var s = $dataSkills[l.skillId];
  1006.                 if (s && l.level <= level && !(l.note.includes('<陣形非表示>') || l.note.includes('<HideFormation>'))) {
  1007.                     var text = '\\C['+color[1]+']' + addSkillText + '\\C['+color[0]+']' + s.name;
  1008.                     ary.push(text);
  1009.                 }

  1010.             }
  1011.             for (var i=0;i<8;i++) {
  1012.                 var value = c.params[i][$gameParty.bfLevel(id)];
  1013.                 if (value > 1) {
  1014.                     ary.push([i,value]);
  1015.                 }
  1016.             }
  1017.             for (var i=0,max=c.traits.length;i<max;i++) {
  1018.                 var trait = c.traits[i];
  1019.                 if (!(trait.code === 23 && trait.dataId === 10) && !(trait.code === 55 && trait.dataId === 0)) {
  1020.                     ary.push(trait);
  1021.                 }
  1022.             }
  1023.             ary = ary.concat(ary2);
  1024.             var size = 18;
  1025.             this.height = (ary.length * (size + 2)) + this.lineHeight() + this.standardPadding() * 2 + 8;
  1026.             this.width = Math.max(this.textWidth(c.name) + 18, paramWindowWidth);
  1027.             if (ary.length > 0) this.height += 4;
  1028.             this.createContents();
  1029.             this.contents.fontSize = 20;
  1030.             this.drawText(c.name,0,1,this.contentsWidth(),'center');
  1031.             if (ary.length > 0) this.contents.fillRect(4,25,this.contentsWidth()-8,2,'rgba(255,255,255,0.5)');
  1032.             this.contents.fontSize = size;
  1033.             var n = 0;
  1034.             for (var i=0,max=ary.length;i<max;i++) {
  1035.                 if (typeof ary[i] === 'string') {
  1036.                     this.drawTextEx(ary[i], 4, (size+2) * n + 30);
  1037.                     n++;
  1038.                 } else if (ary[i][1]) {
  1039.                     var text = '\\C['+color[1]+']' + TextManager.param(ary[i][0]) + '\\C['+color[2]+']+' + ary[i][1];
  1040.                     this.drawTextEx(text, 4, (size+2) * n + 30);
  1041.                     n++;
  1042.                 } else {
  1043.                     var trait = ary[i];
  1044.                     if (this.drawTraits(trait,4, (size+2) * n + 30)) n++;
  1045.                 }
  1046.             }
  1047.             this.height = (n * (size + 2)) + this.lineHeight() + this.standardPadding() * 2 + 8;
  1048.         }
  1049.     };

  1050.     Window_BFParameter.prototype.drawTraits = function(trait, x, y) {
  1051.         var vocab = paramVocab;
  1052.         var color = paramColor;
  1053.         var text = '';
  1054.         var dataId = trait.dataId;
  1055.         var value = trait.value;
  1056.         var sys = '\\C['+color[1]+']';
  1057.         var cl = '\\C['+color[0]+']';
  1058.         var ud = value > 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1059.         var sym = value > 0 ? '+' : '';
  1060.         switch (trait.code) {
  1061.             case 11:
  1062.                 if (vocab[0][0]) {
  1063.                     var ele = $dataSystem.elements[dataId];
  1064.                     ud = value < 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1065.                     text = cl + ele + sys + vocab[0][0] + ud + 'x' + Math.floor(value * 100) + '%';
  1066.                 }
  1067.                 break;
  1068.             case 12:
  1069.                 if (vocab[0][1]) {
  1070.                     var param = TextManager.param(dataId);
  1071.                     ud = value < 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1072.                     text = cl + param + sys + vocab[0][1] + ud + 'x' + Math.floor(value * 100) + '%';
  1073.                 }
  1074.                 break;
  1075.             case 13:
  1076.                 if (vocab[0][0]) {
  1077.                     var state = $dataStates[dataId].name;
  1078.                     ud = value < 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1079.                     text = cl + state + sys + vocab[0][0] + ud + 'x' + Math.floor(value * 100) + '%';
  1080.                 }
  1081.                 break;
  1082.             case 14:
  1083.                 if (vocab[0][2]) {
  1084.                     var state = $dataStates[dataId].name;
  1085.                     text = cl + state + sys + vocab[0][2];
  1086.                 }
  1087.                 break;
  1088.             case 21:
  1089.                 var param = TextManager.param(dataId);
  1090.                 text = sys + param + ud + 'x' + Math.floor(value * 100) + '%';
  1091.                 break;
  1092.             case 22:
  1093.                 var xparam = vocab[1][dataId];
  1094.                 if (xparam) {
  1095.                     //if (dataId === 0 && xparam) xparam = TextManager.param(8);
  1096.                     //if (dataId === 1 && xparam) xparam = TextManager.param(9);
  1097.                     if (dataId === 7 && xparam) xparam = TextManager.hpA + xparam;
  1098.                     if (dataId === 8 && xparam) xparam = TextManager.mpA + vocab[1][7];
  1099.                     if (dataId === 9 && xparam) xparam = TextManager.tpA + vocab[1][7];
  1100.                     ud = value > 0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1101.                     text = sys + xparam + ud + sym + Math.floor(value * 100) + '%';
  1102.                 }
  1103.                 break;
  1104.             case 23:
  1105.                 var sparam = vocab[2][dataId];
  1106.                 if (sparam) {
  1107.                     if (dataId === 0) ud = cl;
  1108.                     if (dataId === 4) { sparam = TextManager.mpA + sparam; ud = value < 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']'; }
  1109.                     if (dataId === 5) TextManager.tpA + sparam;
  1110.                     if (dataId === 6 || dataId === 7 || dataId === 8) ud = value < 1.0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1111.                     text = sys + sparam + ud + 'x' + Math.floor(value * 100) + '%';
  1112.                 }
  1113.                 break;
  1114.             case 31:
  1115.                 if (vocab[3][0]) {
  1116.                     var ele = $dataSystem.elements[dataId];
  1117.                     text = sys + vocab[3][0] + cl + ele;
  1118.                 }
  1119.                 break;
  1120.             case 32:
  1121.                 if (vocab[3][1]) {
  1122.                     var state = $dataStates[dataId].name;
  1123.                     text = sys + vocab[3][1] + cl + state;
  1124.                 }
  1125.                 break;
  1126.             case 33:
  1127.                 if (vocab[3][2]) {
  1128.                     text = sys + vocab[3][2] + ud + sym + value;
  1129.                 }
  1130.                 break;
  1131.             case 34:
  1132.                 if (vocab[3][3]) {
  1133.                     text = sys + vocab[3][3] + cl + '+' + value + '回';
  1134.                 }
  1135.                 break;
  1136.             case 41:
  1137.             case 42:
  1138.                 var stype = $dataSystem.skillTypes[dataId];
  1139.                 var v = trait.code === 41 ? vocab[4][0] : vocab[4][1];
  1140.                 if (v) text = sys + v + cl + stype;
  1141.                 break;
  1142.             case 43:
  1143.             case 44:
  1144.                 var skill = $dataSkills[dataId];
  1145.                 var v = trait.code === 43 ? vocab[4][2] : vocab[4][3];
  1146.                 if (v) text = sys + v + cl + skill.name;
  1147.                 break;
  1148.             case 51:
  1149.             case 52:
  1150.                 var type = trait.code === 51 ? $dataSystem.weaponTypes[dataId] : $dataSystem.armorTypes[dataId];
  1151.                 var v = trait.code === 51 ? vocab[5][0] : vocab[5][1];
  1152.                 if (v) text = sys + v + cl + type;
  1153.                 break;
  1154.             case 53:
  1155.             case 54:
  1156.                 var etype = $dataSystem.equipTypes[dataId];
  1157.                 var v = trait.code === 53 ? vocab[5][2] : vocab[5][3];
  1158.                 if (v) text = sys + v + cl + etype;
  1159.                 break;
  1160.             case 55:
  1161.                 if (vocab[5][4]) text = sys + vocab[5][4];
  1162.                 break;
  1163.             case 61:
  1164.                 if (vocab[6][0]) {
  1165.                     ud = value > 0 ? '\\C['+color[2]+']' : '\\C['+color[3]+']';
  1166.                     text = sys + vocab[6][0] + ud + sym + (value * 100) + '%';
  1167.                 }
  1168.                 break;
  1169.             case 62:
  1170.                 if (vocab[6][1+dataId]) {
  1171.                     if (dataId === 2) text = TextManager.tpA + text;
  1172.                     text = sys + vocab[6][1 + dataId];
  1173.                 }
  1174.                 break;
  1175.             case 63:
  1176.                 if (vocab[6][5]) text = sys + vocab[6][5] + defeatText[dataId];
  1177.                 break;
  1178.             case 64:
  1179.                 if (vocab[6][6+dataId]) text = sys + vocab[6][6+dataId];
  1180.                 break;
  1181.         }

  1182.         if(text) this.drawTextEx(text, x, y);
  1183.         return !!text;
  1184.     };

  1185.     Window_BFParameter.prototype.updatePosition = function() {
  1186.         if (this._statusWindow && this._statusWindow.active) {
  1187.             var index = this._statusWindow._index;
  1188.             var rect = this._statusWindow.itemRect(index);
  1189.             this.x = rect.x - this.width + this._statusWindow.x;
  1190.             if (this._statusWindow.x > this.x){
  1191.                 this.x = rect.x + this._statusWindow.x + 80;
  1192.             }
  1193.             var y = rect.y - this.height / 2 + this._statusWindow.y + (rect.height / 2);
  1194.             y = y.clamp(this._statusWindow.y,Graphics.boxHeight - this.height);
  1195.             this.y = y;
  1196.             if (index !== this._index) {
  1197.                 this.refresh();
  1198.                 this._index = index;
  1199.             }
  1200.         }
  1201.     };

  1202.     ////////////////////////////////////////////////////////////////////////////////////

  1203.     function Window_BFInfo() {
  1204.         this.initialize.apply(this, arguments);
  1205.     }

  1206.     Window_BFInfo.prototype = Object.create(Window_Base.prototype);
  1207.     Window_BFInfo.prototype.constructor = Window_BFInfo;

  1208.     Window_BFInfo.prototype.initialize = function(x,y,w,h) {
  1209.         Window_Base.prototype.initialize.call(this, x,y,w,h);
  1210.         this.refresh();
  1211.     };

  1212.     Window_BFInfo.prototype.standardPadding = function() {
  1213.         return 6;
  1214.     };

  1215.     Window_BFInfo.prototype.refresh = function() {
  1216.         var text = $gameParty.battleFormation() ? $gameParty.battleFormation().name : basicFormationText;
  1217.         this.contents.fontSize = 22;
  1218.         this.changeTextColor(this.textColor(4));
  1219.         this.drawText(menuBattleFormationTitle,8,0,this.contentsWidth()-16,'center');
  1220.         this.contents.fillRect(4,32,this.contentsWidth()-8,2,'rgba(255,255,255,0.5)');
  1221.         this.changeTextColor(this.normalColor());
  1222.         this.drawText(text,8,32,this.contentsWidth()-16,'center');
  1223.     };

  1224.     ////////////////////////////////////////////////////////////////////////////////////

  1225.     var __WMCommand_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
  1226.     Window_MenuCommand.prototype.addOriginalCommands = function() {
  1227.         __WMCommand_addOriginalCommands.call(this);
  1228.         if (addMenuBattleFormation){
  1229.             this.addCommand(menuBattleFormationTitle, 'battleFormation', true);
  1230.         }
  1231.     };

  1232.     var __SMenu_create = Scene_Menu.prototype.create;
  1233.     Scene_Menu.prototype.create = function() {
  1234.         __SMenu_create.call(this);
  1235.         this.createFormationInfoWindow();
  1236.     };

  1237.     Scene_Menu.prototype.createFormationInfoWindow = function() {
  1238.         var cw = this._commandWindow;
  1239.         var sw = this._statusWindow;
  1240.         var gw = this._goldWindow;
  1241.         var v = $gameVariables._data;
  1242.         var s = $gameSwitches._data;
  1243.         var h = this._goldWindow.height + 8;
  1244.         var w = this._goldWindow.width;
  1245.         var x = eval(battleFormationInfoX) || 0;
  1246.         var y = eval(battleFormationInfoY) || 0;
  1247.         this._fInfoWindow = new Window_BFInfo(x,y,w,h);
  1248.         this.addWindow(this._fInfoWindow);
  1249.     };

  1250.     var __SMenu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  1251.     Scene_Menu.prototype.createCommandWindow = function() {
  1252.         __SMenu_createCommandWindow.call(this);
  1253.         this._commandWindow.setHandler('battleFormation',   this.commandBattleFormation.bind(this));
  1254.     };

  1255.     Scene_Menu.prototype.commandBattleFormation = function() {
  1256.         SceneManager.push(Scene_BattleFormation);
  1257.     };

  1258.     ////////////////////////////////////////////////////////////////////////////////////

  1259.     function Scene_BattleFormation() {
  1260.         this.initialize.apply(this, arguments);
  1261.     }

  1262.     Scene_BattleFormation.prototype = Object.create(Scene_MenuBase.prototype);
  1263.     Scene_BattleFormation.prototype.constructor = Scene_BattleFormation;

  1264.     Scene_BattleFormation.prototype.initialize = function() {
  1265.         Scene_MenuBase.prototype.initialize.call(this);
  1266.     };

  1267.     Scene_BattleFormation.prototype.create = function() {
  1268.         Scene_MenuBase.prototype.create.call(this);
  1269.         this.createBackSprite();
  1270.         this.createWindowLayer();
  1271.         this.createHelpWindow();
  1272.         this.createCommandWindow();
  1273.         this.createStatusWindow();
  1274.         this.createParameterWindow();
  1275.     };

  1276.     Scene_BattleFormation.prototype.createBackSprite = function() {
  1277.         var back1 = new Sprite(ImageManager.loadBattleback1($gameMap._battleback1Name));
  1278.         back1.move(-92,-58);
  1279.         var back2 = new Sprite(ImageManager.loadBattleback2($gameMap._battleback2Name));
  1280.         back2.move(-92,-58);
  1281.         this.addChild(back1);
  1282.         this.addChild(back2);
  1283.     };

  1284.     Scene_BattleFormation.prototype.update = function() {
  1285.         if (!this.isBusy()) {
  1286.             this._commandWindow.open();
  1287.         }
  1288.         Scene_MenuBase.prototype.update.call(this);
  1289.         if (this._preIndex !== this._commandWindow.index()) {
  1290.             this._statusWindow.refresh();
  1291.             this._preIndex = this._commandWindow.index();
  1292.         }
  1293.         if (showParamWindow && this._statusWindow.active) this._paramWindow.open();
  1294.         this._paramWindow.updatePosition();
  1295.     };

  1296.     Scene_BattleFormation.prototype.isBusy = function() {
  1297.         return this._commandWindow.isClosing() || Scene_MenuBase.prototype.isBusy.call(this);
  1298.     };

  1299.     Scene_BattleFormation.prototype.terminate = function() {
  1300.         Scene_MenuBase.prototype.terminate.call(this);
  1301.     };

  1302.     Scene_BattleFormation.prototype.createCommandWindow = function() {
  1303.         var y = this._helpWindow.y + this._helpWindow.height;
  1304.         this._commandWindow = new Window_BFFormationList(y);
  1305.         this._commandWindow.setHandler('cancel', this.popScene.bind(this));
  1306.         this._commandWindow.setHandler('set', this.setFormation.bind(this));
  1307.         this._commandWindow.setHandler('right', this.commandStatus.bind(this));
  1308.         this.addWindow(this._commandWindow);
  1309.         this._commandWindow.setHelpWindow(this._helpWindow);
  1310.     };

  1311.     Scene_BattleFormation.prototype.createStatusWindow = function() {
  1312.         var x = this._commandWindow.x + this._commandWindow.width;
  1313.         var y = this._helpWindow.y + this._helpWindow.height;
  1314.         this._statusWindow = new Window_BFStatus(x,y);
  1315.         this._statusWindow.setHandler('cancel', this.onCancelStatus.bind(this));
  1316.         this._statusWindow.setHandler('ok', this.onOkStatus.bind(this));
  1317.         this._statusWindow.setCommandWindow(this._commandWindow);
  1318.         this.addWindow(this._statusWindow);
  1319.     };

  1320.     Scene_BattleFormation.prototype.createParameterWindow = function() {
  1321.         this._paramWindow = new Window_BFParameter();
  1322.         this._paramWindow.setStatusWindow(this._statusWindow);
  1323.         this._paramWindow.setCommandWindow(this._commandWindow);
  1324.         this.addChild(this._paramWindow);
  1325.     };

  1326.     Scene_BattleFormation.prototype.setFormation = function() {
  1327.         $gameParty.setBattleFormation(this._commandWindow.currentExt());
  1328.         this._commandWindow.refresh();
  1329.         this._commandWindow.activate();
  1330.     };

  1331.     Scene_BattleFormation.prototype.commandStatus = function() {
  1332.         this._commandWindow.deactivate();
  1333.         this._statusWindow.activate();
  1334.         this._statusWindow.select(0);
  1335.         this._statusWindow.refresh();
  1336.         this._paramWindow.refresh();
  1337.     };

  1338.     Scene_BattleFormation.prototype.onCancelStatus = function() {
  1339.         this._paramWindow.close();
  1340.         this._statusWindow.clearLock();
  1341.         this._statusWindow.deselect();
  1342.         this._statusWindow.deactivate();
  1343.         this._statusWindow.refresh();
  1344.         this._commandWindow.activate();
  1345.     };

  1346.     Scene_BattleFormation.prototype.onOkStatus = function() {
  1347.         if (!this._statusWindow.isLock()) {
  1348.             this._statusWindow.setLock();
  1349.             this._statusWindow.activate();
  1350.             this._statusWindow.refresh();
  1351.         } else {
  1352.             this._statusWindow.changeActorFormation();
  1353.             $gameParty.setBattleFormation(this._commandWindow.currentExt());
  1354.             this._statusWindow.clearLock();
  1355.             this._statusWindow.activate();
  1356.             this._commandWindow.refresh();
  1357.             this._statusWindow.refresh();
  1358.         }
  1359.     };

  1360.     ////////////////////////////////////////////////////////////////////////////////////

  1361.     var __SBattle_initialize = Scene_Battle.prototype.initialize;
  1362.     Scene_Battle.prototype.initialize = function() {
  1363.         $gameParty.refreshBattleFormation();
  1364.         __SBattle_initialize.call(this);
  1365.     };

  1366.     Scene_Battle.prototype.resetActorPosition = function() {
  1367.         this._spriteset._actorSprites.forEach(function(actor){
  1368.             actor.startMove(0,0);
  1369.         }.bind(this));
  1370.     };

  1371.     if (Imported['SceneFormation']) {

  1372.         var __SBattle_onMemberOk = Scene_Battle.prototype.onMemberOk;
  1373.         Scene_Battle.prototype.onMemberOk = function() {
  1374.             __SBattle_onMemberOk.call(this);
  1375.             if (this._scopeIndex === null){
  1376.                 $gameParty.refreshBattleFormation();
  1377.                 this.resetActorPosition();
  1378.             }
  1379.         };

  1380.         var __SBattle_onStandOk = Scene_Battle.prototype.onStandOk;
  1381.         Scene_Battle.prototype.onStandOk = function() {
  1382.             __SBattle_onStandOk.call(this);
  1383.             if (this._scopeIndex === null){
  1384.                 $gameParty.refreshBattleFormation();
  1385.                 this.resetActorPosition();
  1386.             }
  1387.         };

  1388.         var __SBattle_onRelease = Scene_Battle.prototype.onRelease;
  1389.         Scene_Battle.prototype.onRelease = function() {
  1390.             __SBattle_onRelease.call(this);
  1391.             $gameParty.refreshBattleFormation();
  1392.             this.resetActorPosition();
  1393.         };

  1394.         var __SBattle_onAdd = Scene_Battle.prototype.onAdd;
  1395.         Scene_Battle.prototype.onAdd = function() {
  1396.             __SBattle_onAdd.call(this);
  1397.             $gameParty.refreshBattleFormation();
  1398.             this.resetActorPosition();
  1399.         };
  1400.     }

  1401.     ////////////////////////////////////////////////////////////////////////////////////
  1402. }());
复制代码

老鹰

梦石
40
星屑
38044
在线时间
7127 小时
注册时间
2012-5-26
回帖
3306

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2016-10-2 12:29:26 | 显示全部楼层
211行以下的注释

  1. * @help ------------------------------------------------------
  2. * プラグインコマンド
  3. * ------------------------------------------------------
  4. * このプラグインには、以下のプラグインコマンドがあります。
  5. *
  6. * 陣形 シーン呼び出し
  7. * BattleFormation callScene
  8. * ・陣形シーンを呼び出します。
  9. *
  10. * 陣形 設定 アイテムID
  11. * BattleFormation Set アイテムID
  12. * ・陣形をアイテムIDに設定します。
复制代码


在 插件命令 中输入 BattleFormation callScene 来呼叫阵型窗口, 输入 BattleFormation Set アイテムID 来将当前阵型设置为ID号物品所代表的阵型(其中 アイテムID 替换为 物品id号)

挑这个主要的说下,其他的请谷歌翻译

  1. * ―――陣形を作る―――
  2. * ・陣形の基本設定
  3. * アイテムのメモ欄で設定します。
  4. * 設定したアイテムを入手することで、その陣形が使用可能になります。
  5. *
  6. * 以下の設定がある場合、そのアイテムは陣形アイテムとして扱われます。
  7. * アイテムのメモに
  8. * <陣形設定>
  9. * 一人目のX座標,Y座標,使用するクラスID[,配置条件]
  10. * 二人目のX座標,Y座標,使用するクラスID[,配置条件]
  11. * 三人目のX座標,Y座標,使用するクラスID[,配置条件]
  12. * ・・・
  13. * </陣形設定>
  14. * と記述します。
复制代码


在 物品 界面中的备注栏输入
<陣形設定>
第一个角色的x坐标, y坐标, 使用的class id [,附加条件]
第二个角色的………………
</陣形設定>

输入了几个角色,就是几个人的阵型
class id似乎是指处在该位置的角色的id号属性值会被附加算上(不知道阵法到底是干啥的,推荐结合默认脚本的角色属性编号去试试看)
附加条件可选,此处内容会被eval然后当做js脚本处理,如果全员的附加条件都返回true,阵型才有效

这个物品的名字就是阵型的名字,物品的简介就是阵型的简介。


好了,更详细的(一直到331行都是说明)请去自己翻译,因为我看着这个莫名其妙没有截图效果的插件烦了,我也不会JS
回复

使用道具 举报

梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
 楼主| 发表于 2016-10-2 13:02:29 | 显示全部楼层
本帖最后由 347780682 于 2016-10-2 13:03 编辑


额 补下效果图

说明翻译我也是看过 但是还是不会做呢,我已经按照他说明的来设置了,但是还是没有见显示新设置的阵形

HU%RA}N0}W@_PY@FUJ7~`WD.png ~CGA_Q1GA`_JNKDL%KJ}I}G.png F91_(])Y[N{)S_($BRGFZ(T.png

点评

範例:https://t.co/QdaMYvd5dx サガ風戦闘レイアウト ver1.00 MV用サンプルプロジェクト  发表于 2016-10-2 15:16
我以为这种东西都会有个范例的,没有范例的话还是推荐插件开头的注释一行行看过去吧,我是懒得看了  发表于 2016-10-2 13:34
回复

使用道具 举报

梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
 楼主| 发表于 2016-10-3 13:05:58 | 显示全部楼层
347780682 发表于 2016-10-2 13:02
额 补下效果图

说明翻译我也是看过 但是还是不会做呢,我已经按照他说明的来设置了,但是还是没有见显 ...

@tseyik 大神你的范例我下载了 ,但是有个问题 同样的设置同样的插件,范例里面可以用, 拿出来到新工程里面就用不了
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部