//============================================================================== // dsGrowthByAction.js // Copyright (c) 2015 - 2019 Douraku // Released under the MIT License. // http://opensource.org/licenses/mit-license.php //============================================================================== /*: * @plugindesc 戦闘中の行動による能力成長プラグイン ver1.5.1 * @author 道楽 * * @param Instant Apply * @desc 戦闘中の行動後に能力値成長を反映させるか * (true なら戦闘中に反映 / false なら戦闘終了時に反映) * @default true * @type boolean * * @param Apply Growth Text * @desc 戦闘後に成長値を反映した時に表示されるテキスト * %1 - 対象アクターの名前 %2 - 能力値名 %3 - 上昇量 * @default %1 の %2 が %3 上がった! * * @param Show Growth Text Type * @desc 能力値成長時のテキストをどのように表示するか * @default 1 * @type select * @option 非表示 * @value 0 * @option メッセージ * @value 1 * @option ポップアップ * @value 2 * @option 右上一覧 * @value 3 * * @param Growth Window Offset Y * @desc 能力値成長ウィンドウ位置のY方向オフセット * @default 0 * @type number * * @param Popup Duration * @desc 能力値成長時のテキストを表示する時間 * @default 90 * @type number * * @param Apply User Growth Hit * @desc 使用者の成長値適応をヒット時のみにするか? * (true ヒット時 / false 使用時) * @default false * @type boolean * * @param Ignore User Growth By Zero Damage * @desc ダメージを与えられない場合、使用者の成長値適応を無視するか? * (true 無視する / false 無視しない) * @default false * @type boolean * * @param Hp Growth Param * @desc 最大HPの成長パラメータ * @default {"Icon":"32","Min Value":"10","Max Value":"10","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Mp Growth Param * @desc 最大MPの成長パラメータ * @default {"Icon":"33","Min Value":"10","Max Value":"10","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Atk Growth Param * @desc 攻撃力の成長パラメータ * @default {"Icon":"34","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Def Growth Param * @desc 防御力の成長パラメータ * @default {"Icon":"35","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Mat Growth Param * @desc 魔法力の成長パラメータ * @default {"Icon":"36","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Mdf Growth Param * @desc 魔法防御の成長パラメータ * @default {"Icon":"37","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Agi Growth Param * @desc 敏捷性の成長パラメータ * @default {"Icon":"38","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Luk Growth Param * @desc 運の成長パラメータ * @default {"Icon":"39","Min Value":"1","Max Value":"3","Min Required Exp":"100","Max Required Exp":"100","Exp Random Unit":"10"} * @type struct * * @param Growth SE Name * @desc 能力値成長時の効果音のファイル名 * @default Up4 * * @param Growth SE Volume * @desc 能力値成長時の効果音のボリューム * @default 80 * @type number * * @param Growth SE Pitch * @desc 能力値成長時の効果音のピッチ * @default 100 * @type number * * @param Show Status Window * @desc ステータス画面に成長値の蓄積率を表示するか? * (true なら表示する / false なら表示しない) * @default false * @type boolean * * @param Battle Gain Limit * @desc 一度の戦闘で獲得できる成長値の上限値 * (0の場合は上限なく獲得できる) * @default 0 * @type number * * @help * ※能力値の成長パラメータについての注釈 * 各能力値にはそれぞれ以下のパラメータが存在します。 * ・Icon * 能力値のアイコンIDです。 * ポップアップ表示などで使用されます。 * * ・Min Value * ・Max Value * 一度の成長で能力値が増加する値です。 * 成長ごとにMin Value ~ Max Valueのランダムな値で能力値が成長します。 * また、Max ValueはMin Value以上に値を設定してください。 * 例) * ・Min Value: 3, Max Value: 3 の場合 * 成長ごとに 3 増加 * ・Min Value: 5, Max Value: 7 の場合 * 成長ごとに 5 or 6 or 7 増加 * * ・Min Required Exp * ・Max Required Exp * ・Exp Random Unit * 能力値の成長に必要な成長値の計算に使用するパラメータです。 * 成長にはMin Required Exp ~ Max Required Expの範囲内で、 * Exp Random Unitの倍数の成長値が必要になります。 * また、必要な成長値は能力値成長ごとに再計算されます。 * 例) * ・Min Required Exp: 5, Max Required Exp: 10, Exp Random Unit:1 の場合 * 能力値の成長には 5 or 6 or 7 or 8 or 9 or 10 の成長値が必要 * ・Min Required Exp: 10, Max Required Exp: 30, Exp Random Unit:5 の場合 * 能力値の成長には 10 or 15 or 20 or 25 or 30 の成長値が必要 * * ----------------------------------------------------------------------------- * * このプラグインは以下のメモタグの設定ができます。 * * ----------------------------------------------------------------------------- * スキルに設定するメモタグ * * ・スキルの使用者が獲得できる成長値の設定 * * [能力値番号] - 上昇させる通常能力値の番号を1桁の数値で設定する。(数字) * 0 - HP, 1 - MP, 2 - 攻撃力, 3 - 防御力 * 4 - 魔法力, 5 - 魔法防御, 6 - 敏捷性, 7 - 運 * [成長値] - スキルを使用した時に獲得できる成長値。 * この数値を一定量蓄積することで能力値が上昇する。 * * ・スキルの対象者が獲得できる成長値の設定 * * [能力値番号] - 上昇させる通常能力値の番号を1桁の数値で設定する。(数字) * 0 - HP, 1 - MP, 2 - 攻撃力, 3 - 防御力 * 4 - 魔法力, 5 - 魔法防御, 6 - 敏捷性, 7 - 運 * [成長値] - スキルの効果を受けた時に獲得できる成長値。 * この数値を一定量蓄積することで能力値が上昇する。 * * e.g.) * スキルの使用者が攻撃力の成長値を「5」蓄積する * * スキルの対象者が運の成長値を「10」蓄積する * * * メモタグ設定の補足: * 「通常攻撃」で成長値を獲得する場合はスキル1(攻撃)にタグを記述してください。 * 「防御」で成長値を獲得する場合はスキル2(防御)にタグを記述してください。 * なお、対象者の成長値はスキルがヒットした時のみ上昇します。 * * ----------------------------------------------------------------------------- * エネミーに設定するメモタグ * * ・エネミーに対してスキルを使用したときの成長できるレベルの限界値 * * [成長限界レベル] - この値よりレベルが高いアクターは成長値を獲得できなくなる。 * 設定されていない場合は条件なく成長値を獲得できる。(数字) * * ----------------------------------------------------------------------------- * */ /*~struct~GrowthParam: * @param Icon * @desc 能力値成長時に表示するアイコン * @type number * * @param Min Value * @desc 能力値が成長する最低値 * @type number * * @param Max Value * @desc 能力値が成長する最大値 * @type number * * @param Min Required Exp * @desc 能力値の成長に必要な成長値の最小値 * @type number * * @param Max Required Exp * @desc 能力値の成長に必要な成長値の最大値 * @type number * * @param Exp Random Unit * @desc 能力値の成長に必要な成長値の乱数単位 * @type number */ var Imported = Imported || {}; Imported.dsGrowthByAction = true; (function (exports) { 'use strict'; exports.Param = (function() { var ret = {}; var parameters = PluginManager.parameters('dsGrowthByAction'); var parseGrowthParam = function(param) { var ret = {}; ret.Icon = Number(param['Icon']); ret.MinValue = Number(param['Min Value']); ret.MaxValue = Number(param['Max Value']); ret.MinRequiredExp = Number(param['Min Required Exp']); ret.MaxRequiredExp = Number(param['Max Required Exp']); ret.ExpRandomUnit = Number(param['Exp Random Unit']); return ret; }; ret.InstantApply = Boolean(parameters['Instant Apply'] === 'true' || false); ret.ApplyGrowthText = String(parameters['Apply Growth Text']); ret.GrowthWindowOffsetY = Number(parameters['Growth Window Offset Y']); ret.ShowApplyText = Boolean(parameters['Show Apply Text'] === 'true' || false); ret.ShowGrowthTextType = Number(parameters['Show Growth Text Type']); ret.PopupDuration = Number(parameters['Popup Duration']); ret.ApplyUserGrowthByHit = Boolean(parameters['Apply User Growth Hit'] === 'true' || false); ret.IgnoreUserGrowthByZeroDamage = Boolean(parameters['Ignore User Growth By Zero Damage'] === 'true' || false); ret.GrowthParam = []; ret.GrowthParam[0] = parseGrowthParam(JSON.parse(parameters['Hp Growth Param'])); ret.GrowthParam[1] = parseGrowthParam(JSON.parse(parameters['Mp Growth Param'])); ret.GrowthParam[2] = parseGrowthParam(JSON.parse(parameters['Atk Growth Param'])); ret.GrowthParam[3] = parseGrowthParam(JSON.parse(parameters['Def Growth Param'])); ret.GrowthParam[4] = parseGrowthParam(JSON.parse(parameters['Mat Growth Param'])); ret.GrowthParam[5] = parseGrowthParam(JSON.parse(parameters['Mdf Growth Param'])); ret.GrowthParam[6] = parseGrowthParam(JSON.parse(parameters['Agi Growth Param'])); ret.GrowthParam[7] = parseGrowthParam(JSON.parse(parameters['Luk Growth Param'])); ret.GrowthSEName = String(parameters['Growth SE Name']); ret.GrowthSEVolume = Number(parameters['Growth SE Volume']); ret.GrowthSEPitch = Number(parameters['Growth SE Pitch']); ret.ShowStatusWindow = Boolean(parameters['Show Status Window'] === 'true' || false); ret.BattleGainLimit = Number(parameters['Battle Gain Limit']); return ret; })(); //-------------------------------------------------------------------------- /** CONST */ function CONST() {} CONST.SHOW_GROWTH_HIDE = 0; CONST.SHOW_GROWTH_MESSAGE = 1; CONST.SHOW_GROWTH_POPUP = 2; CONST.SHOW_GROWTH_LIST = 3; //-------------------------------------------------------------------------- /** BattleManager */ var _BattleManager_endAction = BattleManager.endAction; BattleManager.endAction = function() { if ( this._action ) { this._action.applyGrowthExp(); } _BattleManager_endAction.call(this); }; var _BattleManager_gainRewards = BattleManager.gainRewards; BattleManager.gainRewards = function() { _BattleManager_gainRewards.call(this); this.applyGrowthParam(); }; BattleManager.applyGrowthParam = function() { if ( !exports.Param.InstantApply ) { var delay = 0; $gameParty.allMembers().forEach(function(actor) { actor.applyGrowthParam(delay); if ( exports.Param.ShowGrowthTextType === CONST.SHOW_GROWTH_POPUP ) { if ( actor.isGrowthPopupRequested() ) { delay += 20; } } }); } }; //-------------------------------------------------------------------------- /** SoundManager */ SoundManager.playGrowthPopup = function() { var se = { name: exports.Param.GrowthSEName, volume: exports.Param.GrowthSEVolume, pitch: exports.Param.GrowthSEPitch, pan: 0, }; AudioManager.playStaticSe(se); }; //-------------------------------------------------------------------------- /** Sprite_Growth */ exports.Sprite_Growth = (function() { function Sprite_Growth() { this.initialize.apply(this, arguments); } Sprite_Growth.prototype = Object.create(Sprite_Damage.prototype); Sprite_Growth.prototype.constructor = Sprite_Growth; Sprite_Growth.prototype.initialize = function() { Sprite_Damage.prototype.initialize.call(this); this._delay = 0; this._duration = exports.Param.PopupDuration; }; Sprite_Growth.prototype.lineHeight = function() { return 28; }; Sprite_Growth.prototype.setup = function(target, width) { this.setupParameter(target); this.createBitmap(width, this.lineHeight() * target.growthPopupCount()); this.drawBackground(); this.drawGrowthParam(target); }; Sprite_Growth.prototype.setupParameter = function(target) { this._delay = target.growthPopupDelay() || 0; this._duration += this._delay; this.visible = (this._delay <= 0) ? true : false; }; Sprite_Growth.prototype.createBitmap = function(w, h) { this.bitmap = new Bitmap(w, h); this.bitmap.fontSize = 24; this.bitmap.outlineWidth = 6; }; Sprite_Growth.prototype.drawBackground = function() { this.bitmap.paintOpacity = 192; this.bitmap.fillAll('black'); this.bitmap.paintOpacity = 255; }; Sprite_Growth.prototype.drawGrowthParam = function(target) { var lineHeight = this.lineHeight(); var lineCount = 0; for ( var ii = 0; ii < 8; ii++ ) { var growth = target.growthPopup(ii); if ( growth > 0 ) { var x = 0; var y = lineCount++ * lineHeight; var iconIndex = exports.Param.GrowthParam[ii].Icon; if ( iconIndex != 0 ) { this.drawIcon(iconIndex, x, y); x += this.bitmap.fontSize + 4; } var text = exports.Param.ApplyGrowthText.format(target.name(), TextManager.param(ii), growth); this.bitmap.drawText(text, x + 4, y, this.bitmap.width - x - 4 * 2, lineHeight, 'left'); } } }; Sprite_Growth.prototype.drawIcon = function(iconIndex, x, y) { var iconBitmap = ImageManager.loadSystem('IconSet'); var pw = Window_Base._iconWidth; var ph = Window_Base._iconHeight; var sx = iconIndex % 16 * pw; var sy = Math.floor(iconIndex / 16) * ph; var dx = this.bitmap.fontSize; var dy = this.bitmap.fontSize; this.bitmap.blt(iconBitmap, sx, sy, pw, ph, x + 2, y + 2, dx, dy); }; Sprite_Growth.prototype.update = function() { Sprite_Damage.prototype.update.call(this); if ( this._delay > 0 ) { if ( --this._delay <= 0 ) { this.visible = true; } } }; Sprite_Growth.prototype.updateChild = function(sprite) { }; return Sprite_Growth; })(); //-------------------------------------------------------------------------- /** Sprite_GrowthPopup */ exports.Sprite_GrowthPopup = (function() { function Sprite_GrowthPopup() { this.initialize.apply(this, arguments); } Sprite_GrowthPopup.prototype = Object.create(exports.Sprite_Growth.prototype); Sprite_GrowthPopup.prototype.constructor = Sprite_GrowthPopup; Sprite_GrowthPopup.prototype.initialize = function() { exports.Sprite_Growth.prototype.initialize.call(this); }; Sprite_GrowthPopup.prototype.setup = function(target, width) { exports.Sprite_Growth.prototype.setup.call(this, target, width); this.y -= target.growthPopupCount() * this.lineHeight(); this.createTargetName(target); this.drawTargetName(target); }; Sprite_GrowthPopup.prototype.createTargetName = function(target) { this._targetNameSprite = new Sprite(); this._targetNameSprite.y = -20; this._targetNameSprite.bitmap = new Bitmap(92, 20); this._targetNameSprite.bitmap.fontSize = 18; this._targetNameSprite.bitmap.paintOpacity = 192; this._targetNameSprite.bitmap.fillAll('black'); this._targetNameSprite.bitmap.paintOpacity = 255; this.addChild(this._targetNameSprite); }; Sprite_GrowthPopup.prototype.drawTargetName = function(target) { var width = this._targetNameSprite.bitmap.width; var height = this._targetNameSprite.bitmap.height; this._targetNameSprite.bitmap.drawText(target.name(), 1, 1, width-2, height, 'left'); }; return Sprite_GrowthPopup; })(); //-------------------------------------------------------------------------- /** Sprite_Actor */ var _Sprite_Actor_updateDamagePopup = Sprite_Actor.prototype.updateDamagePopup; Sprite_Actor.prototype.updateDamagePopup = function() { if ( exports.Param.ShowGrowthTextType === CONST.SHOW_GROWTH_POPUP ) { this.setupGrowthPopup(); } _Sprite_Actor_updateDamagePopup.call(this); }; Sprite_Actor.prototype.setupGrowthPopup = function() { if ( this._battler.isGrowthPopupRequested() ) { if ( this._battler.isSpriteVisible() ) { var sprite = new exports.Sprite_GrowthPopup(); sprite.x += this._homeX + this.popupOffsetX(); sprite.y += this._homeY + this.popupOffsetY(); sprite.setup(this._battler, 192); this._damages.push(sprite); if ( Imported.YEP_BattleEngineCore ) { BattleManager._spriteset.addChild(sprite); } else { this.parent.addChild(sprite); } SoundManager.playGrowthPopup(); } this._battler.clearGrowthPopup(); } }; Sprite_Actor.prototype.popupOffsetX = function() { return -96; }; Sprite_Actor.prototype.popupOffsetY = function() { return -64; }; //-------------------------------------------------------------------------- /** Game_Action */ var _Game_Action_clear = Game_Action.prototype.clear; Game_Action.prototype.clear = function() { _Game_Action_clear.call(this); this._applyUser = false; this._appliedTargets = []; this._effectedAction = false; }; var _Game_Action_apply = Game_Action.prototype.apply; Game_Action.prototype.apply = function(target) { _Game_Action_apply.call(this, target); if ( this.isApplyUserGrowthExp(target) ) { this._applyUser = true; } if ( this.isApplyTargetGrowthExp(target) ) { if ( !this._appliedTargets.contains(target) ) { this._appliedTargets.push(target); } } }; Game_Action.prototype.applyGrowthExp = function() { if ( this.subject().isActor() ) { if ( this._applyUser ) { this.applyUserGrowthExp(); } } this._appliedTargets.forEach(function(target) { this.applyTargetGrowthExp(target); }, this); }; Game_Action.prototype.applyUserGrowthExp = function() { var subject = this.subject(); var item = this.item(); for ( var ii = 0; ii < 8; ii++ ) { var meta = 'userGrowthExp' + ('0'+ii).slice(-1); if ( item.meta[meta] ) { subject.addGrowthExp(ii, Number(item.meta[meta])); } } if ( exports.Param.InstantApply ) { subject.applyGrowthParam(0); } }; Game_Action.prototype.applyTargetGrowthExp = function(target) { var item = this.item(); for ( var ii = 0; ii < 8; ii++ ) { var meta = 'targetGrowthExp' + ('0'+ii).slice(-1); if ( item.meta[meta] ) { target.addGrowthExp(ii, Number(item.meta[meta])); } } if ( exports.Param.InstantApply ) { target.applyGrowthParam(0); } }; var _Game_Action_executeDamage = Game_Action.prototype.executeDamage; Game_Action.prototype.executeDamage = function(target, value) { if ( this.isHpEffect() ) { var tmpValue = this.isDrain() ? Math.min(target.hp, value) : value; if ( tmpValue > 0 ) { this._effectedAction = true; } } if ( this.isMpEffect() ) { var tmpValue = !this.isMpRecover() ? Math.min(target.mp, value) : value; if ( tmpValue !== 0 ) { this._effectedAction = true; } } _Game_Action_executeDamage.call(this, target, value); }; Game_Action.prototype.isApplyUserGrowthExp = function(target) { if ( this.subject().isActor() && target.isEnemy() ) { if ( target.enemy().meta.growthLevel ) { if ( target.enemy().meta.growthLevel < this.subject().level ) { return false; } } } if ( exports.Param.ApplyUserGrowthByHit ) { if ( !target.result().isHit() ) { return false; } } if ( exports.Param.IgnoreUserGrowthByZeroDamage ) { if ( !this._effectedAction ) { return false; } } return true; }; Game_Action.prototype.isApplyTargetGrowthExp = function(target) { if ( this.subject().isEnemy() && target.isActor() ) { if ( this.subject().enemy().meta.growthLevel ) { if ( this.subject().enemy().meta.growthLevel < target.level ) { return false; } } } if ( !target.isActor() ) { return false; } if ( !target.result().isHit() ) { return false; } return true; }; //-------------------------------------------------------------------------- /** Game_Actor */ var _Game_Actor_initMembers = Game_Actor.prototype.initMembers; Game_Actor.prototype.initMembers = function() { _Game_Actor_initMembers.call(this); this.clearGrowthParam(); }; Game_Actor.prototype.clearGrowthParam = function() { this._growthParam = [0,0,0,0,0,0,0,0]; this._growthExp = [0,0,0,0,0,0,0,0]; this._growthPopup = [0,0,0,0,0,0,0,0]; this._growthLimit = [0,0,0,0,0,0,0,0]; this._growthPopupDelay = 0; this.clearGrowthRequiredExp(); }; Game_Actor.prototype.clearGrowthRequiredExp = function() { this._growthRequiredExp = []; for ( var ii = 0; ii < 8; ii++ ) { this.resetGrowthRequiredExp(ii); } }; Game_Actor.prototype.resetGrowthRequiredExp = function(paramId) { var growthParam = exports.Param.GrowthParam[paramId]; if ( growthParam.MinRequiredExp >= growthParam.MaxRequiredExp ) { this._growthRequiredExp[paramId] = growthParam.MinRequiredExp; } else { var range = Math.floor((growthParam.MaxRequiredExp - growthParam.MinRequiredExp) / growthParam.ExpRandomUnit) + 1; this._growthRequiredExp[paramId] = Math.floor(Math.random() * range) * growthParam.ExpRandomUnit; this._growthRequiredExp[paramId] += growthParam.MinRequiredExp; } }; var _Game_Actor_onBattleStart = Game_Actor.prototype.onBattleStart; Game_Actor.prototype.onBattleStart = function() { if ( !this._growthExp ) { this.clearGrowthParam(); } _Game_Actor_onBattleStart.call(this); this._growthLimit.fill(exports.Param.BattleGainLimit); }; var _Game_Actor_paramPlus = Game_Actor.prototype.paramPlus; Game_Actor.prototype.paramPlus = function(paramId) { var param = _Game_Actor_paramPlus.call(this, paramId); param += this._growthParam ? (this._growthParam[paramId] || 0) : 0; return param; }; Game_Actor.prototype.addGrowthExp = function(paramId, exp) { if ( !this._growthExp ) { this.clearGrowthParam(); } if ( exports.Param.BattleGainLimit > 0 ) { if ( $gameParty.inBattle() ) { if ( exp <= this._growthLimit[paramId] ) { this._growthLimit[paramId] -= exp; } else { exp = this._growthLimit[paramId]; this._growthLimit[paramId] = 0; } } } this._growthExp[paramId] += exp; }; Game_Actor.prototype.growthPopup = function(paramId) { if ( !this._growthPopup ) { this.clearGrowthParam(); } return this._growthPopup[paramId]; }; Game_Actor.prototype.growthPopupCount = function() { if ( !this._growthPopup ) { this.clearGrowthParam(); } var count = 0; for ( var ii = 0; ii < 8; ii++ ) { if ( this._growthPopup[ii] > 0 ) { count++; } } return count; }; Game_Actor.prototype.clearGrowthPopup = function() { for ( var ii = 0; ii < 8; ii++ ) { this._growthPopup[ii] = 0; } }; Game_Actor.prototype.growthPopupDelay = function() { return this._growthPopupDelay; }; Game_Actor.prototype.isGrowthPopupRequested = function() { return (this.growthPopupCount() > 0) ? true : false; }; Game_Actor.prototype.growthValue = function(paramId, addCount) { var growthParam = exports.Param.GrowthParam[paramId]; var value = 0; if ( growthParam.MinValue >= growthParam.MaxValue ) { value = growthParam.MinValue * addCount; } else { var range = growthParam.MaxValue - growthParam.MinValue + 1; for ( var ii = 0; ii < addCount; ii++ ) { var addValue = growthParam.MinValue + Math.floor(Math.random() * range); value += addValue; } } return value; }; Game_Actor.prototype.growthExpRate = function(paramId) { if ( !this._growthExp ) { this.clearGrowthParam(); } if ( !this._growthRequiredExp ) { this.clearGrowthRequiredExp(); } return (this._growthExp[paramId] / this._growthRequiredExp[paramId]).clamp(0.0, 1.0); }; Game_Actor.prototype.applyGrowthParam = function(delay) { if ( !this._growthExp ) { this.clearGrowthParam(); } if ( !this._growthRequiredExp ) { this.clearGrowthRequiredExp(); } var newPage = false; for ( var ii = 0; ii < 8; ii++ ) { var growth = 0; while ( this._growthExp[ii] >= this._growthRequiredExp[ii] ) { growth += this.growthValue(ii, 1); this._growthExp[ii] -= this._growthRequiredExp[ii]; this.resetGrowthRequiredExp(ii); } if ( growth > 0 ) { this._growthPopup[ii] += growth; this._growthParam[ii] += growth; if ( exports.Param.ShowGrowthTextType === CONST.SHOW_GROWTH_MESSAGE ) { if ( !newPage ) { $gameMessage.newPage(); newPage = true; } var text = exports.Param.ApplyGrowthText.format(this.name(), TextManager.param(ii), growth); $gameMessage.add(text); } } } if ( newPage ) { this.refresh(); } this._growthPopupDelay = delay; }; //-------------------------------------------------------------------------- /** Window_Base */ Window_Base.prototype.growthColor1 = function() { return this.textColor(28); }; Window_Base.prototype.growthColor2 = function() { return this.textColor(29); }; Window_Base.prototype.drawActorGrowthGauge = function(actor, paramId, x, y, width) { var color1 = this.growthColor1(); var color2 = this.growthColor2(); this.drawGauge(x, y, width, actor.growthExpRate(paramId), color1, color2); }; //-------------------------------------------------------------------------- /** Window_GrowthLog */ exports.Window_GrowthLog = (function() { function Window_GrowthLog() { this.initialize.apply(this, arguments); } Window_GrowthLog.prototype = Object.create(Window_Base.prototype); Window_GrowthLog.prototype.constructor = Window_GrowthLog; Window_GrowthLog.prototype.initialize = function() { var width = this.windowWidth(); var height = this.windowHeight(); var x = Graphics.boxWidth - width; var y = exports.Param.GrowthWindowOffsetY; Window_Base.prototype.initialize.call(this, x, y, width, height); this.opacity = 0; this.createGrowthSprites(); this.hide(); }; Window_GrowthLog.prototype.lineHeight = function() { return 28; }; Window_GrowthLog.prototype.standardPadding = function() { return 6; }; Window_GrowthLog.prototype.windowWidth = function() { return 320 + this.standardPadding() * 2; }; Window_GrowthLog.prototype.windowHeight = function() { return this.fittingHeight(0); }; Window_GrowthLog.prototype.createGrowthSprites = function() { this._growthSprites = []; }; Window_GrowthLog.prototype.update = function() { Window_Base.prototype.update.call(this); if ( exports.Param.ShowGrowthTextType === CONST.SHOW_GROWTH_LIST ) { this.updateGrowthLog(); } }; Window_GrowthLog.prototype.updateGrowthLog = function() { this.setupGrowthLog(); if ( this._growthSprites.length > 0 ) { if ( !this._growthSprites[0].isPlaying() ) { this.removeChild(this._growthSprites[0]); this._growthSprites.shift(); } } if ( this._growthSprites.length <= 0 ) { this.hide(); } }; Window_GrowthLog.prototype.setupGrowthLog = function() { var y = this.standardPadding(); $gameParty.members().forEach(function(member) { if ( member.isGrowthPopupRequested() ) { var sprite = new exports.Sprite_Growth(); sprite.x = this.standardPadding(); sprite.y = y; sprite.setup(member, this.contentsWidth()); this._growthSprites.push(sprite); this.addChild(sprite); this.show(); SoundManager.playGrowthPopup(); y += sprite.height; member.clearGrowthPopup(); } }, this); }; return Window_GrowthLog; })(); //-------------------------------------------------------------------------- /** Window_Status */ Window_Status.prototype.drawActorHp = function(actor, x, y, width) { width = width || 186; if ( exports.Param.ShowStatusWindow ) { this.drawActorGrowthGauge(this._actor, 0, x, y + 2, width); } Window_Base.prototype.drawActorHp.call(this, actor, x, y, width); }; Window_Status.prototype.drawActorMp = function(actor, x, y, width) { width = width || 186; if ( exports.Param.ShowStatusWindow ) { this.drawActorGrowthGauge(this._actor, 1, x, y + 2, width); } Window_Base.prototype.drawActorMp.call(this, actor, x, y, width); }; //-------------------------------------------------------------------------- /** Scene_Battle */ var _Scene_Battle_createAllWindows = Scene_Battle.prototype.createAllWindows; Scene_Battle.prototype.createAllWindows = function() { _Scene_Battle_createAllWindows.call(this); this.createGrowthWindow(); }; Scene_Battle.prototype.createGrowthWindow = function() { this._growthWindow = new exports.Window_GrowthLog(); this.addWindow(this._growthWindow); }; //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- if ( Imported.TMStatusMenuEx ) { //---------------------------------------------------------------------- /** Window_Status */ Window_Status.prototype.drawParams = function(y) { var parameters = PluginManager.parameters('TMStatusMenuEx'); var x = +parameters['paramNameX']; var w = +parameters['paramNameWidth']; var x2 = +parameters['paramX']; var w2 = +parameters['paramWidth']; var paramBackGround = parameters['paramBackGround'] === '1' ? true : false; var lineHeight = this.lineHeight(); for ( var ii = 0; ii < 6; ii++ ) { var paramId = ii + 2; if ( TextManager.param(paramId) ) { if ( paramBackGround ) { this.drawParamBackGround(x, y, x2 + w2 - x); } if ( exports.Param.ShowStatusWindow ) { this.drawActorGrowthGauge(this._actor, paramId, x, y, x2 + w2 - x); } this.changeTextColor(this.systemColor()); this.drawText(TextManager.param(paramId), x, y, w); this.resetTextColor(); this.drawText(this._actor.param(paramId), x2, y, w2, 'right'); y += lineHeight; } } }; } else { //---------------------------------------------------------------------- /** Window_Status */ Window_Status.prototype.drawParameters = function(x, y) { var lineHeight = this.lineHeight(); for ( var ii = 0; ii < 6; ii++ ) { var paramId = ii + 2; var y2 = y + lineHeight * ii; if ( exports.Param.ShowStatusWindow ) { this.drawActorGrowthGauge(this._actor, paramId, x, y2, 160+60); } this.changeTextColor(this.systemColor()); this.drawText(TextManager.param(paramId), x, y2, 160); this.resetTextColor(); this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right'); } }; } // Imported.TMStatusMenuEx }((this.dsGrowthByAction = this.dsGrowthByAction || {})));