== States Defaults ==
No description
This plugin requires the Battle Popup Customizer plugin:
http://sumrndm.site/battle-popup-customizer/
State Popups
Version 1.02
SomeRanDev
This plugin requires the Battle Popup Customizer plugin:
http://sumrndm.site/battle-popup-customizer/
This is an extension to the Battle Popup Customizer that adds popups that
display the addition or removal of States and Buffs during battles.
==============================================================================
List of State Notetags
==============================================================================
This is a list of notetags that can be used to customize the various
properties of a State's popup:
Use these to manipulate the default variables that are set up in the
Parameters for each individual State.
Example:
==============================================================================
Buff Explanation
==============================================================================
You can also use Buff/Debuff Popups with this plugin.
The Param IDs represent the default stats:
0 - Max HP
1 - Max MP
2 - Attack
3 - Defense
4 - Magic Attack
5 - Magic Defense
6 - Agility
7 - Luck
Use these as a guide to manipulate the various properties of the Buffs or
Debuffs in the Parameters!
==============================================================================
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,
~ SomeRanDev
var SRD = SRD || {};
SRD.StatePopups = SRD.StatePopups || {};
var Imported = Imported || {};
Imported["SumRndmDde State Popups"] = 1.02;
if(Imported["SumRndmDde Battle Popup Customizer"]) {
if(Imported["SumRndmDde Battle Popup Customizer"] < 1.10) {
alert("Your 'SRD_BattlePopupCustomizer' plugin is out of date. It is highly recommended that you update it.");
}
(function(_, __) {
"use strict";
//-----------------------------------------------------------------------------
// SRD.StatePopups
//-----------------------------------------------------------------------------
const params = PluginManager.parameters('SRD_StatePopups');
_.defaultAdd = String(params['Default Add Text']);
_.defaultRem = String(params['Default Remove Text']);
_.defaultX = String(params['Default X Pos']);
_.defaultY = String(params['Default Y Pos']);
_.defaultColor = String(params['Default Color']);
_.defaultOutline = String(params['Default Outline']);
_.defaultDuration = parseInt(params['Default Duration']);
_.defaultAnimations = String(params['Default Animations']).split(/\s*,\s*/);
_.defaultFlashColor = eval(`[${String(params['Default Flash Color'])}]`);
_.defaultFlashDuration = parseInt(params['Default Flash Duration']);
_.buffInfo = [];
for(let i = 0; i <= 7; i++) {
_.buffInfo[i] = {};
_.buffInfo[i].posText = String(params['Param '+i+' Pos Text']);
_.buffInfo[i].negText = String(params['Param '+i+' Neg Text']);
_.buffInfo[i].remText = String(params['Param '+i+' Remove Text']);
_.buffInfo[i].x = String(params['Param '+i+' X Pos']);
_.buffInfo[i].y = String(params['Param '+i+' Y Pos']);
_.buffInfo[i].color = String(params['Param '+i+' Color']);
_.buffInfo[i].outline = String(params['Param '+i+' Outline']);
_.buffInfo[i].duration = parseInt(params['Param '+i+' Duration']);
_.buffInfo[i].animations = String(params['Param '+i+' Animations']).split(/\s*,\s*/);
_.buffInfo[i].flashColor = eval(`[${String(params['Param '+i+' Flash Color'])}]`);
_.buffInfo[i].flashDuration = parseInt(params['Param '+i+' Flash Duration']);
}
_.loadNotetags = function() {
const addNote = /<Popup\s*Add\s*Text\s*:\s*(.*)\s*>/im;
const removeNote = /<Popup\s*Remove\s*Text\s*:\s*(.*)\s*>/im;
const xNote = /<Popup\s*X\s*:\s*(.*)\s*>/im;
const yNote = /<Popup\s*Y\s*:\s*(.*)\s*>/im;
const colorNote = /<Popup\s*Color\s*:\s*(.*)\s*>/im;
const outlineNote = /<Popup\s*Outline\s*:\s*(.*)\s*>/im;
const durationNote = /<Popup\s*Duration\s*:\s*(.*)\s*>/im;
const animatesNote = /<Popup\s*Animations\s*:\s*(.*)\s*>/im;
const flashColorNote = /<Popup\s*Flash\s*Color\s*:\s*(.*)\s*>/im;
const flashDurationNote = /<Popup\s*Flash\s*Duration\s*:\s*(.*)\s*>/im;
for(let i = 1; i < $dataStates.length; i++) {
const state = $dataStates[i];
if(state) {
const note = state.note;
state._sp_popupInfo = {};
if(note.match(addNote)) {
state._sp_popupInfo.addText = String(RegExp.$1);
} else {
state._sp_popupInfo.addText = _.defaultAdd;
}
if(note.match(removeNote)) {
state._sp_popupInfo.remText = String(RegExp.$1);
} else {
state._sp_popupInfo.remText = _.defaultRem;
}
if(note.match(xNote)) {
state._sp_popupInfo.x = String(RegExp.$1);
} else {
state._sp_popupInfo.x = _.defaultX;
}
if(note.match(yNote)) {
state._sp_popupInfo.y = String(RegExp.$1);
} else {
state._sp_popupInfo.y = _.defaultY;
}
if(note.match(colorNote)) {
state._sp_popupInfo.color = String(RegExp.$1);
} else {
state._sp_popupInfo.color = _.defaultColor;
}
if(note.match(outlineNote)) {
state._sp_popupInfo.outline = String(RegExp.$1);
} else {
state._sp_popupInfo.outline = _.defaultOutline;
}
if(note.match(durationNote)) {
state._sp_popupInfo.duration = parseInt(RegExp.$1);
} else {
state._sp_popupInfo.duration = _.defaultDuration;
}
if(note.match(animatesNote)) {
state._sp_popupInfo.animations = String(RegExp.$1).split(/\s*,\s*/);
} else {
state._sp_popupInfo.animations = _.defaultAnimations.clone();
}
if(note.match(flashColorNote)) {
state._sp_popupInfo.flashColor = eval(`[${String(RegExp.$1)}]`);
} else {
state._sp_popupInfo.flashColor = _.defaultFlashColor.clone();
}
if(note.match(flashDurationNote)) {
state._sp_popupInfo.flashDuration = parseInt(RegExp.$1);
} else {
state._sp_popupInfo.flashDuration = _.defaultFlashDuration;
}
}
}
};
//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------
let notetagsLoaded = false;
const _DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if(!_DataManager_isDatabaseLoaded.apply(this, arguments)) return false;
if(!notetagsLoaded) {
_.loadNotetags();
notetagsLoaded = true;
}
return true;
};
//-----------------------------------------------------------------------------
// Game_Battler
//-----------------------------------------------------------------------------
const _Game_Battler_addState = Game_Battler.prototype.addState;
Game_Battler.prototype.addState = function(stateId) {
if (this.isStateAddable(stateId) && !this.isStateAffected(stateId)) {
this._result.pushNewAddedState(stateId);
}
_Game_Battler_addState.apply(this, arguments);
};
//-----------------------------------------------------------------------------
// Game_ActionResult
//-----------------------------------------------------------------------------
const _Game_ActionResult_clear = Game_ActionResult.prototype.clear;
Game_ActionResult.prototype.clear = function() {
_Game_ActionResult_clear.apply(this, arguments);
this.newAddedStates = [];
};
Game_ActionResult.prototype.addedNewStateObjects = function() {
return this.newAddedStates.map(function(id) {
return $dataStates[id];
});
};
Game_ActionResult.prototype.isNewStateAdded = function(stateId) {
return this.newAddedStates.contains(stateId);
};
Game_ActionResult.prototype.pushNewAddedState = function(stateId) {
if (!this.isNewStateAdded(stateId)) {
this.newAddedStates.push(stateId);
}
};
//-----------------------------------------------------------------------------
// Sprite_Damage
//-----------------------------------------------------------------------------
const _Sprite_Damage_setup = Sprite_Damage.prototype.setup;
Sprite_Damage.prototype.setup = function(target) {
_Sprite_Damage_setup.apply(this, arguments);
if(!eval(__.condition)) return;
if(this._result.isStatusAffected()) {
const addStates = this._result.addedNewStateObjects();
const remStates = this._result.removedStateObjects();
const posBuffs = this._result.addedBuffs;
const negBuffs = this._result.addedDebuffs;
const remBuffs = this._result.removedBuffs;
for(let i = 0; i < addStates.length; i++) {
const state = addStates[i];
const info = state._sp_popupInfo;
info.text = info.addText.replace(/%1/, state.name);
this.createSpecialStateInfo(info);
this.incrementSpecial(__.xShift, __.yShift);
}
for(let i = 0; i < remStates.length; i++) {
const state = remStates[i];
const info = state._sp_popupInfo;
info.text = info.remText.replace(/%1/, state.name);
this.createSpecialStateInfo(info);
this.incrementSpecial(__.xShift, __.yShift);
}
for(let i = 0; i < posBuffs.length; i++) {
const info = _.buffInfo[posBuffs[i]];
info.text = info.posText;
this.createSpecialStateInfo(info);
this.incrementSpecial(__.xShift, __.yShift);
}
for(let i = 0; i < negBuffs.length; i++) {
const info = _.buffInfo[negBuffs[i]];
info.text = info.negText;
this.createSpecialStateInfo(info);
this.incrementSpecial(__.xShift, __.yShift);
}
for(let i = 0; i < remBuffs.length; i++) {
const info = _.buffInfo[remBuffs[i]];
info.text = info.remText;
this.createSpecialStateInfo(info);
this.incrementSpecial(__.xShift, __.yShift);
}
}
};
Sprite_Damage.prototype.createSpecialStateInfo = function(info) {
var bitmap = this.createChildBitmap(info, info.text.length);
var sprite = this.createChildSprite(bitmap);
sprite.bitmap.drawText(info.text, 0, 0, bitmap.width, bitmap.height, 'left');
sprite.dy = 0;
sprite.x = eval(info.x);
sprite.y = eval(info.y);
sprite.xBase = this._xOffsetSpecial;
sprite.yBase = this._yOffsetSpecial;
sprite.animations = info.animations.clone();
sprite.duration = info.duration;
sprite.oriDuration = sprite.duration;
sprite.flashColor = info.flashColor.clone();
sprite.flashDuration = info.flashDuration;
sprite.oriX = sprite.x;
sprite.oriY = sprite.y;
};
})(SRD.StatePopups, SRD.BattlePopupCustomizer);
} else {
alert("Please install 'SRD_BattlePopupCustomizer' in order to use 'SRD_StatePopups'!");
window.close();
}