//============================================================================= // Dragon quest monster Plugins - Core Engine // DQM_Plugin.js //============================================================================= var Imported = Imported || {}; Imported.DQM_Plugin = false; var DQM = DQM || {}; DQM.Core = DQM.Core || {}; //============================================================================= /*: * @plugindesc v1.0 Recreate the same RPG system than the games Dragon Quest * Monsters. * * @param ---Tension--- * @default * * @param Tension Name * @desc Defines the command 'Tension' name in the game * Default: Tension * @default Tension * * @param Tension Message Use * @desc Defines the message displayed when the skill 'Tension' is used * Default: utilise Tension * @default utilise Tension * * @param Tension List Level * @desc Defines all levels of tension * the negative levels are automatically defined with positive levels * Default: 5,20,50,100 * @default 5,20,50,100 * * @param Tension Message Result * @desc Defines the message displayed to see the new level of tension * %1 : new level of tension * Default: Sa tension passe à %1 * @default Sa tension passe à %1 * * @param Tension Message Too High * @desc Defines the message displayed when the tension is up but has already * reached highest limit * Default: Sa tension était déjà au maximum * @default Sa tension était déjà au maximum * * @param Tension Message Too Low * @desc Defines the message displayed when the tension is down but has already * reached lowest limit * Default: Sa tension ne peut pas descendre plus bas * @default Sa tension ne peut pas descendre plus bas * * @param Tension Formula Damage * @desc Defines the formula used to evaluate atk, def, mat and mdf of an actor * with the tension as new parameter * %1 : default value of param * Default: %1 * (1 + 4*%2/100) * @default %1 * (1 + 4*%2/100) * * @help * ============================================================================ * Introduction and Instructions * ============================================================================ * * DQM_Tension_Plugins is made for RPG Maker MV. This plugin functions * primarily to recreate the Tension Skill from Dragon Quest Games Series. * * ============================================================================ * Tension Skill * ============================================================================ * This is a particular skill in Dragon Quest Monsters : When used, the user * rises up this tension, leveling up its attack and resistance. The tension * is always reset to level 0 at the start of the battle, at the end of a * battle, and at each end of turn, for each battler which has attacked or * defended as last action. * * ============================================================================ * Parameters * ============================================================================ * * ---------------------------------------------------------------------------- * 1) Tension * ---------------------------------------------------------------------------- * * Tension Name * -------------------------------- * Defines the command 'Tension' name in the game * * Default Value = "Tension" * * * Tension Message Use * -------------------------------- * Defines the message displayed when the skill 'Tension' is used * This message has the same properties than the message displayed for any * skill in the database. * * Default Value = " utilise Tension" * * * Tension List Level * -------------------------------- * Defines all levels of tension * Each value are separated by the character "," * the negative levels are automatically defined with positive levels * * Example : * if you define the values 5,10,50 * the complete list of tension level is -50,-10,-5,0,5,10,50 * * Default Value = "5,20,50,100" * * * Tension Message Result * -------------------------------- * Defines the message displayed to see the new level of tension * * Parameter message list : * %1 : new level of tension * * Default Value = "Sa tension passe à %1" * * * Tension Message Too High * -------------------------------- * Defines the message displayed when the tension is up but has already * reached highest limit * * Default Value = "Sa tension était déjà au maximum" * * * Tension Message Too Low * -------------------------------- * Defines the message displayed when the tension is down but has already * reached lowest limit * * Default Value = "Sa tension ne peut pas descendre plus bas" * * * Tension Formula Damage * -------------------------------- * Defines the formula used to evaluate atk, def, mat and mdf of an actor * with the tension as new parameter * * Parameter message list : * %1 : default value of param * * Default Value = "%1 * (1 + 4*%2/100)" * * ============================================================================ * Notetags * ============================================================================ * * Many notetags are created to define parameters of Dragon Quest Monsters. * Here are a exhaustive list : * * Class Notetags * * Gives the Tension skill to actor with this class reaching the level 50. * * Enemy Notetags * * Add the Tension skill as action enabled for this enemy. * This skill has the priority 5. * * Skill Notetags * * * Gives to the skill the power of change the tension level of the target * in order to level up (or down if -) x times. * * * Reset tension level of the target only if the tension is above 0. * * * Reset tension level of the target only if the tension is below 0. * * Item Notetags * * * Gives to the skill the power of change the tension level of the target * in order to level up (or down if -) x times. * * * Reset tension level of the target only if the tension is above 0. * * * Reset tension level of the target only if the tension is below 0. * * ============================================================================ * Script functions * ============================================================================ * * ============================================================================ * Changelog * ============================================================================ * * Version 1.00: * - Finished plugin! */ //============================================================================= //============================================================================= // Parameter Variables //============================================================================= DQM.Parameters = PluginManager.parameters('DQM_tension_plugin'); DQM.Param = DQM.Param || {}; // Parameter Tension DQM.Param.TensionName = String(DQM.Parameters['Tension Name'] || 'Tension'); DQM.Param.TensionMessageUse = ' '.concat(String(DQM.Parameters['Tension Message Use'] || 'utilise Tension')); DQM.Param.TensionListLevel = String(DQM.Parameters['Tension List Level'] || '5,20,50,100').split(','); DQM.Param.TensionMessageResult = String(DQM.Parameters['Tension Message Result'] || 'Sa tension passe à %1'); DQM.Param.TensionMessageTooHigh = String(DQM.Parameters['Tension Message Too High'] || 'Sa tension était déjà au maximum'); DQM.Param.TensionMessageTooLow = String(DQM.Parameters['Tension Message Too Low'] || 'Sa tension ne peut pas descendre plus bas'); DQM.Param.TensionFormulaDamage = String(DQM.Parameters['Tension Formula Damage'] || '%1 * (1 + 4*%2/100)'); //============================================================================= // DataManager //============================================================================= DQM.Core.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded; DataManager.isDatabaseLoaded = function() { if (!DQM.Core.DataManager_isDatabaseLoaded.call(this)) return false; if (!DQM._loaded_DQM_plugins) { this.processDQMNotetags4(); this.processDQMNotetags2(); this.processDQMNotetags3(); this.processDQMNotetags8(); DQM._loaded_DQM_plugins = true; } return true; }; DataManager.processDQMNotetags2 = function() { var noteW = /<(?:LEARN SKILL TENSION AT LEVEL)[ ]([0-9]+)>/i; for (var n = 1; n < $dataClasses.length; n++) { var obj = $dataClasses[n]; var notedata = obj.note.split(/[\r\n]+/); for (var i = 0; i < notedata.length; i++){ var line = notedata[i]; if (line.match(noteW)) { $dataClasses[n].learnings.push({"level":Number(String(RegExp.$1)),"skillId":DQM.Param.TensionId}); } } } }; DataManager.processDQMNotetags3 = function() { var noteA = /<(?:CAN EXECUTE TENSION ACTION)>/i; for (var n = 1; n < $dataEnemies.length; n++) { var obj = $dataEnemies[n]; var notedata = obj.note.split(/[\r\n]+/); for (var i = 0; i < notedata.length; i++){ var line = notedata[i]; if (line.match(noteA)) { $dataEnemies[n].tensionAllowed = true; } } } DQM.Param.RandomTroopId = $dataTroops.length; $dataTroops[DQM.Param.RandomTroopId] = DQM.Param.TroopBasis; $dataTroops[DQM.Param.RandomTroopId].id = DQM.Param.RandomTroopId; }; DataManager.processDQMNotetags4 = function() { var noteAJ = /<(?:CHANGE TENSION OF TARGET TO THE CURRENT LEVEL)[ ]([-]?[0-9]+)>/i; var noteAO = /<(?:REMOVE ANY TENSION BOOST)>/i; var noteAP = /<(?:REMOVE ANY TENSION UNBOOST)>/i; for (var n = 1; n < $dataSkills.length; n++) { var obj = $dataSkills[n]; var notedata = obj.note.split(/[\r\n]+/); for (var i = 0; i < notedata.length; i++){ var line = notedata[i]; if (line.match(noteAJ)) { $dataSkills[n].effects.push({"code":101,"dataId":0,"value1":Number(RegExp.$1),"value2":0}); } else if (line.match(noteAO)) { $dataSkills[n].effects.push({"code":109,"dataId":0,"value1":1,"value2":0}); } else if (line.match(noteAP)) { $dataSkills[n].effects.push({"code":109,"dataId":0,"value1":-1,"value2":0}); } } } DQM.Param.RecruitId = $dataSkills.length; $dataSkills[DQM.Param.RecruitId] = {}; $dataSkills[DQM.Param.RecruitId] = {"id":DQM.Param.RecruitId,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":DQM.Param.RecruitFormula,"type":0,"variance":20},"description":"","effects":[{"code":102,"dataId":0,"value1":0,"value2":0}],"hitType":1,"iconIndex":76,"message1":DQM.Param.RecruitMessageUse,"message2":"","mpCost":0,"name":"Recruter","note":"Compétence #2001 sera utilisée lorsque\nvous sélectionnerez la commande Recruter.","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":0,"successRate":100,"tpCost":0,"tpGain":0}; }; DataManager.processDQMNotetags8 = function() { var noteC = /<(?:CHANGE TENSION OF TARGET TO THE CURRENT LEVEL)[ ]([-]?[0-9]+)>/i; var noteD = /<(?:REMOVE ANY TENSION BOOST)>/i; var noteE = /<(?:REMOVE ANY TENSION UNBOOST)>/i; for (var n = 1; n < $dataItems.length; n++) { var obj = $dataItems[n]; var notedata = obj.note.split(/[\r\n]+/); for (var i = 0; i < notedata.length; i++){ var line = notedata[i]; if (line.match(noteC)) { $dataSkills[n].effects.push({"code":101,"dataId":0,"value1":Number(RegExp.$1),"value2":0}); } else if (line.match(noteD)) { $dataSkills[n].effects.push({"code":109,"dataId":0,"value1":1,"value2":0}); } else if (line.match(noteE)) { $dataSkills[n].effects.push({"code":109,"dataId":0,"value1":-1,"value2":0}); } } } }; //============================================================================= // Scene_Manager //============================================================================= //============================================================================= // BattleManager //============================================================================= //============================================================================= // Scene_Title //============================================================================= //============================================================================= // Scene_Menu //============================================================================= //============================================================================= // Scene_Battle //============================================================================= Scene_Battle.prototype.commandTension = function() { BattleManager.inputtingAction().setTension(); this.selectNextCommand(); }; //============================================================================= // Game_BattlerBase //============================================================================= DQM.Core.Game_BattlerBase_initMembers = Game_BattlerBase.prototype.initMembers; Game_BattlerBase.prototype.initMembers = function() { DQM.Core.Game_BattlerBase_initMembers.apply(this); this._tension = 0; this._tensionToReset = false; }; DQM.Core.Game_BattlerBase_clearBuffs = Game_BattlerBase.prototype.clearBuffs; Game_BattlerBase.prototype.clearBuffs = function() { DQM.Core.Game_BattlerBase_clearBuffs.apply(this); this.TensionReset(); }; Game_BattlerBase.prototype.getChangeTensionLevel = function(oldLevel) { var newIndex = DQM.Param.TensionListLevel.indexOf(String(Math.abs(this._tension))); if (Math.abs(this._tension) !== this._tension) { newIndex = -newIndex - 2; } var oldIndex = DQM.Param.TensionListLevel.indexOf(String(Math.abs(oldLevel))); if (Math.abs(oldLevel) !== oldLevel) { oldIndex = -oldIndex - 2; } return newIndex - oldIndex; }; Game_BattlerBase.prototype.TensionUp = function(levelBonus) { var oldIndex = DQM.Param.TensionListLevel.indexOf(String(Math.abs(this._tension))); if (Math.abs(this._tension) !== this._tension) { oldIndex = -oldIndex - 2; } if (oldIndex + levelBonus > -1) { this._tension = Number(DQM.Param.TensionListLevel[Math.min(oldIndex + levelBonus, DQM.Param.TensionListLevel.length - 1)]); } else if (oldIndex + levelBonus === -1) { this._tension = 0; } else { this._tension = -Number(DQM.Param.TensionListLevel[Math.min(- oldIndex - levelBonus - 2, DQM.Param.TensionListLevel.length - 1)]); } }; Game_BattlerBase.prototype.TensionReset = function() { this._tension = 0; }; Game_BattlerBase.prototype.canTension = function() { }; Game_BattlerBase.prototype.tensionId = function() { return DQM.Param.TensionId; }; //============================================================================= // Game_Battler //============================================================================= DQM.Core.Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd; Game_Battler.prototype.onBattleEnd = function() { this.TensionReset(); DQM.Core.Game_Battler_onBattleEnd.call(this); }; DQM.Core.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart; Game_Battler.prototype.onBattleStart = function() { DQM.Core.Game_Battler_onBattleStart.call(this); this._tensionToReset = false; }; DQM.Core.Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd; Game_Battler.prototype.onTurnEnd = function() { DQM.Core.Game_Battler_onTurnEnd.call(this); if (this._tensionToReset) { this.TensionReset(); } this._tensionToReset = false; }; //============================================================================= // Game_Actor //============================================================================= Game_Actor.prototype.canTension = function() { return this.isLearnedSkill(DQM.Param.TensionId) || Game_BattlerBase.prototype.canTension.call(this); }; //============================================================================= // Game_Enemy //============================================================================= Game_Enemy.prototype.actions = function() { var actionDefault = this.enemy().actions; if (this.enemy().tensionAllowed) { actionDefault.push({"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":DQM.Param.TensionId}) } return this.enemy().actions; }; //============================================================================= // Game_Map //============================================================================= //============================================================================= // Game_Action //============================================================================= Game_Action.EFFECT_TENSION_CHANGE = 101; Game_Action.EFFECT_RESET_TENSION = 109; Game_Action.prototype.setTension = function() { this.setSkill(this.subject().tensionId()); }; DQM.Core.Game_Action_applyItemEffect = Game_Action.prototype.applyItemEffect; Game_Action.prototype.applyItemEffect = function(target, effect) { switch (effect.code) { case Game_Action.EFFECT_TENSION_CHANGE: this.itemEffectTensionChange(target, effect); break; case Game_Action.EFFECT_RESET_TENSION: this.itemEffectResetTension(target, effect); break; default: DQM.Core.Game_Action_applyItemEffect.call(this, target, effect); break; } }; DQM.Core.Game_Action_testItemEffect = Game_Action.prototype.testItemEffect; Game_Action.prototype.testItemEffect = function(target, effect) { switch (effect.code) { case Game_Action.EFFECT_TENSION_CHANGE: var valMax = Number(DQM.Param.TensionListLevel[DQM.Param.TensionListLevel.length - 1]); return (effect.value1 !== 0 && ((target._tension !== valMax && effect.value1 > 0) || (target._tension !== -valMax && effect.value1 < 0))); case Game_Action.EFFECT_RESET_TENSION: return (target._tension * effect.value1) > 0; default: return DQM.Core.Game_Action_testItemEffect.call(this, target, effect); } }; DQM.Core.Game_Action_apply = Game_Action.prototype.apply; Game_Action.prototype.apply = function(target) { DQM.Core.Game_Action_apply.call(this, target); if ((this.item().damage.type > 0) && (BattleManager._targets.length === 0)) { this.subject()._tensionToReset = true; } }; Game_Action.prototype.itemEffectTensionChange = function(target, effect) { target.result()._TensionAffected = true; target._tensionToReset = false; var newLevel = effect.value1; const oldValue = target._tension; target.TensionUp(newLevel); target.result()._levelTensionChange = target.getChangeTensionLevel(oldValue); this.makeSuccess(target); }; Game_Action.prototype.itemEffectResetTension = function(target, effect) { if (target._tension * effect.value1 > 0) { target.TensionReset(); } }; //============================================================================= // Game_ActionResult //============================================================================= DQM.Core.Game_ActionResult_clear = Game_ActionResult.prototype.clear; Game_ActionResult.prototype.clear = function() { DQM.Core.Game_ActionResult_clear.call(this); this._TensionAffected = false; this._levelTensionChange = 0; }; Game_ActionResult.prototype.isTensionAffected = function() { return this._TensionAffected; }; //============================================================================= // Window_MenuStatus //============================================================================= //============================================================================= // Window_ItemList //============================================================================= //============================================================================= // Window_SkillStatus //============================================================================= //============================================================================= // Window_EquipStatus //============================================================================= //============================================================================= // Window_SkillType //============================================================================= //============================================================================= // Window_ActorCommand //============================================================================= DQM.Core.Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList; Window_ActorCommand.prototype.makeCommandList = function() { if(this._actor) { if (this._actor.canTension()) { this.addCommand(DQM.Param.TensionName, 'tension', true); } } }; //============================================================================= // End of File //=============================================================================