/*: * @plugindesc SRPGギア用_戦闘予測のダメージや命中率の計算結果を変数に格納するプラグイン * @target MZ * @url * @author 通りすがりの「」 * @base SRPG_core_MZ * @orderAfter SRPG_core_MZ * * @param variableTargetDamage * @text 変数番号_攻撃側の与えるダメージ * @desc 格納する変数番号を入力 * @default * @type number * * @param variableTargetHit * @text 変数番号_攻撃側の命中率 * @desc 格納する変数番号を入力 * @default * @type number * * @param variableUserDamage * @text 変数番号_迎撃側の与えるダメージ * @desc 格納する変数番号を入力 * @default * @type number * * @param variableUserHit * @text 変数番号_迎撃側の命中率 * @desc 格納する変数番号を入力 * @default * @type number * @help SRPG_GetCalcResultPrediction.js * * SRPGギア用_戦闘予測のダメージや命中率の計算結果を変数に格納するよ * クリティカル率の取得表示はコモンイベント側で出来ると思う * プラグインリストに追加するときはSRPG_core_MZ.jsよりも下の位置に置くこと * あと早く寝ろ */ (()=> { var parameters = PluginManager.parameters('SRPG_core_MZ'); var _srpgPredictionWindowMode = Number(parameters['srpgPredictionWindowMode'] || 1); var _srpgUseAgiAttackPlus = parameters['useAgiAttackPlus'] || 'true'; var _srpgBattleReaction = Number(parameters['srpgBattleReaction'] || 1); var parameters2 = PluginManager.parameters('SRPG_GetCalcResultPrediction'); var _variableTargetDamage = Number(parameters2['variableTargetDamage'] || -1); var _variableTargetHit = Number(parameters2['variableTargetHit'] || -1); var _variableUserDamage = Number(parameters2['variableUserDamage'] || -1); var _variableUserHit = Number(parameters2['variableUserHit'] || -1); //==================================================================== // ●Window_SrpgPrediction //==================================================================== // 内容を描画する Window_SrpgPrediction.prototype.drawContents = function() { this.resetFontSettings(); var lineHeight = this.lineHeight(); var padding = 24; var user = this._actionArray[1]; var target = this._targetArray[1]; // 攻撃側 var action = user.currentAction(); var damage = action.srpgPredictionDamage(target); var hit = action.itemHit(target); var eva = action.itemEva(target); this.drawSrpgBattleActionName(user, action, this.innerWidth / 2 + padding * 2, lineHeight * 0, true); var hitResult = this.drawSrpgBattleHit(hit, eva, this.innerWidth / 2 + padding * 2, lineHeight * 1); this.drawSrpgBattleDistance(user, action, this.innerWidth / 2 + 172 + padding * 2, lineHeight * 1); this.drawSrpgBattleDamage(damage, this.innerWidth / 2 + padding * 2, lineHeight * 2, doubleActionRate); // 変数に格納 if(_variableTargetDamage > -1){ $gameVariables.setValue(_variableTargetDamage, damage); } if(_variableTargetHit > -1){ $gameVariables.setValue(_variableTargetHit, hitResult); } // 迎撃側 var reaction = target.currentAction(); // スキルが使えない or 攻撃側が応戦不能の攻撃の場合 if (reaction && (!target.canUse(reaction.item()) || user.currentAction().item().meta.srpgUncounterable)) { reaction = null; } if (!reaction || user === target) { this.drawSrpgBattleActionName(target, reaction, padding, lineHeight * 0, false); } else { var damage = reaction.srpgPredictionDamage(user); var hit = reaction.itemHit(user); var eva = reaction.itemEva(user); this.drawSrpgBattleActionName(target, reaction, padding, lineHeight * 0, true); var hitResult = this.drawSrpgBattleHit(hit, eva, padding, lineHeight * 1); this.drawSrpgBattleDistance(target, reaction, 172 + padding, lineHeight * 1); this.drawSrpgBattleDamage(damage, padding, lineHeight * 2, doubleActionRate); // 変数に格納 if(_variableUserDamage > -1){ $gameVariables.setValue(_variableUserDamage, damage); } if(_variableUserHit > -1){ $gameVariables.setValue(_variableUserHit, hitResult); } } if (_srpgPredictionWindowMode === 2) return; // 行動順序 BattleManager.makeActionOrders(); this.contents.fontSize = 18; var order = BattleManager.actionBattlers(); var doubleActioncheck = []; var doubleActionRate = 0; var iconBoxWidth = ImageManager.iconWidth + 4; var orderX = this.innerWidth / 2 - iconBoxWidth; var orderY = lineHeight - 2; var line = 0 this.drawText('Action', orderX, -8, iconBoxWidth * 2, 'center'); for (var i = 0; i < order.length; i++) { battler = order[i]; if (user === battler && action && action.item()) { // 初回行動時 if (doubleActioncheck.indexOf(battler) < 0) { this.drawSrpgBattleOrders(battler, action.item(), orderX + iconBoxWidth, 17 + orderY * line); // 2回行動がある場合 } else if (_srpgUseAgiAttackPlus === 'true' && doubleActioncheck.indexOf(battler) >= 0) { actionRate = this.setDoubleActionRate(user, target); if (actionRate > 0) { this.drawSrpgBattleOrders(battler, action.item(), orderX + iconBoxWidth, 17 + orderY * line); this.drawSrpgActionRate(actionRate, orderX + iconBoxWidth, 17 + orderY * line); } } // 次の行へ doubleActioncheck.push(battler); line++; } else if (target === battler && reaction && reaction.item()) { // 初回行動時 if (doubleActioncheck.indexOf(battler) < 0) { this.drawSrpgBattleOrders(battler, reaction.item(), orderX, 17 + orderY * line); // 応戦が反撃率に応じる場合 if (_srpgBattleReaction === 2 && target.cnt > 0) { this.drawSrpgActionRate(target.cnt * 100, orderX, 17 + orderY * line); } // 2回行動がある場合 } else if (_srpgUseAgiAttackPlus === 'true' && doubleActioncheck.indexOf(battler) >= 0) { actionRate = this.setDoubleActionRate(target, user); if (_srpgBattleReaction === 2 && target.cnt > 0) actionRate = Math.floor(actionRate * target.cnt); if (actionRate > 0) { this.drawSrpgBattleOrders(battler, reaction.item(), orderX, 17 + orderY * line); this.drawSrpgActionRate(actionRate, orderX, 17 + orderY * line); } } // 次の行へ doubleActioncheck.push(battler); line++; } } }; // 予想される命中率を描画する Window_SrpgPrediction.prototype.drawSrpgBattleHit = function(hit, eva, x, y) { var val = Math.floor((hit.clamp(0, 1.0) * (1.0 - eva).clamp(0, 1.0)) * 100); // 命中・回避を同時に処理する this.changeTextColor(ColorManager.systemColor()); this.drawText(TextManager.param(8), x, y, 98); this.resetTextColor(); this.drawText(val.clamp(0, 100) + '%', x + 80, y, 64, 'right'); return val.clamp(0, 100); }; })();