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

Project1

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

[已经过期] 关于Yanfly Engine Plugins 的 Party System帮助栏问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
143
在线时间
217 小时
注册时间
2010-8-10
帖子
81
跳转到指定楼层
1
发表于 2016-3-14 10:22:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 余烬之中 于 2016-8-3 10:05 编辑

在系统上已经设置了显示帮助栏,进入游戏帮助栏也确实显示了,但是里面是空的,难道还需要再设置帮助内容吗》?如何操作


JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // Yanfly Engine Plugins - Party System
  3. // YEP_PartySystem.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.YEP_PartySystem = true;
  8.  
  9. var Yanfly = Yanfly || {};
  10. Yanfly.Party = Yanfly.Party || {};
  11.  
  12. //=============================================================================
  13. /*:
  14.  * @plugindesc v1.07 Replaces the default 'Formation' command with a new
  15.  * menu for players to easily change party formations.
  16.  * @author Yanfly Engine Plugins
  17.  *
  18.  * @param ---General---
  19.  * @default
  20.  *
  21.  * @param Max Battle Members
  22.  * @desc Maximum amount of actors that can participate in battle.
  23.  * Default: 4
  24.  * @default 4
  25.  *
  26.  * @param Show Battle Command
  27.  * @desc Show the 'Formation' command in the Party Command Window?
  28.  * NO - false     YES - true
  29.  * @default true
  30.  *
  31.  * @param Enable Battle Command
  32.  * @desc Enable the 'Formation' command in the Party Command Window?
  33.  * NO - false     YES - true
  34.  * @default true
  35.  *
  36.  * @param Battle Cooldown
  37.  * @desc How many turns must the player wait after changing party?
  38.  * @default 1
  39.  *
  40.  * @param Maximum Followers
  41.  * @desc Maximum number of followers on the map.
  42.  * Default: 4
  43.  * @default 4
  44.  *
  45.  * @param ---Menu---
  46.  * @default
  47.  *
  48.  * @param Help Window
  49.  * @desc Show the Help Window in the party menu?
  50.  * NO - false     YES - true
  51.  * @default true
  52.  *
  53.  * @param Text Alignment
  54.  * @desc The text alignment for the command window.
  55.  * left     center     right
  56.  * @default center
  57.  *
  58.  * @param Change Command
  59.  * @desc How the 'Change' command appears in the command menu.
  60.  * Leave this blank to remove it.
  61.  * @default Change
  62.  *
  63.  * @param Remove Command
  64.  * @desc How the 'Remove' command appears in the command menu.
  65.  * Leave this blank to remove it.
  66.  * @default Remove
  67.  *
  68.  * @param Revert Command
  69.  * @desc How the 'Revert' command appears in the command menu.
  70.  * Leave this blank to remove it.
  71.  * @default Revert
  72.  *
  73.  * @param Finish Command
  74.  * @desc How the 'Finish' command appears in the command menu.
  75.  * Leave this blank to remove it.
  76.  * @default Finish
  77.  *
  78.  * @param ---Selection---
  79.  * @default
  80.  *
  81.  * @param Empty Text
  82.  * @desc What text to display in an empty party slot.
  83.  * @default - Empty -
  84.  *
  85.  * @param Actor Face
  86.  * @desc Show the actor's face?
  87.  * NO - false     YES - true
  88.  * @default true
  89.  *
  90.  * @param Actor Sprite
  91.  * @desc Show the actor's sprite?
  92.  * NO - false     YES - true
  93.  * @default true
  94.  *
  95.  * @param ---List---
  96.  * @default
  97.  *
  98.  * @param Remove Text
  99.  * @desc The text used to display the "Remove" command in the party
  100.  * member list.
  101.  * @default Remove
  102.  *
  103.  * @param Remove Icon
  104.  * @desc The icon used to display next to the "Remove" command in the
  105.  * party member list.
  106.  * @default 16
  107.  *
  108.  * @param Sprite Y Buffer
  109.  * @desc This is the amount to adjust the actor graphic by.
  110.  * @default 16
  111.  *
  112.  * @param In Party Text Color
  113.  * @desc This is the text color to be used if the actor is currently
  114.  * in the party.
  115.  * @default 6
  116.  *
  117.  * @param ---Locking---
  118.  * @default
  119.  *
  120.  * @param Lock First Actor
  121.  * @desc Allows you to lock the first actor in the game by default.
  122.  * OFF - false     ON - true
  123.  * @default false
  124.  *
  125.  * @param Locked Icon
  126.  * @desc This sets what icon to be used when an actor is locked.
  127.  * @default 195
  128.  *
  129.  * @param Required Icon
  130.  * @desc This sets what icon to be used when an actor is required.
  131.  * @default 205
  132.  *
  133.  * @param ---Detail Window---
  134.  * @default
  135.  *
  136.  * @param Enable Detail Window
  137.  * @desc Make use of the detailed party window next to the list.
  138.  * NO - false     YES - true
  139.  * @default true
  140.  *
  141.  * @param List Width
  142.  * @desc If detail window is enabled, what is the width of the
  143.  * party list window?
  144.  * @default 300
  145.  *
  146.  * @param Actor Parameters
  147.  * @desc If there is enough room, this is the text shown to list
  148.  * the actor's parameters.
  149.  * @default Parameters
  150.  *
  151.  * @param Actor Equipment
  152.  * @desc If there is enough room, this is the text shown to list
  153.  * the actor's equipment.
  154.  * @default Equipment
  155.  *
  156.  * @help
  157.  * ============================================================================
  158.  * Introduction
  159.  * ============================================================================
  160.  *
  161.  * This plugin replaces the "Formation" command found in the in-game menu with
  162.  * a new scene where the player can adjust the party he or she wants in a more
  163.  * comfortable way.
  164.  *
  165.  * If you are using YEP_BattleEngineCore.js and would like to enable party
  166.  * switching mid-battle, place this plugin under YEP_BattleEngineCore.js in
  167.  * the plugin's list.
  168.  *
  169.  * This plugin is plug and play. All you have to do is just turn it on and
  170.  * change the parameters to your liking.
  171.  *
  172.  * ============================================================================
  173.  * Plugin Commands
  174.  * ============================================================================
  175.  *
  176.  * Here are some plugin commands you can use!
  177.  *
  178.  * Plugin Command:
  179.  *   OpenPartyMenu     Opens up the Party Menu from the field.
  180.  *
  181.  * Actors can also be required, meaning the player must have that actor(s) in
  182.  * the party before the player is able to leave the party menu. Required actors
  183.  * can be moved around, unlike locked actors. Keep in mind if you do make some
  184.  * actors required, do not make the game require more actors than the possible
  185.  * maximum battle members or else the player will be stuck in the party menu.
  186.  *
  187.  * Plugin Command:
  188.  *   ShowBattleFormation    - Shows 'Formation' command in battle.
  189.  *   HideBattleFormation    - Hides 'Formation' command in battle.
  190.  *   EnableBattleFormation  - Enables 'Formation' command in battle.
  191.  *   DisableBattleFormation - Disables 'Formation' command in battle.
  192.  *
  193.  *   LockActor 3          - Locks actor 3.
  194.  *   LockActor 4 5 6      - Locks actors 4, 5, and 6.
  195.  *   UnlockActor 3        - Unlocks actor 3.
  196.  *   UnlockActor 4 5 6    - Unlocks actors 4, 5, and 6.
  197.  *                        * Locked Actors cannot be moved out of their current
  198.  *                          position and must be in the party.
  199.  *
  200.  *   RequireActor 3       - Player must have actor 3 in party.
  201.  *   RequireActor 4 5 6   - Player must have actors 4, 5, and 6 in party.
  202.  *   UnrequireActor 3     - Player no longer needs actor 3 in party.
  203.  *   UnrequireActor 4 5 6 - Player no longer needs actors 4, 5, and 6 in party.
  204.  *                        * Required Actors must be in the party in order for
  205.  *                          the player to be able to exit the party menu.
  206.  *
  207.  *   ChangePartyMax 5     - Changes max party size to 5.
  208.  *
  209.  * ============================================================================
  210.  * Changelog
  211.  * ============================================================================
  212.  *
  213.  * Version 1.07:
  214.  * - Fixed a bug that caused music to not replay properly when accessing the
  215.  * Party change menu from battle.
  216.  *
  217.  * Version 1.06:
  218.  * - Fixed a bug with certain actors not drawing properly.
  219.  *
  220.  * Version 1.05:
  221.  * - Added 'Maximum Followers' parameter. This number should be the maximum
  222.  * number you have in your game if you ever increase the maximum party size
  223.  * midway through your game.
  224.  *
  225.  * Version 1.04:
  226.  * - Fixed a visual bug with mid-battle formation changing against backgrounds
  227.  * without battlebacks.
  228.  * - Formation changes during mid-battle will resume bgm/bgs currently played.
  229.  *
  230.  * Version 1.03:
  231.  * - Fixed a bug that would cause AutoBattlers to stall if they got added into
  232.  * the party mid-battle.
  233.  *
  234.  * Version 1.02:
  235.  * - Made a change so that the number of followers updates properly when you
  236.  * increase the maximum number of battle members.
  237.  *
  238.  * Version 1.01:
  239.  * - Added 'Battle Cooldown' plugin parameter.
  240.  * - Added 'ChangePartyMax x' plugin command.
  241.  * - Added feature where if you leave the class comand name empty, it will
  242.  * remove the command.
  243.  *
  244.  * Version 1.00:
  245.  * - Finished Plugin!
  246.  */
  247. //=============================================================================
  248.  
  249. //=============================================================================
  250. // Parameter Variables
  251. //=============================================================================
  252.  
  253. Yanfly.Parameters = PluginManager.parameters('YEP_PartySystem');
  254. Yanfly.Param = Yanfly.Param || {};
  255. Yanfly.Icon = Yanfly.Icon || {};
  256.  
  257. Yanfly.Param.MaxBattleMembers = Number(Yanfly.Parameters['Max Battle Members']);
  258. Yanfly.Param.PartyShowBattle = String(Yanfly.Parameters['Show Battle Command']);
  259. Yanfly.Param.PartyEnBattle = String(Yanfly.Parameters['Enable Battle Command']);
  260. Yanfly.Param.PartyCooldown = Number(Yanfly.Parameters['Battle Cooldown']);
  261. Yanfly.Param.PartyMaxFollower = Number(Yanfly.Parameters['Maximum Followers']);
  262. Yanfly.Param.PartyHelpWindow = String(Yanfly.Parameters['Help Window']);
  263. Yanfly.Param.PartyLockFirst = String(Yanfly.Parameters['Lock First Actor']);
  264. Yanfly.Param.PartyTextAlign = String(Yanfly.Parameters['Text Alignment']);
  265. Yanfly.Param.PartyCommand1 = String(Yanfly.Parameters['Change Command']);
  266. Yanfly.Param.PartyCommand2 = String(Yanfly.Parameters['Remove Command']);
  267. Yanfly.Param.PartyCommand3 = String(Yanfly.Parameters['Revert Command']);
  268. Yanfly.Param.PartyCommand4 = String(Yanfly.Parameters['Finish Command']);
  269. Yanfly.Param.PartyEmptyText = String(Yanfly.Parameters['Empty Text']);
  270. Yanfly.Param.PartyShowFace = String(Yanfly.Parameters['Actor Face']);
  271. Yanfly.Param.PartyShowCharacter = String(Yanfly.Parameters['Actor Sprite']);
  272. Yanfly.Icon.PartyLocked = Number(Yanfly.Parameters['Locked Icon']);
  273. Yanfly.Icon.PartyRequired = Number(Yanfly.Parameters['Required Icon']);
  274. Yanfly.Icon.PartyRemove = Number(Yanfly.Parameters['Remove Icon']);
  275. Yanfly.Param.PartySpriteBufferY = Number(Yanfly.Parameters['Sprite Y Buffer']);
  276. Yanfly.Param.ColorInParty = Number(Yanfly.Parameters['In Party Text Color']);
  277. Yanfly.Param.PartyDetailWin = String(Yanfly.Parameters['Enable Detail Window']);
  278. Yanfly.Param.PartyListWidth = Number(Yanfly.Parameters['List Width']);
  279. Yanfly.Param.PartyDetailParam = String(Yanfly.Parameters['Actor Parameters']);
  280. Yanfly.Param.PartyDetailEquip = String(Yanfly.Parameters['Actor Equipment']);
  281.  
  282. //=============================================================================
  283. // Game_System
  284. //=============================================================================
  285.  
  286. Yanfly.Party.Game_System_initialize = Game_System.prototype.initialize;
  287. Game_System.prototype.initialize = function() {
  288.     Yanfly.Party.Game_System_initialize.call(this);
  289.     this.initPartySettings();
  290. };
  291.  
  292. Game_System.prototype.initPartySettings = function() {
  293.     this._showBattleFormation = eval(Yanfly.Param.PartyShowBattle);
  294.     this._battleFormationEnabled = eval(Yanfly.Param.PartyEnBattle);
  295. };
  296.  
  297. Game_System.prototype.isShowBattleFormation = function() {
  298.     if (this._showBattleFormation === undefined) this.initPartySettings();
  299.     return this._showBattleFormation;
  300. };
  301.  
  302. Game_System.prototype.setShowBattleFormation = function(value) {
  303.     if (this._showBattleFormation === undefined) this.initPartySettings();
  304.     this._showBattleFormation = value;
  305. };
  306.  
  307. Game_System.prototype.isBattleFormationEnabled = function() {
  308.     if (this._battleFormationEnabled === undefined) this.initPartySettings();
  309.     if (this._battleFormationCooldown === undefined) {
  310.       this.resetBattleFormationCooldown();
  311.     }
  312.     if (this._battleFormationCooldown > 0) return false;
  313.     return this._battleFormationEnabled;
  314. };
  315.  
  316. Game_System.prototype.setBattleFormationEnabled = function(value) {
  317.     if (this._battleFormationEnabled === undefined) this.initPartySettings();
  318.     this._battleFormationEnabled = value;
  319. };
  320.  
  321. Game_System.prototype.resetBattleFormationCooldown = function() {
  322.     this._battleFormationCooldown = 0;
  323. };
  324.  
  325. Game_System.prototype.updateBattleFormationCooldown = function() {
  326.     if (this._battleFormationCooldown === undefined) {
  327.       this.resetBattleFormationCooldown();
  328.     }
  329.     this._battleFormationCooldown--;
  330. };
  331.  
  332. Game_System.prototype.setBattleFormationCooldown = function() {
  333.     this._battleFormationCooldown = Yanfly.Param.PartyCooldown;
  334. };
  335.  
  336. //=============================================================================
  337. // Game_Actor
  338. //=============================================================================
  339.  
  340. Yanfly.Party.Game_Actor_setup = Game_Actor.prototype.setup;
  341. Game_Actor.prototype.setup = function(actorId) {
  342.     Yanfly.Party.Game_Actor_setup.call(this, actorId);
  343.     this.initLocked();
  344. };
  345.  
  346. Game_Actor.prototype.initLocked = function() {
  347.     this._locked = false;
  348.     this._required = false;
  349. };
  350.  
  351. Yanfly.Party.Game_Actor_isFormationChangeOk =
  352.     Game_Actor.prototype.isFormationChangeOk;
  353. Game_Actor.prototype.isFormationChangeOk = function() {
  354.     if (this._locked) return false;
  355.     return Yanfly.Party.Game_Actor_isFormationChangeOk.call(this);
  356. };
  357.  
  358. //=============================================================================
  359. // Game_Party
  360. //=============================================================================
  361.  
  362. Yanfly.Party.Game_Party_initialize = Game_Party.prototype.initialize;
  363. Game_Party.prototype.initialize = function() {
  364.     Yanfly.Party.Game_Party_initialize.call(this);
  365.     this.initBattleMaxSize();
  366.     this.initializeBattleMembers();
  367. };
  368.  
  369. Game_Party.prototype.initBattleMaxSize = function() {
  370.     this._BattleMaxSize = Yanfly.Param.MaxBattleMembers;
  371.     this.initializeBattleMembers();
  372. };
  373.  
  374. Game_Party.prototype.changeBattleMax = function(value) {
  375.     this._BattleMaxSize = value;
  376.     this.initializeBattleMembers();
  377. };
  378.  
  379. Game_Party.prototype.loadActorImages = function() {
  380.     for (var i = 0; i < this.members().length; ++i) {
  381.       var actor = this.members()[i];
  382.       if (!actor) continue;
  383.       ImageManager.loadFace(actor.faceName());
  384.       ImageManager.loadCharacter(actor.characterName());
  385.     }
  386. };
  387.  
  388. Game_Party.prototype.battleMembers = function() {
  389.     if (this.toInitializeBattleMembers()) this.initializeBattleMembers();
  390.     var battleParty = [];
  391.     for (var i = 0; i < this._battleMembers.length; ++i) {
  392.       var actorId = this._battleMembers[i];
  393.       if (battleParty.length > this.maxBattleMembers()) break;
  394.       if (actorId === null) continue;
  395.       if (!$gameActors.actor(actorId)) continue;
  396.       if (!$gameActors.actor(actorId).isAppeared()) continue;
  397.       battleParty.push($gameActors.actor(actorId));
  398.     }
  399.     return battleParty;
  400. };
  401.  
  402. Game_Party.prototype.maxBattleMembers = function() {
  403.     if (this._BattleMaxSize === undefined) this.initBattleMaxSize();
  404.     return Math.max(this._BattleMaxSize, 1);
  405. };
  406.  
  407. Yanfly.Party.Game_Party_setupStartingMembers =
  408.     Game_Party.prototype.setupStartingMembers;
  409. Game_Party.prototype.setupStartingMembers = function() {
  410.     Yanfly.Party.Game_Party_setupStartingMembers.call(this);
  411.     this.initializeBattleMembers();
  412.     if (eval(Yanfly.Param.PartyLockFirst)) this.lockActor(this._actors[0]);
  413. };
  414.  
  415. Game_Party.prototype.toInitializeBattleMembers = function() {
  416.     if (this._battleMembers === null) return true;
  417.     if (!this._battleMembers) this.initializeBattleMembers();
  418.     return (this._battleMembers.length !== this.maxBattleMembers());
  419. };
  420.  
  421. Yanfly.Party.Game_Party_setupBattleTestMembers =
  422.     Game_Party.prototype.setupBattleTestMembers;
  423. Game_Party.prototype.setupBattleTestMembers = function() {
  424.     Yanfly.Party.Game_Party_setupBattleTestMembers.call(this);
  425.     if (eval(Yanfly.Param.PartyLockFirst)) this.lockActor(this._actors[0]);
  426.     for (var i = 0; i < $dataActors.length; ++i) {
  427.       var actor = $dataActors[i];
  428.       if (!actor) continue;
  429.       if (this._battleMembers.contains(actor.id)) continue;
  430.       this._actors.push(actor.id);
  431.     }
  432.     this.loadActorImages();
  433. };
  434.  
  435. Game_Party.prototype.initializeBattleMembers = function() {
  436.     this._battleMembers = [];
  437.     for (var i = 0; i < this.maxBattleMembers(); ++i) {
  438.       if (this._actors[i]) {
  439.         this._battleMembers.push(this._actors[i]);
  440.       } else {
  441.         this._battleMembers.push(0);
  442.       }
  443.     }
  444.     if ($gamePlayer) $gamePlayer.refresh();
  445. };
  446.  
  447. Yanfly.Party.Game_Party_addActor = Game_Party.prototype.addActor;
  448. Game_Party.prototype.addActor = function(actorId) {
  449.     Yanfly.Party.Game_Party_addActor.call(this, actorId);
  450.     if (this._battleMembers.contains(actorId)) return;
  451.     if (!this._battleMembers.contains(0)) return;
  452.     var index = this._battleMembers.indexOf(0);
  453.     this._battleMembers[index] = actorId;
  454.     $gamePlayer.refresh();
  455.     $gameMap.requestRefresh();
  456.     this.rearrangeActors();
  457. };
  458.  
  459. Yanfly.Party.Game_Party_removeActor = Game_Party.prototype.removeActor;
  460. Game_Party.prototype.removeActor = function(actorId) {
  461.     Yanfly.Party.Game_Party_removeActor.call(this, actorId);
  462.     if (!this._battleMembers.contains(actorId)) return;
  463.     var index = this._battleMembers.indexOf(actorId);
  464.     this._battleMembers[index] = 0;
  465.     $gamePlayer.refresh();
  466.     $gameMap.requestRefresh();
  467.     this.rearrangeActors();
  468. };
  469.  
  470. Game_Party.prototype.rearrangeActors = function() {
  471.     if (this._battleMembers === null) this.initializeBattleMembers();
  472.     var battleArray = [];
  473.     for (var i = 0; i < this._battleMembers.length; ++i) {
  474.       var actorId = this._battleMembers[i];
  475.       if (actorId === null) continue;
  476.       if ($gameActors.actor(actorId)) battleArray.push(actorId);
  477.     }
  478.     var reserveArray = [];
  479.     for (var i = 0; i < this._actors.length; ++i) {
  480.       var actorId = this._actors[i];
  481.       if (battleArray.contains(actorId)) continue;
  482.       if ($gameActors.actor(actorId) === null) continue;
  483.       reserveArray.push(actorId);
  484.     }
  485.     reserveArray = this.sortReserveParty(reserveArray);
  486.     this._actors = battleArray.concat(reserveArray);
  487. };
  488.  
  489. Game_Party.prototype.sortReserveParty = function(party) {
  490.     party.sort(function(a, b) { return a - b; });
  491.     return party;
  492. };
  493.  
  494. Game_Party.prototype.lockActor = function(actorId) {
  495.     var actor = $gameActors.actor(actorId);
  496.     if (actor) actor._locked = true;
  497. };
  498.  
  499. Game_Party.prototype.reconstructActions = function(actorId) {
  500.     for (var i = 0; i < this.members().length; ++i) {
  501.       var member = this.members()[i];
  502.       if (!member) continue;
  503.       if (member.currentAction() && member.currentAction().item()) continue;
  504.       member.makeActions();
  505.     }
  506. };
  507.  
  508. Yanfly.Party.Game_Party_swapOrder = Game_Party.prototype.swapOrder;
  509. Game_Party.prototype.swapOrder = function(index1, index2) {
  510.     this.swapOrderBattleMembers(index1, index2);
  511.     Yanfly.Party.Game_Party_swapOrder.call(this, index1, index2);
  512.     this.rearrangeActors();
  513.     $gamePlayer.refresh();
  514. };
  515.  
  516. Game_Party.prototype.swapOrderBattleMembers = function(index1, index2) {
  517.     var bm = this._battleMembers;
  518.     if (bm.length > index1 && bm.length > index2) {
  519.       var actorId1 = this._battleMembers[index1];
  520.       var actorId2 = this._battleMembers[index2];
  521.     } else if (bm.length > index1) {
  522.       var actorId1 = this._battleMembers[index1];
  523.       var actorId2 = this._actors[index2];
  524.     } else if (bm.length > index2) {
  525.       var actorId1 = this._actors[index1];
  526.       var actorId2 = this._battleMembers[index2];
  527.     }
  528.     if (bm.length > index1) this._battleMembers[index1] = actorId2;
  529.     if (bm.length > index2) this._battleMembers[index2] = actorId1;
  530. };
  531.  
  532. //=============================================================================
  533. // Game_Troop
  534. //=============================================================================
  535.  
  536. Yanfly.Party.Game_Troop_increaseTurn = Game_Troop.prototype.increaseTurn;
  537. Game_Troop.prototype.increaseTurn = function() {
  538.     Yanfly.Party.Game_Troop_increaseTurn.call(this);
  539.     $gameSystem.updateBattleFormationCooldown();
  540. };
  541.  
  542. //=============================================================================
  543. // Game_Player
  544. //=============================================================================
  545.  
  546. Game_Followers.prototype.initialize = function() {
  547.     this._visible = $dataSystem.optFollowers;
  548.     this._gathering = false;
  549.     this._data = [];
  550.     var max = Yanfly.Param.PartyMaxFollower || $gameParty.maxBattleMembers();
  551.     for (var i = 1; i < max; i++) {
  552.         this._data.push(new Game_Follower(i));
  553.     }
  554. };
  555.  
  556. //=============================================================================
  557. // Game_Interpreter
  558. //=============================================================================
  559.  
  560. Yanfly.Party.Game_Interpreter_pluginCommand =
  561.     Game_Interpreter.prototype.pluginCommand;
  562. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  563.     Yanfly.Party.Game_Interpreter_pluginCommand.call(this, command, args)
  564.     if (command === 'OpenPartyMenu') this.gotoSceneParty();
  565.     if (command === 'ChangePartyMax') $gameParty.changeBattleMax(args[0]);
  566.     if (command === 'LockActor') this.lockActor(args, true);
  567.     if (command === 'UnlockActor') this.lockActor(args, false);
  568.     if (command === 'RequireActor') this.requireActor(args, true);
  569.     if (command === 'UnrequireActor') this.requireActor(args, false);
  570.     if (command === 'ShowBattleFormation') {
  571.       $gameSystem.setShowBattleFormation(true);
  572.     }
  573.     if (command === 'HideBattleFormation') {
  574.       $gameSystem.setShowBattleFormation(false);
  575.     }
  576.     if (command === 'EnableBattleFormation') {
  577.       $gameSystem.setBattleFormationEnabled(true);
  578.     }
  579.     if (command === 'DisableBattleFormation') {
  580.       $gameSystem.setBattleFormationEnabled(false);
  581.     }
  582. };
  583.  
  584. Game_Interpreter.prototype.gotoSceneParty = function() {
  585.     if ($gameParty.inBattle()) return;
  586.     $gameParty.loadActorImages();
  587.     SceneManager.push(Scene_Party);
  588. };
  589.  
  590. Game_Interpreter.prototype.lockActor = function(args, value) {
  591.     for (i = 0; i < args.length; i++) {
  592.       var actorId = Number(args[i]);
  593.       if ($gameActors.actor(actorId)) {
  594.         $gameActors.actor(actorId)._locked = value;
  595.       }
  596.     }
  597. };
  598.  
  599. Game_Interpreter.prototype.requireActor = function(args, value) {
  600.     for (i = 0; i < args.length; i++) {
  601.       var actorId = Number(args[i]);
  602.       if ($gameActors.actor(actorId)) {
  603.         $gameActors.actor(actorId)._required = value;
  604.       }
  605.     }
  606. };
  607.  
  608. //=============================================================================
  609. // Window_PartyMenuCommand
  610. //=============================================================================
  611.  
  612. Window_PartyMenuCommand = function() {
  613.     this.initialize.apply(this, arguments);
  614. }
  615.  
  616. Window_PartyMenuCommand.prototype = Object.create(Window_Command.prototype);
  617. Window_PartyMenuCommand.prototype.constructor = Window_PartyMenuCommand;
  618.  
  619. Window_PartyMenuCommand.prototype.initialize = function(x, y) {
  620.     Window_Command.prototype.initialize.call(this, x, y);
  621. };
  622.  
  623. Window_PartyMenuCommand.prototype.windowWidth = function() {
  624.     var ww = $gameParty.maxBattleMembers() * Window_Base._faceWidth;
  625.     ww += this.standardPadding() * 2;
  626.     return (Graphics.boxWidth - ww).clamp(Graphics.boxWidth / 4, 240);
  627. };
  628.  
  629. Window_PartyMenuCommand.prototype.numVisibleRows = function() {
  630.     return 4;
  631. };
  632.  
  633. Window_PartyMenuCommand.prototype.itemTextAlign = function() {
  634.     return Yanfly.Param.PartyTextAlign;
  635. };
  636.  
  637. Window_PartyMenuCommand.prototype.makeCommandList = function() {
  638.     this.addChangeCommand();
  639.     this.addRemoveCommand();
  640.     this.addRevertCommand();
  641.     this.addCustomCommand();
  642.     this.addCancelCommand();
  643. };
  644.  
  645. Window_PartyMenuCommand.prototype.addChangeCommand = function() {
  646.     if (Yanfly.Param.PartyCommand1 === '') return;
  647.     this.addCommand(Yanfly.Param.PartyCommand1, 'change');
  648. };
  649.  
  650. Window_PartyMenuCommand.prototype.addRemoveCommand = function() {
  651.     if (Yanfly.Param.PartyCommand2 === '') return;
  652.     this.addCommand(Yanfly.Param.PartyCommand2, 'remove');
  653. };
  654.  
  655. Window_PartyMenuCommand.prototype.addRevertCommand = function() {
  656.     if (Yanfly.Param.PartyCommand3 === '') return;
  657.     this.addCommand(Yanfly.Param.PartyCommand3, 'revert');
  658. };
  659.  
  660. Window_PartyMenuCommand.prototype.addCustomCommand = function() {
  661. };
  662.  
  663. Window_PartyMenuCommand.prototype.addCancelCommand = function() {
  664.     var enabled = this.isCancelEnabled();
  665.     if (Yanfly.Param.PartyCommand4 === '') return;
  666.     this.addCommand(Yanfly.Param.PartyCommand4, 'cancel', enabled);
  667. };
  668.  
  669. Window_PartyMenuCommand.prototype.inParty = function(actor) {
  670.     return ($gameParty.battleMembers().contains(actor));
  671. };
  672.  
  673. Window_PartyMenuCommand.prototype.isCancelEnabled = function() {
  674.     if ($gameParty.aliveMembers().length <= 0) return false;
  675.     if ($gameParty.battleMembers().length <= 0) return false;
  676.     for (var i = 0; i < $gameParty._actors.length; ++i) {
  677.       var actorId = $gameParty._actors[i];
  678.       if (this.refuseCancel(actorId)) return false;
  679.     }
  680.     return true
  681. };
  682.  
  683. Window_PartyMenuCommand.prototype.refuseCancel = function(actorId) {
  684.     if ($gameParty._battleMembers.contains(actorId)) return false;
  685.     if ($gameActors.actor(actorId)._required) return true;
  686.     return false;
  687. };
  688.  
  689. //=============================================================================
  690. // Window_PartySelect
  691. //=============================================================================
  692.  
  693. Window_PartySelect = function() {
  694.     this.initialize.apply(this, arguments);
  695. }
  696.  
  697. Window_PartySelect.prototype = Object.create(Window_Selectable.prototype);
  698. Window_PartySelect.prototype.constructor = Window_PartySelect;
  699.  
  700. Window_PartySelect.prototype.initialize = function(commandWindow) {
  701.     var wx = commandWindow.width;
  702.     var wy = commandWindow.y;
  703.     var ww = Graphics.boxWidth - commandWindow.width;
  704.     var wh = commandWindow.height;
  705.     Window_Selectable.prototype.initialize.call(this, wx, wy, ww, wh);
  706.     this.select(-1);
  707.     this.deactivate();
  708.     this.refresh();
  709. };
  710.  
  711. Window_PartySelect.prototype.maxCols = function() {
  712.     return $gameParty.maxBattleMembers();
  713. };
  714.  
  715. Window_PartySelect.prototype.maxItems = function() {
  716.     return $gameParty.maxBattleMembers();
  717. };
  718.  
  719. Window_PartySelect.prototype.itemRect = function(index) {
  720.     var rect = new Rectangle();
  721.     rect.width = this.contents.width / this.maxItems();
  722.     rect.height = this.contents.height;
  723.     rect.x = index * rect.width;
  724.     rect.y = 0;
  725.     return rect;
  726. };
  727.  
  728. Window_PartySelect.prototype.refresh = function() {
  729.     this.makeItemList();
  730.     this.createContents();
  731.     this.drawAllItems();
  732. };
  733.  
  734. Window_PartySelect.prototype.makeItemList = function() {
  735.     this._data = $gameParty._battleMembers.slice(0);
  736. };
  737.  
  738. Window_PartySelect.prototype.drawItem = function(index) {
  739.     var actor = $gameActors.actor(this._data[index]);
  740.     var rect = this.itemRect(index);
  741.     rect.x += this.textPadding() / 2;
  742.     rect.y += this.textPadding() / 2;
  743.     rect.width -= this.textPadding();
  744.     rect.height -= this.textPadding();
  745.     if (actor) {
  746.       this.drawActor(rect, actor);
  747.     } else {
  748.       this.drawEmpty(rect);
  749.     }
  750. };
  751.  
  752. Window_PartySelect.prototype.drawEmpty = function(rect) {
  753.     var color = this.gaugeBackColor();
  754.     this.changePaintOpacity(false);
  755.     this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
  756.     this.changePaintOpacity(true);
  757.     this.resetFontSettings();
  758.     var text = Yanfly.Param.PartyEmptyText
  759.     this.contents.drawText(text, rect.x, rect.y, rect.width,
  760.         rect.height, 'center');
  761. };
  762.  
  763. Window_PartySelect.prototype.drawActor = function(rect, actor) {
  764.     if (eval(Yanfly.Param.PartyShowFace)) {
  765.       this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.height);
  766.     }
  767.     if (eval(Yanfly.Param.PartyShowCharacter)) {
  768.       var ry = rect.height * 19/20;
  769.       this.drawActorCharacter(actor, rect.x + rect.width / 2, ry);
  770.     }
  771.     this.drawActorName(actor, rect.x, rect.y, rect.width);
  772.     this.drawLockedIcon(actor, rect);
  773.     this.drawRequiredIcon(actor, rect);
  774. };
  775.  
  776. Window_PartySelect.prototype.drawLockedIcon = function(actor, rect) {
  777.     if (!actor._locked) return;
  778.     var ix = rect.x + rect.width - Window_Base._iconWidth - 2;
  779.     var iy = rect.y + rect.height - Window_Base._iconHeight - 2;
  780.     this.drawIcon(Yanfly.Icon.PartyLocked, ix, iy)
  781. };
  782.  
  783. Window_PartySelect.prototype.drawRequiredIcon = function(actor, rect) {
  784.     if (!actor._required) return;
  785.     var ix = rect.x + 2;
  786.     var iy = rect.y + rect.height - Window_Base._iconHeight - 2;
  787.     this.drawIcon(Yanfly.Icon.PartyRequired, ix, iy)
  788. };
  789.  
  790. Window_PartySelect.prototype.curActor = function() {
  791.     if (!this._data) return null;
  792.     var actorId = this._data[this._index];
  793.     return $gameActors.actor(actorId);
  794. };
  795.  
  796. Window_PartySelect.prototype.prevActor = function() {
  797.     var id = this._index === 0 ? this._data.length - 1 : this._index - 1;
  798.     var actorId = this._data[id];
  799.     return $gameActors.actor(actorId);
  800. };
  801.  
  802. Window_PartySelect.prototype.nextActor = function() {
  803.     var id = this._index === this._data.length - 1 ? 0 : this._index + 1;
  804.     var actorId = this._data[id];
  805.     return $gameActors.actor(actorId);
  806. };
  807.  
  808. Window_PartySelect.prototype.processActor = function(value) {
  809.     return true;
  810. };
  811.  
  812. Window_PartySelect.prototype.isCurrentItemEnabled = function() {
  813.     if (this.curActor()) return this.curActor().isFormationChangeOk();
  814.     return true;
  815. };
  816.  
  817. Window_PartySelect.prototype.processPageup = function() {
  818.     if (this.curActor() && this.curActor()._locked) {
  819.       this.playBuzzerSound();
  820.     } else if (this.prevActor() && this.prevActor()._locked) {
  821.       this.playBuzzerSound();
  822.     } else if (this.processActor('prevActor')) {
  823.       Window_Selectable.prototype.processPageup.call(this);
  824.       this.activate();
  825.       this.select(this._index === 0 ? this._data.length - 1 : this._index - 1)
  826.     } else {
  827.       this.playBuzzerSound();
  828.     }
  829. };
  830.  
  831. Window_PartySelect.prototype.processPagedown = function() {
  832.     if (this.curActor() && this.curActor()._locked) {
  833.       this.playBuzzerSound();
  834.     } else if (this.nextActor() && this.nextActor()._locked) {
  835.       this.playBuzzerSound();
  836.     } else if (this.processActor('nextActor')) {
  837.       Window_Selectable.prototype.processPagedown.call(this);
  838.       this.activate();
  839.       this.select(this._index === this._data.length - 1 ? 0 : this._index + 1)
  840.     } else {
  841.       this.playBuzzerSound();
  842.     }
  843. };
  844.  
  845. Window_PartySelect.prototype.setDetailWindow = function(win) {
  846.     this._detailWindow = win;
  847.     this.callUpdateHelp();
  848. };
  849.  
  850. Window_PartySelect.prototype.callUpdateHelp = function() {
  851.     this.setHelpWindowItem(this.curActor());
  852.     this.setDetailWindowItem(this.curActor());
  853. };
  854.  
  855. Window_PartySelect.prototype.setHelpWindowItem = function(actor) {
  856.     if (this._helpWindow && actor) {
  857.       this._helpWindow.setText(actor.profile());
  858.     } else if (this._helpWindow) {
  859.       this._helpWindow.clear();
  860.     }
  861. };
  862.  
  863. Window_PartySelect.prototype.setDetailWindowItem = function(actor) {
  864.     if (this._detailWindow) this._detailWindow.setActor(actor);
  865. };
  866.  
  867. Window_PartySelect.prototype.item = function() {
  868.     var index = this.index();
  869.     return this._data && index >= 0 ? this._data[index] : null;
  870. };
  871.  
  872. //=============================================================================
  873. // Window_PartyList
  874. //=============================================================================
  875.  
  876. Window_PartyList = function() {
  877.     this.initialize.apply(this, arguments);
  878. }
  879.  
  880. Window_PartyList.prototype = Object.create(Window_Selectable.prototype);
  881. Window_PartyList.prototype.constructor = Window_PartyList;
  882.  
  883. Window_PartyList.prototype.initialize = function(partyWindow) {;
  884.     var wy = partyWindow.y + partyWindow.height;
  885.     this._detailedWindow = eval(Yanfly.Param.PartyDetailWin);
  886.     var ww = this.windowWidth();
  887.     var wh = Graphics.boxHeight - wy;
  888.     Window_Selectable.prototype.initialize.call(this, 0, wy, ww, wh);
  889.     this.select(1);
  890.     this.deactivate();
  891.     this.refresh();
  892. };
  893.  
  894. Window_PartyList.prototype.windowWidth = function() {
  895.     if (this._detailedWindow) {
  896.       return Yanfly.Param.PartyListWidth;
  897.     } else {
  898.       return Graphics.boxWidth;
  899.     }
  900. };
  901.  
  902. Window_PartyList.prototype.maxItems = function() {
  903.     return this._data ? this._data.length : 1;
  904. };
  905.  
  906. Window_PartyList.prototype.refresh = function() {
  907.     this.makeItemList();
  908.     this.createContents();
  909.     this.drawAllItems();
  910. };
  911.  
  912. Window_PartyList.prototype.makeItemList = function() {
  913.     this._data = [0];
  914.     this.createActorOrder();
  915.     this._data.push(0);
  916. };
  917.  
  918. Window_PartyList.prototype.createActorOrder = function() {
  919.     for (var i = 0; i < $gameParty._actors.length; ++i) {
  920.       var actorId = $gameParty._actors[i];
  921.       if ($gameActors.actor(actorId)) this._data.push(actorId);
  922.     }
  923. };
  924.  
  925. Window_PartyList.prototype.drawAllItems = function() {
  926.     var topIndex = this.topIndex();
  927.     for (var i = 0; i < this.maxPageItems(); i++) {
  928.         var index = topIndex + i;
  929.         if (index < this.maxItems()) {
  930.             this.drawItem(index);
  931.             this.clearItem(index + 1);
  932.         }
  933.     }
  934. };
  935.  
  936. Window_PartyList.prototype.drawItem = function(index) {
  937.     var actor = $gameActors.actor(this._data[index]);
  938.     if (actor) {
  939.       var bitmap = ImageManager.loadCharacter(actor.characterName());
  940.       if (bitmap.width <= 0) {
  941.         return setTimeout(this.drawItem.bind(this, index), 5);
  942.       }
  943.     }
  944.     this.clearItem(index);
  945.     var rect = this.itemRect(index);
  946.     if (this._data[index] === 0) {
  947.       this.drawRemove(rect);
  948.       return;
  949.     }
  950.     this.drawActor(actor, rect);
  951. };
  952.  
  953. Window_PartyList.prototype.drawRemove = function(rect) {
  954.     var ibw = Window_Base._iconWidth + 4;
  955.     rect.width -= this.textPadding();
  956.     this.drawIcon(Yanfly.Icon.PartyRemove, rect.x + 2, rect.y + 2);
  957.     this.drawText(Yanfly.Param.PartyCommand2, rect.x + ibw, rect.y,
  958.       rect.width - ibw);
  959. };
  960.  
  961. Window_PartyList.prototype.drawActor = function(actor, rect) {
  962.     this.drawBasic(actor, rect);
  963.     if (this._detailedWindow) return;
  964.     this.drawExtra(actor, rect);
  965. };
  966.  
  967. Window_PartyList.prototype.drawBasic = function(actor, rect) {
  968.     var wx = Window_Base._iconWidth / 2 + this.textPadding() / 2;
  969.     var wy = rect.y + rect.height + Yanfly.Param.PartySpriteBufferY
  970.     this.drawActorCharacter(actor, wx, wy);
  971.     this.changeTextColor(this.listColor(actor));
  972.     this.changePaintOpacity(this.actorIsEnabled(actor));
  973.     var ibw = Window_Base._iconWidth + 4;
  974.     this.drawText(actor.name(), rect.x + ibw, rect.y, rect.width - ibw);
  975.     this.changePaintOpacity(true);
  976.     this.drawRestrictions(actor, rect);
  977.     this.resetFontSettings();
  978. };
  979.  
  980. Window_PartyList.prototype.drawExtra = function(actor, rect) {
  981.     var section = this.itemSection();
  982.     this.drawActorLevel(actor, section * 2, rect.y);
  983.     this.drawActorHp(actor, section * 3, rect.y, section - 6);
  984.     this.drawActorMp(actor, section * 4, rect.y, section - 6);
  985.     if ($dataSystem.optDisplayTp) {
  986.       this.drawActorTp(actor, section * 5, rect.y, section - 6);
  987.     }
  988.     this.drawRestrictions(actor, rect);
  989. };
  990.  
  991. Window_PartyList.prototype.drawRestrictions = function(actor, rect) {
  992.     if (this._detailedWindow) {
  993.       var wx = this.contents.width - Window_Base._iconWidth - 2;
  994.     } else {
  995.       var section = this.itemSection();
  996.       var wx = section * 2 - Window_Base._iconWidth - 2;
  997.     }
  998.     if (actor._locked) {
  999.       this.drawIcon(Yanfly.Icon.PartyLocked, wx, rect.y);
  1000.       wx -= Window_Base._iconWidth;
  1001.     }
  1002.     if (actor._required) {
  1003.       this.drawIcon(Yanfly.Icon.PartyRequired, wx, rect.y);
  1004.     }
  1005. };
  1006.  
  1007. Window_PartyList.prototype.itemSection = function() {
  1008.     var sections = 5;
  1009.     if ($dataSystem.optDisplayTp) sections += 1;
  1010.     return this.contents.width / sections;
  1011. };
  1012.  
  1013. Window_PartyList.prototype.drawCurrentAndMax = function(current, max, x, y,
  1014.                                                    width, color1, color2) {
  1015.     var labelWidth = this.textWidth('HP');
  1016.     var valueWidth = this.textWidth(Yanfly.Util.toGroup(max));
  1017.     var slashWidth = this.textWidth('/');
  1018.     var x1 = x + width - valueWidth;
  1019.     this.changeTextColor(color1);
  1020.     this.drawText(Yanfly.Util.toGroup(current), x1, y, valueWidth, 'right');
  1021. };
  1022.  
  1023. Window_PartyList.prototype.listColor = function(actor) {
  1024.     if (actor.isBattleMember()) {
  1025.       return this.textColor(Yanfly.Param.ColorInParty);
  1026.     }
  1027.     return this.normalColor()
  1028. };
  1029.  
  1030. Window_PartyList.prototype.curActor = function() {
  1031.     var actorId = this._data[this._index];
  1032.     return $gameActors.actor(actorId);
  1033. };
  1034.  
  1035. Window_PartyList.prototype.isCurrentItemEnabled = function() {
  1036.     if (this.curActor()) return this.curActor().isFormationChangeOk();
  1037.     return true;
  1038. };
  1039.  
  1040. Window_PartyList.prototype.actorIsEnabled = function(actor) {
  1041.     return actor.isAppeared();
  1042. };
  1043.  
  1044. Window_PartyList.prototype.setDetailWindow = function(win) {
  1045.     this._detailWindow = win;
  1046.     this.callUpdateHelp();
  1047. };
  1048.  
  1049. Window_PartyList.prototype.callUpdateHelp = function() {
  1050.     this.setHelpWindowItem($gameActors.actor(this.item()));
  1051.     this.setDetailWindowItem($gameActors.actor(this.item()));
  1052. };
  1053.  
  1054. Window_PartyList.prototype.setHelpWindowItem = function(actor) {
  1055.     if (this._helpWindow && actor) {
  1056.         this._helpWindow.setText(actor.profile());
  1057.     } else if (this._helpWindow) {
  1058.         this._helpWindow.clear();
  1059.     }
  1060. };
  1061.  
  1062. Window_PartyList.prototype.setDetailWindowItem = function(actor) {
  1063.     if (this._detailWindow) this._detailWindow.setActor(actor);
  1064. };
  1065.  
  1066. Window_PartyList.prototype.item = function() {
  1067.     var index = this.index();
  1068.     return this._data && index >= 0 ? this._data[index] : null;
  1069. };
  1070.  
  1071. //=============================================================================
  1072. // Window_PartyDetail
  1073. //=============================================================================
  1074.  
  1075. function Window_PartyDetail() {
  1076.     this.initialize.apply(this, arguments);
  1077. }
  1078.  
  1079. Window_PartyDetail.prototype = Object.create(Window_Base.prototype);
  1080. Window_PartyDetail.prototype.constructor = Window_PartyDetail;
  1081.  
  1082. Window_PartyDetail.prototype.initialize = function(x, y, width, height) {
  1083.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  1084.     this._actor = null;
  1085. };
  1086.  
  1087. Window_PartyDetail.prototype.setActor = function(actor) {
  1088.     if (this._actor === actor) return;
  1089.     this._actor = actor;
  1090.     this.refresh();
  1091. };
  1092.  
  1093. Window_PartyDetail.prototype.clear = function() {
  1094.     this.contents.clear();
  1095.     this.drawDarkRect(0, 0, this.contents.width, this.contents.height);
  1096.     this.changeTextColor(this.systemColor());
  1097.     var text = Yanfly.Param.PartyEmptyText
  1098.     this.contents.drawText(text, 0, 0, this.contents.width,
  1099.         this.contents.height, 'center');
  1100. };
  1101.  
  1102. Window_PartyDetail.prototype.refresh = function() {
  1103.     if (!this._actor) return this.clear();
  1104.     this.contents.clear();
  1105.     this.drawActorBasicInfo();
  1106.     this.calculateAvailableLines();
  1107.     this.drawDarkRectangles();
  1108.     this.drawActorParams();
  1109.     this.drawActorEquips();
  1110. };
  1111.  
  1112. Window_PartyDetail.prototype.drawDarkRectangles = function() {
  1113.     var ww = this.contents.width / 2;
  1114.     var wy = this.lineHeight() * 4;
  1115.     if (this._linesAvailable >= 7) wy += this.lineHeight();
  1116.     if (this._linesAvailable === 4) wy += this.lineHeight();
  1117.     var max = this._linesAvailable;
  1118.     max = Math.min(this._linesAvailable, this._actor.equipSlots().length);
  1119.     for (var i = 0; i < max; ++i) {
  1120.       if (wy + this.lineHeight() > this.contents.height) break;
  1121.       this.drawDarkRect(ww, wy, ww, this.lineHeight());
  1122.       wy += this.lineHeight();
  1123.     }
  1124.     var wy = this.lineHeight() * 4;
  1125.     if (this._linesAvailable >= 7) wy += this.lineHeight();
  1126.     if (this._linesAvailable === 4) wy += this.lineHeight();
  1127.     for (var i = 0; i < 6; ++i) {
  1128.       var rect = this.paramRect(i);
  1129.       this.drawDarkRect(rect.x, rect.y, rect.width, rect.height);
  1130.     }
  1131. };
  1132.  
  1133. Window_PartyDetail.prototype.drawDarkRect = function(dx, dy, dw, dh) {
  1134.     var color = this.gaugeBackColor();
  1135.     this.changePaintOpacity(false);
  1136.     this.contents.fillRect(dx + 1, dy + 1, dw - 2, dh - 2, color);
  1137.     this.changePaintOpacity(true);
  1138. };
  1139.  
  1140. Window_PartyDetail.prototype.paramRect = function(index) {
  1141.     var rect = new Rectangle();
  1142.     rect.x = 0;
  1143.     rect.y = this.lineHeight() * 4;
  1144.     rect.height = this.lineHeight();
  1145.     rect.width = this.contents.width / 2
  1146.     if (this._linesAvailable >= 7) rect.y += this.lineHeight();
  1147.     if (this._linesAvailable === 4) rect.y += this.lineHeight();
  1148.     if (this._linesAvailable >= 6) {
  1149.       rect.y += this.lineHeight() * index;
  1150.     } else {
  1151.       rect.width /= 2;
  1152.       rect.x = index % 2 === 0 ? 0 : rect.width;
  1153.       rect.y += this.lineHeight() * Math.floor(index / 2);
  1154.     }
  1155.     return rect;
  1156. };
  1157.  
  1158. Window_PartyDetail.prototype.drawActorBasicInfo = function() {
  1159.     var w = this.width - this.padding * 2;
  1160.     var h = this.height - this.padding * 2;
  1161.     var y = 0;
  1162.     var padding = 0;
  1163.     var xpad = padding + Window_Base._faceWidth;
  1164.     var width = w - 162 - this.textPadding();
  1165.     h = Window_Base._faceHeight;
  1166.     this.drawActorFace(this._actor, 0, 0, Window_Base._faceWidth, h);
  1167.     this.drawActorSimpleStatus(this._actor, xpad, y, width);
  1168. };
  1169.  
  1170. Window_PartyDetail.prototype.calculateAvailableLines = function() {
  1171.     if (this._linesAvailable) return;
  1172.     this._linesAvailable = this.contents.height - this.lineHeight() * 4;
  1173.     this._linesAvailable /= this.lineHeight();
  1174.     this._linesAvailable = Math.floor(this._linesAvailable);
  1175. };
  1176.  
  1177. Window_PartyDetail.prototype.drawActorParams = function() {
  1178.     this.drawActorParamsTitle();
  1179.     for (var i = 0; i < 6; ++i) {
  1180.       var rect = this.paramRect(i);
  1181.       if (this._linesAvailable > 4) {
  1182.         rect.x += 8;
  1183.         rect.width -= 16;
  1184.       } else {
  1185.         rect.x += 4;
  1186.         rect.width -= 8;
  1187.       }
  1188.       var paramId = i + 2;
  1189.       var text = TextManager.param(paramId);
  1190.       this.changeTextColor(this.systemColor());
  1191.       this.drawText(text, rect.x, rect.y, rect.width);
  1192.       var paramValue = Yanfly.Util.toGroup(this._actor.param(paramId));
  1193.       this.changeTextColor(this.normalColor());
  1194.       this.drawText(paramValue, rect.x, rect.y, rect.width, 'right');
  1195.     }
  1196. };
  1197.  
  1198. Window_PartyDetail.prototype.drawActorParamsTitle = function() {
  1199.     var wy = this.lineHeight() * 4;
  1200.     var ww = this.contents.width / 2;
  1201.     if (this._linesAvailable >= 7) {
  1202.       var text = Yanfly.Param.PartyDetailParam;
  1203.       this.changeTextColor(this.systemColor());
  1204.       this.drawText(text, 0, wy, ww, 'center');
  1205.     } else if (this._linesAvailable === 4) {
  1206.       var text = Yanfly.Param.PartyDetailParam;
  1207.       this.changeTextColor(this.systemColor());
  1208.       this.drawText(text, 0, wy, ww, 'center');
  1209.     }
  1210. };
  1211.  
  1212. Window_PartyDetail.prototype.drawActorEquips = function() {
  1213.     this.drawActorEquipsTitle();
  1214.     var equips = this.getActorEquips();
  1215.     this.drawActorEquipsList(equips);
  1216. };
  1217.  
  1218. Window_PartyDetail.prototype.drawActorEquipsTitle = function() {
  1219.     var wy = this.lineHeight() * 4;
  1220.     var ww = this.contents.width / 2;
  1221.     if (this._linesAvailable >= 7) {
  1222.       var text = Yanfly.Param.PartyDetailEquip;
  1223.       this.changeTextColor(this.systemColor());
  1224.       this.drawText(text, ww, wy, ww, 'center');
  1225.     } else if (this._linesAvailable === 4) {
  1226.       var text = Yanfly.Param.PartyDetailEquip;
  1227.       this.changeTextColor(this.systemColor());
  1228.       this.drawText(text, ww, wy, ww, 'center');
  1229.     }
  1230. };
  1231.  
  1232. Window_PartyDetail.prototype.getActorEquips = function() {
  1233.     var equips = [];
  1234.     for (var i = 0; i < this._actor.equips().length; ++i) {
  1235.       var equip = this._actor.equips()[i];
  1236.       if (equip) equips.push(equip);
  1237.     }
  1238.     return equips;
  1239. };
  1240.  
  1241. Window_PartyDetail.prototype.drawActorEquipsList = function(equips) {
  1242.     this._lastSlot = false;
  1243.     var max = this._linesAvailable;
  1244.     var ww = this.contents.width / 2;
  1245.     var wh = this.lineHeight();
  1246.     var wy = this.lineHeight() * 4;
  1247.     var wx = ww + 6;
  1248.     ww -= 12;
  1249.     if (this._linesAvailable >= 7) {
  1250.       max -= 1;
  1251.       wy += this.lineHeight();
  1252.     }
  1253.     if (this._linesAvailable === 4) {
  1254.       max -= 1;
  1255.       wy += this.lineHeight();
  1256.     }
  1257.     for (var i = 0; i < equips.length; ++i) {
  1258.       var equip = equips[i];
  1259.       if (!equip) break;
  1260.       if (i >= max - 1 && i < equips.length - 1) this._lastSlot = true;
  1261.       if (this._lastSlot) {
  1262.         var iconIndex = equip.iconIndex;
  1263.         this.drawIcon(iconIndex, wx + 2, wy + 2);
  1264.         wx += Window_Base._iconWidth;
  1265.         continue;
  1266.       } else if (this._lastSlot && i === equips.length - 1) {
  1267.         var iconIndex = equip.iconIndex;
  1268.         this.drawIcon(iconIndex, wx + 2, wy + 2);
  1269.         wx += Window_Base._iconWidth;
  1270.       } else {
  1271.         this.drawItemName(equip, wx, wy, ww);
  1272.       }
  1273.       wy += this.lineHeight();
  1274.     }
  1275. };
  1276.  
  1277. //=============================================================================
  1278. // Battle Engine Core Implementation
  1279. //=============================================================================
  1280.  
  1281. if (Imported.YEP_BattleEngineCore) {
  1282.  
  1283. //=============================================================================
  1284. // BattleManager
  1285. //=============================================================================
  1286.  
  1287. Yanfly.Party.BattleManager_startBattle = BattleManager.startBattle;
  1288. BattleManager.startBattle = function() {
  1289.     if (!$gameTemp._partyBattle) {
  1290.       Yanfly.Party.BattleManager_startBattle.call(this);
  1291.     }
  1292.     $gameTemp._partyBattle = false;
  1293.     this._bypassMoveToStartLocation = false;
  1294. };
  1295.  
  1296. Yanfly.Party.BattleManager_playBattleBgm = BattleManager.playBattleBgm;
  1297. BattleManager.playBattleBgm = function() {
  1298.     var restartBgm = true;
  1299.     if (Yanfly.Party.SavedBattleBgm) {
  1300.       AudioManager.playBgm(Yanfly.Party.SavedBattleBgm);
  1301.       Yanfly.Party.SavedBattleBgm = undefined;
  1302.       restartBgm = false;
  1303.     }
  1304.     if (Yanfly.Party.SavedBattleBgs) {
  1305.       AudioManager.playBgs(Yanfly.Party.SavedBattleBgs);
  1306.       Yanfly.Party.SavedBattleBgs = undefined;
  1307.       restartBgm = false;
  1308.     }
  1309.     if (restartBgm) Yanfly.Party.BattleManager_playBattleBgm.call(this);
  1310. };
  1311.  
  1312. //=============================================================================
  1313. // Game_Unit
  1314. //=============================================================================
  1315.  
  1316. Yanfly.Party.Game_Unit_onBattleStart = Game_Unit.prototype.onBattleStart;
  1317. Game_Unit.prototype.onBattleStart = function() {
  1318.     if ($gameTemp._partyBattle) return;
  1319.     Yanfly.Party.Game_Unit_onBattleStart.call(this);
  1320.     $gameSystem.resetBattleFormationCooldown();
  1321. };
  1322.  
  1323. Yanfly.Party.Game_Unit_onBattleEnd = Game_Unit.prototype.onBattleEnd;
  1324. Game_Unit.prototype.onBattleEnd = function() {
  1325.     if ($gameTemp._partyBattle) return;
  1326.     Yanfly.Party.Game_Unit_onBattleEnd.call(this);
  1327.     $gameSystem.resetBattleFormationCooldown();
  1328. };
  1329.  
  1330. //=============================================================================
  1331. // Window_Command
  1332. //=============================================================================
  1333.  
  1334. Window_Command.prototype.addCommandAt = function(index, name, symbol, en, ext) {
  1335.     if (en === undefined) enabled = true;
  1336.     if (ext === undefined) ext = null;
  1337.     var obj = { name: name, symbol: symbol, enabled: en, ext: ext};
  1338.     this._list.splice(index, 0, obj);
  1339. };
  1340.  
  1341. //=============================================================================
  1342. // Window_PartyCommand
  1343. //=============================================================================
  1344.  
  1345. Yanfly.Party.Window_PartyCommand_makeCommandList =
  1346.     Window_PartyCommand.prototype.makeCommandList;
  1347. Window_PartyCommand.prototype.makeCommandList = function() {
  1348.     Yanfly.Party.Window_PartyCommand_makeCommandList.call(this);
  1349.     this.addFormationCommand();
  1350. };
  1351.  
  1352. Window_PartyCommand.prototype.addFormationCommand = function() {
  1353.     if (!$gameSystem.isShowBattleFormation()) return;
  1354.     var index = this.findSymbol('escape');
  1355.     var enabled = $gameSystem.isBattleFormationEnabled();
  1356.     this.addCommandAt(index, TextManager.formation, 'formation', enabled);
  1357. };
  1358.  
  1359. //=============================================================================
  1360. // Sprite_Actor
  1361. //=============================================================================
  1362.  
  1363. Yanfly.Party.Sprite_Actor_moveToStartPosition =
  1364.     Sprite_Actor.prototype.moveToStartPosition;
  1365. Sprite_Actor.prototype.moveToStartPosition = function() {
  1366.     if (BattleManager._bypassMoveToStartLocation) return;
  1367.     Yanfly.Party.Sprite_Actor_moveToStartPosition.call(this);
  1368. };
  1369.  
  1370. //=============================================================================
  1371. // Spriteset_Battle
  1372. //=============================================================================
  1373.  
  1374. Yanfly.Party.Spriteset_Battle_createBackground =
  1375.     Spriteset_Battle.prototype.createBackground;
  1376. Spriteset_Battle.prototype.createBackground = function() {
  1377.     Yanfly.Party.Spriteset_Battle_createBackground.call(this);
  1378.     if (Yanfly.Party.SavedBackgroundBitmap) {
  1379.       var spr = this._backgroundSprite;
  1380.       spr.bitmap = Yanfly.Party.SavedBackgroundBitmap;
  1381.       Yanfly.Party.SavedBackgroundBitmap = undefined;
  1382.     }
  1383. };
  1384.  
  1385. //=============================================================================
  1386. // Scene_Map
  1387. //=============================================================================
  1388.  
  1389. Yanfly.Party.Scene_Map_create = Scene_Map.prototype.create;
  1390. Scene_Map.prototype.create = function() {
  1391.     Yanfly.Party.Scene_Map_create.call(this);
  1392.     $gameParty.loadActorImages();
  1393. };
  1394.  
  1395. //=============================================================================
  1396. // Scene_Battle
  1397. //=============================================================================
  1398.  
  1399. Yanfly.Party.Scene_Battle_createDisplayObjects =
  1400.     Scene_Battle.prototype.createDisplayObjects;
  1401. Scene_Battle.prototype.createDisplayObjects = function() {
  1402.     Yanfly.Party.Scene_Battle_createDisplayObjects.call(this);
  1403.     $gameParty.loadActorImages();
  1404. };
  1405.  
  1406. Yanfly.Party.Scene_Battle_createPartyCommandWindow =
  1407.     Scene_Battle.prototype.createPartyCommandWindow;
  1408. Scene_Battle.prototype.createPartyCommandWindow = function() {
  1409.     Yanfly.Party.Scene_Battle_createPartyCommandWindow.call(this);
  1410.     var win = this._partyCommandWindow;
  1411.     win.setHandler('formation', this.partyCommandFormation.bind(this));
  1412. };
  1413.  
  1414. Scene_Battle.prototype.partyCommandFormation = function() {
  1415.     BattleManager._bypassMoveToStartLocation = true;
  1416.     $gameParty.loadActorImages();
  1417.     this.prepareBackground();
  1418.     BattleManager._savedActor = BattleManager.actor();
  1419.     $gameSystem.setBattleFormationCooldown();
  1420.     Yanfly.Party.SavedBattleBgm = AudioManager.saveBgm();
  1421.     Yanfly.Party.SavedBattleBgs = AudioManager.saveBgs();
  1422.     SceneManager.push(Scene_Party);
  1423.     BattleManager._phase = 'input';
  1424.     $gameTemp._partyBattle = true;
  1425. };
  1426.  
  1427. Scene_Battle.prototype.prepareBackground = function() {
  1428.     Yanfly.Party.SavedBackgroundBitmap = SceneManager._backgroundBitmap;
  1429.     this._prevWindowLayer = this._windowLayer.y;
  1430.     this._windowLayer.y = Graphics.boxHeight * 495;
  1431.     SceneManager.snapForBackground();
  1432.     this._windowLayer.y = this._prevWindowLayer;
  1433. };
  1434.  
  1435. }; // Imported.YEP_BattleEngineCore
  1436.  
  1437. //=============================================================================
  1438. // Scene_Menu
  1439. //=============================================================================
  1440.  
  1441. Scene_Menu.prototype.commandFormation = function() {
  1442.     $gameParty.loadActorImages();
  1443.     SceneManager.push(Scene_Party);
  1444. };
  1445.  
  1446. //=============================================================================
  1447. // Scene_Party
  1448. //=============================================================================
  1449.  
  1450. Scene_Party = function() {
  1451.     this.initialize.apply(this, arguments);
  1452. }
  1453.  
  1454. Scene_Party.prototype = Object.create(Scene_MenuBase.prototype);
  1455. Scene_Party.prototype.constructor = Scene_Party;
  1456.  
  1457. Scene_Party.prototype.initialize = function() {
  1458.     Scene_MenuBase.prototype.initialize.call(this);
  1459.     this._formerParty = $gameParty._battleMembers.slice(0);
  1460. };
  1461.  
  1462. Scene_Party.prototype.create = function() {
  1463.     Scene_MenuBase.prototype.create.call(this);
  1464.     if (eval(Yanfly.Param.PartyHelpWindow)) this.createHelpWindow();
  1465.     this.createCommandWindow();
  1466.     this.createPartyWindow();
  1467.     this.createListWindow();
  1468.     this.createDetailWindow();
  1469. };
  1470.  
  1471. Scene_Party.prototype.createCommandWindow = function() {
  1472.     this._commandWindow = new Window_PartyMenuCommand(0, 0);
  1473.     if (this._helpWindow) this._commandWindow.y = this._helpWindow.height;
  1474.     this._commandWindow.setHandler('change', this.commandAdjust.bind(this));
  1475.     this._commandWindow.setHandler('remove', this.commandAdjust.bind(this));
  1476.     this._commandWindow.setHandler('revert', this.commandRevert.bind(this));
  1477.     this._commandWindow.setHandler('cancel', this.commandFinish.bind(this));
  1478.     this.addWindow(this._commandWindow);
  1479. };
  1480.  
  1481. Scene_Party.prototype.createPartyWindow = function() {
  1482.     this._partyWindow = new Window_PartySelect(this._commandWindow);
  1483.     if (this._helpWindow) this._partyWindow.setHelpWindow(this._helpWindow);
  1484.     this._partyWindow.setHandler('ok',       this.onPartyOk.bind(this));
  1485.     this._partyWindow.setHandler('cancel',   this.onPartyCancel.bind(this));
  1486.     this._partyWindow.setHandler('pageup',   this.onPartyPageUp.bind(this));
  1487.     this._partyWindow.setHandler('pagedown', this.onPartyPageDown.bind(this));
  1488.     this.addWindow(this._partyWindow);
  1489. };
  1490.  
  1491. Scene_Party.prototype.createListWindow = function() {
  1492.     this._listWindow = new Window_PartyList(this._partyWindow);
  1493.     if (this._helpWindow) this._listWindow.setHelpWindow(this._helpWindow);
  1494.     this._listWindow.setHandler('ok',     this.onListOk.bind(this));
  1495.     this._listWindow.setHandler('cancel', this.onListCancel.bind(this));
  1496.     this.addWindow(this._listWindow);
  1497. };
  1498.  
  1499. Scene_Party.prototype.createDetailWindow = function() {
  1500.     if (!eval(Yanfly.Param.PartyDetailWin)) return;
  1501.     var wx = this._listWindow.width;
  1502.     var wy = this._listWindow.y;
  1503.     var ww = Graphics.boxWidth - wx;
  1504.     var wh = Graphics.boxHeight - wy;
  1505.     this._detailWindow = new Window_PartyDetail(wx, wy, ww, wh);
  1506.     this.addWindow(this._detailWindow);
  1507.     this._partyWindow.setDetailWindow(this._detailWindow);
  1508.     this._listWindow.setDetailWindow(this._detailWindow);
  1509.     this._detailWindow.clear();
  1510. };
  1511.  
  1512. Scene_Party.prototype.refreshWindows = function() {
  1513.     $gameParty.rearrangeActors();
  1514.     this._commandWindow.refresh();
  1515.     this._partyWindow.refresh();
  1516.     this._listWindow.refresh();
  1517.     $gamePlayer.refresh();
  1518.     $gameMap.requestRefresh();
  1519. };
  1520.  
  1521. Scene_Party.prototype.commandAdjust = function() {
  1522.     this._partyWindow.activate();
  1523.     this._partyWindow.select(0);
  1524. };
  1525.  
  1526. Scene_Party.prototype.commandRevert = function() {
  1527.     this._commandWindow.activate();
  1528.     $gameParty._battleMembers = this._formerParty.slice(0);
  1529.     this.refreshWindows();
  1530. };
  1531.  
  1532. Scene_Party.prototype.commandFinish = function() {
  1533.     if ($gameParty.inBattle()) {
  1534.       $gameParty.reconstructActions();
  1535.       if (BattleManager._savedActor) {
  1536.         BattleManager._actorIndex = BattleManager._savedActor.index();
  1537.       }
  1538.     }
  1539.     this.popScene();
  1540. };
  1541.  
  1542. Scene_Party.prototype.onPartyOk = function() {
  1543.     var symbol = this._commandWindow.currentSymbol();
  1544.     if (symbol === 'change') {
  1545.       this._listWindow.activate()
  1546.     } else if (symbol === 'remove') {
  1547.       SoundManager.playEquip();
  1548.       var index = this._partyWindow._index;
  1549.       var actor = $gameActors.actor($gameParty._battleMembers[index]);
  1550.       $gameParty._battleMembers[index] = 0
  1551.       this.refreshWindows();
  1552.       this._partyWindow.activate();
  1553.     }
  1554. };
  1555.  
  1556. Scene_Party.prototype.onPartyCancel = function() {
  1557.     this._partyWindow.select(-1);
  1558.     this._commandWindow.activate();
  1559.     if (this._helpWindow) this._helpWindow.setItem(null);
  1560. };
  1561.  
  1562. Scene_Party.prototype.onPartyPageUp = function() {
  1563.     SoundManager.playEquip();
  1564.     var actorId1 = this._partyWindow.item();
  1565.     if (!this._partyWindow.prevActor()) {
  1566.       var actorId2 = 0;
  1567.     } else {
  1568.       var actorId2 = this._partyWindow.prevActor().actorId();
  1569.     }
  1570.     var max = this._partyWindow.maxItems() - 1;
  1571.     var index1 = this._partyWindow._index;
  1572.     var index2 = this._partyWindow._index === 0 ? max : index1 - 1;
  1573.     $gameParty._battleMembers[index1] = actorId2;
  1574.     $gameParty._battleMembers[index2] = actorId1;
  1575.     this.refreshWindows();
  1576. };
  1577.  
  1578. Scene_Party.prototype.onPartyPageDown = function() {
  1579.     SoundManager.playEquip();
  1580.     var actorId1 = this._partyWindow.item();
  1581.     if (!this._partyWindow.nextActor()) {
  1582.       var actorId2 = 0;
  1583.     } else {
  1584.       var actorId2 = this._partyWindow.nextActor().actorId();
  1585.     }
  1586.     var max = this._partyWindow.maxItems() - 1;
  1587.     var index1 = this._partyWindow._index;
  1588.     var index2 = this._partyWindow._index === max ? 0 : index1 + 1;
  1589.     $gameParty._battleMembers[index1] = actorId2;
  1590.     $gameParty._battleMembers[index2] = actorId1;
  1591.     this.refreshWindows();
  1592. };
  1593.  
  1594. Scene_Party.prototype.onListCancel = function() {
  1595.     this._partyWindow.activate();
  1596. };
  1597.  
  1598. Scene_Party.prototype.onListOk = function() {
  1599.     SoundManager.playEquip();
  1600.     if (this._listWindow.item() <= 0) {
  1601.       this.otherAction();
  1602.     } else {
  1603.       this.switchActors();
  1604.     }
  1605.     this.refreshWindows();
  1606.     this._partyWindow.activate();
  1607. };
  1608.  
  1609. Scene_Party.prototype.otherAction = function() {
  1610.     if (this._listWindow.item() === 0) {
  1611.       $gameParty._battleMembers[this._partyWindow._index] = 0;
  1612.     }
  1613. };
  1614.  
  1615. Scene_Party.prototype.switchActors = function() {
  1616.     var targetId = this._listWindow.item();
  1617.     var targetIndex = this._partyWindow._index;
  1618.     if ($gameParty._battleMembers.contains(targetId)) {
  1619.       var switchId = this._partyWindow.item();
  1620.       var switchIndex = $gameParty._battleMembers.indexOf(targetId);
  1621.       $gameParty._battleMembers[switchIndex] = switchId;
  1622.     };
  1623.     $gameParty._battleMembers[targetIndex] = targetId;
  1624. };
  1625.  
  1626. //=============================================================================
  1627. // Utilities
  1628. //=============================================================================
  1629.  
  1630. Yanfly.Util = Yanfly.Util || {};
  1631.  
  1632. if (!Yanfly.Util.toGroup) {
  1633.     Yanfly.Util.toGroup = function(inVal) {
  1634.         return inVal;
  1635.     }
  1636. };
  1637.  
  1638. //=============================================================================
  1639. // End of File
  1640. //=============================================================================
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-12-24 03:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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