//=============================================================================
// Studio Tamamo - Actor Manager
// Tamamo_ActorManager.js
//=============================================================================
var Imported = Imported || {};
Imported.ActorManager = true;
var Tamamo = Tamamo || {};
Tamamo.ActorManager = Tamamo.ActorManager || {};
//=============================================================================
/*:
* @plugindesc v1.0 Manages the actors' despair and insanity.
* @author Palpaleos
*
* @param Soul Switch
* @desc This switch will trigger the common event. It should be unique.
* @default 1
*
* @param ---Despair---
* @default
*
* @param Despair Variable
* @desc A set of variables that represent this value.
* @default 1
*
* @param Despair Switch
* @desc This switch will trigger the common event. It should be unique.
* @default 1
*
* @param ---Insanity---
* @default
*
* @param Insanity Variable
* @desc A set of variables that represent this value.
* @default 5
*
* @param Insanity Switch
* @desc This switch will trigger the common event. It should be unique.
* @default 1
*
* @param ---Mood---
* @default
*
* @param Mood Variable
* @desc A set of variables that represent this value.
* @default 9
*
*
* @param ---Hunger---
* @default
*
* @param Hunger Variable
* @desc A set of variables that represent this value.
* @default 13
*
* @param Hunger Switch
* @desc This switch will trigger the common event. It should be unique.
* @default 1
*/
//=============================================================================
//=============================================================================
// Parameters
//=============================================================================
Tamamo.Parameters = PluginManager.parameters('Tamamo_ActorManager');
Tamamo.Param = {};
Tamamo.Param.SoulSwitch = Number(Tamamo.Parameters['Soul Switch'] || 2);
Tamamo.Param.DespairVariable = Number(Tamamo.Parameters['Despair Variable'] || 1);
Tamamo.Param.DespairSwitch = Number(Tamamo.Parameters['Despair Switch'] || 3);
Tamamo.Param.InsanityVariable = Number(Tamamo.Parameters['Insanity Variable'] || 5);
Tamamo.Param.InsanitySwitch = Number(Tamamo.Parameters['Insanity Switch'] || 4);
Tamamo.Param.MoodVariable = Number(Tamamo.Parameters['Mood Variable'] || 9);
Tamamo.Param.HungerVariable = Number(Tamamo.Parameters['Hunger Variable'] || 13);
Tamamo.Param.HungerSwitch = Number(Tamamo.Parameters['Hunger Switch'] || 5);
var HungerTimer=0;
//=============================================================================
// Game_Player
//=============================================================================
Tamamo.ActorManager.Game_Player_initialize = Game_Player.prototype.initialize;
Game_Player.prototype.initialize = function() {
Tamamo.Game_Player.initialize.call(this);
}
Tamamo.ActorManager.Game_Player_update = Game_Player.prototype.update;
Game_Player.prototype.update = function(sceneActive) {
if(sceneActive && $gameSwitches.value(Tamamo.GameInit)) {
this.updateParams();
}
Tamamo.ActorManager.Game_Player_update.call(this);
};
Game_Player.prototype.updateParams = function() {
var index=null;
var despairEnd=false;
var insanityEnd=false;
var hungerEnd=false;
if ($gameUnit.deadMembers().length > 0) {
$gameSwitches.setValue(Tamamo.Params.SoulSwitch, true);
}
HungerTimer+=1;
if(HungerTimer===3600){
HungerTimer=0;
}
for (var i = 0; i < 4; i++) {
index = $gameParty.actors[i].actorId;
//hungertimer
if(HungerTimer===0){
$gameParty.actors[i].gainMp(-1);
var shorthand =index+Tamamo.Params.HungerVariable;
if($gameParty.actors[i].mp===0){
$gameVariables.setValue($gameVariables.value(shorthand)+1);
$gameParty.actors[i].gainMp($gameParty.actors[i].mmp);
}
}
//dead ends
//despair
if($gameVariables.value(index+Tamamo.Params.DespairVariable-1)===1000) {
despairEnd=true;
}
//insanity
else if($gameVariables.value(index+Tamamo.Params.InsanityVariable-1)===1000) {
insanityEnd=true;
}
//hunger
else if($gameVariables.value(index+Tamamo.Params.HungerVariable-1)===4) {
hungerEnd=true;
}
}
if (despairEnd) $gameSwitches.setValue(Tamamo.Params.DespairSwitch, true);
if (insanityEnd) $gameSwitches.setValue(Tamamo.Params.InsanitySwitch, true);
if (hungerEnd) $gameSwitches.setValue(Tamamo.Params.HungerSwitch, true);
}
//=============================================================================
// Game_Interpreter
//=============================================================================
Tamamo.ActorManager.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Tamamo.ActorManager.Game_Interpreter_pluginCommand.call(this);
if(commmand === 'setMood')
{
var index = $gameParty.actors[args[0]].actorId;
var feelinfine = true;
var mood;
if(index+Tamamo.Params.DespairVariable-1 >=500) mood = 6;
else if(index+Tamamo.Params.InsanityVariable-1 >=500) mood = 7;
else {
mood=args[0]
}
$gameVariables.setValue(Tamamo.Params.MoodVariable,mood);
}
if(commmand === 'fillHunger')
{
$gameActors.actor(args[0]).gainMp($gameActors.actor(args[0]).mmp);
var index = $gameParty.actors[args[0]].actorId;
var shorthand = index+Tamamo.Params.InsanityVariable-1;
if($gameVariables.value(shorthand) > 0) {
$gameVariables.setValue(shorthand,$gameVariables.value(shorthand)-1);
}
}
};