- //============================================================================= 
- // MyPlugin3.js 
- //============================================================================= 
-   
- /*: 
- * @author XMJL 
- * 横版战斗时在主角头顶上显示状态图标 
- * Modify by HeartCase Li 
- * 
- * @param dx 
- * @desc 图标位移x 
- * @default 0 
- * 
- * @param dy 
- * @desc 图标位移y 
- * @default 0 
- * 
- * @param row 
- * @desc 最大行数 
- * @default 5 
- * 
- * @help StateIconMode true/false 打开或关闭图标 
- */ 
- (function() 
- {         
-         var sw = true; 
-         var parameters = PluginManager.parameters('MyPlugin3'); 
-         var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; 
-     Game_Interpreter.prototype.pluginCommand = function(command, args) { 
-         _Game_Interpreter_pluginCommand.call(this, command, args); 
-         if (command === 'StateIconMode') { 
-                         sw= String(args[0] || 'true'); 
-                         sw = (sw == 'true'); 
-         } 
-     };         
-         var dx = Number(parameters['dx'] || 0); 
-         var dy = Number(parameters['dy'] || 0); 
-         var row = Number(parameters['row'] || 0); 
-     var _Sprite_Battler_initMembers=Sprite_Battler.prototype.initMembers; 
-     Sprite_Battler.prototype.initMembers=function(){ 
-         _Sprite_Battler_initMembers.call(this); 
-         this.createStateIconGroup(); 
-     } 
-     Sprite_Battler.prototype.createStateIconGroup=function(){         
-                 if(!$gameSystem.isSideView()) return; 
-                 var l = $dataStates.length; 
-                 var newFunction = function(){ 
-                 } 
-                 this._stateIconSpriteGroup = []; 
-                 for(var i = 0; i < l; i++){ 
-                         var si = new Sprite_StateIcon; 
-                         this._stateIconSpriteGroup.push(si);         
-                         si.updateIcon = newFunction; 
-                 } 
-     } 
-     var _Sprite_Battler_update=Sprite_Battler.prototype.update; 
-     Sprite_Battler.prototype.update=function(){ 
-         _Sprite_Battler_update.call(this); 
-         if($gameSystem.isSideView()) this.updateIconStateSprite(); 
-     } 
-     Sprite_Battler.prototype.updateIconStateSprite = function(){ 
-                 if (!this._battler ||   
-                         !this._stateIconSpriteGroup) return;                 
-                 var icons = []; 
-                 icons = this._battler.allIcons(); 
-                 var states = this._battler._states; 
-                 function s(a, b){ 
-                         a = states[icons.indexOf(a)]; 
-                         b = states[icons.indexOf(b)]; 
-                         if(!$dataStates[a] || a < 0){ 
-                                 return 1; 
-                         } 
-                         if(!$dataStates[b] || b < 0){ 
-   
-                                 return -1; 
-                         } 
-                         return $dataStates[b].priority -  $dataStates[a].priority; 
-                 } 
-                 icons.sort(s); 
-                 var set = this._stateIconSpriteGroup; 
-                 for(var i=0; i<set.length ; i++){ 
-                         if(icons[i] == undefined || !sw || !this._battler.isAlive()){ 
-                                 this.removeChild(set[i]); 
-                                 set[i]._iconIndex = 0; 
-                                 continue; 
-                         } 
-                         if(!this.children.contains(set[i])) this.addChild(set[i]); 
-                         if(icons[i] != set[i]._iconIndex){ 
-                                 set[i]._iconIndex = icons[i]; 
-                                 set[i].updateFrame(); 
-                         }                 
-                         var bitmap = set[i].bitmap; 
-                         if(bitmap){ 
-                                 set[i].y =  bitmap.height/20 * Math.floor(i / row) + dy 
-                                 set[i].x =  bitmap.width/16 * (i % row)  + dx; 
-                                 if(!this._enemy) set[i].x = bitmap.width/16 * (row - (i % row))  + dx; 
-                         } 
-                 } 
-     } 
-         Sprite_Enemy.prototype.setBattler = function(battler) { 
-                 Sprite_Battler.prototype.setBattler.call(this, battler); 
-                 this._enemy = battler; 
-                 this.setHome(battler.screenX(), battler.screenY()); 
-         }; 
- })();