/*:
* @plugindesc Allows players to distribute points to different stats of the Actors at his or her discretion.
* @author SumRndmDde
*
* @param Default Stats
* @desc A list of stats Actors can distribute to by default.
* All of the available stats can be found in HELP.
* @default mhp, mmp, atk, def, mat, mdf, agi, luk
*
* @param Default Formula
* @desc The default formula used for determining how many "stat points" an Actor gains by leveling up.
* @default Math.ceil(level / 10)
*
* @param Show on Menu
* @desc If 'true', this plugin will place the command in the menu.
* @default true
*
* @param == Stat Reset ==
* @default
*
* @param Allow Stat Resets
* @desc If 'true', then players will have the option to reset the distributed stats and return the used stat points.
* @default true
*
* @param Reset Gold Cost
* @desc The formula determining the amount of gold for resetting.
* Use "points" to reference the amount of points used.
* @default points * 100
*
* @param == Custom Texts ==
* @default
*
* @param Level Up Message
* @desc This message is displayed when an actor levels up to show how many points were gained. %1 is the number of points.
* @default Got %1 stat points!
*
* @param Command Name
* @desc The is the name of the command for stat distribution in the menu.
* @default Stat Boost
*
* @param Points Text
* @desc The text used to display how much points an Actor has.
* @default Stat Points:
*
* @param Upgrade Text
* @desc The text used to display how much points an upgrade is worth.
* @default Upgrade Cost:
*
* @param Spend Text
* @desc The text used in the command window to begin spending.
* @default Spend
*
* @param Reset Text
* @desc The text used in the command window to reset stat points.
* @default Reset
*
* @param Finish Text
* @desc The text used in the command window to leave the scene.
* @default Finish
*
* @param == Gauge Options ==
* @default
*
* @param Use Gauges
* @desc If 'true', the stat distribution will have gauges representing how close the distributed stat is to reaching its max.
* @default true
*
* @param Gauge Height
* @desc The height of the gauges used in the stat distribution.
* @default 14
*
* @param == Points Label ==
* @default
*
* @param Point Icon
* @desc Input the icon index of the icon for stat points.
* Set to 0 to use text instead.
* @default 87
*
* @param Point Text
* @desc If "Point Icon" is set to 0, this will be used as the label for stat points.
* @default Points
*
* @param Point Color
* @desc If using text, this will be the color of the text.
* @default #66ff66
*
* @help
*
* Stat Distribution
* Version 1.07
* SumRndmDde
*
*
* This plugin allows players to distribute points to different stats of the
* Actors at his or her discretion. A command is added to the menu which allows
* access to a new menu for stat distribution!
*
*
* ==============================================================================
* Plugin Commands
* ==============================================================================
*
* Use the following plugin commands to preform various actions.
*
*
*
* OpenStatDistribution Actor [actorId]
*
* This opens the Stat Distribution Menu for the specified Actor ID.
*
*
*
* OpenStatDistribution Party [memberIndex]
*
* This opens the Stat Distribution Menu for the specified Actor based on the
* index in which they are in the party. For example, setting "memberIndex"
* to 0 will open the menu for the party's leader.
*
*
*
* AddStatPoints Actor [actorId] [points]
* AddStatPoints Party [memberIndex] [points]
*
* This adds a specific amount points to a specific Actor.
*
*
* ==============================================================================
* Upgradeable Stats
* ==============================================================================
*
* In order to determine what stats can be upgraded, use the "Default Stats"
* Parameter. Otherwise, notetags can be used to customize the stats
* per each individual Actor:
*
*
*
*
* Sets the Actor's stats to this list.
*
*
*
*
*
* Adds stats to the Actor's already existing upgradeable stats.
*
*
* ==============================================================================
* How to Customize Stats
* ==============================================================================
*
* In order to customize the properties of stats, you must use the Database EX.
* Simply go to the customizable editors, and select "Stat Distribution Editor".
*
* Within here, a list of stats will be available and their variables can
* be changed to fit with your needs. Be sure to reload to see the changes!
*
*
* ==============================================================================
* List of Upgradeable Stats
* ==============================================================================
*
* Here is a list of all the available stats and their three-letter codes.
*
*
* == Base Stats ==
* mhp - Max HP
* mmp - Max MP
* atk - Attack
* def - Defense
* mat - Magical Attack
* mdf - Magical Defense
* agi - Agility
* luk - Luck
*
* == Ex Stats ==
* hit - Hit Rate
* eva - Evasion Rate
* cri - Critical Rate
* cev - Critical Evasion Rate
* mev - Magic Evasion Rate
* mrf - Magic Reflection Rate
* cnt - Counter Attack Rate
* hrg - Hp Regeneration
* mrg - Mp Regeneration
* trg - Tp Regeneration
*
* == Sp Stats ==
* tgr - Target Rate
* grd - Guard Effect Rate
* rec - Recovery Effect Rate
* pha - Pharmacology
* mcr - Mp Cost Rate
* tcr - Tp Charge Rate
* pdr - Physical Damage Rate
* mdr - Magical Damage Rate
* fdr - Floor Damage Rate
* exr - Experience Rate
*
*
* ==============================================================================
* Stat Points
* ==============================================================================
*
* Stat points can be gained by leveling up the Actors.
* The "Default Formula" Parameter can be used to set up a formula for how many
* stat points an Actor will gain upon level. Alternatively, the following
* notetags can be used to give Actors their own formulas:
*
*
*
* For example:
*
*
*
*
* ==============================================================================
* End of Help File
* ==============================================================================
*
* Welcome to the bottom of the Help file.
*
*
* Thanks for reading!
* If you have questions, or if you enjoyed this Plugin, please check
* out my YouTube channel!
*
* https://www.youtube.com/c/SumRndmDde
*
*
* Until next time,
* ~ SumRndmDde
*
*/
var SRD = SRD || {};
SRD.StatDistribution = SRD.StatDistribution || {};
SRD.PluginCommands = SRD.PluginCommands || {};
SRD.NotetagGetters = SRD.NotetagGetters || [];
var Imported = Imported || {};
Imported["SumRndmDde Stat Distribution"] = 1.07;
var $dataDistributeStats = {};
function Scene_Distribute() {
this.initialize.apply(this, arguments);
}
function Window_DistributePoints() {
this.initialize.apply(this, arguments);
}
function Window_DistributeStatus() {
this.initialize.apply(this, arguments);
}
function Window_Distribute() {
this.initialize.apply(this, arguments);
}
function Window_DistributeCommand() {
this.initialize.apply(this, arguments)
}
(function(_) {
"use strict";
//-----------------------------------------------------------------------------
// SRD.StatDistribution
//-----------------------------------------------------------------------------
const params = PluginManager.parameters('SRD_StatDistribution');
_.stats = String(params['Default Stats']).split(/\s*,\s*/);
_.formula = String(params['Default Formula']);
_.show = String(params['Show on Menu']).trim().toLowerCase() === 'true';
_.reset = String(params['Allow Stat Resets']).trim().toLowerCase() === 'true';
_.cost = String(params['Reset Gold Cost']);
_.name = String(params['Command Name']);
_.messsage = String(params['Level Up Message']);
_.points = String(params['Points Text']);
_.upgrade = String(params['Upgrade Text']);
_.spendText = String(params['Spend Text']);
_.resetText = String(params['Reset Text']);
_.finishText = String(params['Finish Text']);
_.drawGauges = String(params['Use Gauges']).trim().toLowerCase() === 'true';
_.gaugeHeight = parseInt(params['Gauge Height']);
_.iconIndex = parseInt(params['Point Icon']);
_.pointText = String(params['Point Text']);
_.pointColor = String(params['Point Color']);
_.checkFileExists = function() {
FileManager.checkDataExists("DistributionStats.json", JsonEx.stringify({
"mhp":{"name":"Max HP","description":"The maximum amount of HP for the actor.","cost":"1","gain":"5","max":"500","min_col":"#ffa655","max_col":"#ea7000"},
"mmp":{"name":"Max MP","description":"The maximum amount of MP for the actor.","cost":"1","gain":"2","max":"200","min_col":"#6666ff","max_col":"#0000ff"},
"atk":{"name":"Attack","description":"Strengthens the damage of physical skills used by \nthe actor.","cost":"1","gain":"1","max":"100","min_col":"#ff7777","max_col":"#f90000"},
"def":{"name":"Defense","description":"Reduces the damage of physical skills the actor is \ntargeted with.","cost":"1","gain":"1","max":"100","min_col":"#52ff33","max_col":"#12b700"},
"mat":{"name":"Magic Attack","description":"Strengthens the damage of magical skills used by \nthe actor.","cost":"1","gain":"1","max":"100","min_col":"#b355ff","max_col":"#a300d9"},
"mdf":{"name":"Magic Defense","description":"Reduces the damage of magical skills the actor is \ntargeted with.","cost":"1","gain":"1","max":"100","min_col":"#55ffe6","max_col":"#00d7b7"},
"agi":{"name":"Agility","description":"Determines how soon the actor will be able to \npreform a turn in battle.","cost":"1","gain":"1","max":"100","min_col":"#fbff55","max_col":"#d9d300"},
"luk":{"name":"Luck","description":"Influences various luck factors for the actor in \ntheir favor.","cost":"1","gain":"1","max":"100","min_col":"#ff55e6","max_col":"#cc00ad"},
"hit":{"name":"Hit Rate","description":"Increases the chance of skills hitting their \ntarget.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"eva":{"name":"Evasion Rate","description":"Increases the likely-hood of an actor evading\na physical skill.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"cri":{"name":"Critical Rate","description":"Determines how likely an actor will preform \na critical hit.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"cev":{"name":"Critical Evasion Rate","description":"Decreases the likely-hood of skills targeting \nthe actor being critical.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"mev":{"name":"Magic Evasion Rate","description":"Increases the likely-hood of an actor evading \na magical skill.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"mrf":{"name":"Magic Reflection Rate","description":"The higher the value, the more likely magical \nreflection will occur.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"cnt":{"name":"Counter Attack Rate","description":"The higher the value, the more likely physical \nreflection will occur.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"hrg":{"name":"Hp Regeneration","description":"The rate in which the actor gains HP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"mrg":{"name":"Mp Regeneration","description":"The rate in which the actor gains MP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"trg":{"name":"Tp Regeneration","description":"The rate in which the actor gains TP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"tgr":{"name":"Target Rate","description":"Increases the chance of the actor being attacked.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"grd":{"name":"Guard Effect Rate","description":"Increases the effectiveness of the actor's guard","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"rec":{"name":"Recovery Effect Rate","description":"Determines the effectiveness of recovery skills.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"pha":{"name":"Pharmacology","description":"Determines the effectiveness of recovery items.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"mcr":{"name":"Mp Cost Rate","description":"The rate in which MP skills cost.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"tcr":{"name":"Tp Charge Rate","description":"The rate in which TP skills cost.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"pdr":{"name":"Physical Damage Rate","description":"The rate in which physical damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"mdr":{"name":"Magical Damage Rate","description":"The rate in which magical damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"fdr":{"name":"Floor Damage Rate","description":"The rate in which floor damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
"exr":{"name":"Experience Rate","description":"The rate in which the actor gains experience.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"}
}));
};
_.loadNotetags = function() {
const data = $dataActors;
const regex1 = //im;
const regex2 = //im;
const regex3 = //im;
for(let i = 1; i < data.length; i++) {
const note = data[i].note;
if(note.match(regex1)) {
const stats = String(RegExp.$1).split(/\s*,\s*/);
data[i]._sd_stats = stats;
}
if(note.match(regex2)) {
const stats = String(RegExp.$1).split(/\s*,\s*/);
if(data[i]._sd_stats === undefined) data[i]._sd_stats = _.stats.clone();
data[i]._sd_stats = data[i]._sd_stats.concat(stats);
}
if(note.match(regex3)) {
data[i]._sd_formula = String(RegExp.$1);
}
}
};
SRD.NotetagGetters.push(_.loadNotetags);
_.alertNeedSuperToolsEngine = function() {
alert("The 'SRD_SuperToolsEngine' plugin is required for using the 'SRD_StatDistribution' plugin.");
if(confirm("Do you want to open the download page to 'SRD_SuperToolsEngine'?")) {
window.open('http://sumrndm.site/super-tools-engine/');
}
};
if(!Imported["SumRndmDde Super Tools Engine"]) {
_.alertNeedSuperToolsEngine();
return;
}
_.checkFileExists();
//-----------------------------------------------------------------------------
// SRD.PluginCommands
//-----------------------------------------------------------------------------
SRD.PluginCommands._sd_getActorType = function(args) {
const type = String(args[0]).toLowerCase();
const id = parseInt(args[1]);
let actor;
if(type === 'actor') {
actor = $gameActors.actor(id);
} else {
actor = $gameParty.members()[id];
}
return actor;
};
SRD.PluginCommands['openstatdistribution'] = function(args) {
const actor = SRD.PluginCommands._sd_getActorType(args);
if(actor) {
$gameParty.setMenuActor(actor);
SceneManager.push(Scene_Distribute);
}
};
SRD.PluginCommands['addstatpoints'] = function(args) {
const actor = SRD.PluginCommands._sd_getActorType(args);
if(actor) {
const points = parseInt(args[2]);
actor.addDistributePoints(points);
}
};
//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------
DataManager._testExceptions.push("DistributionStats.json");
DataManager._databaseFiles.push({name: '$dataDistributeStats', src: "DistributionStats.json"});
if(!SRD.DataManager_isDatabaseLoaded) {
SRD.notetagsLoaded = false;
SRD.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if(!SRD.DataManager_isDatabaseLoaded.apply(this, arguments)) return false;
if(!SRD.notetagsLoaded) {
SRD.NotetagGetters.forEach(function(func) {
func.call(this);
}, this);
SRD.notetagsLoaded = true;
}
return true;
};
}
//-----------------------------------------------------------------------------
// DataManagerEX
//-----------------------------------------------------------------------------
DataManagerEX._distributeStat = 'mhp';
_.DataManagerEX_getCustomInfo = DataManagerEX.getCustomInfo;
DataManagerEX.getCustomInfo = function() {
const result = _.DataManagerEX_getCustomInfo.apply(this, arguments);
result.push(['Stat Distribution Editor', 'DataManagerEX.getStatDistributionHtml']);
return result;
};
DataManagerEX.getStatDistributionHtml = function() {
const data = $dataDistributeStats['mhp'];
return `