Buff Boost Ratio
The value that is multiplied by the stats that are buffed from the Nature.
Replicates the Nature system from Pokemon games to affect Actors.
Natures
Version 1.01
SumRndmDde
This plugin requires the Copy Actors (SRD_CopyActors) plugin.
Make sure it is placed above this plugin.
This is a Plugin that replicates the Nature system from Pokemon.
Each individual Actor will be assigned a random Nature when they are
created. This Nature will give certain buffs and nerfs to the Actor
depending on what the Nature is.
You can customize the available Natures in the Parameters.
You can choose their name, buffs, nerfs, and chance of appearing.
If a Nature's name is left blank, it will not be available to be chosen.
Otherwise, even Natures with no buffs or nerfs can appear.
==========================================================================
Plugin Commands
==========================================================================
You can use the following plugin command to change an Actor's nature:
ChangeActorNature actorId natureId
actorId = Set this to a number or a Game Variable (v[x])
natureId = Set this to the number listed of the nature in the Parameters
Examples:
ChangeActorNature 3 5
ChangeActorNature v[2] 3
==========================================================================
You can use the following plugin command to store an Actor's nature in a
Game Variable:
StoreActorNature actorId variableId
actorId = Set this to a number or a Game Variable (v[x])
natureId = Set this to the ID of the Variable that will store the Nature ID
Examples:
StoreActorNature 5 10
StoreActorNature v[7] 11
==========================================================================
Game_Actor Functions
==========================================================================
Here are some Game_Actor functions you can now use with Actor variables:
actor.nature()
Returns the name of the Actor's nature.
actor.natureId()
Returns the ID of the Actor's nature.
==========================================================================
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.Natures = SRD.Natures || {};
var Imported = Imported || {};
Imported["SumRndmDde Natures"] = 1.00;
if(Imported["SumRndmDde Copy Actors"]) {
(function(_, $) {
"use strict";
var params = PluginManager.parameters('SRD_Natures');
_.buffBoost = parseFloat(params['Buff Boost Ratio']);
_.nerfBoost = parseFloat(params['Nerf Boost Ratio']);
_.edit = String(params['Edit Status Screen']).trim().toLowerCase() === 'true';
_.text = String(params['Nature Text']);
_.size = parseInt(params['Nature Text Size']);
_.color = String(params['Nature Text Color']);
_.buffColor = String(params['Buff Stat Color']);
_.nerfColor = String(params['Nerf Stat Color']);
_.natures = [];
for(var i = 1; i <= 50; i++) {
var name = String(params['Nature ' + i + ' Name']);
if(name.trim().length > 0) {
_.natures[i] = {};
_.natures[i].name = name;
_.natures[i].buffs = String(params['Nature ' + i + ' Buffs']);
_.natures[i].nerfs = String(params['Nature ' + i + ' Nerfs']);
_.natures[i].chance = parseFloat(params['Nature ' + i + ' Chance']);
}
}
//-----------------------------------------------------------------------------
// SRD.CopyActors
//-----------------------------------------------------------------------------
var _$_setupActorVariables = $.setupActorVariables;
$.setupActorVariables = function(actor) {
_$_setupActorVariables.call(this, actor);
_.setupActorNature(actor);
};
//-----------------------------------------------------------------------------
// SRD.Natures
//-----------------------------------------------------------------------------
_.setupActorNature = function(actor) {
var nature = null;
var natureId = 0;
while(!nature) {
natureId = Math.randomInt(_.natures.length) + 1;
nature = _.natures[natureId];
if(nature && Math.random() > nature.chance) {
nature = null;
}
}
actor.nature = nature.name;
actor.natureId = natureId;
actor.natureBuffs = nature.buffs;
actor.natureNerfs = nature.nerfs;
};
var _DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
_DataManager_createGameObjects.call(this);
var data = $dataActors;
for(var i = 0; i < data.length; i++) {
if(data[i] && data[i].nature) {
var actor = data[i];
$gameSystem.natureStorage[actor.id] = [actor.nature, actor.natureId, actor.natureBuffs, actor.natureNerfs];
}
}
};
_.changeActorNature = function(actorId, natureId) {
var actor = $dataActors[actorId];
var nature = _.natures[natureId];
if(actor && nature) {
actor.nature = nature.name;
actor.natureId = natureId;
actor.natureBuffs = nature.buffs;
actor.natureNerfs = nature.nerfs;
}
$gameSystem.natureStorage[actorId] = [actor.nature, actor.natureId, actor.natureBuffs, actor.natureNerfs];
};
_.loadActors = function(data, system) {
for(var i = 0; i < system.natureStorage.length; i++) {
if(system.natureStorage[i]) {
var d = data[i];
data[i].nature = system.natureStorage[i][0];
data[i].natureId = system.natureStorage[i][1];
data[i].natureBuffs = system.natureStorage[i][2];
data[i].natureNerfs = system.natureStorage[i][3];
}
}
};
//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------
var _DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
_DataManager_extractSaveContents.call(this, contents);
_.loadActors($dataActors, $gameSystem);
};
//-----------------------------------------------------------------------------
// Game_System
//-----------------------------------------------------------------------------
var _Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
_Game_System_initialize.call(this);
this._natureActorStorage = [];
};
Object.defineProperty(Game_System.prototype, 'natureStorage', {
get: function() {
return this._natureActorStorage;
},
set: function(value) {
this._natureActorStorage = value;
},
configurable: true
});
//-----------------------------------------------------------------------------
// Game_Actor
//-----------------------------------------------------------------------------
var _Game_Actor_param = Game_Actor.prototype.param;
Game_Actor.prototype.param = function(paramId) {
var value = _Game_Actor_param.call(this, paramId);
value *= this.getNatureBoost(paramId);
var maxValue = this.paramMax(paramId);
var minValue = this.paramMin(paramId);
return Math.round(value.clamp(minValue, maxValue));
};
Game_Actor.prototype.getNatureBoost = function(paramId) {
var params = ['mhp', 'mmp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk'];
if(this.actor().natureBuffs.match(params[paramId])) return _.buffBoost;
if(this.actor().natureNerfs.match(params[paramId])) return _.nerfBoost;
return 1;
};
Game_Actor.prototype.nature = function() {
return this.actor().nature;
};
Game_Actor.prototype.natureId = function() {
return this.actor().natureId;
};
//-----------------------------------------------------------------------------
// Game_Interpreter
//-----------------------------------------------------------------------------
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if(command.trim().toLowerCase() === 'changeactornature') {
var v = $gameVariables._data;
_.changeActorNature(eval(args[0]), parseInt(args[1]));
} else if(command.trim().toLowerCase() === 'storeactornature') {
var v = $gameVariables._data;
var actor = $gameActors.actor(eval(args[0]));
$gameVariables.setValue(parseInt(args[1]), actor.natureId());
}
};
//-----------------------------------------------------------------------------
// Window_Status & Window_StatusInfo
//-----------------------------------------------------------------------------
if(_.edit) {
if(Imported.YEP_StatusMenuCore) {
//Edit of Yanfly's drawGeneralParam function to add compatibility
Window_StatusInfo.prototype.drawGeneralParam = function() {
var rect = new Rectangle();
rect.width = (this.contents.width - this.standardPadding()) / 2;
rect.y = this.lineHeight() * 2;
rect.height = this.lineHeight();
var dx = rect.x + this.textPadding();
var dw = rect.width - this.textPadding() * 2;
this.drawDarkRect(rect.x, rect.y, rect.width, rect.height);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.level, dx, rect.y, dw, 'left');
this.changeTextColor(this.normalColor());
var text = Yanfly.Util.toGroup(this._actor.level);
this.drawText(text, dx, rect.y, dw, 'right');
for (var i = 0; i < 8; ++i) {
if (i < 2) {
rect.y += this.lineHeight();
} else if (i === 2) {
rect.y += this.lineHeight();
rect.width /= 2;
dw = rect.width - this.textPadding() * 2;
} else if (i % 2 === 0) {
rect.x = 0;
dx = rect.x + this.textPadding();
rect.y += this.lineHeight();
} else {
rect.x += rect.width;
dx += rect.width;
}
this.drawDarkRect(rect.x, rect.y, rect.width, rect.height);
this.changeTextColor(this.getNatureColor(i, this._actor));
this.drawText(TextManager.param(i), dx, rect.y, dw, 'left');
this.changeTextColor(this.normalColor());
text = Yanfly.Util.toGroup(this._actor.param(i));
this.drawText(text, dx, rect.y, dw, 'right');
}
};
Window_StatusInfo.prototype.getNatureColor = function(paramId, actor) {
var params = ['mhp', 'mmp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk'];
if(actor.actor().natureBuffs.match(params[paramId])) return _.buffColor;
if(actor.actor().natureNerfs.match(params[paramId])) return _.nerfColor;
return this.systemColor();
};
//Edit of Yanfly's drawGeneralParam function to draw Nature
Window_StatusInfo.prototype.drawGeneral = function() {
var dx = this.standardPadding() / 2;
var dy = 0;
var dw = (this.contents.width - this.standardPadding()) / 2;
var dh = this.lineHeight();
var text;
this.changeTextColor(this.systemColor());
this.drawText(Yanfly.Param.StatusParamText, dx, dy, dw, 'center');
//Draw Actor Nature
var ntext = _.text.replace(/%1/g, this._actor.nature());
this.changeTextColor(_.color);
this.contents.fontSize = _.size;
this.drawText(ntext, dx, this.lineHeight(), dw, 'center');
this.resetFontSettings();
this.changeTextColor(this.systemColor());
dx += this.contents.width / 2;
this.drawText(Yanfly.Param.StatusExpText, dx, dy, dw, 'center');
this.drawGeneralParam(dx, dy, dw, dh);
this.drawGeneralExp(dx, dy, dw, dh);
};
} else {
Window_Status.prototype.drawParameters = function(x, y) {
var lineHeight = this.lineHeight();
//Draw Actor Nature
var ntext = _.text.replace(/%1/g, this._actor.nature());
this.changeTextColor(_.color);
this.contents.fontSize = _.size;
this.drawText(ntext, x, y - (lineHeight / 2), 220, 'center');
this.resetFontSettings();
y += (lineHeight / 2);
for (var i = 0; i < 6; i++) {
var paramId = i + 2;
var y2 = y + lineHeight * i;
this.changeTextColor(this.getNatureColor(paramId, this._actor));
this.drawText(TextManager.param(paramId), x, y2, 160);
this.resetTextColor();
this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
}
};
Window_Status.prototype.getNatureColor = function(paramId, actor) {
var params = ['mhp', 'mmp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk'];
if(actor.actor().natureBuffs.match(params[paramId])) return _.buffColor;
if(actor.actor().natureNerfs.match(params[paramId])) return _.nerfColor;
return this.systemColor();
};
}
}
})(SRD.Natures, SRD.CopyActors);
} else alert('In order to use the SRD_Natures plugin, you need the SRD_CopyActors plugin installed and placed above.');