/* * -------------------------------------------------- * MNKR_EnemyIcon.js * Ver.1.1.0 * Copyright (c) 2020 Munokura * This software is released under the MIT license. * http://opensource.org/licenses/mit-license.php * -------------------------------------------------- */ /*: @target MV @url https://raw.githubusercontent.com/munokura/MNKR-MV-plugins/master/MNKR_EnemyIcon.js @plugindesc An icon will be displayed in front of the enemy character's name on the battle screen. @author munokura @license MIT License @help Displays an icon before the enemy character's name on the battle screen. Enter the tag in the enemy character's memo field as follows: You can specify multiple icon IDs by separating them with commas. Example Notes If you enter a number less than 0, the icon will not be displayed. Also, if you specify a number of icons that exceeds the width of the enemy character's name frame (the default is 9 or more), the icons will not shrink. The icons will overflow the frame and the enemy character's name will not be displayed. There are no plugin commands. Terms of Use: MIT License. http://opensource.org/licenses/mit-license.php Modifications and redistribution are permitted without the author's permission, and there are no restrictions on use (commercial, R18+, etc.). Ver. 1.1.0 Added the ability to display multiple icons. @param defaultIcon @text Default Icon @desc Icon to display when no note tag is entered. Default 16 @type number @default 16 */ /*:ja @target MV @url https://raw.githubusercontent.com/munokura/MNKR-MV-plugins/master/MNKR_EnemyIcon.js @plugindesc 戦闘画面で敵キャラの名前の前にアイコンを表示します。 @help 戦闘画面で敵キャラの名前の前にアイコンを表示します。 敵キャラのメモ欄に下記のようにタグを入れてください。 アイコンIDはカンマ区切りで複数を指定できます。 例 注意事項 のように0以下の数値を入れるとアイコンが表示されません。 また、敵キャラの名前の枠の幅を超えたアイコン数(デフォルトでは9個以上)を 指定するとアイコンは縮まりません。 アイコンが枠をはみ出し、敵キャラ名が表示されません。 プラグインコマンドはありません。 利用規約: MITライセンスです。 http://opensource.org/licenses/mit-license.php 作者に無断で改変、再配布が可能で、 利用形態(商用、18禁利用等)についても制限はありません。 Ver.1.1.0 アイコンを複数表示可能に機能追加 @param defaultIcon @text デフォルトアイコン @type number @desc メモタグを入れない場合に表示するアイコン。デフォルト16 0にすると、非表示で左に詰まります。 @default 16 */ (() => { 'use strict'; const pluginName = document.currentScript.src.split("/").pop().replace(/\.js$/, ""); const parameters = PluginManager.parameters(pluginName); const PRM_defaultIcon = Number(parameters['defaultIcon'] || 0); const _Window_BattleEnemy_drawItem = Window_BattleEnemy.prototype.drawItem Window_BattleEnemy.prototype.drawItem = function (index) { const enemyObj = this._enemies[index]; const icons = enemyObj.enemy().meta.MNKR_EnemyIcon; const iconArr = icons ? icons.split(',').map(Number) : [PRM_defaultIcon]; if (iconArr[0] > 0) { const iconMargin = Window_Base._iconWidth + 2; this.resetTextColor(); const name = enemyObj.name(); const rect = this.itemRectForText(index); const iconBoxWidth = iconMargin * iconArr.length + 2; for (let i in iconArr) { this.drawIcon(iconArr[i], rect.x + iconMargin * i, rect.y + 2); } this.drawText(name, rect.x + iconBoxWidth, rect.y, rect.width - iconBoxWidth); } else { _Window_BattleEnemy_drawItem.call(this, index); }; }; })();