Add english version

This commit is contained in:
OleSTEEP 2024-01-15 18:44:53 +03:00
parent 7bf44fa645
commit 49e9a37f3c
1675 changed files with 1309268 additions and 0 deletions

View file

@ -0,0 +1,6 @@
//=============================================================================
/*:
* @plugindesc ------------------------------------------------------------
* @author Yanfly Engine Plugins
*/
//=============================================================================

View file

@ -0,0 +1,100 @@
/*=============================================================================
* Tileset Properties as Regions
//=============================================================================
/*:
* @plugindesc <AEL_TilesetPropertyRegions> Uses regions to add tile properties.
* @author Archeia
*
* @param Ladder Region
* @desc Region used for Ladder Tiles.
* @default 2
*
* @param Counter Region
* @desc Region used for Counter Tiles.
* @default 3
*
* @param Damage Floor Region
* @desc Region used for Damage Tiles.
* @default 4
*
* @param Bush Region
* @desc Region used for Bush Tiles.
* @default 5
*
* @param Bush Height
* @desc Region used for Bush Tiles.
* @default 12
*
* @help This plugin adds tile properties like Ladder, Bush, Counter and Damage
* Floor to regions. This plugin also does not have any plugin commands.
*/
var Imported = Imported || {};
Imported.AEL_TilesetPropertyRegions = true;
//=============================================================================
// ** Parameter Check
//=============================================================================
var parameters = $plugins.filter(function(p) {
return p.description.contains('<AEL_TilesetPropertyRegions>') })[0].parameters;
//=============================================================================
// ** Set Parameters
//=============================================================================
var AEL = AEL || {};
AEL.TilesetPropertyRegions = AEL.TilesetPropertyRegions || {};
AEL.TilesetPropertyRegions.ladderRegion = Number(parameters['Ladder Region'] || 2);
AEL.TilesetPropertyRegions.counterRegion = Number(parameters['Counter Region'] || 3);
AEL.TilesetPropertyRegions.damageFloorRegion = Number(parameters['Damage Floor Region'] || 4);
AEL.TilesetPropertyRegions.bushRegion = Number(parameters['Bush Region'] || 5);
AEL.TilesetPropertyRegions.bushHeight = Number(parameters['Bush Height'] || 12);
//=============================================================================
// ** Game_Map
//-----------------------------------------------------------------------------
// The game object class for a map. It contains scrolling and passage
// determination functions.
//=============================================================================
// * Determine if Ladder
//=============================================================================
Game_Map.prototype.isLadder = function(x, y) {
return this.isValid(x, y) && (this.checkLayeredTilesFlags(x, y, 0x20) || this.regionId(x, y) === AEL.TilesetPropertyRegions.ladderRegion);
};
//=============================================================================
// * Determine if Counter
//=============================================================================
Game_Map.prototype.isCounter = function(x, y) {
return this.isValid(x, y) && (this.checkLayeredTilesFlags(x, y, 0x80) || this.regionId(x, y) === AEL.TilesetPropertyRegions.counterRegion);
};
//=============================================================================
// * Determine if Damage floor
//=============================================================================
Game_Map.prototype.isDamageFloor = function(x, y) {
return this.isValid(x, y) && (this.checkLayeredTilesFlags(x, y, 0x100) || this.regionId(x, y) === AEL.TilesetPropertyRegions.damageFloorRegion);
};
//=============================================================================
// * Determine if Bush
//=============================================================================
Game_Map.prototype.isBush = function(x, y) {
if(Imported.YED_Tiled){ // Add Compatibility with Tiled
// Check if on Region
var onRegion = this._regions !== undefined && this.regionId(x, y) === AEL.TilesetPropertyRegions.bushRegion;
return this.isValid(x, y) && (this.checkLayeredTilesFlags(x, y, 0x40) || onRegion)
} else {
return this.isValid(x, y) && (this.checkLayeredTilesFlags(x, y, 0x40) || this.regionId(x, y) === AEL.TilesetPropertyRegions.bushRegion);
}
};
//=============================================================================
// * Change Bush Depth
//=============================================================================
Game_CharacterBase.prototype.refreshBushDepth = function() {
if (this.isNormalPriority() && !this.isObjectCharacter() &&
this.isOnBush() && !this.isJumping()) {
if (!this.isMoving()) {
this._bushDepth = AEL.TilesetPropertyRegions.bushHeight;
}
} else {
this._bushDepth = 0;
}
};

View file

@ -0,0 +1,708 @@
//=============================================================================
// TDS Active Chain Skills
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_ActiveChainSkills = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.ActiveChainSkills = _TDS_.ActiveChainSkills || {};
//=============================================================================
/*:
* @author TDS
* @plugindesc
* This script allows you to chain skills in a combo.
*
* @param Minimun Time
* @desc How many frames minimum for chain allowance.
* @default 120
* @param Title Text
* @desc Text displayed above the active chain skills as a title.
* @default Active Chain Skills
* @param Title Font Size
* @desc Font size of the title text of active chain skills.
* @default 20
* @param Active Skill Sound
* @desc Sound effect played whenever an active chain skill has been selected.
* @default {"name": "Skill2", "pan": 0, "pitch": 100, "volume": 80}
*
******************************************************************************
* @param * Chain Input Text *
******************************************************************************
* @param () Up Skill ON
* @desc
* @default \C[17]\C[0]Chain:
*
* @param () Up Skill OFF
* @desc
* @default \C[7]Chain:
*
* @param () Up Skill ACT
* @desc
* @default \C[17]Chain:
*
******************************************************************************
*
* @param () Down Skill ON
* @desc
* @default \C[17]\C[0]Chain:
*
* @param () Down Skill OFF
* @desc
* @default \C[7]Chain:
*
* @param () Down Skill ACT
* @desc
* @default \C[17]Chain:
*
******************************************************************************
*
* @param () Left Skill ON
* @desc
* @default \C[17]\C[0]Attack:
*
* @param () Left Skill OFF
* @desc
* @default \C[7]Attack:
*
* @param () Left Skill ACT
* @desc
* @default \C[17]Attack:
*
******************************************************************************
*
* @param () Right Skill ON
* @desc
* @default \C[17]\C[0]Strike:
*
* @param () Right Skill OFF
* @desc
* @default \C[7]Strike:
*
* @param () Right Skill ACT
* @desc
* @default \C[17]Strike:
*
******************************************************************************
* @help
*-----------------------------------------------------------------------------
* * Skill Notetags - These notetags go in the skill notebox in the database.
*-----------------------------------------------------------------------------
* <ChainSkill: SkillId, Input>
* ^ This note tag allows you to set which skills can be chained to the one
* that has this note tag. Order in the notes reflects order of choice.
* ^ SkillId: Id of the skill that can be chained into.
* ^ Input: Name of the Input. (up, down, left, right, ok, cancel, control, tab, etc..)
*
* Examples:
* <ChainSkill: 15, up>
* <ChainSkill: 16, down>
* <ChainSkill: 17, left>
* <ChainSkill: 18, right>
*
* <ChainOnly> (Case Sensitive.)
* ^ This makes the skill only usable only in chains. (Does not affect enemies.)
*/
//=============================================================================
// Get Plugin Parameters
var parameters = PluginManager.parameters('Active Chain Skills');
// Initialize Parameters
_TDS_.ActiveChainSkills.params = {};
// Get Chain Title
_TDS_.ActiveChainSkills.params.chainTitle = String(parameters['Title Text'] || 'Active Chain Skills');
// Get Chain Title Font Size
_TDS_.ActiveChainSkills.params.titleFontSize = Number(parameters['Title Font Size'] ||20);
// Get Minimun Input time (In Frames)
_TDS_.ActiveChainSkills.params.minimunInputTime = Number(parameters['Minimun Time'] || 120);
// Get Active Skill Sound
_TDS_.ActiveChainSkills.params.activeSkillSound = JsonEx.parse(parameters['Active Skill Sound'] || '{"name": "Skill2", "pan": 0, "pitch": 100, "volume": 80}' );
// Initialize Input Data
_TDS_.ActiveChainSkills.params.inputData = {up: {}, down: {}, left: {}, right: {}};
// Up Data
_TDS_.ActiveChainSkills.params.inputData.up.on = String(parameters['(↑) Up Skill ON'] || '\\C[17]↑\\C[0]Chain: ');
_TDS_.ActiveChainSkills.params.inputData.up.off = String(parameters['(↑) Up Skill OFF'] || '\\C[7]↑Chain: ');
_TDS_.ActiveChainSkills.params.inputData.up.act = String(parameters['(↑) Up Skill ACT'] || '\\C[17]↑Chain: ');
// Down Data
_TDS_.ActiveChainSkills.params.inputData.down.on = String(parameters['(↓) Down Skill ON'] || '\\C[17]↓\\C[0]Chain: ');
_TDS_.ActiveChainSkills.params.inputData.down.off = String(parameters['(↓) Down Skill OFF'] || '\\C[7]↓Chain: ');
_TDS_.ActiveChainSkills.params.inputData.down.act = String(parameters['(↓) Down Skill ACT'] || '\\C[17]↓Chain: ');
// Left Data
_TDS_.ActiveChainSkills.params.inputData.left.on = String(parameters['(←) Left Skill ON'] || '\\C[17]←\\C[0]Chain: ');
_TDS_.ActiveChainSkills.params.inputData.left.off = String(parameters['(←) Left Skill OFF'] || '\\C[7]←Chain: ');
_TDS_.ActiveChainSkills.params.inputData.left.act = String(parameters['(←) Left Skill ACT'] || '\\C[17]←Chain: ');
// Right Data
_TDS_.ActiveChainSkills.params.inputData.right.on = String(parameters['(→) Right Skill ON'] || '\\C[17]→\\C[0]Chain: ');
_TDS_.ActiveChainSkills.params.inputData.right.off = String(parameters['(→) Right Skill OFF'] || '\\C[7]→Chain: ');
_TDS_.ActiveChainSkills.params.inputData.right.act = String(parameters['(→) Right Skill ACT'] || '\\C[17]→Chain: ');
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The static class that manages the database and game objects.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.DataManager_onLoad = DataManager.onLoad;
//=============================================================================
// * On Load Processing
//=============================================================================
DataManager.onLoad = function(object) {
// Run Original Function
_TDS_.ActiveChainSkills.DataManager_onLoad.call(this, object);
// Set Array & Type
var array = object, type = null;
// Object Switch
switch (object) {
case $dataSkills: type = 'SKILL' ;break;
}
// If Type is not null
if (type !== null) {
// If Array is an array
if (Array.isArray(array)) {
// Go Through Array
for (var i = 0; i < array.length; i++) {
// Get Data
var data = array[i];
// Extract MetaData
if (data) { this.extractActiveChainSkillMetaData(data, type); }
}
}
}
};
//=============================================================================
// * Extract Active Chain Skill Meta Data
//=============================================================================
DataManager.extractActiveChainSkillMetaData = function(data, type) {
// If Data has no notes return
if (data.note.length <= 0) { return; }
// If Type is skill
if (type === 'SKILL') {
// Initialize Chain Skill List
data.meta.chainSkillList = {};
// Get Regular Expression
var regExp = /<ChainSkill:(.+),(.+)>/ig;
var str = data.note, arr;
while ((arr = regExp.exec(str)) !== null) {
// Set Parameter Swap Values
data.meta.chainSkillList[arr[2].trim()] = Number(arr[1]);
}
}
};
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The static class that manages the database and game objects.
//=============================================================================
// * Set Active Chain Skill Window
//=============================================================================
BattleManager.setActiveChainSkillWindow = function(chainWindow) { this._activeChainSkillWindow = chainWindow; };
//=============================================================================
// ** Game_BattlerBase
//-----------------------------------------------------------------------------
// The superclass of Game_Battler. It mainly contains parameters calculation.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.Game_BattlerBase_meetsSkillConditions = Game_BattlerBase.prototype.meetsSkillConditions;
//=============================================================================
// * Determine if Skill Meets Use Conditions
//=============================================================================
Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
// Return false if Chain skill is restricted
if (this.isChainSkillRestrict(skill)) { return false; }
// Return Original Function
return _TDS_.ActiveChainSkills.Game_BattlerBase_meetsSkillConditions.call(this, skill);
};
//=============================================================================
// * Determine if Chain Skill is restricted
//=============================================================================
Game_BattlerBase.prototype.isChainSkillRestrict = function(skill) {
if (!this.isActor()) { return false;}
if (!$gameParty.inBattle()) { return false; }
if (!skill.meta.ChainOnly) { return false; }
return !this._activeChainEnabled;
};
//=============================================================================
// ** Game_Battler
//-----------------------------------------------------------------------------
// The superclass of Game_Actor and Game_Enemy. It contains methods for sprites
// and actions.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
_TDS_.ActiveChainSkills.Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
//=============================================================================
// * On Battle Start Processing
//=============================================================================
Game_Battler.prototype.onBattleStart = function() {
// Run Original Function
_TDS_.ActiveChainSkills.Game_Battler_onBattleStart.call(this);
// Set Active Chain Enabled Flag to false
this._activeChainEnabled = false;
};
//=============================================================================
// * On Battle End Processing
//=============================================================================
Game_Battler.prototype.onBattleEnd = function() {
// Run Original Function
_TDS_.ActiveChainSkills.Game_Battler_onBattleEnd.call(this);
// Set Active Chain Enabled Flag to false
this._activeChainEnabled = false;
};
//=============================================================================
// * Enable or Disable Active Chain
//=============================================================================
Game_Battler.prototype.enableActiveChain = function() { if (this.isActor()) { this._activeChainEnabled = true; } };
Game_Battler.prototype.disableActiveChain = function() { if (this.isActor()) { this._activeChainEnabled = false; } };
//=============================================================================
// * Add Active Skill Chain
//=============================================================================
Game_Battler.prototype.addActiveSkillChain = function(skillId) {
// Create Action
var action = new Game_Action(this);
// Set Action Active Chain Skill
action.setActiveChainSkill(skillId);
// Add Action to Actions list
this._actions.splice(1, 0, action);
};
//=============================================================================
// ** Game_Action
//-----------------------------------------------------------------------------
// The game object class for a battle action.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.Game_Action_isValid = Game_Action.prototype.isValid;
//=============================================================================
// * Set Active Chain Skill
//=============================================================================
Game_Action.prototype.setActiveChainSkill = function(skillId) {
// Set Skill
this.setSkill(skillId);
// Set Target
// this.subject().currentAction._targetIndex
this.setTarget(this.subject()._lastTargetIndex);
// Set Active Chain Skill
this._activeChainSkill = true;
};
//=============================================================================
// * Determine if action is valid
//=============================================================================
Game_Action.prototype.isValid = function() {
// Enable Active Chain
if (this._activeChainSkill) { this.subject().enableActiveChain(); }
// Get Original Result
var result = _TDS_.ActiveChainSkills.Game_Action_isValid.call(this);
// Disable Active Chain
if (this._activeChainSkill) { this.subject().disableActiveChain(); }
// Return Result
return result;
};
//=============================================================================
// ** Scene_Battle
//-----------------------------------------------------------------------------
// The scene class of the battle screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.Scene_Battle_CreateAllWindows = Scene_Battle.prototype.createAllWindows;
//=============================================================================
// * Create All Windows
//=============================================================================
Scene_Battle.prototype.createAllWindows = function() {
// Run Original Function
_TDS_.ActiveChainSkills.Scene_Battle_CreateAllWindows.call(this);
// Create Chain Skill Window
this.createChainSkillWindow();
};
//=============================================================================
// * Create Chain Skill Window
//=============================================================================
Scene_Battle.prototype.createChainSkillWindow = function() {
// Create Active Chain Skill Window
this._activeChainSkillWindow = new Window_ChainSkillList();
// Add Child
this.addChild(this._activeChainSkillWindow);
// Set Battle Manager Active Chain Skill Window
BattleManager.setActiveChainSkillWindow(this._activeChainSkillWindow);
};
//=============================================================================
// ** Window_BattleLog
//-----------------------------------------------------------------------------
// The window for displaying battle progress. No frame is displayed, but it is
// handled as a window for convenience.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ActiveChainSkills.Window_BattleLog_initialize = Window_BattleLog.prototype.initialize;
_TDS_.ActiveChainSkills.Window_BattleLog_startAction = Window_BattleLog.prototype.startAction;
_TDS_.ActiveChainSkills.Window_BattleLog_update = Window_BattleLog.prototype.update;
_TDS_.ActiveChainSkills.Window_BattleLog_updateWaitMode = Window_BattleLog.prototype.updateWaitMode;
_TDS_.ActiveChainSkills.Window_BattleLog_displayAction = Window_BattleLog.prototype.displayAction;
_TDS_.ActiveChainSkills.Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_BattleLog.prototype.initialize = function() {
// Run Original Function
_TDS_.ActiveChainSkills.Window_BattleLog_initialize.call(this);
// Set Active Chain Skill Input Couner to 0
this._activeChainSkillInputCounter = 0;
// Set Active Chain Skill to 0
this._activeChainSkill = 0;
};
//=============================================================================
// * Process Custom Code
//=============================================================================
Window_BattleLog.prototype.processCustomCode = function(code) { code(); };
//=============================================================================
// * Start Action
//=============================================================================
//Window_BattleLog.prototype.startAction = function(subject, action, targets) {
// Enable Active Chain
// this.push('processCustomCode', function() { subject.enableActiveChain();});
// Get Item
// var item = action.item();
// Show Chain List
// this.push('showChainSkillList', subject, item);
// Process Custom Code
// this.push('processCustomCode', _TDS_.ActiveChainSkills.Window_BattleLog_startAction.bind(this, subject, action, targets));
// Start Skill Chain Wait
// this.push('startChainSkillInputWait');
//};
//=============================================================================
// * Start Action
//=============================================================================
Window_BattleLog.prototype.startAction = function(subject, action, targets) {
// Enable Active Chain
this.push('processCustomCode', function() { subject.enableActiveChain();});
// Get Item
var item = action.item();
// Show Chain List
this.push('showChainSkillList', subject, item);
// Process Custom Code
this.push('processCustomCode', _TDS_.ActiveChainSkills.Window_BattleLog_startAction.bind(this, subject, action, targets));
// Clear Text
this.push('clear');
// Start Skill Chain Wait
this.push('startChainSkillInputWait');
};
//=============================================================================
// * Display Action Results
//=============================================================================
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
// Run Original Function
_TDS_.ActiveChainSkills.Window_BattleLog_displayActionResults.call(this, subject, target);
// If Subject is an actor
if (subject.isActor()) {
// Get Chain Window
var chainWindow = BattleManager._activeChainSkillWindow;
// If Chain Window is visible
if (chainWindow.visible) {
// Set Wait mode to chain skill input
this.push('setWaitMode', 'chainSkillInput');
// Hide Chain List
this.push('hideChainSkillList');
}
// Enable Active Chain
this.push('processCustomCode', function() { subject.disableActiveChain();});
}
};
//=============================================================================
// * Show Chain Skill List
//=============================================================================
Window_BattleLog.prototype.showChainSkillList = function(subject, skill) {
if (subject === undefined) { return; }
if (!subject.isActor()) { return; }
if (!DataManager.isSkill(skill)) { return; }
// Set Active Chain Skill to 0
// Get Chain Window
var chainWindow = BattleManager._activeChainSkillWindow;
this._activeChainSkill = 0;
// Setup Chain Window
chainWindow.setup(subject, skill);
// If Chain Window is more than 0
if (chainWindow._chainSkills.length > 0) { chainWindow.show(); }
};
//=============================================================================
// * Show Chain Skill List
//=============================================================================
Window_BattleLog.prototype.hideChainSkillList = function() {
// Set Active Chain Skill to 0
this._activeChainSkill = 0;
// Hide Active Chain Skill Window
BattleManager._activeChainSkillWindow.hide();
};
//=============================================================================
// * Start Chain Skill Input Wait
//=============================================================================
Window_BattleLog.prototype.startChainSkillInputWait = function() {
// Set Active chain Skill Input Counter
this._activeChainSkillInputCounter = _TDS_.ActiveChainSkills.params.minimunInputTime ;
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_BattleLog.prototype.update = function() {
// Get Chain Window
var chainWindow = BattleManager._activeChainSkillWindow;
// If Chain Window Exists and its visible
if (chainWindow && chainWindow.visible) { this.updateChainkSkillInput(); }
// Call Original Function
_TDS_.ActiveChainSkills.Window_BattleLog_update.call(this);
};
//=============================================================================
// * Update Chain Skill Input
//=============================================================================
Window_BattleLog.prototype.updateChainkSkillInput = function() {
// Get Chain Window
var chainWindow = BattleManager._activeChainSkillWindow;
// Get Chain Window Skill
var chainSkills = chainWindow._chainSkills;
// If Active Chain Skill is 0
if (this._activeChainSkill === 0) {
// Go Through Chain Skills
for (var i = 0; i < chainSkills.length; i++) {
// Get Input
var input = chainSkills[i][0];
// Get Skill
var skill = chainSkills[i][1];
// If Input is triggered
if (Input.isTriggered(input)) {
// Get Subject
var subject = chainWindow._battler;
if (!subject.canUse(skill)) { continue; }
if (!subject.isLearnedSkill(skill.id)) { continue; }
// Play Sound Effect
AudioManager.playSe(_TDS_.ActiveChainSkills.params.activeSkillSound);
// Set Chain Window Input
chainWindow.chainInput = input;
// Set Active Chain Skill Input Count to 12
this._activeChainSkillInputCounter = 12;
// Set Active Chain Skill Id
this._activeChainSkill = skill.id;
// Add Active Skill Chain to subject
subject.addActiveSkillChain(skill.id);
// Refresh Chain Window
// Break Loop
break;
}
}
}
// If Active Chain Skill Input counter is more than 0
if (this._activeChainSkillInputCounter > 0) {
// Decrease Active Chain Skill Input counter
this._activeChainSkillInputCounter--;
// Return True
return true;
}
};
//=============================================================================
// * Update Wait Mode
//=============================================================================
Window_BattleLog.prototype.updateWaitMode = function() {
// If Wait mode is for chain skill input
if (this._waitMode === 'chainSkillInput') {
// If Active Chain Skill Input counter is more than 0
if (this._activeChainSkillInputCounter > 0) { return true; }
}
// Return Original Function
return _TDS_.ActiveChainSkills.Window_BattleLog_updateWaitMode.call(this);
};
//=============================================================================
// ** Window_ChainSkillList
//-----------------------------------------------------------------------------
// The window for displaying battle progress. No frame is displayed, but it is
// handled as a window for convenience.
//=============================================================================
function Window_ChainSkillList() { this.initialize.apply(this, arguments);}
Window_ChainSkillList.prototype = Object.create(Window_Base.prototype);
Window_ChainSkillList.prototype.constructor = Window_ChainSkillList;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_ChainSkillList.prototype.initialize = function() {
// Get Width
var dw = Math.max(Math.round(Graphics.boxWidth / 2), 450);
// Super Call
Window_Base.prototype.initialize.call(this, -this.standardPadding(), 0, dw, this.fittingHeight(6));
// Set Opacity to 0;
this.opacity = 0;
// Hide
this.hide();
};
//=============================================================================
// * Setup
//=============================================================================
Window_ChainSkillList.prototype.setup = function(battler, skill) {
// Set Battler
this._battler = battler;
// Set Skill
this._skill = skill;
// Initialize Chain Skills Array
this._chainSkills = [];
// If Skill has a chain skill list
if (skill.meta.chainSkillList) {
// Get Inputs
var inputs = Object.keys(skill.meta.chainSkillList);
// Go Through Inputs
for (var i = 0; i < inputs.length; i++) {
// Get Input
var input = inputs[i];
// Get Chain Skill
var chainSkill = skill.meta.chainSkillList[input];
// If Battler does not have skill
if (!battler.isLearnedSkill(chainSkill)) { continue; }
// Add Skill to Chain Skills array
this._chainSkills.push([input, $dataSkills[chainSkill]]);
}
}
// Set Y Coordinates
this.y = Graphics.boxHeight - this.fittingHeight(4);
this.y -= this.fittingHeight(this._chainSkills.length + 1);
// Set Enabled Flag to true;
this._enabled = true;
// Refresh Contents
this.refresh();
};
//=============================================================================
// * Show Window
//=============================================================================
Window_ChainSkillList.prototype.show = function() {
// Activate Window
this.activate();
// Super Call
Window_Base.prototype.show.call(this);
};
//=============================================================================
// * Chain Input
//=============================================================================
Object.defineProperty(Window_ChainSkillList.prototype, 'chainInput', {
get: function() { return this._chainInput; },
set: function(value) {
// Set Chain Input
this._chainInput = value;
// Set Enabled Flag
this._enabled = false;
// Refresh if value is not null
if (value !== null) { this.refresh(); }
},
configurable: true
});
//=============================================================================
// * Refresh
//=============================================================================
Window_ChainSkillList.prototype.refresh = function() {
// Set Chain Input to null if enabled
if (this._enabled) { this._chainInput = null; }
// Clear Contents
this.contents.clear();
// Draw Background Color
this.drawBackgroundColor();
// Draw Chain Skill Title
this.drawChainSkillTitle();
// If Skill Exists
if (this._skill) {
// Draw Chain Skills
this.drawChainSkills();
}
};
//=============================================================================
// * Draw Background Color
//=============================================================================
Window_ChainSkillList.prototype.drawBackgroundColor = function() {
// Get Height
var dh = this.lineHeight() * (this._chainSkills.length + 1);
this.contents.gradientFillRect(0, 0, this.contents.width, dh, 'rgba(0, 0, 0, 192)', 'rgba(0, 0, 0, 0)');
this.contents.paintOpacity = 78;
this.contents.fillRect(0, this.lineHeight() - 4, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;
};
//=============================================================================
// * Draw Chain Skills
//=============================================================================
Window_ChainSkillList.prototype.drawChainSkillTitle = function() {
// Reset Font Settings
this.resetFontSettings();
this.contents.fontSize = _TDS_.ActiveChainSkills.params.titleFontSize;
this.contents.fontItalic = true;
// Draw Title
this.drawText(_TDS_.ActiveChainSkills.params.chainTitle, 12, 0, this.contents.width - 24);
// Reset Font Settings
this.resetFontSettings();
};
//=============================================================================
// * Draw Chain Skills
//=============================================================================
Window_ChainSkillList.prototype.drawChainSkills = function() {
// Set Starting X & Y
var sx = 24, sy = this.lineHeight();
// If Skill has a chain skill list
if (this._skill.meta.chainSkillList) {
// Get Inputs
var inputs = Object.keys(this._skill.meta.chainSkillList);
// Go Through Inputs
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
var skill = $dataSkills[this._skill.meta.chainSkillList[input]];
// If Skill has not been learned
if (!this._battler.isLearnedSkill(skill.id)) { continue; }
// Set Text
var text = '';
// Add Input Text Settings
text = text + this.inputTextSettings(input, skill);
// Add Format to Text
text = text + '\\i[%1]%2'.format(skill.iconIndex, skill.name);
// Draw Text
this.drawTextEx(text, sx, sy);
// Increase Starting Y
sy += this.lineHeight();
}
}
};
//=============================================================================
// * Input Text Settings
//=============================================================================
Window_ChainSkillList.prototype.inputTextSettings = function(input, skill) {
// Set Active Flag
var active = (input === this._chainInput);
// Initialize Text
var text = '';
// Get Input Data
var inputData = _TDS_.ActiveChainSkills.params.inputData;
// Get Input DAta
if (inputData[input]) {
// If Enabled and Battler can use skill
if (this._enabled && this._battler.canUse(skill)) {
// Set Text
text = inputData[input].on;
} else if (!this._enabled && active) {
// Set Text
text = inputData[input].act;
} else {
// Set Text
text = inputData[input].off;
}
}
// Return Text
return text;
};

View file

@ -0,0 +1,772 @@
//=============================================================================
// Aetherflow Plugins - Preload Everything
// Aetherflow_PreloadEverything.js
//=============================================================================
/*:
* @plugindesc v1.0.2 Preload All The Things. (IF YOU HAVE v1.6.1)
* @author Kaliya
*
* @param ReleaseMapChange
* @text Release On Map Change
* @type boolean
* @default true
* @desc Release non-system/global preloaded assets from memory on map change?
*
* @param PreloadSystem
* @text Preload System Resources
* @type boolean
* @default true
* @desc Preload all system based assets on start?
*
* @param ImageCacheSize
* @text Image Cache Size
* @desc Size of the image cache in bytes.
* @type text
* @default 10 * 1000 * 1000
*
* @param AudioCacheSize
* @text Audio Cache Size
* @desc Size of the audio cache in bytes.
* @type text
* @default 20 * 1000 * 1000
*
* @param PreloadGlobal
* @text Global Assets
* @type struct<PreloadContainer>
* @desc Preloaded assets that are kept in memory on game start.
*
* @param PreloadMaps
* @text Map Assets
* @desc A list of Preload Containers used for map assets.
* @type struct<PreloadMapContainer>[]
*
* @help
* ---------------------------------------------------------------------------------
* Introduction
* ---------------------------------------------------------------------------------
* This plugin is designed to allieviate your "preloading" problems. Tired of not
* having your sound play right away when you need it? Tired of some images not
* appearing? Well look no further because those days are a thing of the past. Not
* only does this plugin preload your thingys, but it also acts as a basic caching
* system to help with the problem of memory being overused (if done right). It is
* not a perfect solution, but it should help all games.
*
* NOTE: THIS PLUGIN REQUIRES RPG MAKER MV V1.6.1 IF YOU ARE NOT USING V1.6.1
* THIS PLUGIN WILL NOT WORK AND WILL ERROR OUT. YOU HAVE BEEN WARNED.
*
* ---------------------------------------------------------------------------------
* How-to
* ---------------------------------------------------------------------------------
* The system is fairly straightforward, it uses "containers" to preload and store
* resources. These containers come in two flavors:
*
* GLOBAL: This is a singular container, it is used to store Global, or game wide assets
* these assets are usually things you always want to be loaded. They are all loaded on
* game start.
*
* MAP: These containers are what you use to preload map resources. These containers
* are loaded when the map associated with them is entered. Depending on your plugin
* parameters they will also be released from the cache when you enter a new map.
*
* In order to use the containers you simply modify and add to them via plugin parameters.
*
* ---------------------------------------------------------------------------------
* Caching & How It Works
* ---------------------------------------------------------------------------------
*
* The caching system stores assets in memory until they are no longer needed and
* are manually purged via the available functions, or by being deleted by the system
* itself when a new resource is loaded and the cache is full.
*
* The cache size is determined by two plugin parameters:
*
* Image Cache Size: The size of the image cache in bytes.
*
* Audio Cache Size: The size of the audio cache in bytes.
*
* These two plugin parameters are evaluated and thus you can use math to determine
* what the size rather than having to write out a large number. (e.g: 10 * 1000 * 1000 is a 10MB cache).
*
* You can use various functions in the cache classes to "Reserve" a resource. These
* "reserved" resources will not be automatically purged, so be careful!
*
* When a resource is added to the cache, the cache is sorted by the time the resources were all
* last touched and then if a resource is not reserved it is purged and will need to be reacquired
* again when next used.
*
* ---------------------------------------------------------------------------------
* Containers
* ---------------------------------------------------------------------------------
* For those users who are more hands on, the caching system has a type of object
* known as a "Container". Think of this as a group of objects, that can all be cached
* together and then can all be purged together at the same time, for easy cleanup and
* management. These are not the same as containers you setup in the plugin parameters.
* These containers are only accessed and used via code.
*
* Various function exists to help with the ease and usage of containers. They are
* all well documented throughout the plugin but a brief overview of them is as follows:
*
* ImageManager/AudioManager.addContainer("containerName"): Adds a container to the
* specified resource cache for that type.
*
* ImageManager/AudioManager.addContainerItem("containerName", "itemKey"): Adds an item
* to the container. NOTE: It only adds a key to look up the item in the cache for purging,
* it does not preload or load an item for you, you will need to do that prior to adding it
* to a container.
*
* ImageManager/AudioManager.releaseContainer("containerName"): Releases all objects
* within the specified container from the cache.
*
* ImageManager/AudioManager.releaseContainerItem("containerName", "itemKey"): Releases
* the specified item from the specified container if it exists, freeing it from the
* cache.
*
* ---------------------------------------------------------------------------------
* Credits
* ---------------------------------------------------------------------------------
* This plugin is developed and maintained by Liquidize/Kaliya.
* Some code was ninja'ed with permission from Pivoo (http://pivoo.me)
*
* ---------------------------------------------------------------------------------
* Changelog
* ---------------------------------------------------------------------------------
*
* 1.0.2:
* - Fixed a bug wherein due to slight changes in handling paths, Map based container for images were not being loaded.
*
* 1.0.1:
* - Fixed a bug wherein due to a slight change before release, the path for audio files
* would be incorrect.
*
* 1.0.0:
* - Released!
*
*/
/*~struct~PreloadContainer:
@param Images
@type file[]
@dir images/
@desc A list of images you want to preload for this container.
@param Audio
@type file[]
@dir audio/
@desc A list of audio files you want to preload for this container.
*/
/*~struct~PreloadMapContainer:
@param MapId
@text Map ID
@type number
@desc The id the of map for this container.
@min 0
@max 999
@default 0
@param Images
@type file[]
@dir images/
@desc A list of images you want to preload for this container.
@param Audio
@type file[]
@dir audio/
@desc A list of audio files you want to preload for this container.
*/
//=============================================================================
// PluginManager
//
// NOTE: The parameter parsing functions were originally written by Pivoo (http://pivoo.me)
// he has kindly given me permission to include and modify them but all credit should
// go to him.
//=============================================================================
PluginManager.parseObject = function (obj) {
var output = new Object();
Object.keys(obj).forEach(function (key) {
var param = obj[key];
output[key] = this.parse(param, key);
}, this);
return output;
};
PluginManager.parseArray = function (arr, key) {
return arr.map(function (param, index) {
return this.parse(param, key + '[' + index + ']');
}, this);
};
PluginManager.parse = function (param, key) {
if (!isNaN(param) && param.contains('.')) {
return parseFloat(param);
} else {
try {
param = JSON.parse(param);
switch (param.constructor.name) {
case 'Object': return this.parseObject(param);
case 'Array': return this.parseArray(param, key);
default: return param;
}
} catch (err) {
return param;
}
}
};
//=============================================================================
// Configuration
//=============================================================================
var Aetherflow = Aetherflow || {};
Aetherflow.Preload = Aetherflow.Preload || {};
Aetherflow.Parameters = PluginManager.parameters('Aetherflow_PreloadEverything');
Aetherflow.Param = Aetherflow.Param || {};
Aetherflow.Param["ReleaseMapChange"] = Boolean(Aetherflow.Parameters["ReleaseMapChange"]);
Aetherflow.Param["PreloadSystem"] = eval(Aetherflow.Parameters["PreloadSystem"]);
Aetherflow.Param["PreloadConnections"] = Boolean(Aetherflow.Parameters["PreloadConnections"]);
Aetherflow.Param["GlobalContainer"] = Aetherflow.Parameters["PreloadGlobal"].length > 0 ? JSON.parse(Aetherflow.Parameters["PreloadGlobal"]) : {};
Aetherflow.Param["MapContainers"] = Aetherflow.Parameters["PreloadMaps"].length > 0 ? JSON.parse(Aetherflow.Parameters["PreloadMaps"]) : {};
Aetherflow.Param["ImageCacheSize"] = Number(eval(Aetherflow.Parameters["ImageCacheSize"])) || 10 * 1000 * 1000;
Aetherflow.Param["AudioCacheSize"] = Number(eval(Aetherflow.Parameters["AudioCacheSize"])) || 20 * 1000 * 1000;
// Parse the actual data into the Preload Object for referencing easier.
Aetherflow.Preload.GlobalContainer = PluginManager.parseObject(Aetherflow.Param.GlobalContainer);
Aetherflow.Preload.MapContainers = Object.values(PluginManager.parseObject(Aetherflow.Param.MapContainers));
//=============================================================================
// End Configuration
//=============================================================================
//=============================================================================
// Game_System
//=============================================================================
Game_System.prototype.releaseGlobalContainer = function () {
ImageManager.releaseGlobalContainer();
AudioManager.releaseGlobalContainer();
};
//=============================================================================
// WebAudio
//=============================================================================
WebAudio.prototype.bufferSize = function () {
return this._buffer ? this._buffer.length : null;
};
//=============================================================================
// ImageCache
//=============================================================================
Aetherflow.Preload.ImageCache_initialize = ImageCache.prototype.initialize;
ImageCache.prototype.initialize = function () {
this._containers = {};
Aetherflow.Preload.ImageCache_initialize.call(this);
};
ImageCache.prototype.releaseItem = function (key) {
if (this._items[key]) {
delete this._items[key];
return true;
}
return false;
};
ImageCache.prototype.addContainer = function (container) {
this._containers = this._containers || {};
if (!this._containers[container]) {
this._containers[container] = [];
}
};
ImageCache.prototype.addContainerItem = function (container, itemKey) {
if (this._containers[container]) {
this._containers[container].push(itemKey);
}
};
ImageCache.prototype.releaseContainer = function (container) {
if (!this._containers) this._containers = {};
if (!this._containers[container]) return false;
for (let key of this._containers[container]) {
this.releaseItem(key);
}
delete this._containers[container];
return true;
};
ImageCache.prototype.releaseContainerItem = function (container, itemKey) {
if (!this._container) this._containers = {};
if (!this._containers[container]) return false;
let index = this._containers[container].indexOf(itemKey);
if (index >= 0) {
this._containers[container].splice(index, 1);
return this.releaseItem(itemKey);
}
return false;
};
//=============================================================================
// ImageManager
//=============================================================================
ImageManager.addContainer = function (container) {
return this._imageCache.addContainer(container);
};
ImageManager.addContainerItem = function (container, key) {
return this._imageCache.addContainerItem(container, key);
};
ImageManager.releaseItem = function (img, hue) {
let key = this._generateCacheKey(img, hue);
return this._imageCache.releaseItem(key);
};
ImageManager.releaseContainer = function (container) {
return this._imageCache.releaseContainer(container);
};
ImageManager.releaseContainerItem = function (container, img, hue) {
let key = this._generateCacheKey(img, hue);
return this._imageCache.releaseContainerItem(container, key);
};
ImageManager.releaseGlobalContainer = function () {
return this.releaseContainer("global");
};
//=============================================================================
// AudioCache
//=============================================================================
function AudioCache() {
this.initialize.apply(this, arguments);
}
AudioCache.maxSize = Aetherflow.Param["AudioCacheSize"];
AudioCache.prototype.initialize = function () {
this._items = {};
this._containers = {};
};
AudioCache.prototype.add = function (key, value) {
this._items[key] = {
buffer: value,
touch: Date.now(),
key: key
};
this.truncateCache();
};
AudioCache.prototype.get = function (key) {
if (this._items[key]) {
let item = this._items[key];
item.touch = Date.now();
return item.buffer;
}
return null;
};
AudioCache.prototype.releaseItem = function (key) {
if (this._items[key]) {
delete this._items[key];
return true;
}
return false;
};
AudioCache.prototype.addContainer = function (container) {
this._containers = this._containers || {};
if (!this._containers[container]) {
this._containers[container] = [];
}
};
AudioCache.prototype.addContainerItem = function (container, itemKey) {
if (this._containers[container]) {
this._containers[container].push(itemKey);
}
};
AudioCache.prototype.releaseContainer = function (container) {
if (!this._containers) this._containers = {};
if (!this._container[container]) return false;
for (let key of this._containers[container]) {
this.releaseItem(key);
}
delete this._containers[container];
return true;
};
AudioCache.prototype.releaseContainerItem = function (container, itemKey) {
if (!this._containers) this._containers = {};
if (!this._containers[container]) return false;
let index = this._containers[container].indexOf(itemKey);
if (index >= 0) {
this._containers[container].splice(index, 1);
return this.releaseItem(itemKey);
}
return false;
};
AudioCache.prototype.reserve = function (key, value, reservationId) {
if (!this._items[key]) {
this._items[key] = {
buffer: value,
touch: Date.now(),
key: key
};
}
this._items[key].reservationId = reservationId;
};
AudioCache.prototype.releaseReservation = function (reservationId) {
let items = this._items;
let release = false;
Object.keys(items).map(function (key) {
return items[key];
}).forEach(function (item) {
if (item.reservationId === reservationId)
release = true;
delete item.reservationId;
});
return release;
};
AudioCache.prototype.truncateCache = function () {
let items = this._items;
let sizeLeft = AudioCache.maxSize;
Object.keys(items).map(function (key) {
return items[key];
}).sort(function (a, b) {
return b.touch - a.touch;
}).forEach(function (item) {
if (sizeLeft > 0 || this.mustBeHeld(item)) {
sizeLeft -= item.buffer.bufferSize() ? item.buffer.bufferSize() : 0; // If buffer isn't available than it isn't loaded.
} else {
delete items[item.key];
}
}.bind(this));
};
AudioCache.prototype.mustBeHeld = function (item) {
if (item.reservationId) return true;
if (!item.buffer.isReady()) return true;
return false;
};
AudioCache.prototype.isReady = function () {
let items = this._items;
return !Object.keys(items).some(function (key) {
return !items[key].buffer.isReady();
});
};
//=============================================================================
// AudioManager
//=============================================================================
AudioManager._cache = new AudioCache();
AudioManager._systemReservationId = Utils.generateRuntimeId();
AudioManager._defaultReservationId = "default";
window._aufs = require("fs");
AudioManager._generateCacheKey = function (path) {
return path;
};
AudioManager.clear = function () {
this._cache = new AudioCache();
};
AudioManager.isReady = function () {
return this._cache.isReady();
};
AudioManager.setDefaultReservationid = function (reservationId) {
this._defaultReservationId = reservationId;
};
AudioManager.addContainer = function (container) {
return this._cache.addContainer(container);
};
AudioManager.addContainerItem = function (container, itemKey) {
return this._cache.addContainerItem(container, itemKey);
};
AudioManager.loadBgm = function (filename) {
let path = this._path + "bgm/" + encodeURIComponent(filename) + this.audioFileExt();
return this.loadAudio(path);
};
AudioManager.loadBgs = function (filename) {
let path = this._path + "bgs/" + encodeURIComponent(filename) + this.audioFileExt();
return this.loadAudio(path);
};
AudioManager.loadSe = function (filename) {
let path = this._path + "se/" + encodeURIComponent(filename) + this.audioFileExt();
return this.loadAudio(path);
};
AudioManager.loadMe = function (filename) {
let path = this._path + "me/" + encodeURIComponent(filename) + this.audioFileExt();
return this.loadAudio(path);
};
AudioManager.loadAudio = function (path) {
path = _aufs.cachedAlternativeName(path);
let key = this._generateCacheKey(path);
let buffer = this._cache.get(key);
if (!buffer) {
buffer = new WebAudio(path);
this._cache.add(key, buffer);
}
return buffer;
};
AudioManager.reserveBgm = function (filename, reservationId) {
return this.reserveAudio("bgm/", filename, reservationId);
};
AudioManager.reserveBgs = function (filename, reservationId) {
return this.reserveAudio("bgs/", filename, reservationId);
};
AudioManager.reserveSe = function (filename, reservationId) {
return this.reserveAudio("se/", filename, reservationId);
};
AudioManager.reserveMe = function (filename, reservationId) {
return this.reserveAudio("me/", filename, reservationId);
};
AudioManager.reserveAudio = function (folder, filename, reservationId) {
if (filename) {
let path = _aufs.cachedAlternativeName(this._path + folder + encodeURIComponent(filename) + this.audioFileExt());
let buffer = new WebAudio(path);
this._cache.reserve(this._generateCacheKey(path), buffer, reservationId || this._defaultReservationId);
return buffer;
} else {
return null;
}
};
AudioManager.releaseItem = function (key) {
return this._cache.releaseItem(key);
};
AudioManager.releaseContainer = function (container) {
return this._cache.releaseContainer(container);
};
AudioManager.releaseContainerItem = function (container, key) {
return this._cache.releaseContainerItem(container, key);
};
AudioManager.releaseReservation = function (reservationId) {
return this._cache.releaseReservation(reservationId);
};
AudioManager.releaseGlobalContainer = function () {
return this.releaseContainer("global");
};
AudioManager.playBgm = function (bgm, pos) {
if (this.isCurrentBgm(bgm)) {
this.updateBgmParameters(bgm);
} else {
this.stopBgm();
if (bgm.name) {
if (Decrypter.hasEncryptedAudio && this.shouldUseHtml5Audio()) {
this.playEncryptedBgm(bgm, pos);
}
else {
this._bgmBuffer = this.loadBgm(bgm.name);
this.updateBgmParameters(bgm);
if (!this._meBuffer) {
this._bgmBuffer.play(true, pos || 0);
}
}
}
}
this.updateCurrentBgm(bgm, pos);
};
AudioManager.playBgs = function (bgs, pos) {
if (this.isCurrentBgs(bgs)) {
this.updateBgsParameters(bgs);
} else {
this.stopBgs();
if (bgs.name) {
this._bgsBuffer = this.loadBgs(bgs.name);
this.updateBgsParameters(bgs);
this._bgsBuffer.play(true, pos || 0);
}
}
this.updateCurrentBgs(bgs, pos);
};
AudioManager.playSe = function (se) {
if (se.name) {
this._seBuffers = this._seBuffers.filter(function (audio) {
return audio.isPlaying();
});
let buffer = this.loadSe(se.name);
this.updateSeParameters(buffer, se);
buffer.play(false);
this._seBuffers.push(buffer);
}
};
AudioManager.playMe = function (me) {
this.stopMe();
if (me.name) {
if (this._bgmBuffer && this._currentBgm) {
this._currentBgm.pos = this._bgmBuffer.seek();
this._bgmBuffer.stop();
}
this._meBuffer = this.loadMe(me.name);
this.updateMeParameters(me);
this._meBuffer.play(false);
this._meBuffer.addStopListener(this.stopMe.bind(this));
}
};
//=============================================================================
// DataManager
//=============================================================================
Aetherflow.Preload.DataManager_onLoad = DataManager.onLoad;
DataManager.onLoad = function (object) {
Aetherflow.Preload.DataManager_onLoad.call(this, object);
if (object === $dataSystem) {
Scene_Boot.loadSystemAudio();
Scene_Boot.loadGlobalContainer();
}
};
//=============================================================================
// Scene_Base
//=============================================================================
Aetherflow.Preload.Scene_Base_isReady = Scene_Base.prototype.isReady;
Scene_Base.prototype.isReady = function () {
return Aetherflow.Preload.Scene_Base_isReady.call(this) && AudioManager.isReady();
};
//=============================================================================
// Scene_Boot
//=============================================================================
Scene_Boot.loadSystemAudio = function () {
if (Aetherflow.Param.PreloadSystem === true) {
AudioManager.reserveBgm($dataSystem.airship.bgm.name, AudioManager._systemReservationId);
AudioManager.reserveBgm($dataSystem.battleBgm.name, AudioManager._systemReservationId);
AudioManager.reserveBgm($dataSystem.boat.bgm.name, AudioManager._systemReservationId);
AudioManager.reserveBgm($dataSystem.ship.bgm.name, AudioManager._systemReservationId);
AudioManager.reserveBgm($dataSystem.titleBgm.name, AudioManager._systemReservationId);
AudioManager.reserveMe($dataSystem.gameoverMe.name, AudioManager._systemReservationId);
AudioManager.reserveMe($dataSystem.defeatMe.name, AudioManager._systemReservationId);
AudioManager.reserveMe($dataSystem.victoryMe.name, AudioManager._systemReservationId);
$dataSystem.sounds.forEach(function (sound) {
AudioManager.reserveSe(sound.name, AudioManager._systemReservationId);
});
}
};
Scene_Boot.loadGlobalContainer = function () {
if (Aetherflow.Preload.GlobalContainer) {
ImageManager.addContainer("global");
AudioManager.addContainer("global");
let images = Aetherflow.Preload.GlobalContainer.Images;
if (images) {
for (let image of images) {
let folder = image.split('/')[0] + "/";
let file = image.split('/')[1];
let path = "img/" + folder;
ImageManager.reserveBitmap(path, file, 0, true);
ImageManager.addContainerItem("global", ImageManager._generateCacheKey(path, 0));
}
}
let sounds = Aetherflow.Preload.GlobalContainer.Audio;
if (sounds) {
for (let sound of sounds) {
let folder = sound.split('/')[0] + "/";
let file = sound.split('/')[1];
let path = require("fs").cachedAlternativeName("audio/" + folder + encodeURIComponent(file) + AudioManager.audioFileExt());
AudioManager.reserveAudio(folder, file);
AudioManager.addContainerItem("global", AudioManager._generateCacheKey(path));
}
}
}
};
//=============================================================================
// Scene_Map
//=============================================================================
Scene_Map.prototype.releaseAssets = function () {
let container = Aetherflow.Preload.MapContainers.find(function (element) {
return element.MapId === $gameMap.mapId();
});
if (container) {
if (container.Images && container.Images.length > 0) {
let images = container.Images;
for (let image of images) {
let folder = image.split('/')[0];
let file = image.split('/')[1];
let path = "img/" + folder + "/" + encodeURIComponent(file) + ".png";
ImageManager.releaseItem(path, 0);
}
}
if (container.Audio && container.Audio.length > 0) {
let sounds = container.Audio;
for (let sound of sounds) {
let folder = sound.split('/')[0];
let file = sound.split('/')[1];
AudioManager.releaseItem(require("fs").cachedAlternativeName("audio/" + folder + "/" + encodeURIComponent(file) + AudioManager.audioFileExt()));
}
}
}
};
Scene_Map.prototype.preloadAssets = function () {
let container = Aetherflow.Preload.MapContainers.find(function (element) {
return element.MapId === $gameMap.mapId();
});
if (container) {
let images = container.Images;
if (images) {
for (let image of images) {
let folder = image.split('/')[0] + "/";
let file = image.split('/')[1];
let path = "img/" + folder + encodeURIComponent(file) + ".png";
ImageManager.reserveNormalBitmap(path, 0, ImageManager._defaultReservationId);
}
}
let sounds = container.Audio;
if (sounds) {
for (let sound of sounds) {
let folder = sound.split('/')[0] + "/";
let file = sound.split('/')[1];
AudioManager.reserveAudio(folder, file, AudioManager._defaultReservationId);
}
}
}
};
Aetherflow.Preload.Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function () {
this.releaseAssets();
Aetherflow.Preload.Scene_Map_onMapLoaded.call(this);
this.preloadAssets();
};

View file

@ -0,0 +1,35 @@
//=============================================================================
// TDS Anti Fail Actions
//=============================================================================
/*:
* @plugindesc Prevents failure messages from appearing in certain actions.
*
* @author TDS
*
* @help
*
* Action Note Tags:
*
* <AntiFail>
*
*/
(function() {
//==============================================================================================
// ** Game_Action
//==============================================================================================
// Alias Listing
var tds_AntiFailActions_Game_Action_applyItemUserEffect = Game_Action.prototype.applyItemUserEffect;
//==============================================================================================
// * Apply Item User Effect
//==============================================================================================
Game_Action.prototype.applyItemUserEffect = function(target) {
// Run Original Method
tds_AntiFailActions_Game_Action_applyItemUserEffect.call(this, target);
// If Anti Fail make success
if (this.item().meta.AntiFail) { this.makeSuccess(target) }
};
})();

View file

@ -0,0 +1,250 @@
//=============================================================================
// Archeia Core Changes
// Version: 1.0
//=============================================================================
/*:
* @plugindesc <Archeia_CoreChanges>
* This plugin modifies the core script and adds new things.
*
* @author AEL
*
* @help
*
* Nothing needs to be done.
*
*/
//=============================================================================
var Imported = Imported || {};
Imported.Archeia_CoreChanges = true;
//=============================================================================
// ** Parameter Check
//=============================================================================
var parameters = $plugins.filter(function(p) {
return p.description.contains('<Archeia_CoreChanges>') })[0].parameters;
//=============================================================================
// ** Set Parameters
//=============================================================================
var AEL = AEL || {};
AEL.Archeia_CoreChanges = AEL.Archeia_CoreChanges || {};
//-----------------------------------------------------------------------------
// * Fix Pixi FPS
//-----------------------------------------------------------------------------
/*(function(){
const oldFPSMeter = FPSMeter;
FPSMeter = function(){
oldFPSMeter.apply(this);
const FPSMeter_pause = this.pause;
this.pause = function(){
FPSMeter_pause.apply(this);
//sadly, we can't get frameId because of the fpsmeter.js is minified
//so, restart ticker in all case.
PIXI.ticker.shared._requestId = null;
PIXI.ticker.shared._requestIfNeeded();
}
}
})();*/
//-----------------------------------------------------------------------------
// * Pixi Texture Fix
//-----------------------------------------------------------------------------
PIXI.glCore.GLTexture.prototype.upload = function(source)
{
this.bind();
var gl = this.gl;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
var isVideo = !!source.videoWidth;
var newWidth = isVideo ? source.videoWidth : source.width;
var newHeight = isVideo ? source.videoHeight : source.height;
if(newHeight !== this.height || newWidth !== this.width || isVideo)
{
gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source);
}
else
{
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.format, this.type, source);
}
this.width = newWidth;
this.height = newHeight;
};
//-----------------------------------------------------------------------------
// * Remove smoothing from graphics
//-----------------------------------------------------------------------------
Graphics._centerElement = function(element) {
var width = element.width * this._realScale;
var height = element.height * this._realScale;
element.style.position = 'absolute';
element.style.margin = 'auto';
element.style.top = 0;
element.style.left = 0;
element.style.right = 0;
element.style.bottom = 0;
element.style.width = width + 'px';
element.style.height = height + 'px';
element.style["image-rendering"] = "pixelated";
element.style["font-smooth"] = "none";
};
//-----------------------------------------------------------------------------
// * Change Balloon Image based on Variable
//-----------------------------------------------------------------------------
Sprite_Balloon.prototype.loadBitmap = function() {
this.bitmap = ImageManager.loadSystem($gameVariables.value(25));
this.setFrame(0, 0, 0, 0);
};
//-----------------------------------------------------------------------------
// * Change Size for Balloon Icons to follow RMVXA Standards
//-----------------------------------------------------------------------------
Sprite_Balloon.prototype.updateFrame = function() {
var w = 32;
var h = 24;
var sx = this.frameIndex() * w;
var sy = (this._balloonId - 1) * h;
this.setFrame(sx, sy, w, h);
};
//-----------------------------------------------------------------------------
// * Disable Window Frame Stretching
//-----------------------------------------------------------------------------
(function() {
Window.prototype._refreshFrame = function() {
var w = this._width;
var h = this._height;
var m = 24;
var bitmap = new Bitmap(w, h);
this._windowFrameSprite.bitmap = bitmap;
this._windowFrameSprite.setFrame(0, 0, w, h);
if (w > 0 && h > 0 && this._windowskin) {
var skin = this._windowskin;
var p = 96;
var q = 96;
//Creates easy references for original/new width and height
var oWid = p-m*2;
var nWid = w-m*2;
var oHei = p-m*2;
var nHei = h-m*2;
//Divides to find how many complete repeats for horizontal and vertical
var hRep = Math.floor(nWid / oWid);
var vRep = Math.floor(nHei / oHei);
//Finds remainders for the "fraction" remaining
var hRem = nWid % oWid;
var vRem = nHei % oHei;
//Top Side
for(var i = 0; i < hRep; i++) {
bitmap.blt(skin, p+m, 0, oWid, m, m + (i*oWid), 0, oWid, m);
}
bitmap.blt(skin, p+m, 0, hRem, m, m + (oWid*hRep), 0, hRem, m);
//Bottom Side
for(var i = 0; i < hRep; i++) {
bitmap.blt(skin, p+m, q-m, oWid, m, m + (i*oWid), h-m, oWid, m);
}
bitmap.blt(skin, p+m, q-m, hRem, m, m + (oWid*hRep), h-m, hRem, m);
//Left Side
for(var i = 0; i < vRep; i++) {
bitmap.blt(skin, p, m, m, oHei, 0, m + (i*oHei), m, oHei);
}
bitmap.blt(skin, p, m, m, vRem, 0, m + (vRep*oHei), m, vRem);
//Right Side
for(var i = 0; i < vRep; i++) {
bitmap.blt(skin, p+q-m, m, m, oHei, w-m, m + (i*oHei), m, oHei);
}
bitmap.blt(skin, p+q-m, m, m, vRem, w-m, m + (vRep*oHei), m, vRem);
//Top-Left Corner
bitmap.blt(skin, p+0, 0+0, m, m, 0, 0, m, m);
//Top-Right Corner
bitmap.blt(skin, p+q-m, 0+0, m, m, w-m, 0, m, m);
//Bottom-Left Corner
bitmap.blt(skin, p+0, 0+q-m, m, m, 0, h-m, m, m);
//Bottom-Right Corner
bitmap.blt(skin, p+q-m, 0+q-m, m, m, w-m, h-m, m, m);
}
};
})();
// //-----------------------------------------------------------------------------
// // * Adjust Player Walk Speed
// //-----------------------------------------------------------------------------
// Game_CharacterBase.prototype.realMoveSpeed = function() {
// if (this.isDashing()) {
// return Math.min(4, this._moveSpeed + 1);
// } else {
// return Math.max(3, this._moveSpeed - 1);
// }
// };
//-----------------------------------------------------------------------------
// * Region Randomize
//-----------------------------------------------------------------------------
// Script Call:
// $gameMap.randomPos(eventId, regionId);
//-----------------------------------------------------------------------------
Game_Map.prototype.randomPos = function(eventId, regionId) {
var coords = [];
for (var x = 0; x < $dataMap.width; x++) {
for (var y = 0; y < $dataMap.height; y++) {
var region = this.regionId(x, y);
if (region == regionId) {
coords.push([x, y]);
}
}
}
if (coords.length === 0) return;
var idx = Math.randomInt(coords.length);
var randomCoord = coords[idx];
var event = this._events[eventId];
event.setPosition(randomCoord[0], randomCoord[1]);
};
//-----------------------------------------------------------------------------
// * Disable Galv Camera
//-----------------------------------------------------------------------------
var temp_DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
temp_DataManager_createGameObjects.call(this);
$gameSwitches.setValue(5008, true);
}
//-----------------------------------------------------------------------------
// * Remove Weather Dimming
//-----------------------------------------------------------------------------
var archeia_createDimmer = Weather.prototype._createDimmer;
Weather.prototype._createDimmer = function() {
archeia_createDimmer.call(this);
this._dimmerSprite.setColor(255, 255, 255);
};
//-----------------------------------------------------------------------------
// * Change Follower Graphic to either Idle/Walk/Run
//-----------------------------------------------------------------------------
// var archeia_Game_Player_isDashing = Game_Player.prototype.isDashing;
// Game_Player.prototype.isDashing = function() {
// archeia_Game_Player_isDashing.call(this);
// if $gameSwitches(18) === true {
// }
// };

View file

@ -0,0 +1,250 @@
/*=============================================================================
* Archeia - Message Codes
* By Liquidize - htp://anima.mintkit.lol
* Archeia_MessageCodes.js
* Version: 1.02
*
* This plugin was created by Liquidize for use by Archeia and their team(s),
* I do not request credit in any form, You are licensed to use this plugin in
* anyway you see fit, for any number of projects,games,websites,etc,etc.
*
*
*=============================================================================*/
/*:
* @plugindesc Plugin Description <Archeia_MessageCodes>
* @author Liquidize
*
* @param Variable Set Code
* @desc The escape code used to set a variable.
* @default Var
*
* @param Variable Add Code
* @desc The escape code used to do the addition operation on a variable.
* @default VarA
*
* @param Variable Sub Code
* @desc The escape code used to do the subtraction operation on a variable.
* @default VarS
*
* @param Variable Mul Code
* @desc The escape code used to do the multiplication operation on a variable.
* @default VarX
*
* @param Variable Div Code
* @desc The escape code used to do the division operation on a variable.
* @default VarD
*
* @param Variable Mod Code
* @desc The escape code used do modulo on a variable.
* @default VarM
*
* @param Common Event Code
* @desc The escape code used to call a common event.
* @default Com
*
*
* @help
* This plugin provides two additional escape codes for use in messages. The
* first being an escape code to set the value of a variable, the second being
* an escape code to call a common event.
*
* ---------------------------------------------------------------------------
*
* To use the escape code to set a variable follow the below format:
*
* \ESCAPECODEHERE[VARIABLEID,VALUE]
*
* E.G: \V[10,10]
*
* The above example will set the variable with ID 10, to be the value of 10.
* The V is used as the escape code, as thats what the default value is. You can
* change this value by editing the Variable Code parameter.
*
*
*
* ---------------------------------------------------------------------------
*
* To use the escape code to call a common event, use the following:
*
* \ESCAPECODEHERE[COMMONEVENTID]
*
* E.G: \C[1]
*
* The above example will call the common event with ID of 1. The escape code
* used is C because that is the value of the default escape code, you can
* change it in the parameters.
*
* ============================================================================
* Change Log
* ============================================================================
*
* Version 1.02:
* - Refactored Code
* - Added the ability to call events while in battle.
* - Added the other operations when setting variables (albeit buggy).
*
* Version 1.01a:
* - Another potential fix for things.
*
* Version 1.01:
* - Fixed an issue causing incompatibility with YEP_MessageCore.
* - Potential fix for instant common event execution.
*
* Version 1.0:
* - Finished Script!
*
*=============================================================================*/
var Imported = Imported || {};
var Archeia = Archeia || {};
Archeia.MessageCodes = Archeia.MessageCodes || {};
Archeia.Utils = Archeia.Utils || {};
(function ($) {
"use strict";
var parameters = $plugins.filter(function (plugin) {
return plugin.description.contains('<Archeia_MessageCodes>');
});
if (parameters.length === 0) {
throw new Error("Couldn't find the parameters of Archeia_MessageCodes.");
}
$.Parameters = parameters[0].parameters;
$.Param = {};
$.Param.variableSetCode = String($.Parameters['Variable Set Code']);
$.Param.variableAddCode = String($.Parameters['Variable Add Code']);
$.Param.variableSubCode = String($.Parameters['Variable Sub Code']);
$.Param.variableMulCode = String($.Parameters['Variable Mul Code']);
$.Param.variableDivCode = String($.Parameters['Variable Div Code']);
$.Param.variableModCode = String($.Parameters['Variable Mod Code']);
$.Param.commonEventCode = String($.Parameters['Common Event Code']);
//================================================================================
// Window_Base
//================================================================================
Window_Base.prototype.obtainEscapeParamsArray = function (textState) {
var arr = /^\[(\d+,\d+)]/.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return arr[1].split(',');
} else {
return '';
}
};
var Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter;
Window_Message.prototype.processEscapeCharacter = function (code, textState) {
if (code === $.Param.commonEventCode.toUpperCase()) {
if ($gameParty && $gameParty.inBattle()) {
$gameTroop.setupCommonEvent(parseInt(this.obtainEscapeParam(textState)));
} else {
$gameMap.setupCommonEvent(parseInt(this.obtainEscapeParam(textState)));
}
} else if (code === $.Param.variableSetCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),0);
} else if (code === $.Param.variableAddCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),1);
} else if (code === $.Param.variableSubCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),2);
} else if (code === $.Param.variableMulCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),3);
} else if (code === $.Param.variableDivCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),4);
} else if (code === $.Param.variableModCode.toUpperCase()) {
this.changeVariable(this.obtainEscapeParamsArray(textState),5);
} else {
Window_Message_processEscapeCharacter.call(this, code, textState);
}
};
Window_Message.prototype.changeVariable = function (data,operation) {
if (data) {
var varId = parseInt(data[0]);
try {
var oldVal = $gameVariables.value(varId);
var val = parseInt(data[1]);
switch (operation) {
case 0:
$gameVariables.setValue(varId,oldVal = val);
break;
case 1:
$gameVariables.setValue(varId,oldVal + val);
break;
case 2:
$gameVariables.setValue(varId,oldVal - val);
break;
case 3:
$gameVariables.setValue(varId,oldVal * val);
break;
case 4:
$gameVariables.setValue(varId,oldVal / val);
break;
case 5:
$gameVariables.setValue(varId,oldVal % val);
break;
}
} catch (e) {
$gameVariables.setValue(varId,0);
}
}
};
//================================================================================
// Game_Map
//================================================================================
Game_Map.prototype.setupCommonEvent = function (commonId) {
var commonEvent = $dataCommonEvents[commonId];
if (commonEvent) {
var eventId = this._interpreter.isOnCurrentMap() ? this._interpreter._eventId : 0;
this._interpreter.setupChild(commonEvent.list, eventId);
}
};
Game_Map.prototype.stopCurrentEvent = function () {
if (this.isEventRunning()) {
this._interpreter.terminate();
}
};
//================================================================================
// Game_Troop
//================================================================================
Game_Troop.prototype.setupCommonEvent = function(commonId) {
var commonEvent = $dataCommonEvents[commonId];
if (commonEvent) {
var eventId = this._interpreter.isOnCurrentMap() ? this._interpreter._eventId : 0;
this._interpreter.setupChild(commonEvent.list, eventId);
}
};
//================================================================================
// UTILS
//================================================================================
// The below is a string formatting function that gives me/js/people/anyone/stuff
// the ability to use C#/C styled string formatting using {0},{1} for parameters.
Archeia.Utils.sformat = function () {
var theString = arguments[0];
for (var i = 1; i < arguments.length; i++) {
var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
theString = theString.replace(regEx, arguments[i]);
}
return theString;
};
})(Archeia.MessageCodes);
ArcheiaMessageCodes = Archeia.MessageCodes;
Imported["Archeia_MessageCodes"] = 1.02;

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,697 @@
//=============================================================================
// ★ Aries003_WeatherControl ★ 1.0.0
//=============================================================================
/*:
* @plugindesc Fine-tune in-game weather with various customizable features.
* @author Aries
*
* @help
* Aries003_WeatherControl 1.0.0
* ----------------------------------------------------------------------------
* The Weather Control plugin allows you to control the existing
* weather effects with much more fine-grained authority,
* and adds 3 new weather effects that does not come with RPG Maker MV.
*
* Control the look and feel of in-game weather by adjusting speed, angle,
* size, and assign an image for the 3 built-in weather effects.
*
* Thunder strikes can occur periodically, flashing the screen and playing
* a thunder sound effect. You can adjust the period and
* randomness via parameters.
*
* Plugin commands are also supplied that allow you to change images in-game.
* This change is not saved between files.
* ----------------------------------------------------------------------------
* Listed below are plugin and script commands to adjust weather in-game.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Plugin: AriesToggleStormThunder [Flag]
* Script: Aries.P003_WCT.toggleStormThunder [Flag]
*
* Enables or disables thunderflashes during a Storm.
* [Flag] - 'true' or 'false' without quotation marks.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Plugin: AriesWeather [Weather] [Power] [Duration]
* Script: $gameScreen.changeWeather([Weather], [Power], [Duration])
*
* Sets the current weather.
* [Weather] - 'none', 'rain', 'storm', 'snow', 'leaves', 'embers', 'shine'
* [Power] - A number between 1 to 9
* [Duration] - The duration in frames of how long the transition occurs for.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Plugin: AriesSetWeatherImage [Weather] [Filename]
* Script: Aries.P003_WCT.setWeatherImage([Weather], [Filename])
*
* Sets the current weather.
* [Weather] - 'none', 'rain', 'storm', 'snow', 'leaves', 'embers', 'shine'
* [Filename] - New image file for the weather effect.
* ----------------------------------------------------------------------------
* Changelog
* ----------------------------------------------------------------------------
*
* @param Rain
* @default
*
* @param Detailed Settings (Rain)
* @parent Rain
* @default
*
* @param Storm
* @default
*
* @param Detailed Settings (Storm)
* @parent Storm
* @default
*
* @param Snow
* @default
*
* @param Detailed Settings (Snow)
* @parent Snow
* @default
*
* @param Leaves
* @default
*
* @param Detailed Settings (Leaves)
* @parent Leaves
* @default
*
* @param Embers
* @default
*
* @param Detailed Settings (Embers)
* @parent Embers
* @default
*
* @param Shine
* @default
*
* @param Detailed Settings (Shine)
* @parent Shine
* @default
*
* @param Rain Image
* @parent Rain
* @desc Define a Picture file for raindrops. (Place image in the Pictures folder.)
* Valid: Any file name. Leave empty for default.
* @default
*
* @param Raindrop Count Minimum
* @parent Rain
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during Rain with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 12
*
* @param Raindrop Count Maximum
* @parent Rain
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during Rain with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 300
*
* @param Raindrop Lifetime
* @parent Detailed Settings (Rain)
* @type number
* @min 1
* @max 30
* @desc Controls how long a raindrop should last during Rain.
* Valid: A number between 1 to 30
* @default 5
*
* @param Raindrop Speed
* @parent Detailed Settings (Rain)
* @type number
* @min 1
* @max 100
* @desc Controls the speed of a raindrop during Rain.
* Valid: A number between 1 to 100
* @default 35
*
* @param Raindrop Angle Base
* @parent Detailed Settings (Rain)
* @type number
* @min -60
* @max 60
* @desc Controls the base angle at which raindrops fall during Rain.
* Valid: A number between -60 to 60
* @default 9
*
* @param Raindrop Angle Variation
* @parent Detailed Settings (Rain)
* @type number
* @min 0
* @max 180
* @desc Deviate raindrop angle up to X degrees during Rain. (4 is +-4°)
* Valid: A number between 0 to 180
* @default 4
*
* @param Raindrop Opacity Base
* @parent Detailed Settings (Rain)
* @type number
* @min 0
* @max 255
* @desc Controls the opacity of raindrops during Rain.
* Valid: A number between 0 to 255
* @default 180
*
* @param Raindrop Opacity Variation
* @parent Detailed Settings (Rain)
* @type number
* @min 0
* @max 128
* @desc Deviate raindrop opacity up to X value during Rain. (60 is +-60 opacity)
* Valid: A number between 0 to 128
* @default 60
*
* @param Raindrop Size Variation
* @parent Detailed Settings (Rain)
* @type number
* @min 0
* @max 50
* @desc Deviate raindrop sizes up to X% during Rain. (No effect when not using an image.)
* Valid: A number between 0 to 50
* @default 20
*
* @param Storm Raindrop Lifetime
* @parent Detailed Settings (Storm)
* @type number
* @min 1
* @max 30
* @desc Controls how long a raindrop should last during Storm.
* Valid: A number between 1 to 30
* @default 2
*
* @param Storm Raindrop Speed
* @parent Detailed Settings (Storm)
* @type number
* @min 1
* @max 100
* @desc Controls the speed of a raindrop during Storm.
* Valid: A number between 1 to 100
* @default 75
*
* @param Storm Raindrop Angle Base
* @parent Detailed Settings (Storm)
* @type number
* @min -60
* @max 60
* @desc Controls the base angle at which raindrops fall during Storm.
* Valid: A number between -60 to 60
* @default 18
*
* @param Storm Raindrop Angle Variation
* @parent Detailed Settings (Storm)
* @type number
* @min 0
* @max 180
* @desc Deviate raindrop angle up to X degrees during Storm. (12 is +-12°)
* Valid: A number between 0 to 180
* @default 12
*
* @param Storm Raindrop Opacity Base
* @parent Detailed Settings (Storm)
* @type number
* @min 0
* @max 255
* @desc Controls the opacity of raindrops during Storm.
* Valid: A number between 0 to 255
* @default 210
*
* @param Storm Raindrop Opacity Variation
* @parent Detailed Settings (Storm)
* @type number
* @min 0
* @max 128
* @desc Deviate raindrop opacity up to X value during Rain. (125 is +-125 opacity)
* Valid: A number between 0 to 128
* @default 125
*
* @param Storm Raindrop Size Variation
* @parent Detailed Settings (Storm)
* @type number
* @min 0
* @max 50
* @desc Deviate raindrop sizes up to X% during Storm. (No effect when not using an image.)
* Valid: A number between 0 to 50
* @default 33
*
* @param Storm Thunder
* @parent Storm
* @type boolean
* @on On
* @off Off
* @desc Flash the screen and play a sound effect occasionally during Storm.
* Valid: True/False
* @default true
*
* @param Storm Thunder in Battle
* @parent Storm Thunder
* @type boolean
* @on On
* @off Off
* @desc Allow thunderflashes to occur in battle.
* Valid: True/False
* @default false
*
* @param Thunder Sound
* @parent Storm Thunder
* @desc Sound effect to play when a thunderflash occurs.
* Valid: Any file name.
* @default Thunder9
*
* @param Thunder Sound Volume
* @parent Storm Thunder
* @type number
* @min 0
* @max 100
* @desc Volume of the sound effect played when a thunderflash occurs.
* Valid: A number between 0 to 100.
* @default 75
*
* @param Thunder Sound Pitch
* @parent Storm Thunder
* @type number
* @min 50
* @max 150
* @desc Pitch of the sound effect played when a thunderflash occurs.
* Valid: A number between 50 to 150.
* @default 100
*
* @param Thunder Sound Pitch Variation
* @parent Storm Thunder
* @type number
* @min 0
* @max 50
* @desc Deviate sound pitch up to X value when a thunderflash occurs.
* Valid: A number between 0 to 50.
* @default 15
*
* @param Thunder Flash Power
* @parent Storm Thunder
* @type number
* @min 0
* @max 255
* @desc Strength of the screen flash played when a thunderflash occurs.
* Valid: A number between 0-255.
* @default 180
*
* @param Thunder Flash Variation
* @parent Storm Thunder
* @type number
* @min 0
* @max 128
* @desc Deviate flash power up to X value when a thunderflash occurs.
* Valid: A number between 0-128.
* @default 50
*
* @param Thunder Wait Time
* @parent Storm Thunder
* @type number
* @desc Duration until the next thunderflash. (Adjusted based on Power)
* Valid: Any number
* @default 300
*
* @param Thunder Wait Time Variation
* @parent Storm Thunder
* @type number
* @desc Deviate wait time up to X value until the next thunderflash.
* Valid: Any number
* @default 45
*
* @param Storm Image
* @parent Storm
* @desc Define a Picture file for raindrops (Storm). (Place image in the Pictures folder.)
* Valid: Any file name. Leave empty for default.
* @default
*
* @param Storm Raindrop Count Minimum
* @parent Storm
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during a Storm with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 75
*
* @param Storm Raindrop Count Maximum
* @parent Storm
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during a Storm with the magnitude of 9.
* Valid: A number between 0 to 999
* @default 350
*
* @param Snow Image
* @parent Snow
* @desc Image used for snow.
* Valid: Any file name. Leave empty for default.
* @default
*
* @param Snow Count Minimum
* @parent Snow
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during Snow with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 12
*
* @param Snow Count Maximum
* @parent Snow
* @type number
* @min 0
* @max 999
* @desc Amount of raindrops to create during Snow with the magnitude of 9.
* Valid: A number between 0 to 999
* @default 320
*
* @param Snowflake Lifetime
* @parent Detailed Settings (Snow)
* @type number
* @min 1
* @max 80
* @desc Controls how long a snowflake should last during Snow.
* Valid: A number between 1 to 200
* @default 16
*
* @param Snowflake Speed Base
* @parent Detailed Settings (Snow)
* @type number
* @min 1
* @max 200
* @desc Controls the speed of a snowflake during Snow.
* Valid: A number between 1 to 200
* @default 25
*
* @param Snowflake Speed Variation
* @parent Detailed Settings (Snow)
* @type number
* @min 0
* @max 50
* @desc Deviate snowflake speed up to X value during Snow. (10 is +-10% speed)
* Valid: A number between 0 to 50
* @default 10
*
* @param Snowflake Opacity Base
* @parent Detailed Settings (Snow)
* @type number
* @min 0
* @max 255
* @desc Controls the opacity of snowflakes during Snow.
* Valid: A number between 0 to 255
* @default 220
*
* @param Snowflake Opacity Variation
* @parent Detailed Settings (Snow)
* @type number
* @min 0
* @max 255
* @desc Deviate snowflake opacity up to X value during Snow. (20 is +-20 opacity)
* Valid: A number between 0 to 255
* @default 20
*
* @param Snowflake Size Variation
* @parent Detailed Settings (Snow)
* @type number
* @min 0
* @max 50
* @desc Deviate snowflake sizes up to X% during Snow. (No effect when not using an image.)
* Valid: A number between 0 to 50
* @default 40
*
* @param Leaf Image
* @parent Leaves
* @desc Image used for leaves. * Leaf weather effects do not appear when left empty.
* Valid: Any file name.
* @default Leaf
*
* @param Leaf Count Minimum
* @parent Leaves
* @type number
* @min 0
* @max 999
* @desc Amount of leaves to create during Leaves with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 10
*
* @param Leaf Count Maximum
* @parent Leaves
* @type number
* @min 0
* @max 999
* @desc Amount of leaves to create during Leaves with the magnitude of 9.
* Valid: A number between 0 to 999
* @default 100
*
* @param Leaf Lifetime
* @parent Detailed Settings (Leaves)
* @type number
* @min 1
* @max 80
* @desc Controls how long a leaf should last during Leaves.
* Valid: A number between 1 to 200
* @default 80
*
* @param Leaf Speed Base
* @parent Detailed Settings (Leaves)
* @type number
* @min 1
* @max 15
* @desc Controls the speed of a leaf during Leaves.
* Valid: A number between 1 to 15
* @default 3
*
* @param Leaf Speed Variation
* @parent Detailed Settings (Leaves)
* @type number
* @min 0
* @max 5
* @desc Deviate leaf speed up to X value during Leaves.
* Valid: A number between 0 to 5
* @default 2
*
* @param Leaf Size Variation
* @parent Detailed Settings (Leaves)
* @type number
* @min 0
* @max 50
* @desc Deviate leaf sizes up to X% during Leaves.
* Valid: A number between 0 to 50
* @default 32
*
* @param Embers Image
* @parent Embers
* @desc Image used for embers. * Embers weather do not appear when left empty.
* Valid: Any file name.
* @default Embers
*
* @param Embers Count Minimum
* @parent Embers
* @type number
* @min 0
* @max 999
* @desc Amount of embers to create during Embers with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 20
*
* @param Embers Count Maximum
* @parent Embers
* @type number
* @min 0
* @max 999
* @desc Amount of embers to create during Embers with the magnitude of 9.
* Valid: A number between 0 to 999
* @default 160
*
* @param Embers Lifetime
* @parent Detailed Settings (Embers)
* @type number
* @min 1
* @max 80
* @desc Controls how long embers should last during Embers.
* Valid: A number between 1 to 200
* @default 33
*
* @param Embers Speed Base
* @parent Detailed Settings (Embers)
* @type number
* @min 1
* @max 60
* @desc Controls the speed of embers during Embers.
* Valid: A number between 1 to 60
* @default 30
*
* @param Embers Speed Variation
* @parent Detailed Settings (Embers)
* @type number
* @min 0
* @max 25
* @desc Deviate embers speed up to X value during Embers.
* Valid: A number between 0 to 25
* @default 25
*
* @param Embers Size Variation
* @parent Detailed Settings (Embers)
* @type number
* @min 0
* @max 50
* @desc Deviate leaf sizes up to X% during Leaves.
* Valid: A number between 0 to 50
* @default 40
*
* @param Shine Image
* @parent Shine
* @desc Image used for shining effects.
* Valid: Any file name.
* @default Shine
*
* @param Shine Count Minimum
* @parent Shine
* @type number
* @min 0
* @max 999
* @desc Amount of sparkles to create during Shine with the magnitude of 1.
* Valid: A number between 0 to 999
* @default 20
*
* @param Shine Count Maximum
* @parent Shine
* @type number
* @min 0
* @max 999
* @desc Amount of sparkles to create during Shine with the magnitude of 9.
* Valid: A number between 0 to 999
* @default 360
*
* @param Shine Lifetime
* @parent Detailed Settings (Shine)
* @type number
* @min 1
* @max 25
* @desc Controls how long sparkles should last during Shine.
* Valid: A number between 1 to 25
* @default 25
*
* @param Shine Opacity Base
* @parent Detailed Settings (Shine)
* @type number
* @min 0
* @max 255
* @desc Controls the opacity of sparkles during Shine.
* Valid: A number between 0 to 255
* @default 220
*
* @param Shine Opacity Variation
* @parent Detailed Settings (Shine)
* @type number
* @min 0
* @max 255
* @desc Deviate sparkle opacity up to X value during Shine.
* Valid: A number between 0 to 255
* @default 20
*
* @param Shine Size Variation
* @parent Detailed Settings (Shine)
* @type number
* @min 0
* @max 90
* @desc Deviate sparkle sizes up to X% during Shine.
* Valid: A number between 0 to 90
* @default 80
*/
var Aries = Aries || {};
var Imported = Imported || {};
Aries.P003_WCT = {};
Aries.P003_WCT.Param = PluginManager.parameters('Aries003_WeatherControl');
Aries.P003_WCT.RainImage = String(Aries.P003_WCT.Param["Rain Image"]);
Aries.P003_WCT.RainMin = Number(Aries.P003_WCT.Param["Raindrop Count Minimum"]);
Aries.P003_WCT.RainMax = Number(Aries.P003_WCT.Param["Raindrop Count Maximum"]);
Aries.P003_WCT.RainLife = Number(Aries.P003_WCT.Param["Raindrop Lifetime"]);
Aries.P003_WCT.RainSpeed = Number(Aries.P003_WCT.Param["Raindrop Speed"]);
Aries.P003_WCT.RainAngleC = Number(Aries.P003_WCT.Param["Raindrop Angle Base"]);
Aries.P003_WCT.RainAlphaC = Number(Aries.P003_WCT.Param["Raindrop Opacity Base"]);
Aries.P003_WCT.RainAngleV = Number(Aries.P003_WCT.Param["Raindrop Angle Variation"]);
Aries.P003_WCT.RainAlphaV = Number(Aries.P003_WCT.Param["Raindrop Opacity Variation"]);
Aries.P003_WCT.RainSizeV = Number(Aries.P003_WCT.Param["Raindrop Size Variation"]);
Aries.P003_WCT.StormImage = String(Aries.P003_WCT.Param["Storm Image"]);
Aries.P003_WCT.StormMin = Number(Aries.P003_WCT.Param["Storm Raindrop Count Minimum"]);
Aries.P003_WCT.StormMax = Number(Aries.P003_WCT.Param["Storm Raindrop Count Maximum"]);
Aries.P003_WCT.StormLife = Number(Aries.P003_WCT.Param["Storm Raindrop Lifetime"]);
Aries.P003_WCT.StormSpeed = Number(Aries.P003_WCT.Param["Storm Raindrop Speed"]);
Aries.P003_WCT.StormAngleC = Number(Aries.P003_WCT.Param["Storm Raindrop Angle Base"]);
Aries.P003_WCT.StormAlphaC = Number(Aries.P003_WCT.Param["Storm Raindrop Opacity Base"]);
Aries.P003_WCT.StormAngleV = Number(Aries.P003_WCT.Param["Storm Raindrop Angle Variation"]);
Aries.P003_WCT.StormAlphaV = Number(Aries.P003_WCT.Param["Storm Raindrop Opacity Variation"]);
Aries.P003_WCT.StormSizeV = Number(Aries.P003_WCT.Param["Storm Raindrop Size Variation"]);
Aries.P003_WCT.StormThunder = eval(Aries.P003_WCT.Param["Storm Thunder"]);
Aries.P003_WCT.StormThunderB = eval(Aries.P003_WCT.Param["Storm Thunder in Battle"]);
Aries.P003_WCT.ThunderSound = String(Aries.P003_WCT.Param["Thunder Sound"]);
Aries.P003_WCT.ThunderSEVol = Number(Aries.P003_WCT.Param["Thunder Sound Volume"]);
Aries.P003_WCT.ThunderSEPitch = Number(Aries.P003_WCT.Param["Thunder Sound Pitch"]);
Aries.P003_WCT.ThunderSEPitchV = Number(Aries.P003_WCT.Param["Thunder Sound Pitch Variation"]);
Aries.P003_WCT.ThunderWait = Number(Aries.P003_WCT.Param["Thunder Wait Time"]);
Aries.P003_WCT.ThunderWaitV = Number(Aries.P003_WCT.Param["Thunder Wait Time Variation"]);
Aries.P003_WCT.ThunderFlash = Number(Aries.P003_WCT.Param["Thunder Flash Power"]);
Aries.P003_WCT.ThunderFlashV = Number(Aries.P003_WCT.Param["Thunder Flash Variation"]);
Aries.P003_WCT.SnowImage = String(Aries.P003_WCT.Param["Snow Image"]);
Aries.P003_WCT.SnowMin = Number(Aries.P003_WCT.Param["Snow Count Minimum"]);
Aries.P003_WCT.SnowMax = Number(Aries.P003_WCT.Param["Snow Count Maximum"]);
Aries.P003_WCT.SnowLife = Number(Aries.P003_WCT.Param["Snowflake Lifetime"]);
Aries.P003_WCT.SnowSpeedC = Number(Aries.P003_WCT.Param["Snowflake Speed Base"]);
Aries.P003_WCT.SnowAlphaC = Number(Aries.P003_WCT.Param["Snowflake Opacity Base"]);
Aries.P003_WCT.SnowSpeedV = Number(Aries.P003_WCT.Param["Snowflake Speed Variation"]);
Aries.P003_WCT.SnowAlphaV = Number(Aries.P003_WCT.Param["Snowflake Opacity Variation"]);
Aries.P003_WCT.SnowSizeV = Number(Aries.P003_WCT.Param["Snowflake Size Variation"]);
Aries.P003_WCT.LeafImage = String(Aries.P003_WCT.Param["Leaf Image"]);
Aries.P003_WCT.LeafMin = Number(Aries.P003_WCT.Param["Leaf Count Minimum"]);
Aries.P003_WCT.LeafMax = Number(Aries.P003_WCT.Param["Leaf Count Maximum"]);
Aries.P003_WCT.LeafLife = Number(Aries.P003_WCT.Param["Leaf Lifetime"]);
Aries.P003_WCT.LeafSpeedC = Number(Aries.P003_WCT.Param["Leaf Speed Base"]);
Aries.P003_WCT.LeafSpeedV = Number(Aries.P003_WCT.Param["Leaf Speed Variation"]);
Aries.P003_WCT.LeafSizeV = Number(Aries.P003_WCT.Param["Leaf Size Variation"]);
Aries.P003_WCT.HeatImage = String(Aries.P003_WCT.Param["Embers Image"]);
Aries.P003_WCT.HeatMin = Number(Aries.P003_WCT.Param["Embers Count Minimum"]);
Aries.P003_WCT.HeatMax = Number(Aries.P003_WCT.Param["Embers Count Maximum"]);
Aries.P003_WCT.HeatLife = Number(Aries.P003_WCT.Param["Embers Lifetime"]);
Aries.P003_WCT.HeatSpeedC = Number(Aries.P003_WCT.Param["Embers Speed Base"]);
Aries.P003_WCT.HeatSpeedV = Number(Aries.P003_WCT.Param["Embers Speed Variation"]);
Aries.P003_WCT.HeatSizeV = Number(Aries.P003_WCT.Param["Embers Size Variation"]);
Aries.P003_WCT.MysticImage = String(Aries.P003_WCT.Param["Shine Image"]);
Aries.P003_WCT.MysticMin = Number(Aries.P003_WCT.Param["Shine Count Minimum"]);
Aries.P003_WCT.MysticMax = Number(Aries.P003_WCT.Param["Shine Count Maximum"]);
Aries.P003_WCT.MysticLife = Number(Aries.P003_WCT.Param["Shine Lifetime"]);
Aries.P003_WCT.MysticAlphaC = Number(Aries.P003_WCT.Param["Shine Opacity Base"]);
Aries.P003_WCT.MysticAlphaV = Number(Aries.P003_WCT.Param["Shine Opacity Variation"]);
Aries.P003_WCT.MysticSizeV = Number(Aries.P003_WCT.Param["Shine Size Variation"]);
var _aries_p003_pluginCommand=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(command,args){_aries_p003_pluginCommand.call(this,command,args);if(command==='AriesToggleStormThunder'){Aries.P003_WCT.toggleStormThunder(eval(args[0]))}else if(command==='AriesWeather'){$gameScreen.changeWeather(String(args[0]).toLowerCase(),args[1],args[2])}else if(command==='AriesSetWeatherImage'){Aries.P003_WCT.setWeatherImage(String(args[0]).toLowerCase(),String(args[1]).toLowerCase())}};Aries.P003_WCT.toggleStormThunder=function(flag){Aries.P003_WCT.StormThunder=flag};Aries.P003_WCT.setWeatherImage=function(weathertype,image){switch(weathertype){case 'rain':Aries.P003_WCT.RainImage=image;break;case 'storm':Aries.P003_WCT.StormImage=image;break;case 'snow':Aries.P003_WCT.SnowImage=image;break;case 'leaves':Aries.P003_WCT.LeafImage=image;break;case 'embers':Aries.P003_WCT.HeatImage=image;break;case 'shine':Aries.P003_WCT.MysticImage=image;break}
if(SceneManager._scene instanceof Scene_Map){SceneManager._scene._spriteset.refreshWeatherBitmaps()}};var _aries_p003_gameScreen_clearWeather=Game_Screen.prototype.clearWeather;Game_Screen.prototype.clearWeather=function(){_aries_p003_gameScreen_clearWeather.call(this);this._weatherWind=[0,0];this._stormThunderSound=''
this._stormThunderFlash=0;this._stormThunderCount=4*(Aries.P003_WCT.ThunderWait+Aries.P003_WCT.ThunderWaitV);this._stormThunderFrequency=0;this._snowBloom=0};var _aries_p003_gameScreen_updateWeather=Game_Screen.prototype.updateWeather;Game_Screen.prototype.updateWeather=function(){_aries_p003_gameScreen_updateWeather.call(this);if(this._weatherType==='storm'){if(Aries.P003_WCT.StormThunder===!0&&!$gameParty.inBattle()){this.updateStorm()}else if(Aries.P003_WCT.StormThunderB===!0&&$gameParty.inBattle()){this.updateStorm()}}};Game_Screen.prototype.updateStorm=function(){this._stormThunderCount-=(1+(0.5*Number(this._weatherPower)));if(this._stormThunderCount<=0){var alpha=Math.min((Aries.P003_WCT.ThunderFlash-Aries.P003_WCT.ThunderFlashV)+Math.randomInt(1+Aries.P003_WCT.ThunderFlashV*2),255);this.startFlash([255,255,255,alpha],4);if(Aries.P001_ASE!==undefined){Aries.P001_ASE.glow(18,2,3,0.75)}
this._stormThunderCount=4*((Aries.P003_WCT.ThunderWait-Aries.P003_WCT.ThunderWaitV)+Math.randomInt(1+Aries.P003_WCT.ThunderWaitV*2));thunderSound={name:Aries.P003_WCT.ThunderSound,pan:0,pitch:(Aries.P003_WCT.ThunderSEPitch-Aries.P003_WCT.ThunderSEPitchV)+Math.randomInt(1+Aries.P003_WCT.ThunderSEPitchV*2),volume:Aries.P003_WCT.ThunderSEVol};AudioManager.playStaticSe(thunderSound)}};Spriteset_Map.prototype.refreshWeatherBitmaps=function(){this._weather._createBitmaps()};Weather.prototype._createBitmaps=function(){this._createRainBitmap();this._createStormBitmap();this._createSnowBitmap();this._createLeafBitmap();this._createHeatBitmap();this._createMysticBitmap()};Weather.prototype._createRainBitmap=function(){if(Aries.P003_WCT.RainImage.length>0){this._rainBitmap=ImageManager.loadPicture(Aries.P003_WCT.RainImage)}else{this._rainBitmap=new Bitmap(1,60);this._rainBitmap.fillAll('white')}};Weather.prototype._createStormBitmap=function(){if(Aries.P003_WCT.StormImage.length>0){this._stormBitmap=ImageManager.loadPicture(Aries.P003_WCT.StormImage)}else{this._stormBitmap=new Bitmap(2,100);this._stormBitmap.fillAll('white')}};Weather.prototype._createSnowBitmap=function(){if(Aries.P003_WCT.SnowImage.length>0){this._snowBitmap=ImageManager.loadPicture(Aries.P003_WCT.SnowImage)}else{this._snowBitmap=new Bitmap(9,9);this._snowBitmap.drawCircle(4,4,4,'white')}};Weather.prototype._createLeafBitmap=function(){if(Aries.P003_WCT.LeafImage.length>0){this._leafBitmap=ImageManager.loadPicture(Aries.P003_WCT.LeafImage)}else{this._leafBitmap=new Bitmap(9,9);this._leafBitmap.drawCircle(4,4,4,'green')}};Weather.prototype._createHeatBitmap=function(){if(Aries.P003_WCT.HeatImage.length>0){this._heatBitmap=ImageManager.loadPicture(Aries.P003_WCT.HeatImage)}else{this._heatBitmap=new Bitmap(7,7);this._heatBitmap.drawCircle(3,3,3,'black')}};Weather.prototype._createMysticBitmap=function(){if(Aries.P003_WCT.MysticImage.length>0){this._mysticBitmap=ImageManager.loadPicture(Aries.P003_WCT.MysticImage)}else{this._mysticBitmap=new Bitmap(9,9);this._mysticBitmap.drawCircle(4,4,4,'white');this._mysticBitmap.rotateHue(Math.randomInt(359))}};Weather.prototype._addSprite=function(){var sprite=new Sprite_Weather(this.viewport);switch(this.type){case 'rain':var life=Aries.P003_WCT.RainLife;var size=0.01*((100-Aries.P003_WCT.RainSizeV)+Math.randomInt(1+Aries.P003_WCT.RainSizeV*2));var getangle=((Aries.P003_WCT.RainAngleC-Aries.P003_WCT.RainAngleV)+Math.randomInt(1+Aries.P003_WCT.RainAngleV*2));var alpha=((Aries.P003_WCT.RainAlphaC-Aries.P003_WCT.RainAlphaV)+Math.randomInt(1+Aries.P003_WCT.RainAlphaV*2));sprite.setUp('rain',life,size,getangle,alpha);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'storm':var life=Aries.P003_WCT.StormLife;var size=0.01*((100-Aries.P003_WCT.StormSizeV)+Math.randomInt(1+Aries.P003_WCT.StormSizeV*2));var getangle=((Aries.P003_WCT.StormAngleC-Aries.P003_WCT.StormAngleV)+Math.randomInt(1+Aries.P003_WCT.StormAngleV*2));var alpha=((Aries.P003_WCT.StormAlphaC-Aries.P003_WCT.StormAlphaV)+Math.randomInt(1+Aries.P003_WCT.StormAlphaV*2));sprite.setUp('storm',life,size,getangle,alpha);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'snow':var life=Aries.P003_WCT.SnowLife;var size=0.01*((100-Aries.P003_WCT.SnowSizeV)+Math.randomInt(1+Aries.P003_WCT.SnowSizeV*2));var getangle=(-1+Math.randomInt(3))*0.267;var alpha=((Aries.P003_WCT.SnowAlphaC-Aries.P003_WCT.SnowAlphaV)+Math.randomInt(1+Aries.P003_WCT.SnowAlphaV*2));var snowspeed=1.33+Math.randomInt(2);sprite.setUp('snow',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'leaves':var life=Aries.P003_WCT.LeafLife;var size=0.007*((100-Aries.P003_WCT.LeafSizeV)+Math.randomInt(1+Aries.P003_WCT.LeafSizeV*2));var getangle=Aries.P003_WCT.LeafSpeedV;var alpha=255;var snowspeed=0.83+Math.randomInt(2)
sprite.setUp('leaves',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'embers':var life=Aries.P003_WCT.HeatLife;var size=0.007*((100-Aries.P003_WCT.HeatSizeV)+Math.randomInt(1+Aries.P003_WCT.HeatSizeV*2));var getangle=Aries.P003_WCT.HeatSpeedV;var alpha=255;var snowspeed=0.83+Math.randomInt(2)
sprite.setUp('embers',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'shine':var life=Aries.P003_WCT.MysticLife;var size=0.007*((100-Aries.P003_WCT.MysticSizeV)+Math.randomInt(1+Aries.P003_WCT.MysticSizeV*2));var getangle=12;var alpha=((Aries.P003_WCT.MysticAlphaC-Aries.P003_WCT.MysticAlphaV)+Math.randomInt(1+Aries.P003_WCT.MysticAlphaV*2));var snowspeed=0.25*(2+Math.randomInt(3));sprite.setUp('shine',life,size,getangle,alpha,snowspeed);sprite.rotation=Math.random();sprite.opacity=0;break}
sprite.opacity=0;this._sprites.push(sprite);this.addChild(sprite)};Weather.prototype._getMaxSpriteCount=function(){var maxCount=0;switch(this.type){case 'rain':maxCount=Aries.P003_WCT.RainMin+(Aries.P003_WCT.RainMax*this.power*0.1);break;case 'storm':maxCount=Aries.P003_WCT.StormMin+(Aries.P003_WCT.StormMax*this.power*0.1);break;case 'snow':maxCount=Aries.P003_WCT.SnowMin+(Aries.P003_WCT.SnowMax*this.power*0.1);break;case 'leaves':maxCount=Aries.P003_WCT.LeafMin+(Aries.P003_WCT.LeafMax*this.power*0.1);break;case 'embers':maxCount=Aries.P003_WCT.HeatMin+(Aries.P003_WCT.HeatMax*this.power*0.1);break;case 'shine':maxCount=Aries.P003_WCT.MysticMin+(Aries.P003_WCT.MysticMax*this.power*0.1);break}
return maxCount};Weather.prototype._updateAllSprites=function(){var maxSprites=this._getMaxSpriteCount();if(this._sprites.length<maxSprites){this._addSprite()}
if(this._sprites.length>maxSprites){this._removeSprite()}
this._sprites.forEach(function(sprite){this._updateSprite(sprite);sprite.x=sprite.ax-this.origin.x;sprite.y=sprite.ay-this.origin.y},this)};Weather.prototype._updateSprite=function(sprite){sprite.update();switch(this.type){case 'rain':this._updateRainSprite(sprite);break;case 'storm':this._updateStormSprite(sprite);break;case 'snow':this._updateSnowSprite(sprite);break;case 'leaves':this._updateLeafSprite(sprite);break;case 'embers':this._updateHeatSprite(sprite);break;case 'shine':this._updateMysticSprite(sprite);break}
if(sprite._lifetime<=0&&sprite.opacity<=6){this._rebornSprite(sprite)}};Weather.prototype._updateRainSprite=function(sprite){sprite.bitmap=this._rainBitmap;sprite.rotation=sprite._anglev*(Math.PI/180);var velocity=sprite.getVelocity(Aries.P003_WCT.RainSpeed);sprite.ax+=velocity[0];sprite.ay+=velocity[1]};Weather.prototype._updateStormSprite=function(sprite){sprite.bitmap=this._stormBitmap;sprite.rotation=sprite._anglev*(Math.PI/180);var velocity=sprite.getVelocity(Aries.P003_WCT.StormSpeed);sprite.ax+=velocity[0];sprite.ay+=velocity[1]};Weather.prototype._updateSnowSprite=function(sprite){sprite.bitmap=this._snowBitmap;sprite.ax+=sprite._anglev;sprite.ay+=sprite._snowSpeed};Weather.prototype._updateLeafSprite=function(sprite){sprite.bitmap=this._leafBitmap;sprite.rotation+=0.025*sprite._anglev;sprite.ax+=2*Math.sin(0.0078*sprite._randomSeed);sprite.ay+=sprite._snowSpeed};Weather.prototype._updateHeatSprite=function(sprite){sprite.bitmap=this._heatBitmap;sprite.ax+=2*Math.sin(0.0139*sprite._randomSeed);sprite.ay-=sprite._snowSpeed};Weather.prototype._updateMysticSprite=function(sprite){sprite.bitmap=this._mysticBitmap};Weather.prototype._rebornSprite=function(sprite){sprite.ax=Math.randomInt(Graphics.width+500)-200+this.origin.x;sprite.ay=Math.randomInt(Graphics.height+600)-400+this.origin.y;switch(this.type){case 'rain':var life=Aries.P003_WCT.RainLife;var size=0.01*((100-Aries.P003_WCT.RainSizeV)+Math.randomInt(1+Aries.P003_WCT.RainSizeV*2));var getangle=((Aries.P003_WCT.RainAngleC-Aries.P003_WCT.RainAngleV)+Math.randomInt(1+Aries.P003_WCT.RainAngleV*2));var alpha=((Aries.P003_WCT.RainAlphaC-Aries.P003_WCT.RainAlphaV)+Math.randomInt(1+Aries.P003_WCT.RainAlphaV*2));sprite.setUp('rain',life,size,getangle,alpha);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'storm':var life=Aries.P003_WCT.StormLife;var size=0.01*((100-Aries.P003_WCT.StormSizeV)+Math.randomInt(1+Aries.P003_WCT.StormSizeV*2));var getangle=((Aries.P003_WCT.StormAngleC-Aries.P003_WCT.StormAngleV)+Math.randomInt(1+Aries.P003_WCT.StormAngleV*2));var alpha=((Aries.P003_WCT.StormAlphaC-Aries.P003_WCT.StormAlphaV)+Math.randomInt(1+Aries.P003_WCT.StormAlphaV*2));sprite.setUp('storm',life,size,getangle,alpha);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'snow':var life=Aries.P003_WCT.SnowLife;var size=0.01*((100-Aries.P003_WCT.SnowSizeV)+Math.randomInt(1+Aries.P003_WCT.SnowSizeV*2));var getangle=(-1+Math.randomInt(3))*0.267;var alpha=((Aries.P003_WCT.SnowAlphaC-Aries.P003_WCT.SnowAlphaV)+Math.randomInt(1+Aries.P003_WCT.SnowAlphaV*2));var snowspeed=1.33+Math.randomInt(2);sprite.setUp('snow',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'leaves':var life=Aries.P003_WCT.LeafLife;var size=0.007*((100-Aries.P003_WCT.LeafSizeV)+Math.randomInt(1+Aries.P003_WCT.LeafSizeV*2));var getangle=Aries.P003_WCT.LeafSpeedV;var alpha=255;var snowspeed=0.83+Math.randomInt(2)
sprite.setUp('leaves',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'embers':var life=Aries.P003_WCT.HeatLife;var size=0.007*((100-Aries.P003_WCT.HeatSizeV)+Math.randomInt(1+Aries.P003_WCT.HeatSizeV*2));var getangle=Aries.P003_WCT.HeatSpeedV;var alpha=255;var snowspeed=0.83+Math.randomInt(2)
sprite.setUp('embers',life,size,getangle,alpha,snowspeed);sprite.blendMode=PIXI.BLEND_MODES.NORMAL;break;case 'shine':var life=Aries.P003_WCT.MysticLife;var size=0.007*((100-Aries.P003_WCT.MysticSizeV)+Math.randomInt(1+Aries.P003_WCT.MysticSizeV*2));var getangle=12;var alpha=((Aries.P003_WCT.MysticAlphaC-Aries.P003_WCT.MysticAlphaV)+Math.randomInt(1+Aries.P003_WCT.MysticAlphaV*2));var snowspeed=0.25*(2+Math.randomInt(3));sprite.setUp('shine',life,size,getangle,alpha,snowspeed);sprite.rotation=Math.random();sprite.opacity=0;break}};function Sprite_Weather(){this.initialize.apply(this,arguments)}
Sprite_Weather.prototype=Object.create(Sprite.prototype);Sprite_Weather.prototype.constructor=Sprite_Weather;Sprite_Weather.prototype.initialize=function(){Sprite.prototype.initialize.call(this);this._type='none'
this._lifetime=0;this._size=0;this._anglev=0;this._alpha=0;this._snowSpeed=0;this.setUpDone=!1};Sprite_Weather.prototype.update=function(){if(this.setUpDone===!0){if(this._lifetime>0){if(this._type==='snow'){this.opacity=Math.min(this.opacity+24,this._alpha);this.scale.x=this._size;this.scale.y=this._size}else if(this._type==='shine'){this.opacity=Math.min(this.opacity+48,this._alpha);this.scale.x+=0.09;this.scale.y+=0.09}else if(this._type==='embers'){this.opacity=Math.min(this.opacity+32,this._alpha);var newTone=this.getColorTone();newTone[0]*=0.98;newTone[1]*=0.95;this.setColorTone(newTone);this.scale.x=this._size;this.scale.y=this._size}else{this.opacity=Math.min(this.opacity+72,this._alpha);this.scale.x=this._size;this.scale.y=this._size}
this._lifetime-=1;this._randomSeed-=1}else{if(this._type==='snow'){this.opacity-=16}else if(this._type==='shine'){this.opacity-=15;this.scale.x-=0.09;this.scale.y-=0.09}else if(this._type==='leaves'||this._type==='embers'){this.scale.x-=0.01;this.scale.y-=0.01;this.opacity-=8}else{this.opacity-=48}}}};Sprite_Weather.prototype.setUp=function(type,life,size,getangle,alpha,snowSpeed=0){this._type=type;this._lifetime=life+Math.randomInt(life*0.25);this._size=size;this._anglev=getangle;this._alpha=alpha;this._snowSpeed=snowSpeed;this._randomSeed=Math.randomInt(16777216);if(this._type==='shine'){this.scale.x=0;this.scale.y=0;this.anchor=new Point(0.5,0.5);this.blendMode=PIXI.BLEND_MODES.ADD;this.setColorTone([Math.randomInt(2)*-255,Math.randomInt(2)*-255,Math.randomInt(2)*-255,0])}else if(this._type==='leaves'){this.scale.x=1;this.scale.y=1;this.anchor=new Point(0.5,0.5);this.blendMode=PIXI.BLEND_MODES.NORMAL;this.setColorTone([0,0,0,0])}else if(this._type==='embers'){this.scale.x=1;this.scale.y=1;this.anchor=new Point(0.5,0.5);this.blendMode=PIXI.BLEND_MODES.NORMAL;this.setColorTone([255,200,0,0])}else{this.scale.x=1;this.scale.y=1;this.anchor=new Point(0,0);this.blendMode=PIXI.BLEND_MODES.NORMAL;this.setColorTone([0,0,0,0])}
this.setUpDone=!0};Sprite_Weather.prototype.getVelocity=function(speed){var speedX=speed*Math.cos(this._anglev*(Math.PI/180));var speedY=-1*speed*Math.sin(this._anglev*(Math.PI/180));return[speedY,speedX]};if(Aries.P001_ASE!==undefined){var _aries_p003_spritesetBase_createScreenEffectFilters=Spriteset_Base.prototype.createScreenEffectFilters;Spriteset_Base.prototype.createScreenEffectFilters=function(){_aries_p003_spritesetBase_createScreenEffectFilters.call(this);this._wct_glow_filter=new PIXI.filters.AdvancedBloomFilter();this._wct_glow_filter.enabled=!1;this._wct_glow_filter.brightness=0.5;this._wct_glow_filter.bloomScale=0.667;this._wct_glow_filter.blur=0;this._wct_glow_filter.threshold=0.05;this._filters.push(this._wct_glow_filter)};var _aries_p003_spritesetBase_updateScreenEffects=Spriteset_Base.prototype.updateScreenEffects;Spriteset_Base.prototype.updateScreenEffects=function(){_aries_p003_spritesetBase_updateScreenEffects.call(this);if(this._wct_glow_filter){switch($gameScreen.weatherType()){case 'rain':this._wct_glow_filter.enabled=!0;this._wct_glow_filter.bloomScale=0.035*$gameScreen.weatherPower();this._wct_glow_filter.brightness=1-(0.025*$gameScreen.weatherPower());this._wct_glow_filter.blur=0.1*$gameScreen.weatherPower();this._wct_glow_filter.threshold=0.075;this._wct_heat_filter.enabled=!1;break;case 'storm':this._wct_glow_filter.enabled=!0;this._wct_glow_filter.bloomScale=0.05*$gameScreen.weatherPower();this._wct_glow_filter.brightness=1-(0.06*$gameScreen.weatherPower());this._wct_glow_filter.blur=0.2*$gameScreen.weatherPower();this._wct_glow_filter.threshold=0.075;this._wct_heat_filter.enabled=!1;break;case 'snow':this._wct_glow_filter.enabled=!0;this._wct_glow_filter.bloomScale=0.1+(0.005*$gameScreen.weatherPower());this._wct_glow_filter.brightness=1+(0.001*$gameScreen.weatherPower());this._wct_glow_filter.blur=0.5+(0.1*$gameScreen.weatherPower());this._wct_glow_filter.threshold=0.667;this._wct_heat_filter.enabled=!1;break;case 'embers':this._wct_glow_filter.enabled=!0;this._wct_glow_filter.bloomScale=0.2+(0.015*$gameScreen.weatherPower());+0.2*(1+Math.sin(0.03*Graphics.frameCount));this._wct_glow_filter.brightness=1;this._wct_glow_filter.blur=6+(0.1*$gameScreen.weatherPower());this._wct_glow_filter.threshold=0.75;break;default:this._wct_glow_filter.enabled=!1;this._wct_glow_filter.bloomScale=1;this._wct_glow_filter.brightness=1;this._wct_glow_filter.blur=0;this._wct_glow_filter.threshold=1;break}}}}

View file

@ -0,0 +1,496 @@
//=============================================================================
// TDS Atlas Loader
// Version: 1.3
//=============================================================================
// Add to Imported List
var Imported = Imported || {}; Imported.TDS_AtlasLoader = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {}; _TDS_.AtlasLoader = _TDS_.AtlasLoader || {};
//=============================================================================
/*:
* @plugindesc
* Atlas loading BETA.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** SceneManager
//-----------------------------------------------------------------------------
// The static class that manages scene transitions.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.AtlasLoader.SceneManager_isCurrentSceneBusy = SceneManager.isCurrentSceneBusy;
//=============================================================================
// * Determine if Current scene is busy
//=============================================================================
SceneManager.isCurrentSceneBusy = function () {
// Return true if
if (this._scene && this._nextScene) {
// If Not all atlases are loaded return true
if (!this._nextScene.areAllRequiredAtlasLoaded()) { return true; }
};
// Return Original Function
return _TDS_.AtlasLoader.SceneManager_isCurrentSceneBusy.call(this);
};
//=============================================================================
// ** AtlasManager
//-----------------------------------------------------------------------------
// This static class is used to handle bitmap fonts
//=============================================================================
function AtlasManager() { throw new Error('This is a static class'); }
//=============================================================================
// * Determine if Atlas has Data for key
//=============================================================================
AtlasManager.hasAltasData = function (key) {
if ($atlasData) { return $atlasData.source[key] !== undefined; }
return false;
};
//=============================================================================
// * Get Image Atlas Name
//=============================================================================
AtlasManager.getImageAtlasName = function (key) {
// If Atlas key Exists
if (this.hasAltasData(key)) {
// Return Atlas name
return $atlasData.source[key].atlasName;
};
// Return false
return false;
};
//=============================================================================
// * Initialize Atlas Data
//=============================================================================
AtlasManager.initAtlasData = function () {
// If Atlas is undefined
if (window['$atlasData'] === undefined) {
var path = require('path');
var fs = require('fs');
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/img/atlases/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// Get Atlas File
var data = jsyaml.load(fs.readFileSync(base + '/data/Atlas.yaml', 'utf8'));
// Set Atlas Data
window['$atlasData'] = data;
};
};
//=============================================================================
// * Make Bitmap
//=============================================================================
AtlasManager.makeBitmap = function (key) {
// Get Data
var data = $atlasData.source[key];
// Get Data
if (data) {
// Get Function
var func = data.makeFunction;
// If Creation Function Exists
if (data.makeFunction) {
// Return Atlas Creation Function
return AtlasManager[func.name](func.arguments);
} else {
// Create Bitmap
var bitmap = new Bitmap(data.rect.width, data.rect.height);
// Get Atlas Bitmap
var atlasBitmap = ImageManager.loadAtlas(data.atlasName);
atlasBitmap.addLoadListener(() => {
let sr = data.sourceRect;
if (!atlasBitmap.isReady()) { bitmap.fillAll('rgba(0, 255, 0, 1)') }
else { bitmap.blt(atlasBitmap, sr.x, sr.y, sr.width, sr.height, data.rect.x, data.rect.y); }
})
// Check if Atlas bitmap is ready
/*if (atlasBitmap.isReady()) {
// Get Source Rect
var sr = data.sourceRect;
// Block Transfer
bitmap.blt(atlasBitmap, sr.x, sr.y, sr.width, sr.height, data.rect.x, data.rect.y);
} else {
// Make Bitmap green if atlas is not loaded
if ($gameTemp.isPlaytest()) {
// Make Bitmap green if atlas is not loaded
bitmap.fillAll('rgba(0, 255, 0, 1)');
}
};*/
// Return bitmap
return bitmap;
};
};
// Return Empty Bitmap
return ImageManager.loadEmptyBitmap();
};
//=============================================================================
// * Make WindowSkin
//=============================================================================
AtlasManager.makeWindowSkin = function () {
// Create Bitmap
var bitmap = new Bitmap(192, 192);
// Get Atlas Bitmap
var atlasBitmap = ImageManager.loadAtlas('Atlas1');
// Fill Background Color
bitmap.fillRect(0, 0, 96, 96, 'rgba(0, 255, 0, 1)')
// Transfer Border
var cw = 10, ch = 10
bitmap.blt(atlasBitmap, 0, 0, cw, ch, 96, 0);
bitmap.blt(atlasBitmap, 10, 0, cw, ch, 96 + 96 - cw, 0);
bitmap.blt(atlasBitmap, 0, 10, cw, ch, 96, 96 - ch);
bitmap.blt(atlasBitmap, 10, 10, cw, ch, 96 + 96 - cw, 96 - ch);
bitmap.blt(atlasBitmap, 11, 0, 1, ch, 96 + cw, 0, 96 - (cw * 2))
bitmap.blt(atlasBitmap, 11, 10, 1, ch, 96 + cw, 96 - ch, 96 - (cw * 2))
bitmap.blt(atlasBitmap, 0, 11, cw, 1, 96, ch, cw, 96 - (ch * 2))
bitmap.blt(atlasBitmap, 0, 11, cw, 1, 96 + 96 - 5, ch, cw, 96 - (ch * 2))
// Transfer Colors
for (var i = 0; i < 32; i++) {
var px = (i % 20);
var py = 20 + Math.floor(i / 20);
var color = atlasBitmap.getPixel(px, py);
var dx = 96 + (i % 8) * 12;
var dy = 144 + Math.floor(i / 8) * 12;
bitmap.fillRect(dx, dy, 12, 12, color);
}
// Return Bitmap
return bitmap;
};
//=============================================================================
// * Purge All Atlas Images
//=============================================================================
AtlasManager.purgeAllAtlasImages = function (name) {
// Get Atlas Images
const altasImages = Object.entries($atlasData.source).filter(arr => arr[1].atlasName === name);
// Go through atlas images
for (var i = 0; i < altasImages.length; i++) {
// Get Key
const key = altasImages[i][0];
// Delete Cache Item
delete ImageManager._imageCache._items[key];
};
};
//=============================================================================
// * Load System Atlas Images
//=============================================================================
AtlasManager.loadSystemAtlasImages = function () {
// // If Atlas is undefined
// if (window['$atlasData'] === undefined) {
// // Get Atlas File
// var data = jsyaml.load(fs.readFileSync(base + '/data/Atlas.yaml', 'utf8'));
// // Set Atlas Data
// window['$atlasData'] = data;
// };
// // Load All Atlas Images
// this.loadAllAtlasImages();
};
//=============================================================================
// * Load All Atlas Images
//=============================================================================
AtlasManager.loadAllAtlasImages = function () {
var path = require('path');
var fs = require('fs');
var yaml = require('./js/libs/js-yaml-master')
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/img/atlases/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// // If Atlas is undefined
// if (window['$atlasData'] === undefined) {
// // Get Atlas File
// var data = jsyaml.load(fs.readFileSync(base + '/data/Atlas.yaml', 'utf8'));
// // Set Atlas Data
// window['$atlasData'] = data;
// };
// Go Through Directory
for (var i = 0; i < dirList.length; i++) {
// Get Directory
var directory = dirList[i];
// Get Format
var format = path.extname(dirList[i]);
// Get Filename
var filename = path.basename(directory, format);
// If an image
if (format === '.png') {
// Load Atlas
ImageManager.loadAtlas(filename)
};
};
};
// Initialize Atlas Data
//AtlasManager.initAtlasData()
//=============================================================================
// ** ImageManager
//-----------------------------------------------------------------------------
// The static class that loads images, creates bitmap objects and retains them.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.AtlasLoader.ImageManager_loadNormalBitmap = ImageManager.loadNormalBitmap;
_TDS_.AtlasLoader.ImageManager_requestNormalBitmap = ImageManager.requestNormalBitmap
_TDS_.AtlasLoader.ImageManager_loadBitmap = ImageManager.loadBitmap;
_TDS_.AtlasLoader.ImageManager_reserveBitmap = ImageManager.reserveBitmap;
//=============================================================================
// * Load Atlas Image
//=============================================================================
ImageManager.loadAtlas = function (filename, hue) { return this.reserveBitmap('img/atlases/', filename, hue, false, 'atlas'); };
//=============================================================================
// * Load Atlas Bitmap
//=============================================================================
ImageManager.loadAtlasBitmap = function (filename) {
return this.reserveNormalBitmap(filename, 0, 'atlas');
};
//=============================================================================
// * Load Atlas Key Bitmap
//=============================================================================
ImageManager.loadAtlasKeyBitmap = function (key) {
// Get Decoded Key
var dkey = decodeURIComponent(key);
// If Atlas manager has key
if (AtlasManager.hasAltasData(dkey)) {
// Get Bitmap
var bitmap = this._imageCache.get(key);
// If There's no bitmap and there's atlas data for it
if (!bitmap) {
// Make Bitmap
bitmap = AtlasManager.makeBitmap(dkey);
bitmap.smooth = false;
// Add to Image Cache
this._imageCache.add(key, bitmap);
// Return Bitmap
return bitmap;
};
// Return Bitmap
return bitmap;
};
// Return null
return null;
};
//=============================================================================
// * Load Bitmap
//=============================================================================
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
// If Filename is valid
if (filename) {
// Get Path
const loadFileName = replaceSpecialSymbols(filename);
var path = (folder + encodeURIComponent(loadFileName) + '.png').trim();
// Get Atlas Key Bitmap
var bitmap = this.loadAtlasKeyBitmap(encodeURI(path));
// Return bitmap if not null
if (bitmap !== null) { return bitmap; };
};
// Return Original Function
return _TDS_.AtlasLoader.ImageManager_loadBitmap.call(this, folder, filename, hue, smooth);
};
//=============================================================================
// * Reserve Bitmap
//=============================================================================
ImageManager.reserveBitmap = function (folder, filename, hue, smooth, reservationId) {
// If Filename is valid
if (filename) {
// Get Path
var path = folder + filename + '.png';
path = replaceSpecialSymbols(path);
// Get Atlas Key Bitmap
var bitmap = this.loadAtlasKeyBitmap(path);
// Return bitmap if not null
if (bitmap !== null) { return bitmap; };
};
// Return Original Function
return _TDS_.AtlasLoader.ImageManager_reserveBitmap.call(this, folder, filename, hue, smooth, reservationId);
};
//=============================================================================
// * Load Normal Bitmap
//=============================================================================
ImageManager.loadNormalBitmap = function (path, hue) {
// Get Atlas Key Bitmap
var bitmap = this.loadAtlasKeyBitmap(replaceSpecialSymbols(path));
// Return bitmap if not null
if (bitmap !== null) { return bitmap; };
// Return Original Function
return _TDS_.AtlasLoader.ImageManager_loadNormalBitmap.call(this, path, hue);
};
//=============================================================================
// * Request Normal Bitmap
//=============================================================================
ImageManager.requestNormalBitmap = function (path, hue) {
// Get Atlas Key Bitmap
var bitmap = this.loadAtlasKeyBitmap(path);
// Return bitmap if not null
if (bitmap !== null) { return bitmap; };
// Return Original Function
return _TDS_.AtlasLoader.ImageManager_requestNormalBitmap.call(this, path, hue);
};
// Load All Atlas Images (Yes for some reason it needs to be just here to work)
// AtlasManager.loadAllAtlasImages();
AtlasManager.loadSystemAtlasImages()
//=============================================================================
// ** Scene_Boot
//-----------------------------------------------------------------------------
// The scene class for initializing the entire game.
//=============================================================================
// * Determine if Scene is Busy
//=============================================================================
Scene_Boot.prototype.isBusy = function () {
// If Image Manager is not ready return true
if (!ImageManager.isReady()) { return true; }
// Super Call
return Scene_Base.prototype.isBusy.call(this);
};
//=============================================================================
// ** Scene_Base
//-----------------------------------------------------------------------------
// The Superclass of all scene within the game.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.AtlasLoader.Scene_Base_initialize = Scene_Base.prototype.initialize;
_TDS_.AtlasLoader.Scene_Base_terminate = Scene_Base.prototype.terminate
//=============================================================================
// * Determine if Scene is Busy
//=============================================================================
Scene_Base.prototype.initialize = function () {
// Load Reserved Bitmaps
this.loadReservedBitmaps();
// Run Original Function
_TDS_.AtlasLoader.Scene_Base_initialize.call(this);
// Initialize Atlas List
this.initAtlastLists();
// Load Required Atlas Images
this.loadRequiredAtlasImages();
};
//=============================================================================
// * Terminate the scene before switching to a another scene.
//=============================================================================
Scene_Base.prototype.terminate = function () {
// Run Original Function
_TDS_.AtlasLoader.Scene_Base_terminate.call(this);
// Dump Required Atlases
this.dumpRequiredAtlas();
}
//=============================================================================
// * Load Reserved Bitmaps
//=============================================================================
Scene_Base.prototype.loadReservedBitmaps = function () { };
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_Base.prototype.initAtlastLists = function () {
// List of Atlases require for the scene to start
this._requiredAtlasList = [];
// List of Atlases to dump when scene is done
this._dumpAtlasList = []
// All Atlas Loaded Flag
this._allAtlasLoaded = false;
};
//=============================================================================
// * Add Required Atlas
//=============================================================================
Scene_Base.prototype.addRequiredAtlas = function (name, dump = true) {
// If Required Atlast list does not contain name
if (!this._requiredAtlasList.contains(name)) {
// Add it to required atlas list
this._requiredAtlasList.push(name);
};
// If Dump and Dump atlas list does not contain name
if (dump && !this._dumpAtlasList.contains(name)) {
// Add it to dump atlas list
this._dumpAtlasList.push(name);
};
};
//=============================================================================
// * Load Required Atlas Images
//=============================================================================
Scene_Base.prototype.loadRequiredAtlasImages = function () {
// Go Through Required Atlas List
for (var i = 0; i < this._requiredAtlasList.length; i++) {
ImageManager.loadAtlas(this._requiredAtlasList[i]);
};
};
//=============================================================================
// * Dump Required Atlas Images
//=============================================================================
Scene_Base.prototype.dumpRequiredAtlas = function () {
// Initialize Dump List
var dumpList = this._dumpAtlasList.clone();
// Get Next Scene
var nextScene = SceneManager._nextScene;
// If Next Scene Exists
if (nextScene) {
// Get Required Atlas List from Next Scene
var nextRequiredAtlasList = nextScene._requiredAtlasList;
// Go through required Atlas list
for (var i = 0; i < nextRequiredAtlasList.length; i++) {
// Get Index in dump list
var index = dumpList.indexOf(nextRequiredAtlasList[i]);
// Remove fro Dump list if it exists
if (index >= 0) { dumpList.splice(index, 1); };
};
};
// Go Through Dump List
for (var i = 0; i < dumpList.length; i++) {
// Get Atlas Name
var atlasName = dumpList[i];
// Get Atlas Key
var key = 'img/atlases/' + atlasName + '.png:0'
// Delete Cache Item
delete ImageManager._imageCache._items[key];
};
};
//=============================================================================
// * Check if all required atlases are loaded
//=============================================================================
Scene_Base.prototype.areAllRequiredAtlasLoaded = function () {
// If Atlas loading has not started return false
if (this._allAtlasLoaded) { return true; }
// Set Loaded Flag
var loaded = true;
// Go Through Required Atlas List
for (var i = 0; i < this._requiredAtlasList.length; i++) {
// Get Bitmap
var bitmap = ImageManager.loadAtlas(this._requiredAtlasList[i]);
// If Bitmap Loading state is not loaded
if (bitmap._loadingState !== 'loaded') {
// Set loaded flag to false
loaded = false;
break
};
};
// Set Loaded flag to false
if (!ImageManager.isReady()) { loaded = false; }
// If Loaded set All Atlas loaded flag to true
if (loaded) { this._allAtlasLoaded = true; };
// Return loaded flag
return loaded;
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,402 @@
//=============================================================================
// TDS Battle Commands List
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_BattleCommandsList = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.BattleCommandsList = _TDS_.BattleCommandsList || {};
//=============================================================================
/*:
* @plugindesc
* This plugin allows you to set custom battle commands for actors and classes.
*
* @author TDS
* @param Skill Type Names
* @desc Names of skill types. (Used for skill list commands) (Use a , to separate and leave empty for default name.)
* @default
*
* @help
* ============================================================================
* * Actor & Class Notetags
* ============================================================================
* Use the following note tags within the actor or class note boxes to
* set the command list for the actor or class. (Actor note tags will
* override class tags.)
*
* <BattleCommandsList>
* Command
* </BattleCommandsList>
*
* Example:
*
* <BattleCommandsList>
* attack
* defend
* skillList
* skillTypeList: 1
* skill: 10
* items
* item: 2
* </BattleCommandsList>
*
* Command List:
*
* attack
* ^ Adds default attack command to the commmand list.
*
* defend
* ^ Adds default defense command to the command list.
*
* skillList
* ^ Adds default skill command to the command list. (Shows all skills)
*
* skillTypeList: SkillTypeId
* ^ Adds a skill list command which only shows a type of skill.
* ^ SkillTypeId: Id of the type of skill to show.
*
* skill: ID
* ^ Adds a skill as a command.
* ^ ID: Id of the skill to set as a command.
*
* items
* ^ Adds default item command to the command list. (Shows all items)
*
* item: ID
* ^ Adds an item as a command.
* ^ ID: ID of the item to set as a command.
*
* ============================================================================
* * Skill & Item Notetags
* ============================================================================
* These note tags will modify how items and skills are displayed or used
* in the command window.
*
* <CommandName: NAME>
* ^ This note tag allows you to set a display name for a skill or item
* when it is being displayed as a command.
* ^ NAME: Name to use as a command.
*
* Example:
* <CommandName: Limit break>
*
*
* <CommandHideUntilSwitch: ID>
* ^ This note tag makes it so if a switch is not on the item or skill
* will not be displayed in the command list.
* ^ ID: ID of the switch to use.
*
* Example:
* <CommandHideUntilSwitch: 5>
*
*
* <CommandHideUntilUsable>
* ^ This note tag makes it so if an item or skill cannot be used by
* the actor it will not be displayed in the command list.
*
*
* <CommandHideUntilLearned>
* ^ This note tag makes it so if a skill has not been learned by the
* actor it will not be displayed in the command list.
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Battle Commands List");
// Initialize After Battle Commmon Event Parameters
_TDS_.BattleCommandsList.params = {};
// Skill Type Custom Names
_TDS_.BattleCommandsList.params.sTypeNames = [''];
// Get Text
var text = parameters['Skill Type Names'];
// If Text is not empty
if (text !== '') {
// Create List
var list = text.split(/,/);
// Go through List
for (var i = 0; i < list.length; i++) {
// Add Skill Type Name
_TDS_.BattleCommandsList.params.sTypeNames.push(list[i].trim());
}
}
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The static class that manages the database and game objects.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.BattleCommandsList.DataManager_onLoad = DataManager.onLoad;
//=============================================================================
// * On Load Processing
//=============================================================================
DataManager.onLoad = function(object) {
// Run Original Function
_TDS_.BattleCommandsList.DataManager_onLoad.call(this, object);
// Set Array & Type
var array = object, type = null;
// Object Switch
switch (object) {
case $dataActors: type = 'ACTOR' ;break;
// case $dataClasses: type = 'CLASS' ;break;
// case $dataItems: type = 'ITEM' ;break;
// case $dataSkills: type = 'SKILL' ;break;
}
// If Type is not null
if (type !== null) {
// If Array is an array
if (Array.isArray(array)) {
// Go Through Array
for (var i = 0; i < array.length; i++) {
// Get Data
var data = array[i];
// Extract MetaData
if (data) { this.extractActorBattleListMetaData(data, type); }
}
}
}
};
//=============================================================================
// * Extract Meta Data
//=============================================================================
DataManager.extractActorBattleListMetaData = function(data, type) {
// If Data has no notes return
if (data.note.length <= 0) { return; }
// If Type is Actor
if (type === 'ACTOR' || type === 'CLASS') {
// If Data Meta has Info Text
// Get Regexp
var noteData = data.note.split(/[\r\n]+/);
var regS = /<BattleCommandsList>/i, regE = /<\/BattleCommandsList>/;
// Set Addline Flag to false
var addLine = false;
// Convert Battle Command List
data.meta.BattleCommandsList = [];
// Go Through Note Data
for (var i = 0; i < noteData.length; i++) {
var line = noteData[i];
if (line.match(regS)) { addLine = true ; continue ;}
if (line.match(regE)) { addLine = false ; continue ;}
// If add line flag is true
if (addLine) {
var commandData = line.split(/:/i);
data.meta.BattleCommandsList.push({ type: commandData[0].toLowerCase(), id: Number(commandData[1]) })
}
}
}
};
//=============================================================================
// ** Game_Actor
//-----------------------------------------------------------------------------
// The game object class for an actor.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.BattleCommandsList.Game_Actor_setup = Game_Actor.prototype.setup;
//=============================================================================
// * Setup
//=============================================================================
Game_Actor.prototype.setup = function(actorId) {
// Run Original Function
_TDS_.BattleCommandsList.Game_Actor_setup.call(this, actorId);
// Initialize Battle Command List
this.initBattleCommandsList();
};
//=============================================================================
// * Initialize Actor Battle Commands List
//=============================================================================
Game_Actor.prototype.initBattleCommandsList = function() {
// Get Actor & Current Class
var actor = this.actor(), currentClass = this.currentClass();
// Find Corrent Battle Command List
if (actor.meta.BattleCommandsList) {
// Set Battle Command List
this._battleCommandsList = actor.meta.BattleCommandsList.clone();
} else if (currentClass.meta.BattleCommandsList) {
// Set Battle Command List
this._battleCommandsList = currentClass.meta.BattleCommandsList.clone();
} else {
// Set Battle Command List
this._battleCommandsList = []
}
};
//=============================================================================
// * Determine if Battler has custom battle commands
//=============================================================================
Game_Actor.prototype.hasCustomBattleCommands = function() { return this._battleCommandsList.length > 0; };
//=============================================================================
// * Get Actor Battle Commands List
//=============================================================================
Game_Actor.prototype.battleCommandsList = function() { return this._battleCommandsList; };
//=============================================================================
// * Determine if Actor can show item battle command
//=============================================================================
Game_Actor.prototype.canShowItemBattleCommand = function(item) {
if (item.meta.CommandHideUntilUsable && !this.canUse(item)) { return false; };
if (item.meta.CommandHideUntilLearned && !this.isLearnedSkill(item.id)) { return false; };
if (item.meta.CommandHideUntilSwitch && !$gameSwitches.value(Number(item.meta.CommandHideUntilSwitch))) { return false; };
// Return true by default
return true;
};
//=============================================================================
// ** Window_ActorCommand
//-----------------------------------------------------------------------------
// The window for selecting an actor's action on the battle screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.BattleCommandsList.Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
//=============================================================================
// * Make Command List
//=============================================================================
Window_ActorCommand.prototype.makeCommandList = function() {
// If Actor has Custom Battle Commands
if (this._actor && this._actor.hasCustomBattleCommands()) {
// Make Custom Actor Command List
this.makeCustomActorCommandList();
return;
};
// Run Original Function
_TDS_.BattleCommandsList.Window_ActorCommand_makeCommandList.call(this);
};
//=============================================================================
// * Make Custom Actor Command List
//=============================================================================
Window_ActorCommand.prototype.makeCustomActorCommandList = function() {
// Get Actor
var actor = this._actor;
// Get Actor Battle Commands List
var list = actor.battleCommandsList();
// Go Through List
for (var i = 0; i < list.length; i++) { this.addActorCustomCommand(list[i]); };
};
//=============================================================================
// * Add Actor Custom Command
//=============================================================================
Window_ActorCommand.prototype.addActorCustomCommand = function(obj) {
// Get Actor
var actor = this._actor;
// Object type case
switch (obj.type.toLowerCase()) {
case 'attack': this.addAttackCommand() ;break;
case 'skilllist': this.addSkillCommands() ;break;
case 'defend': this.addGuardCommand() ;break;
case 'items': this.addItemCommand() ;break;
case 'skilltypelist':
var stypeId = obj.id;
var presetName = _TDS_.BattleCommandsList.params.sTypeNames[stypeId];
// If Stype Names is not ''
if (presetName && presetName !== '') {
var name = presetName;
} else {
var name = $dataSystem.skillTypes[stypeId];
}
this.addCommand(name, 'skill', true, stypeId);
break;
case 'skill':
// Get Skill
var skill = $dataSkills[obj.id];
// If Skill command can be shown
if (actor.canShowItemBattleCommand(skill)) {
// Get Skill Name
var name = (skill.meta.CommandName || skill.name).trim();
// Add Command
this.addCommand(name, 'actionSkill', actor.canUse(skill), skill.id);
}
break;
case 'item':
// Get Skill
var item = $dataItems[obj.id];
// If Item command can be shown
if (actor.canShowItemBattleCommand(item)) {
// Get Item Name
var name = (item.meta.CommandName || item.name).trim();
// Add Command
this.addCommand(name, 'actionItem', actor.canUse(item), item.id);
}
break;
default:
this.addCommand('ERROR', 'ERROR', false);
break;
}
};
//=============================================================================
// ** Scene_Battle
//-----------------------------------------------------------------------------
// The scene class of the battle screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.BattleCommandsList.Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;
_TDS_.BattleCommandsList.Scene_Battle_onEnemyCancel = Scene_Battle.prototype.onEnemyCancel;
_TDS_.BattleCommandsList.Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel;
//=============================================================================
// * Create Actor Command Window
//=============================================================================
Scene_Battle.prototype.createActorCommandWindow = function() {
// Run Original Function
_TDS_.BattleCommandsList.Scene_Battle_createActorCommandWindow.call(this);
// Set Actor Command Window Handlers
this._actorCommandWindow.setHandler('actionSkill', this.commandActorCommandAction.bind(this));
this._actorCommandWindow.setHandler('actionItem', this.commandActorCommandAction.bind(this));
};
//=============================================================================
// * On Enemy Cancel
//=============================================================================
Scene_Battle.prototype.onEnemyCancel = function() {
// Run Original Function
_TDS_.BattleCommandsList.Scene_Battle_onEnemyCancel.call(this);
switch (this._actorCommandWindow.currentSymbol()) {
case 'actionSkill':
this._actorCommandWindow.activate();
break;
case 'actionItem':
this._actorCommandWindow.activate();
break;
}
};
//=============================================================================
// * On Actor Cancel
//=============================================================================
Scene_Battle.prototype.onActorCancel = function() {
// Run Original Function
_TDS_.BattleCommandsList.Scene_Battle_onActorCancel.call(this);
switch (this._actorCommandWindow.currentSymbol()) {
case 'actionSkill':
this._actorCommandWindow.activate();
break;
case 'actionItem':
this._actorCommandWindow.activate();
break;
}
};
//=============================================================================
// * Create Actor Command Window
//=============================================================================
Scene_Battle.prototype.commandActorCommandAction = function() {
var symbol = this._actorCommandWindow.currentSymbol();
var id = this._actorCommandWindow.currentExt();
var action = BattleManager.inputtingAction();
if (symbol === 'actionSkill') { action.setSkill(id); }
if (symbol === 'actionItem') { action.setItem(id); }
this.onSelectAction();
}

View file

@ -0,0 +1,447 @@
//=============================================================================
// TDS Character Movement Graphics
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_CharacterMovementGraphics = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.CharacterMovementGraphics = _TDS_.CharacterMovementGraphics || {};
//=============================================================================
/*:
* @plugindesc
* This plugins let's you set special graphics for character movements such as:
* idle, walking, and running.
*
* @author TDS
*
* @help
*
* Use the following in a script call to set the movement graphics for an
* actor:
*
* $gameActors.actor(actorId).setMovementGraphics(idle, walking, running);
* ^ actorId: Actor database ID.
* ^ idle: Graphics name for idle. (Not moving)
* ^ walking: Graphics name for walking. (Normal walking)
* ^ running: Graphics name for running. (Moving and Dashing at the same time)
*
* Example:
*
* $gameActors.actor(1).setMovementGraphics('$NormalMale', '$NormalMale', '$Teen_Male%(8)');
*
*
* Use the following in a script call to clear he movement graphics for an
* actor:
*
* $gameActors.actor(actorId).clearMovementGraphics();
* ^ actorId: Actor database ID.
*
* Example:
*
* $gameActors.actor(1).clearMovementGraphics();
*
*/
//=============================================================================
//=============================================================================
// ** Game_Actor
//-----------------------------------------------------------------------------
// The game object class for an actor.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CharacterMovementGraphics.Game_Actor_initMembers = Game_Actor.prototype.initMembers;
//=============================================================================
// * Initialize Members
//=============================================================================
Game_Actor.prototype.initMembers = function() {
// Run Original Function
_TDS_.CharacterMovementGraphics.Game_Actor_initMembers.call(this);
// Initialize Character Movement Graphics
this._characterMovementGraphics = {};
};
//=============================================================================
// * Set Movement Graphics
//=============================================================================
Game_Actor.prototype.setMovementGraphics = function(idle, walking, running) {
// Set Character Movement Graphics
this.setMovementGraphicData('idle', idle);
this.setMovementGraphicData('walking', walking);
this.setMovementGraphicData('running', running);
};
//=============================================================================
// * Set Movement Graphic Data
//=============================================================================
Game_Actor.prototype.setMovementGraphicData = function(name, data) {
// Set Default Data
if (typeof data === 'string') { data = { name: data, index: 1 }; };
// Set Character Movement Graphics Data
this._characterMovementGraphics[name.toLowerCase()] = data;
};
//=============================================================================
// * Clear Movement Graphics
//=============================================================================
Game_Actor.prototype.clearMovementGraphics = function() {
// Delete Character Movement Graphics
delete this._characterMovementGraphics;
// Initialize Character Movement Graphics
this._characterMovementGraphics = {};
};
//=============================================================================
// ** Game_CharacterBase
//-----------------------------------------------------------------------------
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CharacterMovementGraphics.Game_CharacterBase_update = Game_CharacterBase.prototype.update;
//=============================================================================
// * Frame Update
//=============================================================================
Game_CharacterBase.prototype.update = function() {
// Run Original Function
_TDS_.CharacterMovementGraphics.Game_CharacterBase_update.call(this);
// Update Movement Graphics
this.updateMovementGraphics();
};
//=============================================================================
// * Determine if Movement Graphic should be updated
//=============================================================================
Game_CharacterBase.prototype.canUpdateMovementGraphics = function() { return false; };
//=============================================================================
// * Determine if running graphic should be used
//=============================================================================
Game_CharacterBase.prototype.shouldUseRunningGraphics = function() { return false; }
//=============================================================================
// * Determine if Character is climbing
//=============================================================================
Game_CharacterBase.prototype.isClimbing = function() { return this.regionId() === 90; };
//=============================================================================
// * Get Movement Graphics Source
//=============================================================================
Game_CharacterBase.prototype.movementGraphicsSource = function() { return null };
//=============================================================================
// * Update Movement Graphics
//=============================================================================
Game_CharacterBase.prototype.updateMovementGraphics = function() {
// If Normal
if (this.canUpdateMovementGraphics()) {
// Get Actor
var actor = this.movementGraphicsSource();
// If Actor Exists
if (actor) {
// Get Graphics
var graphics = actor._characterMovementGraphics;
// Get Character Graphic Name
var characterName = this.characterName();
// Get character index
var characterIndex = this.characterIndex();
// If Moving
if (this.isMoving()) {
// If Climbing
if (this.isClimbing()) {
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (this.shouldUseRunningGraphics()) {
if (graphics.running && (characterName !== graphics.running.name || characterIndex !== graphics.running.index)) {
let bitmap = ImageManager.loadCharacter(graphics.running.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.running.name, graphics.running.index);
}
} else {
if (graphics.walking && (characterName !== graphics.walking.name || characterIndex !== graphics.walking.index)) {
let bitmap = ImageManager.loadCharacter(graphics.walking.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.walking.name, graphics.walking.index);
}
};
};
} else {
// If Climbing
if (this.isClimbing()) {
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (graphics.idle && this._stopCount > 0 && (characterName !== graphics.idle.name || characterIndex !== graphics.idle.index)) {
let bitmap = ImageManager.loadCharacter(graphics.idle.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.idle.name, graphics.idle.index);
}
}
}
}
};
// Update Toast
this.updateToast();
};
//=============================================================================
// * Update Toast
//=============================================================================
Game_CharacterBase.prototype.updateToast = function() {
// Get Actor
var actor = this.movementGraphicsSource();
// If Actor exists
if (actor) {
// If Switch 12 is on
if ($gameSwitches.value(12) === true) {
// If Actor is dead
if (actor.isDead()) {
// Get Character Graphic Name
var characterName = this.characterName();
// If not on Toasted
if (characterName !== '$Toasted') { this.setImage("$Toasted", 0); }
this.setStepAnime(true);
} else {
this.setStepAnime(false);
};
};
}
};
//=============================================================================
// ** Game_Player
//-----------------------------------------------------------------------------
// The game object class for the player. It contains event starting
// determinants and map scrolling functions.
//=============================================================================
// * Determine if Movement Graphic should be updated
//=============================================================================
Game_Player.prototype.canUpdateMovementGraphics = function() { return this.isNormal() && this.movementGraphicsSource().isAlive(); };
//=============================================================================
// * Get Movement Graphics Source
//=============================================================================
Game_Player.prototype.movementGraphicsSource = function() { return $gameParty.leader(); };
//=============================================================================
// * Determine if running graphic should be used
//=============================================================================
Game_Player.prototype.shouldUseRunningGraphics = function() { return this.isDashing(); }
Game_Player.prototype.getFollowers = function() {
return this._followers;
};
Game_Followers.prototype.getFollowerById = function(id) {
// Go Through Data
for (var i = 0; i < this._data.length; i++) {
// Get Follower
var follower = this._data[i];
// If Follower Graphics Data matches the ID
if (follower._graphicsData && follower._graphicsData.id === id) {
return follower;
};
};
return null;
};
//=============================================================================
// ** Game_Follower
//-----------------------------------------------------------------------------
// The game object class for a follower. A follower is an allied character,
// other than the front character, displayed in the party.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CharacterMovementGraphics.Game_Follower_initialize = Game_Follower.prototype.initialize;
Game_Follower.prototype.initialize = function(memberIndex) {
_TDS_.CharacterMovementGraphics.Game_Follower_initialize.call(this, memberIndex);
this._characterMovementGraphics = null;
this._hasCharacterMovementGraphics = false;
};
_TDS_.CharacterMovementGraphics.Game_Follower_update = Game_Follower.prototype.update;
//=============================================================================
// * Determine if Movement Graphic should be updated
//=============================================================================
Game_Follower.prototype.canUpdateMovementGraphics = function() {
// Get Source
var source = this.movementGraphicsSource();
// Return if source exists and is alive
if (source) {
return $gamePlayer.isNormal() && this.isVisible() && source && source.isAlive();
} else {
return this._graphicsData && this._graphicsData.id && this._hasCharacterMovementGraphics;
}
};
//=============================================================================
// * Get Movement Graphics Source
//=============================================================================
Game_Follower.prototype.movementGraphicsSource = function() { return this.actor() };
//=============================================================================
// * Determine if running graphic should be used
//=============================================================================
Game_Follower.prototype.shouldUseRunningGraphics = function() { return $gamePlayer.isDashing(); }
//=============================================================================
// * Determine if running graphic should be used
//=============================================================================
Game_Follower.prototype.update = function() {
// Run Original Version
_TDS_.CharacterMovementGraphics.Game_Follower_update.call(this);
// Update Toast
this.updateToast();
};
//=============================================================================
// * Set Movement Graphics
//=============================================================================
Game_Follower.prototype.setMovementGraphics = function(idle, walking, running) {
// Set Character Movement Graphics
if (!this._characterMovementGraphics) this._characterMovementGraphics = {};
this._hasCharacterMovementGraphics= true;
this.setMovementGraphicData('idle', idle);
this.setMovementGraphicData('walking', walking);
this.setMovementGraphicData('running', running);
};
//=============================================================================
// * Set Movement Graphic Data
//=============================================================================
Game_Follower.prototype.setMovementGraphicData = function(name, data) {
if (!this._characterMovementGraphics) this._characterMovementGraphics = {};
// Set Default Data
if (typeof data === 'string') { data = { name: data, index: 1 }; };
// Set Character Movement Graphics Data
this._characterMovementGraphics[name.toLowerCase()] = data;
};
//=============================================================================
// * Clear Movement Graphics
//=============================================================================
Game_Follower.prototype.clearMovementGraphics = function() {
// Delete Character Movement Graphics
delete this._characterMovementGraphics;
// Initialize Character Movement Graphics
this._characterMovementGraphics = null;
this._hasCharacterMovementGraphics = false;
};
Game_Follower.prototype.updateMovementGraphics = function() {
// If Normal
if (this.canUpdateMovementGraphics()) {
// Get Actor
var actor = this.movementGraphicsSource();
// If Actor Exists
if (actor) {
// Get Graphics
var graphics = actor._characterMovementGraphics;
// Get Character Graphic Name
var characterName = this.characterName();
// Get character index
var characterIndex = this.characterIndex();
// If Moving
if (this.isMoving()) {
// If Climbing
if (this.isClimbing()) {
if (characterName === "DW_BASIL" || characterName === "$DW_BASIL_RUN%(8)") {
this._characterMovementGraphics.climbing = { name: "DW_Climb", index: 0 };
}
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (this.shouldUseRunningGraphics()) {
if (graphics.running && (characterName !== graphics.running.name || characterIndex !== graphics.running.index)) {
let bitmap = ImageManager.loadCharacter(graphics.running.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.running.name, graphics.running.index);
}
} else {
if (graphics.walking && (characterName !== graphics.walking.name || characterIndex !== graphics.walking.index)) {
let bitmap = ImageManager.loadCharacter(graphics.walking.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.walking.name, graphics.walking.index);
}
};
};
} else {
// If Climbing
if (this.isClimbing()) {
if (characterName === "DW_BASIL" || characterName === "$DW_BASIL_RUN%(8)") {
this._characterMovementGraphics.climbing = { name: "DW_Climb", index: 0 };
}
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (graphics.idle && this._stopCount > 0 && (characterName !== graphics.idle.name || characterIndex !== graphics.idle.index)) {
let bitmap = ImageManager.loadCharacter(graphics.idle.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.idle.name, graphics.idle.index);
}
}
}
} else if (this._characterMovementGraphics) {
// Get Graphics
var graphics = this._characterMovementGraphics;
// Get Character Graphic Name
var characterName = this.characterName();
// Get character index
var characterIndex = this.characterIndex();
// If Moving
if (this.isMoving()) {
// If Climbing
if (this.isClimbing()) {
if (characterName === "DW_BASIL" || characterName === "$DW_BASIL_RUN%(8)") {
this._characterMovementGraphics.climbing = { name: "DW_Climb", index: 0 };
}
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (this.shouldUseRunningGraphics()) {
if (graphics.running && (characterName !== graphics.running.name || characterIndex !== graphics.running.index)) {
let bitmap = ImageManager.loadCharacter(graphics.running.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.running.name, graphics.running.index);
}
} else {
if (graphics.walking && (characterName !== graphics.walking.name || characterIndex !== graphics.walking.index)) {
let bitmap = ImageManager.loadCharacter(graphics.walking.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.walking.name, graphics.walking.index);
}
};
};
} else {
// If Climbing
if (this.isClimbing()) {
if (characterName === "DW_BASIL" || characterName === "$DW_BASIL_RUN%(8)") {
this._characterMovementGraphics.climbing = { name: "DW_Climb", index: 0 };
}
if (graphics.climbing && (characterName !== graphics.climbing.name || characterIndex !== graphics.climbing.index)) {
let bitmap = ImageManager.loadCharacter(graphics.climbing.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.climbing.name, graphics.climbing.index);
}
} else {
if (graphics.idle && this._stopCount > 0 && (characterName !== graphics.idle.name || characterIndex !== graphics.idle.index)) {
let bitmap = ImageManager.loadCharacter(graphics.idle.name);
if(!bitmap.isReady()) {return;}
this.setImage(graphics.idle.name, graphics.idle.index);
}
}
}
}
};
// Update Toast
this.updateToast();
};

View file

@ -0,0 +1,266 @@
/*:
* @plugindesc Basic plugin for manipulating important parameters.
* @author RM CoreScript team
*
* @help
* Basic plugin for manipulating important parameters.
* There is no plugin command.
*
* Caching images improves performance but increases memory allocation.
* On mobile devices, a lot of memory allocation causes the browser to crash.
* Therefore, the upper limit of memory allocation is set with cacheLimit.
*
* If you want to regain high performance, just increase cacheLimit.
* There is no need to revert to 1.4.
*
* @param cacheLimit
* @type number
* @desc The upper limit of images' cached size (MPixel)
* @default 10
*
* @param screenWidth
* @type number
* @desc The resolution of screen width
* @default 816
*
* @param screenHeight
* @type number
* @desc The resolution of screen height
* @default 624
*
* @param changeWindowWidthTo
* @type number
* @desc If set, change window width to this value
*
* @param changeWindowHeightTo
* @type number
* @desc If set, change window height to this value
*
* @param renderingMode
* @type select
* @option canvas
* @option webgl
* @option auto
* @desc The rendering mode (canvas/webgl/auto)
* @default auto
*
* @param alwaysDash
* @type boolean
* @desc The initial value whether the player always dashes (on/off)
* @on ON
* @off OFF
* @default false
*
* @param textSpeed
* @type number
* @desc The text speed on "Show Text". The larger this parameter is, the slower text speed. (0: show all texts at once)
* @default 1
*
* @param enableProgressBar
* @type boolean
* @desc Show progress bar when it takes a long time to load resources
* @default true
*
* @param maxRenderingFps
* @type number
* @desc The maximum value of rendering frame per seconds (0: unlimited)
* @default 0
*/
/*:ja
* @plugindesc 基本的なパラメーターを設定するプラグインです
* @author RM CoreScript team
*
* @help
* 基本的なパラメーターを設定するプラグインです
* このプラグインにはプラグインコマンドはありません
*
* 画像をキャッシュするとパフォーマンスは向上しますがその分メモリ確保も増大します
* モバイルデバイスではたくさんのメモリ確保はブラウザをクラッシュさせます
* そこでメモリ確保の上限を画像キャッシュ上限値で設定しています
*
* もし高いパフォーマンスを取り戻したければただ画像キャッシュ上限値を増加させればよいです
* 1.4に戻す必要はありません
*
* @param cacheLimit
* @type number
* @text 画像キャッシュ上限値
* @desc 画像のメモリへのキャッシュの上限値 (MPix)
* @default 10
*
* @param screenWidth
* @type number
* @text ゲーム画面の幅
* @default 816
*
* @param screenHeight
* @type number
* @text ゲーム画面の高さ
* @default 624
*
* @param changeWindowWidthTo
* @type number
* @text ウィンドウの幅
* @desc 値が設定されなかった場合ゲーム画面の幅と同じ
*
* @param changeWindowHeightTo
* @type number
* @text ウィンドウの高さ
* @desc 値が設定されなかった場合ゲーム画面の高さと同じ
*
* @param renderingMode
* @type select
* @option canvas
* @option webgl
* @option auto
* @text レンダリングモード
* @default auto
*
* @param alwaysDash
* @type boolean
* @text 常時ダッシュの初期値
* @on ON
* @off OFF
* @default false
*
* @param textSpeed
* @type number
* @text 文章の表示のスピード
* @desc 数字が大きいほど文章の表示スピードが遅くなります (0を指定した場合は一度に全文を表示します)
* @default 1
*
* @param autoSaveFileId
* @type number
* @text オートセーブ番号
* @desc 場所移動の際に指定したファイル番号にオートセーブします0を指定した場合はオートセーブしません
* @default 0
*
* @param errorMessage
* @type string
* @text エラーメッセージ
* @desc エラー時にプレイヤーに向けて表示するメッセージです
* @default エラーが発生しましたゲームの作者にご連絡ください
*
* @param showErrorDetail
* @type boolean
* @text エラー詳細表示
* @desc ONにするとエラー時にエラーを発生させたイベントの情報とスタックトレースを表示します
* @default true
*
* @param enableProgressBar
* @type boolean
* @text ロード進捗バー有効化
* @desc ONにすると読み込みに時間がかかっている時にロード進捗バーを表示します
* @default true
*
* @param maxRenderingFps
* @type number
* @text 描画FPS上限値
* @desc 描画FPSの上限値を設定します (0を指定した場合は制限なし)
* @default 0
*/
(function() {
'use strict';
function isNumber(str) {
return !!str && !isNaN(str);
}
function toNumber(str, def) {
return isNumber(str) ? +str : def;
}
var parameters = PluginManager.parameters('Community_Basic');
var cacheLimit = toNumber(parameters['cacheLimit'], 10);
var screenWidth = toNumber(parameters['screenWidth'], 816);
var screenHeight = toNumber(parameters['screenHeight'], 624);
var renderingMode = parameters['renderingMode'].toLowerCase();
var alwaysDash = (parameters['alwaysDash'] === 'true') ||(parameters['alwaysDash'] === 'on');
var textSpeed = toNumber(parameters['textSpeed'], 1);
var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0);
var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0);
var maxRenderingFps = toNumber(parameters['maxRenderingFps'], 0);
var errorMessage = parameters['errorMessage'];
var showErrorDetail = parameters['showErrorDetail'] === 'true';
var enableProgressBar = parameters['enableProgressBar'] === 'true';
var windowWidth;
var windowHeight;
if(windowWidthTo){
windowWidth = windowWidthTo;
}else if(screenWidth !== SceneManager._screenWidth){
windowWidth = screenWidth;
}
if(windowHeightTo){
windowHeight = windowHeightTo;
}else if(screenHeight !== SceneManager._screenHeight){
windowHeight = screenHeight;
}
ImageCache.limit = cacheLimit * 1000 * 1000;
SceneManager._screenWidth = screenWidth;
SceneManager._screenHeight = screenHeight;
SceneManager._boxWidth = screenWidth;
SceneManager._boxHeight = screenHeight;
SceneManager.preferableRendererType = function() {
if (Utils.isOptionValid('canvas')) {
return 'canvas';
} else if (Utils.isOptionValid('webgl')) {
return 'webgl';
} else if (renderingMode === 'canvas') {
return 'canvas';
} else if (renderingMode === 'webgl') {
return 'webgl';
} else {
return 'auto';
}
};
var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
_ConfigManager_applyData.apply(this, arguments);
if (config['alwaysDash'] === undefined) {
this.alwaysDash = alwaysDash;
}
};
var _Window_Message_clearFlags = Window_Message.prototype.clearFlags;
Window_Message.prototype.clearFlags = function(textState) {
_Window_Message_clearFlags.apply(this, arguments);
this._textSpeed = textSpeed - 1;
};
var _SceneManager_initNwjs = SceneManager.initNwjs;
SceneManager.initNwjs = function() {
_SceneManager_initNwjs.apply(this, arguments);
if (Utils.isNwjs() && windowWidth && windowHeight) {
var dw = windowWidth - window.innerWidth;
var dh = windowHeight - window.innerHeight;
window.moveBy(-dw / 2, -dh / 2);
window.resizeBy(dw, dh);
}
};
if (maxRenderingFps) {
var currentTime = Date.now();
var deltaTime = 1000 / maxRenderingFps;
var accumulator = 0;
var _SceneManager_renderScene = SceneManager.renderScene;
SceneManager.renderScene = function() {
var newTime = Date.now();
accumulator += newTime - currentTime;
currentTime = newTime;
if (accumulator >= deltaTime) {
accumulator -= deltaTime;
_SceneManager_renderScene.apply(this, arguments);
}
};
}
// Graphics.setProgressEnabled(enableProgressBar);
})();

View file

@ -0,0 +1,376 @@
// by VienDesu! Poring Team 2023
// ============================================================
// Add Cordova pause/resume events support for AudioManager
// ============================================================
var currentBgm = null;
var currentBgs = null;
document.addEventListener("deviceready", onCordovaDeviceReady, false);
function onCordovaDeviceReady() {
console.log("AudioManager - SETUP!!!"); //Remove in release
document.addEventListener("pause", onCordovaPause, false);
document.addEventListener("resume", onCordovaResume, false);
};
function onCordovaPause() {
console.log("AudioManager - HIDE!!!"); //Remove in release
currentBgm = AudioManager.saveBgm();
currentBgs = AudioManager.saveBgs();
AudioManager.stopAll();
};
function onCordovaResume() {
console.log("AudioManager - SHOW!!!"); //Remove in release
AudioManager.replayBgm(currentBgm);
AudioManager.replayBgs(currentBgs);
};
// =========================================================
// Add Cordova pause/resume events support for RPG Maker
// =========================================================
WebAudio.prototype._setupEventHandlers = function () {
var resumeHandler = function () {
var context = WebAudio._context;
if (context && context.state === "suspended" && typeof context.resume === "function") {
context.resume().then(function () {
WebAudio._onTouchStart();
});
} else {
WebAudio._onTouchStart();
}
};
document.addEventListener("keydown", resumeHandler);
document.addEventListener("mousedown", resumeHandler);
document.addEventListener("touchend", resumeHandler);
document.addEventListener('touchstart', this._onTouchStart.bind(this));
document.addEventListener('visibilitychange', this._onVisibilityChange.bind(this));
document.addEventListener("deviceready", this._onCordovaDeviceReady.bind(this), false);
};
WebAudio.prototype._onCordovaDeviceReady = function () {
console.log("WebAudio - SETUP!!!"); //Remove in release
document.addEventListener("pause", this._onCordovaPause.bind(this), false);
document.addEventListener("resume", this._onCordovaResume.bind(this), false);
};
WebAudio.prototype._onCordovaPause = function () {
console.log("WebAudio - HIDE!!!"); //Remove in release
this._onHide();
};
WebAudio.prototype._onCordovaResume = function () {
console.log("WebAudio - SHOW!!!"); //Remove in release
this._onShow();
};
Html5Audio.prototype._setupEventHandlers = function () {
document.addEventListener('touchstart', this._onTouchStart.bind(this));
document.addEventListener('visibilitychange', this._onVisibilityChange.bind(this));
this._audioElement.addEventListener("loadeddata", this._onLoadedData.bind(this));
this._audioElement.addEventListener("error", this._onError.bind(this));
this._audioElement.addEventListener("ended", this._onEnded.bind(this));
this._audioElement.addEventListener("deviceready", this._onCordovaDeviceReady.bind(this), false);
};
Html5Audio.prototype._onCordovaDeviceReady = function () {
console.log("Html5Audio - SETUP!!!"); //Remove in release
this._audioElement.addEventListener("pause", this._onCordovaPause.bind(this), false);
this._audioElement.addEventListener("resume", this._onCordovaResume.bind(this), false);
};
Html5Audio.prototype._onCordovaPause = function () {
console.log("Html5Audio - HIDE!!!"); //Remove in release
this._onHide();
};
Html5Audio.prototype._onCordovaResume = function () {
console.log("Html5Audio - SHOW!!!"); //Remove in release
this._onShow();
};
// =====================================================================
// Add Cordova pause/resume events support for AudioStreaming plugin
// =====================================================================
StreamWebAudio.prototype._setupEventHandlers = function() {
var resumeHandler = function() {
var context = StreamWebAudio._context;
if (context && context.state === "suspended" && typeof context.resume === "function") {
context.resume().then(function() {
StreamWebAudio._onTouchStart();
})
} else {
StreamWebAudio._onTouchStart();
}
};
document.addEventListener("keydown", resumeHandler);
document.addEventListener("mousedown", resumeHandler);
document.addEventListener("touchend", resumeHandler);
document.addEventListener('touchstart', this._onTouchStart.bind(this));
document.addEventListener('visibilitychange', this._onVisibilityChange.bind(this));
document.addEventListener("deviceready", this._onCordovaDeviceReady.bind(this), false);
};
StreamWebAudio.prototype._onCordovaDeviceReady = function () {
console.log("StreamWebAudio - SETUP!!!"); //Remove in release
document.addEventListener("pause", this._onCordovaPause.bind(this), false);
document.addEventListener("resume", this._onCordovaResume.bind(this), false);
};
StreamWebAudio.prototype._onCordovaPause = function () {
console.log("StreamWebAudio - HIDE!!!"); //Remove in release
this._onHide();
};
StreamWebAudio.prototype._onCordovaResume = function () {
console.log("StreamWebAudio - SHOW!!!"); //Remove in release
this._onShow();
};
// ============================
// Clear back button action
// ============================
document.addEventListener("backbutton", function(event){
event.preventDefault();
});
// =====================
// Scale game canvas
// =====================
document.addEventListener("deviceready", () => {
Graphics._centerElement = function (element) {
console.log("Element centered!!!");
var width = 640 * (window.screen.height / 480);
var height = window.screen.height;
element.style.position = 'absolute';
element.style.margin = 'auto';
element.style.top = 0;
element.style.left = 0;
element.style.right = 0;
element.style.bottom = 0;
element.style.width = width + 'px';
element.style.height = height + 'px';
};
})
// ===========================
// Gamepad tips on default
// ===========================
ConfigManager.gamepadTips = true;
ConfigManager.applyData = function (config) {
_TDS_.OmoriBASE.ConfigManager_applyData.call(this, config);
var initCheckList = ['characterStrafe', 'battleAnimations',
'battleAnimationSpeed', 'battleLogSpeed', 'screenResolution',
'fullScreen', 'menuAnimations']
for (var i = 0; i < initCheckList.length; i++) {
var name = initCheckList[i];
if (config[name] === undefined) { config[name] = this[name]; };
};
Yanfly.Param.ScreenWidth = 640 * (config.screenResolution + 1);
Yanfly.Param.ScreenHeight = 480 * (config.screenResolution + 1);
SceneManager._screenWidth = Yanfly.Param.ScreenWidth;
SceneManager._screenHeight = Yanfly.Param.ScreenHeight;
this.characterTurning = config.characterTurning;
this.characterStrafe = config.characterStrafe;
this.battleAnimations = config.battleAnimations;
this.battleAnimationSpeed = config.battleAnimationSpeed;
this.battleLogSpeed = config.battleLogSpeed === undefined ? 1 : config.battleLogSpeed;
this.screenResolution = config.screenResolution;
this.fullScreen = config.fullScreen;
this.menuAnimations = config.menuAnimations;
this.gamepadTips = config.gamepadTips || true;
this.textSkip = config.textSkip || false;
Input.keyMapper = config.keyboardInputMap;
Input.gamepadMapper = config.gamepadInputMap;
if (Input.keyMapper === undefined) { this.setDefaultKeyboardKeyMap(); };
if (Input.gamepadMapper === undefined) { this.setDefaultGamepadKeyMap(); };
Yanfly.updateResolution();
Yanfly.moveToCenter();
if ($gameSwitches) {
if (_TDS_.CharacterPressTurn_Strafing) {
$gameSwitches.setValue(_TDS_.CharacterPressTurn_Strafing.params.strafingDisableSwitchID, this.characterStrafe);
$gameSwitches.setValue(_TDS_.CharacterPressTurn_Strafing.params.pressDisableSwitchID, this.characterTurning)
};
};
};
ConfigManager.restoreDefaultConfig = function () {
const fs = require("fs");
const path = require('path');
var base = path.dirname(process.mainModule.filename);
base = path.join(base, 'save/');
if (fs.existsSync(base + "config.rpgsave")) { fs.unlinkSync(base + "config.rpgsave"); }
ConfigManager.characterStrafe = true;
ConfigManager.characterTurning = true;
ConfigManager.battleAnimations = true;
ConfigManager.battleAnimationSpeed = 0;
ConfigManager.battleLogSpeed = 1;
ConfigManager.screenResolution = 0;
ConfigManager.fullScreen = false;
ConfigManager.menuAnimations = true;
ConfigManager.gamepadTips = true;
ConfigManager.alwaysDash = false;
ConfigManager.textSkip = false;
this.setDefaultKeyboardKeyMap();
this.setDefaultGamepadKeyMap();
AudioManager._bgmVolume = 70;
AudioManager._bgsVolume = 90;
AudioManager._meVolume = 90;
AudioManager._seVolume = 90;
ConfigManager.bgmVolume = 70
ConfigManager.bgsVolume = 90
ConfigManager.meVolume = 90
ConfigManager.seVolume = 90
ConfigManager.applyData(ConfigManager);
let needsRestore = confirm(LanguageManager.languageData().text.System.plugins.optionsMenu.alertMessages["restoreGeneral"]);
if (!!needsRestore) { DataManager._restoreGlobalInfo(); }
}
Window_OmoMenuOptionsGeneral.prototype.processOptionCommand = function() {
var index = this.index();
var data = this._optionsList[index];
switch (index) {
case 0: // Screen Resolution
Yanfly.Param.ScreenWidth = 640 * (data.index + 1);
Yanfly.Param.ScreenHeight = 480 * (data.index + 1) ;
SceneManager._screenWidth = Yanfly.Param.ScreenWidth;
SceneManager._screenHeight = Yanfly.Param.ScreenHeight;
Yanfly.updateResolution();
Yanfly.moveToCenter();
// Set Config Manager Screen Resolution
ConfigManager.screenResolution = data.index;
break;
case 1:
ConfigManager.gamepadTips = data.index === 0 ? false : true;
if(SceneManager._scene instanceof Scene_OmoriTitleScreen) {
SceneManager._scene.refreshCommandHints(); // Refresh command title hints;
}
break;
case 2: ConfigManager.textSkip = data.index === 0 ? true : false; break;
case 3: ConfigManager.battleLogSpeed = data.index; ;break;
case 4: ConfigManager.alwaysDash = data.index === 0 ? true : false ;break;
// OMORI RUS mod specific:
case 5: ConfigManager.rusCoverInBadEnding = data.index === 0 ? true : false; break;
};
};
// ===================
// Android Wake Lock
// ===================
document.addEventListener("deviceready", () => {
window.plugins.insomnia.keepAwake();
})
// =============================
// Saves in external storage
// =============================
window._SAYGEXES = {};
function setSayGexValue(key, f, fallback) {
let saygex = window._SAYGEXES[key];
if (saygex != undefined) {
return f(saygex);
} else {
window._SAYGEXES[key] = fallback;
}
}
function getSaveName(path) {
return require.libs.path._solve_dots(path).split("/")[1];
}
function getAndroidSavePath(path) {
return cordova.file.externalDataDirectory + "save/" + getSaveName(path);
}
document.addEventListener("deviceready", () => {
StorageManager.isLocalMode = function () {
return true;
};
NativeFunctions.saveFileExists = function(path) {
if (window._SAYGEXES[path] != undefined) {
return window._SAYGEXES[path].exists;
}
let xhr = new XMLHttpRequest();
xhr.open("GET", getAndroidSavePath(path), false);
try {
xhr.send();
} catch (e) {
setSayGexValue(path, (v) => { v.exists = false; }, {exists: false, content: null});
return false;
}
setSayGexValue(path, (v) => { v.exists = true; }, {exists: true, content: null});
return xhr.status === 200 || xhr.status === 0;
}
NativeFunctions.readSaveFileUTF8 = function(path) {
let gex = window._SAYGEXES[path];
if (gex != undefined) {
if (gex.content != null) {
return gex.content;
}
}
let xhr = new XMLHttpRequest();
xhr.open("GET", getAndroidSavePath(path), false);
xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
xhr.setRequestHeader("Pragma", "no-cache");
try {
xhr.send();
} catch (e) {
if (e.message.startsWith("Failed to execute 'send'")) {
alert(`Server returned status code 404 (${getAndroidSavePath(path)})`);
} else {
alert(e);
}
}
if (xhr.status !== 200 && xhr.status !== 0) {
alert(`Server returned status code ${xhr.status}`);
}
let text = xhr.responseText;
setSayGexValue(path, (v) => { v.content = text; }, {exists: true, content: text});
return text;
}
NativeFunctions.writeSaveFileUTF8 = function(path, data) {
setSayGexValue(path, (v) => { v.exists = true; v.content = data; }, {exists: true, content: data});
var split_path = require.libs.path._solve_dots(path).split("/");
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
console.log(`Writing ${path} save file to the externalStorage`);
dirEntry.getDirectory(split_path[0], { create: true }, function (subDirEntry) {
subDirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
};
fileWriter.write(data);
});
}, (e) => {
console.log("Error to create external save file: " + e.toString());
});
});
});
}
})

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,358 @@
//=============================================================================
// TDS Custom Picture Controls
// Version: 1.2
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_CustomPictureControls = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.CustomPictureControls = _TDS_.CustomPictureControls || {};
//=============================================================================
/*:
* @plugindesc
* This plugin add custom controls as well as pictures for effects.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
//=============================================================================
// * Update Wait mode
//=============================================================================
Game_Interpreter.prototype.updateWaitMode = function() {
// If Wait for picture animation
if (this._waitMode === 'pictureAnimation') {
// Get Picture
var picture = $gameScreen.picture(this._lastAnimatingPicture);
// If Picture exists and has a finite animation
if (picture && picture.hasAnimation(true)) { return true; }
// Set Last animating Picture to null
this._lastAnimatingPicture = null;
};
// Return Original Function
return _TDS_.CustomPictureControls.Game_Interpreter_updateWaitMode.call(this);
};
//=============================================================================
// * Get Picture Sprite
//=============================================================================
Game_Interpreter.prototype.getPictureSprite = function(pictureId) {
return SceneManager._scene._spriteset._pictureContainer.children[pictureId]
};
//=============================================================================
// * Remove Picture Custom Frames
//=============================================================================
Game_Interpreter.prototype.removePictureCustomFrames = function(pictureId) {
// Get Picture
try {
var picture = $gameScreen.picture(pictureId);
// If Picture Exists
if (picture) {
// Clear Picture Custom Frame
picture.clearCustomFrame();
// Reset Picture Frame
this.getPictureSprite.resetFrame()
};
} catch(e) {}
};
//=============================================================================
// * Setup Picture Custom Frames
//=============================================================================
Game_Interpreter.prototype.setupPictureCustomFrames = function(pictureId, width, height, hFrames, vFrames) {
// Get Vertical & Horizontal Sizes
var fWidth = width / hFrames;
var fHeight = height / vFrames;
// Get Total Frames
var totalFrames = hFrames * vFrames;
// Initialize Rects Array
var rects = []
// Go Through Total frames
for (var i = 0; i < totalFrames; i++) { rects.push(new Rectangle((i % hFrames) * fWidth, Math.floor(i / hFrames) * fHeight, fWidth, fHeight)); };
// Setup Picture Frames
$gameScreen.picture(pictureId).setupCustomFrame(rects);
};
//=============================================================================
// * Set Picture Frame Index
//=============================================================================
Game_Interpreter.prototype.setPictureFrameIndex = function(pictureId, index) {
// Get Picture
var picture = $gameScreen.picture(pictureId)
// Set frame Index
picture.setCustomFrameIndex(index)
// Update Custom Frame
this.getPictureSprite(pictureId).updateCustomFrame();
};
//=============================================================================
// * Set Picture Animation
//=============================================================================
Game_Interpreter.prototype.setPictureAnimation = function(pictureId, frames, delay, loops = Infinity, wait = true) {
// Get Picture
var picture = $gameScreen.picture(pictureId);
// If Picture exists
if (picture) {
// Create animation
var animation = {frames: [], loops: loops, index: 0}
// Go Through Frames
for (var i = 0; i < frames.length; i++) {
// Get Frame
var frame = frames[i];
// If frame is an array
if (Array.isArray(frame)) {
// Add Frame to Animation
animation.frames.push({frame: frame[0], delay: frame[1], maxDelay: frame[1]})
} else {
// Add Frame to Animation
animation.frames.push({frame: frame, delay: delay, maxDelay: delay})
};
};
// Set Custom Frame animation
picture.setCustomFrameAnimation(animation);
// Update Custom Frame
this.getPictureSprite(pictureId).updateCustomFrame();
// If Wait and Loops is not infinite
if (wait && loops !== Infinity) {
// Set Wait mode
this.setWaitMode('pictureAnimation')
// Set Last Animating Picture
this._lastAnimatingPicture = pictureId;
};
};
};
//=============================================================================
// ** Game_Picture
//-----------------------------------------------------------------------------
// The game object class for a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Game_Picture_initBasic = Game_Picture.prototype.initBasic;
_TDS_.CustomPictureControls.Game_Picture_update = Game_Picture.prototype.update;
//=============================================================================
// * Initialize Basic
//=============================================================================
Game_Picture.prototype.initBasic = function() {
// Run Original Function
_TDS_.CustomPictureControls.Game_Picture_initBasic.call(this);
// Initialize Frame Data
this.clearCustomFrame()
};
//=============================================================================
// * Determine if Picture has animation
//=============================================================================
Game_Picture.prototype.hasAnimation = function(finite = false) {
// Get Data
var data = this._frameData;
// If Frame data exists
if (data && data.animation !== null) {
// Return false if the animation is infinite
if (finite && !data.animation.loops !== Infinity) { return true; };
// Return true
return true;
};
// Return false by default
return false;
};
//=============================================================================
// * Clear Custom Frame
//=============================================================================
Game_Picture.prototype.clearCustomFrame = function() { this._frameData = null; };
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.setupCustomFrame = function(frames) {
// Initialize Frame Data
this._frameData = {frames: frames, frameIndex: 0, animation: null, refreshFrame: true}
};
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.setCustomFrameAnimation = function(animation) {
// Get Data
var data = this._frameData;
// If Frame data exists
if (data) {
// Set Frame Data Animation
data.animation = animation;
// Set Custom Frame Index
this.setCustomFrameIndex(animation.frames[animation.index].frame);
};
};
//=============================================================================
// * Get Custom Frame
//=============================================================================
Game_Picture.prototype.removeCustomFrameAnimation = function() {
// If Frame data exists
if (this._frameData) { this._frameData.animation = null; };
}
//=============================================================================
// * Set Custom Frame Index
//=============================================================================
Game_Picture.prototype.setCustomFrameIndex = function(index) {
// If Frame data exists
if (this._frameData) {
// Set Frame index
this._frameData.frameIndex = index;
// Set Refresh frame flag
this._frameData.refreshFrame = true;
};
}
//=============================================================================
// * Determine if Frame needs refreshing
//=============================================================================
Game_Picture.prototype.needsFrameRefresh = function() {
if (this._frameData) { return this._frameData.refreshFrame }
return false;
};
//=============================================================================
// * Get Custom Frame
//=============================================================================
Game_Picture.prototype.customFrame = function() {
return this._frameData.frames[this._frameData.frameIndex]
}
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.update = function() {
// Run Original Function
_TDS_.CustomPictureControls.Game_Picture_update.call(this);
// Update Frame Animation
this.updateFrameAnimation();
};
//=============================================================================
// * Frame Frame Animation
//=============================================================================
Game_Picture.prototype.updateFrameAnimation = function() {
// Get Data
var data = this._frameData;
// If Data and Animation Data exists
if (data && data.animation) {
// Get Animation
var anim = data.animation;
// Get Animation Frame
var frameAnim = anim.frames[anim.index];
// If Frame Animation Delay is 0 or less
if (frameAnim.delay <= 0) {
// Reset Frame Animation Max Delay
frameAnim.delay = frameAnim.maxDelay;
// Get MAx Frames
var maxFrames = anim.frames.length;
// If Animation has reached the end
if (anim.index >= maxFrames-1) {
// If Animation loops is more than 0
if (anim.loops > 0) {
// Decrease Animation loop count
anim.loops--
// Increase Index
anim.index = (anim.index + 1) % maxFrames;
} else {
// Remove Custom Frame Animation
this.removeCustomFrameAnimation()
};
} else {
// Increase Index
anim.index = (anim.index + 1) % maxFrames;
};
// Set Custom Frame Index
this.setCustomFrameIndex(anim.frames[anim.index].frame)
} else {
// Decrease Frame Animation Delay
frameAnim.delay--;
};
};
};
//=============================================================================
// ** Sprite_Picture
//-----------------------------------------------------------------------------
// The sprite for displaying a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Sprite_Picture_initialize = Sprite_Picture.prototype.initialize;
_TDS_.CustomPictureControls.Sprite_Picture_updateOther = Sprite_Picture.prototype.updateOther;
_TDS_.CustomPictureControls.Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap
//=============================================================================
// * Object Initialization
//=============================================================================
Sprite_Picture.prototype.initialize = function(pictureId) {
// Get Picture Object
let picture = $gameScreen.picture(pictureId);
// If picture exists and it has frame data
if (picture && picture._frameData) {
// Set Refresh frame flag to true
picture._frameData.refreshFrame = true;
};
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_initialize.call(this, pictureId);
};
//=============================================================================
// * Update Bitmap
//=============================================================================
Sprite_Picture.prototype.updateBitmap = function() {
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_updateBitmap.call(this);
// Get Picture Object
var picture = this.picture();
// If Picture Exists
if (picture) {
// If Picture has frame data
if (picture._frameData) {
// Update Custom Frame
this.updateCustomFrame();
} else {
// Reset Frame
this.resetFrame()
};
};
};
//=============================================================================
// * Object Initialize
//=============================================================================
Sprite_Picture.prototype.updateOther = function() {
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_updateOther.call(this);
// Update Custom Frame
this.updateCustomFrame();
};
//=============================================================================
// * Update Custom Frame
//=============================================================================
Sprite_Picture.prototype.updateCustomFrame = function() {
// Get Picture Data
var picture = this.picture();
// If Picture Frame needs Refresh
if (picture && picture.needsFrameRefresh()) {
// Get Custom Frame
var rect = picture.customFrame();
// Set Frame
this.setFrame(rect.x, rect.y, rect.width, rect.height);
// Set Refresh Flag to false
picture._frameData.refreshFrame = false;
};
};
//=============================================================================
// * Reset Frame
//=============================================================================
Sprite_Picture.prototype.resetFrame = function() {
// If Bitmap Exist
if (this.bitmap) {
// Set Frame
this.setFrame(0, 0, this.bitmap.width, this.bitmap.height);
} else {
// Clear Frame
this.setFrame(0, 0, 0, 0);
}
};

View file

@ -0,0 +1,154 @@
//=============================================================================
// TDS Custom Character Rectangles
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {};
Imported.TDS_CustomCharacterRectangles = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {};
_TDS_.CustomCharacterRectangles = _TDS_.CustomCharacterRectangles || {};
//=============================================================================
/*:
* @plugindesc
* Description
*
* @author TDS
*
* Set Movement RoutePlayer (Wait)
* Scriptthis.setCustomFrameXY(6, 1)
* Wait5 frames
* Scriptthis.setCustomFrameXY(7, 1)
* Wait5 frames
* Scriptthis.setCustomFrameXY(8, 1)
* Wait5 frames
*
* Example Script Calls:
* $gameMap.event(36).setCustomFrameXY(0, 2);
* $gamePlayer.setCustomFrameXY(7, 5);
*
* To reset:
* $gameMap.event(idA).setCustomFrameXY(null, null);
*/
//=============================================================================
//=============================================================================
// ** Game_CharacterBase
//-----------------------------------------------------------------------------
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomCharacterRectangles.Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
//=============================================================================
// * Initialize Members
//=============================================================================
Game_CharacterBase.prototype.initMembers = function() {
// Set Custom Frame Properties to null
this.setCustomFrameXYWH(null, null, null, null);
// Run Original Function
_TDS_.CustomCharacterRectangles.Game_CharacterBase_initMembers.call(this);
};
//=============================================================================
// * Set Custom frame X & Y
//=============================================================================
Game_CharacterBase.prototype.setCustomFrameXY = function(x, y) {
// Set custom frame X & Y
this._customFrameX = x;
this._customFrameY = y;
};
//=============================================================================
// * Set Custom Frame Width & Height
//=============================================================================
Game_CharacterBase.prototype.setCustomFrameWH = function(width, height) {
// Set custom frame Width & Height
this._customFrameWidth = width;
this._customFrameHeight = height;
};
//=============================================================================
// * Set Custom Frame X, Y, Width and Height
//=============================================================================
Game_CharacterBase.prototype.setCustomFrameXYWH = function(x, y, width, height) {
// Set Custom Frame Properties
this._customFrameX = x;
this._customFrameY = y;
this._customFrameWidth = width;
this._customFrameHeight = height;
};
//=============================================================================
// ** Sprite_Character
//-----------------------------------------------------------------------------
// The sprite for displaying a character.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomCharacterRectangles.Sprite_Character_characterBlockX = Sprite_Character.prototype.characterBlockX;
_TDS_.CustomCharacterRectangles.Sprite_Character_characterBlockY = Sprite_Character.prototype.characterBlockY;
_TDS_.CustomCharacterRectangles.Sprite_Character_characterPatternX = Sprite_Character.prototype.characterPatternX;
_TDS_.CustomCharacterRectangles.Sprite_Character_characterPatternY = Sprite_Character.prototype.characterPatternY;
_TDS_.CustomCharacterRectangles.Sprite_Character_patternWidth = Sprite_Character.prototype.patternWidth;
_TDS_.CustomCharacterRectangles.Sprite_Character_patternHeight = Sprite_Character.prototype.patternHeight;
//=============================================================================
// * Get Character Block X
//=============================================================================
Sprite_Character.prototype.characterBlockX = function() {
// Get Custom Frame X
var frameX = this._character._customFrameX;
// Return Custom Frame X
if (frameX !== null) { return frameX; };
// Return Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_characterBlockX.call(this);
};
//=============================================================================
// * Get Character Block Y
//=============================================================================
Sprite_Character.prototype.characterBlockY = function() {
// Get Custom Frame Y
var frameY = this._character._customFrameY;
// Return Custom Frame Y
if (frameY !== null) { return frameY; };
// Return Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_characterBlockY.call(this);
};
//=============================================================================
// * Get Character Pattern X
//=============================================================================
Sprite_Character.prototype.characterPatternX = function() {
// Return 0 if using a custom frame
if (this._character._customFrameX !== null) { return 0; };
// Return Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_characterPatternX.call(this);
};
//=============================================================================
// * Get Character Pattern Y
//=============================================================================
Sprite_Character.prototype.characterPatternY = function() {
// Return 0 if using a custom frame
if (this._character._customFrameY !== null) { return 0; };
// Return Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_characterPatternY.call(this);
};
//=============================================================================
// * Get Character Pattern Width
//=============================================================================
Sprite_Character.prototype.patternWidth = function() {
// Get Custom Frame Width
var frameWidth = this._character._customFrameWidth;
// Return Custom Frame Width
if (frameWidth !== null) { return frameWidth; };
// Run Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_patternWidth.call(this);
};
//=============================================================================
// * Get Character Pattern Height
//=============================================================================
Sprite_Character.prototype.patternHeight = function() {
// Get Custom Frame Width
var frameHeight = this._character._customFrameHeight;
// Return Custom Frame Width
if (frameHeight !== null) { return frameHeight; };
// Run Original Function
return _TDS_.CustomCharacterRectangles.Sprite_Character_patternHeight.call(this);
};

View file

@ -0,0 +1,366 @@
//=============================================================================
// TDS Custom Picture Controls
// Version: 1.2
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_CustomPictureControls = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.CustomPictureControls = _TDS_.CustomPictureControls || {};
//=============================================================================
/*:
* @plugindesc
* This plugin add custom controls as well as pictures for effects.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
//=============================================================================
// * Update Wait mode
//=============================================================================
Game_Interpreter.prototype.updateWaitMode = function() {
// If Wait for picture animation
if (this._waitMode === 'pictureAnimation') {
// Get Picture
var picture = $gameScreen.picture(this._lastAnimatingPicture);
// If Picture exists and has a finite animation
if (picture && picture.hasAnimation(true)) { return true; }
// Set Last animating Picture to null
this._lastAnimatingPicture = null;
};
// Return Original Function
return _TDS_.CustomPictureControls.Game_Interpreter_updateWaitMode.call(this);
};
//=============================================================================
// * Get Picture Sprite
//=============================================================================
Game_Interpreter.prototype.getPictureSprite = function(pictureId) {
return SceneManager._scene._spriteset._pictureContainer.children[pictureId]
};
//=============================================================================
// * Remove Picture Custom Frames
//=============================================================================
Game_Interpreter.prototype.removePictureCustomFrames = function(pictureId) {
// Get Picture
var picture = $gameScreen.picture(pictureId);
// If Picture Exists
if (picture) {
// Clear Picture Custom Frame
picture.clearCustomFrame();
// Reset Picture Frame
this.getPictureSprite.resetFrame()
};
};
//=============================================================================
// * Setup Picture Custom Frames
//=============================================================================
Game_Interpreter.prototype.setupPictureCustomFrames = function(pictureId, width, height, hFrames, vFrames) {
// Get Vertical & Horizontal Sizes
var fWidth = width / hFrames;
var fHeight = height / vFrames;
// Get Total Frames
var totalFrames = hFrames * vFrames;
// Initialize Rects Array
var rects = []
// Go Through Total frames
for (var i = 0; i < totalFrames; i++) { rects.push(new Rectangle((i % hFrames) * fWidth, Math.floor(i / hFrames) * fHeight, fWidth, fHeight)); };
// Setup Picture Frames
$gameScreen.picture(pictureId).setupCustomFrame(rects);
};
//=============================================================================
// * Set Picture Frame Index
//=============================================================================
Game_Interpreter.prototype.setPictureFrameIndex = function(pictureId, index) {
// Get Picture
var picture = $gameScreen.picture(pictureId)
// Set frame Index
picture.setCustomFrameIndex(index)
// Update Custom Frame
this.getPictureSprite(pictureId).updateCustomFrame();
};
//=============================================================================
// * Set Picture Animation
//=============================================================================
Game_Interpreter.prototype.setPictureAnimation = function(pictureId, frames, delay, loops = Infinity, wait = true) {
// Get Picture
var picture = $gameScreen.picture(pictureId);
// If Picture exists
if (picture) {
// Create animation
var animation = {frames: [], loops: loops, index: 0}
// Go Through Frames
for (var i = 0; i < frames.length; i++) {
// Get Frame
var frame = frames[i];
// If frame is an array
if (Array.isArray(frame)) {
// Add Frame to Animation
animation.frames.push({frame: frame[0], delay: frame[1], maxDelay: frame[1]})
} else {
// Add Frame to Animation
animation.frames.push({frame: frame, delay: delay, maxDelay: delay})
};
};
// Set Custom Frame animation
picture.setCustomFrameAnimation(animation);
// Update Custom Frame
this.getPictureSprite(pictureId).updateCustomFrame();
// If Wait and Loops is not infinite
if (wait && loops !== Infinity) {
// Set Wait mode
this.setWaitMode('pictureAnimation')
// Set Last Animating Picture
this._lastAnimatingPicture = pictureId;
};
};
};
//=============================================================================
// ** Game_Picture
//-----------------------------------------------------------------------------
// The game object class for a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Game_Picture_initBasic = Game_Picture.prototype.initBasic;
_TDS_.CustomPictureControls.Game_Picture_update = Game_Picture.prototype.update;
//=============================================================================
// * Initialize Basic
//=============================================================================
Game_Picture.prototype.initBasic = function() {
// Run Original Function
_TDS_.CustomPictureControls.Game_Picture_initBasic.call(this);
// Initialize Frame Data
this.clearCustomFrame()
};
//=============================================================================
// * Determine if Picture has animation
//=============================================================================
Game_Picture.prototype.hasAnimation = function(finite = false) {
// Get Data
var data = this._frameData;
// If Frame data exists
if (data && data.animation !== null) {
// Return false if the animation is infinite
if (finite && !data.animation.loops !== Infinity) { return true; };
// Return true
return true;
};
// Return false by default
return false;
};
//=============================================================================
// * Clear Custom Frame
//=============================================================================
Game_Picture.prototype.clearCustomFrame = function() { this._frameData = null; };
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.setupCustomFrame = function(frames) {
// Initialize Frame Data
this._frameData = {frames: frames, frameIndex: 0, animation: null, refreshFrame: true}
};
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.setCustomFrameAnimation = function(animation) {
// Get Data
var data = this._frameData;
// If Frame data exists
if (data) {
// Set Frame Data Animation
data.animation = animation;
// Set Custom Frame Index
this.setCustomFrameIndex(animation.frames[animation.index].frame);
};
};
//=============================================================================
// * Get Custom Frame
//=============================================================================
Game_Picture.prototype.removeCustomFrameAnimation = function() {
// If Frame data exists
if (this._frameData) { this._frameData.animation = null; };
}
//=============================================================================
// * Set Custom Frame Index
//=============================================================================
Game_Picture.prototype.setCustomFrameIndex = function(index) {
// If Frame data exists
if (this._frameData) {
// Set Frame index
this._frameData.frameIndex = index;
// Set Refresh frame flag
this._frameData.refreshFrame = true;
};
}
//=============================================================================
// * Determine if Frame needs refreshing
//=============================================================================
Game_Picture.prototype.needsFrameRefresh = function() {
if (this._frameData) { return this._frameData.refreshFrame }
return false;
};
//=============================================================================
// * Get Custom Frame
//=============================================================================
Game_Picture.prototype.customFrame = function() {
return this._frameData.frames[this._frameData.frameIndex]
}
//=============================================================================
// * Frame Update
//=============================================================================
Game_Picture.prototype.update = function() {
// Run Original Function
_TDS_.CustomPictureControls.Game_Picture_update.call(this);
// Update Frame Animation
this.updateFrameAnimation();
};
//=============================================================================
// * Frame Frame Animation
//=============================================================================
Game_Picture.prototype.updateFrameAnimation = function() {
// Get Data
var data = this._frameData;
// If Data and Animation Data exists
if (data && data.animation) {
// Get Animation
var anim = data.animation;
// Get Animation Frame
var frameAnim = anim.frames[anim.index];
// If Frame Animation Delay is 0 or less
if (frameAnim.delay <= 0) {
// Reset Frame Animation Max Delay
frameAnim.delay = frameAnim.maxDelay;
// Get MAx Frames
var maxFrames = anim.frames.length;
// If Animation has reached the end
if (anim.index >= maxFrames-1) {
// If Animation loops is more than 0
if (anim.loops > 0) {
// Decrease Animation loop count
anim.loops--
// Increase Index
anim.index = (anim.index + 1) % maxFrames;
} else {
// Remove Custom Frame Animation
this.removeCustomFrameAnimation()
};
} else {
// Increase Index
anim.index = (anim.index + 1) % maxFrames;
};
// Set Custom Frame Index
this.setCustomFrameIndex(anim.frames[anim.index].frame)
} else {
// Decrease Frame Animation Delay
frameAnim.delay--;
};
};
};
//=============================================================================
// ** Sprite_Picture
//-----------------------------------------------------------------------------
// The sprite for displaying a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.CustomPictureControls.Sprite_Picture_initialize = Sprite_Picture.prototype.initialize;
_TDS_.CustomPictureControls.Sprite_Picture_updateOther = Sprite_Picture.prototype.updateOther;
_TDS_.CustomPictureControls.Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap
//=============================================================================
// * Object Initialization
//=============================================================================
Sprite_Picture.prototype.initialize = function(pictureId) {
// Get Picture Object
let picture = $gameScreen.picture(pictureId);
// If picture exists and it has frame data
if (picture && picture._frameData) {
// Set Refresh frame flag to true
picture._frameData.refreshFrame = true;
};
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_initialize.call(this, pictureId);
};
//=============================================================================
// * Update Bitmap
//=============================================================================
Sprite_Picture.prototype.updateBitmap = function() {
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_updateBitmap.call(this);
// Get Picture Object
var picture = this.picture();
// If Picture Exists
if (picture) {
// If Picture has frame data
if (picture._frameData) {
// Update Custom Frame
this.updateCustomFrame();
} else {
// Reset Frame
this.resetFrame()
};
};
};
//=============================================================================
// * Object Initialize
//=============================================================================
Sprite_Picture.prototype.updateOther = function() {
// Run Original Function
_TDS_.CustomPictureControls.Sprite_Picture_updateOther.call(this);
// Update Custom Frame
this.updateCustomFrame();
};
//=============================================================================
// * Update Custom Frame
//=============================================================================
Sprite_Picture.prototype.updateCustomFrame = function() {
// Get Picture Data
var picture = this.picture();
// If Picture Frame needs Refresh
if (picture && picture.needsFrameRefresh()) {
// Get Custom Frame
var rect = picture.customFrame();
// Set Frame
this.setFrame(rect.x, rect.y, rect.width, rect.height);
// Set Refresh Flag to false
picture._frameData.refreshFrame = false;
};
};
//=============================================================================
// * Reset Frame
//=============================================================================
Sprite_Picture.prototype.resetFrame = function() {
// If Bitmap Exist
if (this.bitmap) {
// Set Frame
this.setFrame(0, 0, this.bitmap.width, this.bitmap.height);
} else {
// Clear Frame
this.setFrame(0, 0, 0, 0);
}
};
//=============================================================================
// * Object Initialize
//=============================================================================
// Sprite_Picture.prototype.setFrame = function(x, y, width, height) {
// Sprite.prototype.setFrame.call(this, x, y, width, height)
// console.log(arguments.callee.caller.toString())
// console.log(x, y, width, height)
// }

View file

@ -0,0 +1,30 @@
//-----------------------------------------------------------------------------
// Galv's Disable Mouse
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// DisableMouse.js
//-----------------------------------------------------------------------------
// Version 1.0
// 2015-11-03 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_NoMouse = true;
//-----------------------------------------------------------------------------
/*:
* @plugindesc Disables mouse clicks.
*
* @author Galv - galvs-scripts.com
*
* @help
* This space intentionally left blank.
*
*/
TouchInput._onMouseDown = function(event) {
// Overwrite to do nothing
};

View file

@ -0,0 +1,665 @@
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// █▐▐ Follower Control
// ╞══════════════════════════════════════════════════════════════════════════════════╡
/*:
* @plugindesc Options to control and enhance interaction with followers.
* @author Exhydra
*
* @param Interpreter Commands
* @desc (Advanced Option) Comma delimited list of allowed
interpreter commands followers can use.
* @default 205,212,213
*
* @help
* Plugin
*
* Version : 1.2
* Release : 14th July 2016
* Updated : 24rd July 2016
* License : Free for Commercial and Non-Commercial Usage
*
* Plugin Commands
*
* exaFC.linkEvent boolean followerId eventId
*
* Link or unlink a follower to an event on the current map. The
* condition to start the follower event will match whatever is selected
* on the 'Trigger' drop-down menu within the linked event.
*
* boolean
* Value(s) true, false
*
* followerId
* Value(s) 0, 1, 2, (...)
* Note The 0th position is the 1st follower, and so on.
*
* eventId
* Value(s) Map Event ID
*
* exaFC.followerInstruct boolean followerId
*
* Enable or disable re-directing interpreter commands to a follower.
* Once enabled, you can set the Movement Route target to 'Player' and
* pass each command listed within to the selected follower. Should be
* used in conjunction with the 'exaFC.followerStop' plugin command.
*
* boolean
* Value(s) true, false
*
* followerId
* Value(s) 0, 1, 2, (...)
* Note The 0th position is the 1st follower, and so on. Value
* is only required to be included when enabling the
* command.
*
* exaFC.moveType type followerId moveSpeed moveFrequency
*
* Selects and/or changes the move type of a follower. Should be
* used in conjunction with the 'followerStop' and 'lockProperties'
* plugin command.
*
* type
* Value(s) fixed, random, approach, custom, clear
* Note When selecting the 'custom' type, place the Movement
* Route you wish the follower to copy directly beneath
* the plugin command. The 'clear' option will erase
* the current memorized move route.
*
* followerId
* Value(s) 0, 1, 2, (...)
* Note The 0th position is the 1st follower, and so on.
*
* moveSpeed
* Value(s) Integer
* Note Value is optional.
*
* moveFrequency
* Value(s) Integer
* Note Value is optional.
*
* exaFC.lockProperties boolean followerId
*
* Lock or unlock the properties of a follower. By default,
* followers will mirror the movement speed as well as various
* other properties of the party leader. This command will stop
* the selected follower from doing so.
*
* boolean
* Value(s) true, false
*
* followerId
* Value(s) 0, 1, 2, (...)
* Note The 0th position is the 1st follower, and so on.
*
* exaFC.followerStop boolean
*
* Enable or disable followers chasing the player.
*
* boolean
* Value(s) true, false
*
* exaFC.followerCollision boolean
*
* Enable or disable player collision with followers.
*
* boolean
* Value(s) true, false
*
* exaFC.clearAll
*
* Clears control properties from all followers.
*
*
*
* Examples
*
* exaFC.linkEvent true 1 15
* Link the 2nd follower to the event with an ID of 15.
*
* exaFC.linkEvent false 1
* Unlink the 2nd follower from the linked event.
*
* exaFC.followerInstruct true 2
* Re-direct interpreter commands to the 3rd follower.
*
* exaFC.followerInstruct false
* Disable interpreter command re-direct for all followers.
*
* exaFC.followerStop true
* Disable followers chasing the player.
*
* exaFC.followerCollision true
* Enables player collision with followers.
*
*/
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Plugin
// ╘══════════════════════════════════════════════════════════════════════════════════╛
var Imported = Imported || {};
Imported.EXA_SimpleFollowerControl = true;
var EXA = EXA || {};
EXA.FC = EXA.FC || {};
EXA.FC.pluginParams = PluginManager.parameters('Exhydra_FollowerControl');
EXA.FC.pluginParams.allowedList = EXA.FC.pluginParams['Interpreter Commands'] || '205,212,213';
EXA.FC.pluginParams.allowedList.split(',').map(Number);
EXA.FC.followerControl = false;
EXA.FC.followerControlId = -1;
EXA.FC.followerStop = false;
EXA.FC.followerCollision = false;
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Interpreter
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] pluginCommand
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
EXA.FC.Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'exaFC.linkEvent') {
var follower = $gamePlayer._followers.follower(args[1]);
if (follower) {
if (args[0] === 'true') {
follower._fcEventId = Number(args[2]);
} else {
follower._fcEventId = -1;
}
}
}
if (command === 'exaFC.followerInstruct') {
if (args[0] === 'true') {
EXA.FC.followerControlId = Number(args[1]);
EXA.FC.followerControl = true;
} else {
EXA.FC.followerControlId = -1;
EXA.FC.followerControl = false;
}
}
if (command === 'exaFC.moveType') {
var follower = $gamePlayer._followers.follower(args[1]) || null;
if (follower) {
if (args[0] === 'fixed') {
follower._moveType = 0;
} else if (args[0] === 'random') {
follower._moveType = 1;
} else if (args[0] === 'approach') {
follower._moveType = 2;
} else if (args[0] === 'custom') {
if (this.nextEventCode() === 205) {
var moveRoute = this._list[this._index + 1].parameters[1];
follower.setMoveRoute(moveRoute);
follower._moveType = 3;
this._index = this._index + 2;
} else {
follower._moveType = 0;
}
} else if (args[0] === 'clear') {
follower._moveType = 0;
follower.setMoveRoute(null);
}
if (args[2]) {
follower._moveSpeed = Number(args[2]);
}
if (args[3]) {
follower._moveFrequency = Number(args[3]);
}
}
}
if (command === 'exaFC.lockProperties') {
var followerId = Number(args[1]);
var follower = $gamePlayer._followers.follower(followerId) || null;
if (follower) {
if (args[0] === 'true') {
follower._fcRetainAttrib = true;
} else {
follower._fcRetainAttrib = false;
}
}
}
if (command === 'exaFC.followerStop') {
EXA.FC.followerStop = (args[0] == 'true');
}
if (command === 'exaFC.followerCollision') {
var toggle = (args[0] == 'true')
EXA.FC.followerCollision = toggle;
$gamePlayer._followers.forEach(function (follower) {
follower.setThrough(!toggle);
});
}
if (command === 'exaFC.clearAll') {
EXA.FC.followerControlId = -1;
EXA.FC.followerControl = false;
EXA.FC.followerStop = false;
EXA.FC.followerCollision = false;
$gamePlayer._followers.forEach(function (follower) {
follower._fcEventId = -1;
follower._moveType = 0;
follower._fcEventLock = false;
follower._fcPrelockDirection = 0;
follower._fcRetainAttrib = false;
follower.setMoveRoute(null);
follower.setThrough(true);
follower.update();
});
}
}; // Game_Interpreter pluginCommand
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] character
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Interpreter_character = Game_Interpreter.prototype.character;
Game_Interpreter.prototype.character = function(param) {
if (isNaN(param)) {
var followerMatch = param.match(/fcF:(\d+)/);
if (followerMatch) {
var followerId = followerMatch[1];
return $gamePlayer._followers.follower(followerId);
}
}
return EXA.FC.Game_Interpreter_character.call(this, param);
}; // Game_Interpreter character
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] executeCommand
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Interpreter_executeCommand = Game_Interpreter.prototype.executeCommand;
Game_Interpreter.prototype.executeCommand = function() {
if (EXA.FC.followerControl) {
var command = this.currentCommand();
if (command) {
if (EXA.FC.pluginParams.allowedList.indexOf(command.code) != -1) {
if (command.parameters[0] < 0) {
command.parameters[0] = 'fcF:' + EXA.FC.followerControlId;
}
}
}
}
return EXA.FC.Game_Interpreter_executeCommand.call(this);
}; // Game_Interpreter executeCommand
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Player
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] isCollidedWithCharacters
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Player.prototype.isCollidedWithCharacters = function(x, y) {
return this.isCollidedWithFollowers(x, y) ||
Game_CharacterBase.prototype.isCollidedWithCharacters.call(this, x, y);
}; // Game_Player isCollidedWithCharacters
// NEW ───────────────────────────────────────────────────────────────────────────────┐
// □ [Function] isCollidedWithFollowers
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Player.prototype.isCollidedWithFollowers = function(x, y) {
if (EXA.FC.followerCollision) {
return this._followers.isSomeoneCollided(x, y);
}
return false;
}; // Game_Player isCollidedWithFollowers
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] startMapEvent
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Player_startMapEvent = Game_Player.prototype.startMapEvent;
Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
if (!$gameMap.isEventRunning()) {
this._followers.forEach(function(follower, index) {
if (follower._fcEventId > -1) {
if (follower.pos(x, y)) {
event = $gameMap.event(follower._fcEventId);
if (event.isTriggerIn(triggers)) {
event._fcFollowerId = index;
event.start();
}
}
}
});
}
EXA.FC.Game_Player_startMapEvent.call(this, x, y, triggers, normal);
}; // Game_Player startMapEvent
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Event
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initMembers
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Event_initMembers = Game_Event.prototype.initMembers;
Game_Event.prototype.initMembers = function() {
EXA.FC.Game_Event_initMembers.call(this);
this._fcFollowerId = -1;
}; // Game_Event initMembers
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] lock
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Event_lock = Game_Event.prototype.lock;
Game_Event.prototype.lock = function() {
EXA.FC.Game_Event_lock.call(this);
if (this._fcFollowerId > -1) {
$gamePlayer._followers.follower(this._fcFollowerId).lock();
}
}; // Game_Event lock
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] unlock
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Event_unlock = Game_Event.prototype.unlock;
Game_Event.prototype.unlock = function() {
EXA.FC.Game_Event_unlock.call(this);
if (this._fcFollowerId > -1) {
$gamePlayer._followers.follower(this._fcFollowerId).unlock();
this._fcFollowerId = -1;
}
}; // Game_Event unlock
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Follower
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] initialize
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Follower_initialize = Game_Follower.prototype.initialize;
Game_Follower.prototype.initialize = function(memberIndex) {
EXA.FC.Game_Follower_initialize.call(this, memberIndex);
this._fcEventId = -1;
this._fcEventLock = false;
this._fcPrelockDirection = 0;
this._fcRetainAttrib = false;
}; // Game_Follower initialize
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] update
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Follower_update = Game_Follower.prototype.update;
Game_Follower.prototype.update = function() {
if (this._fcRetainAttrib || EXA.FC.followerControl) {
Game_Character.prototype.update.call(this);
} else {
EXA.FC.Game_Follower_update.call(this);
}
}; // Game_Follower update
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] updateStop
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.updateStop = function() {
if (this._fcEventLock) {
this.resetStopCount();
}
Game_Character.prototype.updateStop.call(this);
if (!this.isMoveRouteForcing()) {
this.updateSelfMovement();
}
}; // Game_Follower updateStop
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] lock
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.lock = function() {
if (!this._fcEventLock) {
this._fcPrelockDirection = this.direction();
this.turnTowardPlayer();
this._fcEventLock = true;
}
}; // Game_Follower lock
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] unlock
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.unlock = function() {
if (this._fcEventLock) {
this._fcEventLock = false;
this.setDirection(this._fcPrelockDirection);
}
}; // Game_Follower unlock
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] updateSelfMovement
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.updateSelfMovement = function() {
if (this._moveType > 0) {
if (!this._fcEventLock && this.isNearTheScreen() &&
this.checkStop(this.stopCountThreshold())) {
switch (this._moveType) {
case 1:
this.moveTypeRandom();
break;
case 2:
this.moveTypeTowardPlayer();
break;
case 3:
this.moveTypeCustom();
break;
}
}
}
}; // Game_Follower updateSelfMovement
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] stopCountThreshold
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.stopCountThreshold = function() {
return 30 * (5 - this.moveFrequency());
}; // Game_Follower stopCountThreshold
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] moveTypeRandom
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.moveTypeRandom = function() {
switch (Math.randomInt(6)) {
case 0: case 1:
this.moveRandom();
break;
case 2: case 3: case 4:
this.moveForward();
break;
case 5:
this.resetStopCount();
break;
}
}; // Game_Follower moveTypeRandom
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] moveTypeTowardPlayer
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.moveTypeTowardPlayer = function() {
if (this.isNearThePlayer()) {
switch (Math.randomInt(6)) {
case 0: case 1: case 2: case 3:
this.moveTowardPlayer();
break;
case 4:
this.moveRandom();
break;
case 5:
this.moveForward();
break;
}
} else {
this.moveRandom();
}
}; // Game_Follower moveTypeTowardPlayer
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] moveTypeCustom
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.moveTypeCustom = function() {
this.updateRoutineMove();
}; // Game_Follower moveTypeCustom
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] isNearThePlayer
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.isNearThePlayer = function() {
var sx = Math.abs(this.deltaXFrom($gamePlayer.x));
var sy = Math.abs(this.deltaYFrom($gamePlayer.y));
return sx + sy < 20;
}; // Game_Follower isNearThePlayer
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] isCollidedWithCharacters
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.isCollidedWithCharacters = function(x, y) {
if (EXA.FC.followerCollision) {
return (Game_Character.prototype.isCollidedWithCharacters.call(this, x, y) ||
this.isCollidedWithPlayerCharacters(x, y));
} else {
return Game_Character.prototype.isCollidedWithCharacters.call(this, x, y);
}
}; // Game_Follower isCollidedWithCharacters
// NEW ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] isCollidedWithPlayerCharacters
// └──────────────────────────────────────────────────────────────────────────────────┘
Game_Follower.prototype.isCollidedWithPlayerCharacters = function(x, y) {
return this.isNormalPriority() && $gamePlayer.isCollided(x, y);
}; // Game_Follower isCollidedWithPlayerCharacters
// ╒══════════════════════════════════════════════════════════════════════════════════╕
// ■ [Object] Game_Followers
// ╘══════════════════════════════════════════════════════════════════════════════════╛
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] updateMove
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Followers_updateMove = Game_Followers.prototype.updateMove;
Game_Followers.prototype.updateMove = function() {
if (EXA.FC.followerStop) return;
EXA.FC.Game_Followers_updateMove.call(this);
}; // Game_Followers updateMove
// ALIAS ─────────────────────────────────────────────────────────────────────────────┐
// □ [Function] jumpAll
// └──────────────────────────────────────────────────────────────────────────────────┘
EXA.FC.Game_Followers_jumpAll = Game_Followers.prototype.jumpAll;
Game_Followers.prototype.jumpAll = function() {
if (EXA.FC.followerStop) return;
EXA.FC.Game_Followers_jumpAll.call(this);
}; // Game_Followers jumpAll
// ▌▌██████████████████████████████████████ EOF █████████████████████████████████████▐▐

View file

@ -0,0 +1,96 @@
"use strict";
//=============================================================================
// TDS External Notes
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {}; Imported.TDS_ExternalNotes = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {}; _TDS_.ExternalNotes = _TDS_.ExternalNotes || {};
//=============================================================================
/*:
* @plugindesc
* This script allows you to set notes for objects with an external file.
*
* @author TDS
*
* @help
* ============================================================================
* * Notes
* ============================================================================
*
* <LoadNotes: KEY, VALUE>
*
* KEY
* ^ Key name. (Used to divide different types of notes)
*
*
* VALUE
* ^ Value name. (Contains the contents of the notes)
*
*
* Example:
*
* <LoadNotes: Actors, test1>
*/
//=============================================================================
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ExternalNotes.DataManager_loadDatabase = DataManager.loadDatabase;
_TDS_.ExternalNotes.DataManager_extractMetadata = DataManager.extractMetadata;
//=============================================================================
// * Load Database
//=============================================================================
DataManager.loadDatabase = function () {
var path = require('path');
var fs = require('fs');
var yaml = require('./js/libs/js-yaml-master')
var base = path.dirname(process.mainModule.filename);
// If External Notes Data is undefined
if (window['$externalNotesData'] === undefined) {
// Get Atlas File
window['$externalNotesData'] = jsyaml.load(fs.readFileSync(base + '/data/Notes.yaml', 'utf8'));
};
// Run Original Function
_TDS_.ExternalNotes.DataManager_loadDatabase.call(this);
};
//=============================================================================
// * Extract Metadata
//=============================================================================
DataManager.extractMetadata = function (data) {
// If Data note is not empty
if (data.note.length > 0) {
// Get Regular Expression
var re = /<LoadNotes:(.+)>/gmi;
// Notes
var notes = '';
// Iterate
for (; ;) {
// Get Match
var match = re.exec(data.note);
// If Match
if (match) {
// Get Arguments
var args = RegExp.$1.split(',');
// Add Custom notes to notes
notes += $externalNotesData.NOTES[args[0].trim()][args[1].trim()] + '\n'
} else {
break;
};
};
// Add Custom notes to data notes
data.note += notes;
};
// Run Original Function
_TDS_.ExternalNotes.DataManager_extractMetadata.call(this, data);
};

View file

@ -0,0 +1,348 @@
//=============================================================================
// ExtraMovementFrames.js
//=============================================================================
// Version: 1.0.3
// Date: 10 November 2015
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*:
* @author Modern Algebra (rmrk.net)
* @plugindesc Set sprites with more than 3 frames of animation
*
* @param Cycle Time
* @desc The normal number of frames to complete animation cycle for custom sprites
* @default 60
*
* @param Default Idle Frame
* @desc The idle frame for custom sprites unless changed in the filename
* @default 0
*
* @param Default Pattern
* @desc Set patterns for custom sprites unless changed in the filename.
* @default []
*
* @help INSTRUCTIONS:
*
* To create sprites that have more than 3 frames of animation, you need
* to rename the character graphic to something of the form:
*
* RegularName%(x)
* x : the number of frames in each character sprite
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* EXAMPLES:
*
* $001-Fighter01%(4)
* // This graphic is a single character with four frames of animation.
*
* 022-Actors12%(6)
* // This graphic would be interpreted as a character sheet of 8
* // characters each having six frames of animation.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Additionally, this script also allows you to specify the "idle" frame (the
* frame where the sprite is not moving), and also the pattern if you wish to so
* specify. In essence, all you need to do is add those integers after the
* number of frames:
*
* Regular_Name%(x y z1 z2 ... zn)
* x : the number of frames in each character sprite
* y : the idle frame (the frame shown when sprite is not moving)
* z1 ... zn : the pattern.
*
* If you choose to specify a pattern, then the idle frame is not automatically
* included in the pattern and should be repeated if you want it to appear
*
* When naming your files, be aware that the first frame in a sprite is index 0,
* the second frame is index 1, etc.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* EXAMPLES:
*
* $003-Fighter03%(4 2)
* // This graphic is a single character with four frames of animation.
* // The idle frame is 2 (the third one over). The pattern when moving
* // would be 2 3 0 1, 2 3 0 1, etc. (unless default patterns set -
* // see below)
*
* 032-People05%(4 0 1 0 3 2)
* // This graphic would be interpreted as a character sheet of 8
* // characters, each having four frames of animation. The idle frame is
* // 0 (the first in the sheet), and the pattern is 1 0 3 2,
* // 1 0 3 2, etc.
*
* $003-Fighter03%(6 0 1 2 3 4 5)
* // This graphic is a single character with six frames of animation.
* // The idle frame is 0 (the first frame). The pattern when moving
* // is 1 2 3 4 5, 1 2 3 4 5, etc.
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* PLUGIN SETTINGS:
*
* Cycle Time = 60
*
* Cycle Time is the number of frames it will take to complete a full
* animation cycle for custom sprites at normal speed. It must be set to an
* integer.
*
*
* Default Idle Frame = 0
*
* If you do not specify an idle frame for custom sprites in the file name, then it
* will be this frame. You must set this to an integer.
*
* Default Pattern = []
*
* If you do not specify a pattern, then what happens depends on what you write
* in the plugin setting for "Default Pattern". For this setting, you have the
* option of writing in arrays of numbers in the following format:
*
* [x y z1 z2 ... zn]
* x : number of frames in the sprites for which this pattern is default
* y : idle frame
* z1 z2 ... zn : the pattern
*
* If you have setup one of those arrays for the number of frames which this
* custom sprite has, then it will use that pattern and idle frame.
*
* If you have not set up a default pattern for this number of frames, then the
* animation will simply cycle through the number of frames, starting with the
* idle frame and moving right. The idle frame will be included in the animation.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* EXAMPLES
*
* Default Pattern = [5 1 2 3 4 3 2]
* // Whenever you set up a custom sprite that has 5 frames of animation
* // but do not specify a pattern, the idle frame will be 1 and the
* // pattern will be 2 3 4 3 2, 2 3 4 3 2, etc.
*
* Default Pattern = [5 1 2 3 4 3 2], [6 0 1 2 5 4 3 0]
* // Whenever you set up a custom sprite that has 5 frames of animation
* // but do not specify a pattern, the idle frame will be 1 and the
* // pattern will be 2 3 4 3 2, 2 3 4 3 2, etc.
* // Whenever you set up a custom sprite that has 6 frames of animation
* // but do not specify a pattern, the idle frame will be 0 and the
* // pattern will be 1 2 5 4 3 0, 1 2 5 4 3 0, etc.
*/
//=============================================================================
var Imported = Imported || {};
Imported.MA_ExtraMovementFrames = true;
var ModernAlgebra = ModernAlgebra || {};
ModernAlgebra.EMF = {};
(function() {
// Get Script Name, in case user unexpectedly altered it
//var path = document.currentScript.src;
//var scriptName = path.substring(path.lastIndexOf('/')+1).match(/^(.+?)(\.[^.]*$|$)/)[1];
// Set Parameters
ModernAlgebra.EMF.parameters = PluginManager.parameters("ExtraMovementFrames");
ModernAlgebra.EMF.cycleTime = (+ModernAlgebra.EMF.parameters['Cycle Time']) || 60; // Default = 60
ModernAlgebra.EMF.idleFrame = (+ModernAlgebra.EMF.parameters['Default Idle Frame']) || 0; // Default = 0
ModernAlgebra.EMF.defaultPattern = [];
var emfPattMatch = ModernAlgebra.EMF.parameters['Default Pattern'].match(/\[.+?\]/g); // Default []
if (emfPattMatch) {
// Get all arrays of numbers
for (var i = 0; i < emfPattMatch.length; i++) {
digitMatch = emfPattMatch[i].match(/\d+/g);
if (digitMatch) { ModernAlgebra.EMF.defaultPattern.push(digitMatch.map(Number)); }
}
}
//=========================================================================
// ImageManager
//=========================================================================
// isEmfCharacter - Checks if filename is a customly animated sprite
ImageManager.isEmfCharacter = function(filename) {
return !!filename.match(/\%[\(\[][\d\s]+[\)\]]/); // check filename for %() or %[]
};
//=========================================================================
// Game_CharacterBase
//=========================================================================
// initMembers
ModernAlgebra.EMF.GameCharacterBase_initMembers =
Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
this.maClearEmfCharacterState();
ModernAlgebra.EMF.GameCharacterBase_initMembers.apply(this, arguments); // original method
};
// maClearEmfCharacterState
Game_CharacterBase.prototype.maClearEmfCharacterState = function() {
this._isEmfCharacter = false;
this._emfCharacterState = { frameNum: 3, idleFrame: ModernAlgebra.EMF.idleFrame, pattern: [2, 1, 0, 1] };
};
// isEmfCharacter - Check whether a customly animated sprites
Game_CharacterBase.prototype.isEmfCharacter = function() {
return this._isEmfCharacter;
};
// emfCharacterState - makes this._emfCharacterState public
Game_CharacterBase.prototype.emfCharacterState = function() {
return this._emfCharacterState;
};
// setImage - adjusts to call EMF setup method
ModernAlgebra.EMF.GameCharacterBase_setImage =
Game_CharacterBase.prototype.setImage;
Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
const [oldCharName, oldCharIndex] = [this.characterName(), this.characterIndex()]
ModernAlgebra.EMF.GameCharacterBase_setImage.apply(this, arguments); // original method
this.maemfSetupEmfCharacter();
if(oldCharName !== characterName) {this.resetPattern();}
if(oldCharName === characterName && oldCharIndex !== characterIndex) {this.resetPattern();}
};
// maSetupEmfCharacter - setup custom animation sprite
Game_CharacterBase.prototype.maemfSetupEmfCharacter = function() {
this.maClearEmfCharacterState();
var charName = this.characterName();
if (ImageManager.isEmfCharacter(charName)) {
var sign = charName.match(/(?:\%[\(\[])[\d\s]+(?:[\)\]])/);
var signArgs = sign[0].match(/\d+/g); // array of digit strings
if (signArgs) {
this._isEmfCharacter = true;
// Map arguments in file name to an array of numbers
signArgs = signArgs.map(Number);
signArgsLength = signArgs.length;
this.emfCharacterState().frameNum = signArgs.shift();
this.emfCharacterState().idleFrame = (signArgsLength > 1) ? signArgs.shift() : ModernAlgebra.EMF.idleFrame;
if (signArgsLength > 2) {
this.emfCharacterState().pattern = signArgs;
} else {
var success = false;
// Check for a default match for this number of frames
for (var i = 0; i < ModernAlgebra.EMF.defaultPattern.length; i++) {
if (ModernAlgebra.EMF.defaultPattern[i][0] === this.emfCharacterState().frameNum) {
this.emfCharacterState().idleFrame = ModernAlgebra.EMF.defaultPattern[i][1];
this.emfCharacterState().pattern = ModernAlgebra.EMF.defaultPattern[i].slice(2, (ModernAlgebra.EMF.defaultPattern[i].length));
success = true;
break;
}
}
// If still no pattern specified
if (!success) {
// Populate pattern with a simple cycle starting after idle
this.emfCharacterState().pattern = [];
var idleFramePlus = this.emfCharacterState().idleFrame + 1;
for (var i = 0; i < this.emfCharacterState().frameNum; i++) {
this.emfCharacterState().pattern.push((i + idleFramePlus) % this.emfCharacterState().frameNum);
}
}
}
}
}
};
// animationWait
ModernAlgebra.EMF.GameCharacterBase_animationWait =
Game_CharacterBase.prototype.animationWait;
Game_CharacterBase.prototype.animationWait = function() {
// If EMF Character
if (this.isEmfCharacter()) {
var realSpeed = this.realMoveSpeed();
var frameNum = this.maxPattern();
return Math.floor((8 - realSpeed)*(ModernAlgebra.EMF.cycleTime / (4*frameNum))); // CycleTime divided by number of frames in animation
} else {
// Run Default Method - approx. 60 frames at normal speed
return ModernAlgebra.EMF.GameCharacterBase_animationWait.apply(this, arguments) // original method
}
};
// maxPattern
ModernAlgebra.EMF.GameCharacterBase_maxPattern =
Game_CharacterBase.prototype.maxPattern;
Game_CharacterBase.prototype.maxPattern = function() {
if (this.isEmfCharacter()) {
return this.emfCharacterState().pattern.length; // Length of pattern array
} else {
return ModernAlgebra.EMF.GameCharacterBase_maxPattern.apply(this, arguments); // original method
}
};
// pattern
ModernAlgebra.EMF.GameCharacterBase_pattern =
Game_CharacterBase.prototype.pattern;
Game_CharacterBase.prototype.pattern = function() {
if (this.isEmfCharacter()) {
if (this._pattern < 0) {
return this.emfCharacterState().idleFrame; // Idle Frame if _pattern < 0
} else {
var patternIndex = (this._pattern % this.emfCharacterState().pattern.length);
return this.emfCharacterState().pattern[patternIndex]; // index of pattern array
}
} else {
return ModernAlgebra.EMF.GameCharacterBase_pattern.apply(this, arguments); // original method
}
};
// isOriginalPattern - Original pattern is -1 for custom sprites
ModernAlgebra.EMF.GameCharacterBase_isOriginalpattern =
Game_CharacterBase.prototype.isOriginalPattern;
Game_CharacterBase.prototype.isOriginalPattern = function() {
if (this.isEmfCharacter()) {
return this.pattern() === -1;
} else {
return ModernAlgebra.EMF.GameCharacterBase_isOriginalpattern.apply(this, arguments); // original method
}
};
// straighten - Straighten to original pattern
ModernAlgebra.EMF.GameCharacterBase_straighten =
Game_CharacterBase.prototype.straighten;
Game_CharacterBase.prototype.straighten = function() {
if (this.isEmfCharacter()) {
if (this.hasWalkAnime() || this.hasStepAnime()) {
this._pattern = -1;
}
this._animationCount = 0;
} else {
ModernAlgebra.EMF.GameCharacterBase_straighten.apply(this, arguments)
}
};
// resetPattern - Idle is -1 for custom sprites
ModernAlgebra.EMF.GameCharacterBase_resetPattern =
Game_CharacterBase.prototype.resetPattern;
Game_CharacterBase.prototype.resetPattern = function() {
if (this.isEmfCharacter()) {
this.setPattern(-1);
} else {
ModernAlgebra.EMF.GameCharacterBase_resetPattern.apply(this, arguments); // original method
}
};
//=========================================================================
// Game_Event
//=========================================================================
// setupPageSettings - adjust original pattern
ModernAlgebra.EMF.GameEvent_setupPageSettings =
Game_Event.prototype.setupPageSettings;
Game_Event.prototype.setupPageSettings = function() {
ModernAlgebra.EMF.GameEvent_setupPageSettings.apply(this, arguments);
// Original pattern is always idle for custom sprites
if (this.isEmfCharacter()) { this._originalPattern = -1; }
this.resetPattern();
};
//=========================================================================
// Sprite_Character
//=========================================================================
// patternWidth - afjust based on number of frames
ModernAlgebra.EMF.SpriteCharacter_patternWidth =
Sprite_Character.prototype.patternWidth;
Sprite_Character.prototype.patternWidth = function() {
var pw = ModernAlgebra.EMF.SpriteCharacter_patternWidth.apply(this, arguments)
if (this._character.isEmfCharacter()) {
var frameNum = this._character.emfCharacterState().frameNum;
return ((pw*3) / frameNum);
} else {
return pw;
}
};
})();

View file

@ -0,0 +1,318 @@
//=============================================================================
// TDS Extra Followers
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_ExtraFollowers = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.ExtraFollowers = _TDS_.ExtraFollowers || {};
//=============================================================================
/*:
* @plugindesc
* This plugin allows you to add extra followers to your party.
*
* @param Max Extra Followers
* @desc Max amount of Extra Followers to add.
* @default 4
*
* @author TDS
*
* @help
* ============================================================================
* * Script Calls
* ============================================================================
*
* To clear all extra followers use the following script
* call:
*
* this.clearExtraFollowers();
*
*
*
*
* To add an extra follower use the following script call:
*
*
* this.addExtraFollower(ID, NAME, INDEX, POSITION);
*
* ID
* ^ Id used for tracking the follower.
*
* NAME:
* ^ Graphics name.
*
* INDEX:
* ^ Graphics Index.
*
* POSITION
* ^ Position of the extra follower. (1~8)
* (Optional: Defaults to the last available position.)
*
* Examples:
*
* this.addExtraFollower('OldMan', 'FA_CHURCH_MARKET', 1);
*
*
* this.addExtraFollower('girl', 'FA_CHURCH_MARKET', 3, 6);
*
*
*
*
* To remove an extra follower use the following script call:
*
* this.removeExtraFollower(POSITION);
*
* POSITION:
* ^ Position of the extra follower. (1~8);
* (Optional: Defaults to the last position.)
*
*
* Examples:
*
* this.removeExtraFollower();
*
* this.removeExtraFollower(5);
*
*
*
* To remove an extra follower by it's ID use the following
* script call:
*
* $gamePlayer._followers.removeExtraFollower(ID);
*
* ID
* ^ Follower Id.
*
* Examples:
*
* this.removeFollowerById('OldMan')
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Extra_Followers");
// Initialize Parameters
_TDS_.ExtraFollowers.params = {};
_TDS_.ExtraFollowers.params.maxExtraFollowers = Number(parameters['Max Extra Followers'] || 4);
//=============================================================================
// ** Game_Followers
//-----------------------------------------------------------------------------
// The wrapper class for a follower array.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ExtraFollowers.Game_Followers_initialize = Game_Followers.prototype.initialize;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Followers.prototype.initialize = function() {
// Run Original Function
_TDS_.ExtraFollowers.Game_Followers_initialize.call(this);
// Extra Start
var extraStart = this._data.length;
for (var i = 0; i < _TDS_.ExtraFollowers.params.maxExtraFollowers; i++) {
this._data.push(new Game_Follower(extraStart + i + 1))
};
};
//=============================================================================
// * Add Extra Follower Last
//=============================================================================
Game_Followers.prototype.nextExtraFollowerSlot = function() {
// Get Starting Index
var index = $gameParty.maxBattleMembers()-1;
// Go Through Data
for (var i = index; i < this._data.length; i++) {
// Get Follower
var follower = this._data[i];
// Set Index
index = i;
// If Follower Graphics data is undefined
if (follower._graphicsData === undefined) { break; }
};
// Return Index
return index;
};
//=============================================================================
// * Last Extra Follower Slot
//=============================================================================
Game_Followers.prototype.lastExtraFollowerSlot = function() {
// Start
var start = $gameParty.maxBattleMembers()-1;
// Get Starting Index
var index = this._data.length-1
// Go Through Data in reverse
for (var i = this._data.length-1; i >= start; i--) {
// Get Follower
var follower = this._data[i];
// Set Index
index = i;
if (follower._graphicsData !== undefined) { break; }
};
// Return Index
return index;
};
//=============================================================================
// * Clear Extra Followers
//=============================================================================
Game_Followers.prototype.clearExtraFollowers = function() {
// Go Through Data
for (var i = 0; i < this._data.length; i++) {
// Get Follower
var follower = this._data[i];
// Delete Follower Graphics Data
delete follower._graphicsData;
};
// Refresh
this.refresh();
};
//=============================================================================
// * Add Extra Follower
//=============================================================================
Game_Followers.prototype.addExtraFollower = function(id, name, index, cIndex) {
// Set default character index
if (cIndex === undefined) { cIndex = this.nextExtraFollowerSlot(); };
// Follower Object
var follower = this._data[cIndex];
// Set Graphics Data
follower._graphicsData = {id: id, name: name, index: index};
// Refresh
this.refresh();
};
//=============================================================================
// * Add Extra Follower
//=============================================================================
Game_Followers.prototype.removeExtraFollower = function(index) {
// Set Default Index
if (index === undefined) { index = this.lastExtraFollowerSlot(); };
// Follower Object
var follower = this._data[index];
// Delete Graphics Data
delete follower._graphicsData;
// Realign Extra Followers
this.realignExtraFollowers();
// Refresh
this.refresh();
};
//=============================================================================
// * Remove Follower By ID
//=============================================================================
Game_Followers.prototype.removeFollowerById = function(id) {
// Go Through Data
for (var i = 0; i < this._data.length; i++) {
// Get Follower
var follower = this._data[i];
// If Follower Graphics Data matches the ID
if (follower._graphicsData && follower._graphicsData.id === id) {
delete follower._graphicsData;
};
};
// Realign Extra Followers
this.realignExtraFollowers();
// Refresh
this.refresh();
};
//=============================================================================
// * Realign Extar Followers
//=============================================================================
Game_Followers.prototype.realignExtraFollowers = function(index) {
var graphics = this._data.filter(function(follower) {
return follower._graphicsData !== undefined;
});
// Get Starting Index
var index = $gameParty.maxBattleMembers()-1;
// Go Through Data
for (var i = index; i < this._data.length; i++) {
// Get Follower
var follower = this._data[i];
// Get Data
var data = graphics[i - index];
// Get Graphics Data
var graphicsData = data ? Object.assign({}, data._graphicsData) : null;
// Delete Follower Data
delete follower._graphicsData
// If Graphics DAta
if (graphicsData) {
// Set Graphics Data
follower._graphicsData = graphicsData;
};
};
};
//=============================================================================
// ** Game_Follower
//-----------------------------------------------------------------------------
// The game object class for a follower. A follower is an allied character,
// other than the front character, displayed in the party.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ExtraFollowers.Game_Follower_isVisible = Game_Follower.prototype.isVisible;
_TDS_.ExtraFollowers.Game_Follower_refresh = Game_Follower.prototype.refresh;
//=============================================================================
// * Determine if visible
//=============================================================================
Game_Follower.prototype.isVisible = function() {
// Return true if follower has graphics data
if ($gamePlayer.followers().isVisible() && this._graphicsData) { return true; };
// Return default
return _TDS_.ExtraFollowers.Game_Follower_isVisible.call(this);
};
//=============================================================================
// * Add Extra Follower
//=============================================================================
Game_Follower.prototype.refresh = function() {
// If Graphics Data Exists
if (this._graphicsData) {
this.setImage(this._graphicsData.name, this._graphicsData.index);
} else {
// Run Original Function
_TDS_.ExtraFollowers.Game_Follower_refresh.call(this);
}
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Clear Extra Followers
//=============================================================================
Game_Interpreter.prototype.clearExtraFollowers = function() {
// Clear Extra Followers
$gamePlayer._followers.clearExtraFollowers();
};
//=============================================================================
// * Add Extra Follower
//=============================================================================
Game_Interpreter.prototype.addExtraFollower = function(id, name, index, cIndex) {
// Add Extra Follower
$gamePlayer._followers.addExtraFollower(id, name, index, cIndex);
};
//=============================================================================
// * Remove Extra Follower
//=============================================================================
Game_Interpreter.prototype.removeExtraFollower = function(index) {
// Remove Extra Follower
$gamePlayer._followers.removeExtraFollower(index);
};
//=============================================================================
// * Remove Extra Follower by ID
//=============================================================================
Game_Interpreter.prototype.removeFollowerById = function(id) {
// Remove Extra Follower
$gamePlayer._followers.removeFollowerById(id);
};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,28 @@
/*:
* @plugindesc Filter Controller Blur Quality Patch
* v 1.01 - replaced Kawase Blur with regular Guassin
* @author Anisoft (aka Dairnon)
*
* @help
*
* This adds a new quality param after the blur ammount param.
* To use simply just add the amount u want after amount param
*
*
* Ex:
*
* setFilter id amount quality
*
* setFilter 0 32 8
*
*
*/
Filter_Controller.defaultFilterParam["blur"] = [8, 4];
Filter_Controller.filterNameMap["blur"] = PIXI.filters.BlurFilter; // -> No KawaseBlur: slow
(function($) {
$.blur = function(filter, cp) {
filter.blur = cp[0];
cp[1] ? filter.quality = cp[1] : null;
}
})(Filter_Controller.updateFilterHandler);

View file

@ -0,0 +1,182 @@
//=============================================================================
// TDS Follower Control
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_FollowerControl = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.FollowerControl = _TDS_.FollowerControl || {};
//=============================================================================
// ** Game_Follower
//-----------------------------------------------------------------------------
// The game object class for a follower. A follower is an allied character,
// other than the front character, displayed in the party.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.FollowerControl.Game_Follower_initialize = Game_Follower.prototype.initialize;
_TDS_.FollowerControl.Game_Follower_update = Game_Follower.prototype.update;
_TDS_.FollowerControl.Game_Follower_chaseCharacter = Game_Follower.prototype.chaseCharacter;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Follower.prototype.initialize = function(memberIndex) {
// Set Released Flag
this._released = false;
// Run Original Function
_TDS_.FollowerControl.Game_Follower_initialize.call(this, memberIndex);
};
//=============================================================================
// * Release/Enslave
//=============================================================================
Game_Follower.prototype.release = function() { this._released = true; };
Game_Follower.prototype.enslave = function() { this._released = false; };
//=============================================================================
// * Determine if Follower is Free
//=============================================================================
Game_Follower.prototype.isFree = function() { return this._released; };
//=============================================================================
// * Frame Update
//=============================================================================
Game_Follower.prototype.update = function() {
// If Free
if (this.isFree()) {
// Update Character
Game_Character.prototype.update.call(this);
return;
};
// Run Original Function
_TDS_.FollowerControl.Game_Follower_update.call(this);
};
//=============================================================================
// * Chase Character
//=============================================================================
Game_Follower.prototype.chaseCharacter = function(character) {
// If Free
if (this.isFree()) { return; };
// Run Original Function
_TDS_.FollowerControl.Game_Follower_chaseCharacter.call(this, character);
};
//=============================================================================
// * Refresh
//=============================================================================
Game_Follower.prototype.refresh = function() {
var characterName = this.characterName();
var characterIndex = this.characterIndex()
this.setImage(characterName, characterIndex);
};
//=============================================================================
// * Character Name
//=============================================================================
Game_Follower.prototype.characterName = function() {
// If Visible
if (this.isVisible()) {
if (this.actor().isDead()) { return '$Toast'; }
return this.actor().characterName();
};
// Return Empty String
return '';
};
//=============================================================================
// * Character Index
//=============================================================================
Game_Follower.prototype.characterIndex = function() {
// If Visible
if (this.isVisible()) {
if (this.actor().isDead()) { return 5; }
return this.actor().characterIndex();
};
return 0;
};
//=============================================================================
// ** Window_Base
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.FollowerControl.Game_Interpreter_clear = Game_Interpreter.prototype.clear;
_TDS_.FollowerControl.Game_Interpreter_character = Game_Interpreter.prototype.character;
//=============================================================================
// * Clear
//=============================================================================
Game_Interpreter.prototype.clear = function() {
// Run Original Function
_TDS_.FollowerControl.Game_Interpreter_clear.call(this);
// Clear Follower Character
this.clearFollower();
};
//=============================================================================
// * Get Follower
//=============================================================================
Game_Interpreter.prototype.getFollower = function(index) { return $gamePlayer.followers().follower(index); };
//=============================================================================
// * Release Follower
//=============================================================================
Game_Interpreter.prototype.releaseFollower = function(index) {
// Get Follower
var follower = this.getFollower(index);
// Release Follower
if (follower) { follower.release(); }
};
//=============================================================================
// * Enslave Follower
//=============================================================================
Game_Interpreter.prototype.enslaveFollower = function(index) {
// Get Follower
var follower = this.getFollower(index);
// Release Follower
if (follower) { follower.enslave(); }
};
//=============================================================================
// * Set Follower Character
//=============================================================================
Game_Interpreter.prototype.controlFollower = function(index, release) {
// If Release is undefined
if (release === undefined) { release = true; }
// Set Follower Character
this._followerCharacter = this.getFollower(index);
// Release Follower Character
if (release) { this._followerCharacter.release(); }
};
//=============================================================================
// * Clear Follower Character
//=============================================================================
Game_Interpreter.prototype.clearFollower = function(index, enslave) {
// If Enslaved is undefined
if (enslave === undefined) { enslave = true; }
// Enslave Character
if (enslave && this._followerCharacter) { this._followerCharacter.enslave(); }
// Set Follower Character to null
this._followerCharacter = null;
};
//=============================================================================
// * Get Character
//=============================================================================
Game_Interpreter.prototype.character = function(param) {
// If Follower Character
if (this._followerCharacter) {
// Get Character
var character = this._followerCharacter;
// Return Character
return character;
};
// Return Original Function
return _TDS_.FollowerControl.Game_Interpreter_character.call(this, param);
};
// this.isVisible() ? this.actor().characterIndex() : 0;
// characterName = //'!Flame';
// characterIndex = 5;
// if (this._memberIndex === 1) {
// characterName = '!Flame';
// characterIndex = 4;
// };

View file

@ -0,0 +1,38 @@
//=============================================================================
// Fullscreen.js
//=============================================================================
/*:
* @plugindesc Starts the game in fullscreen
* @author Christian Schicho
*
* @help
*/
; (function () {
function extend(obj, name, func) {
var orig = obj.prototype[name]
obj.prototype[name] = function () {
orig.call(this)
func.call(this)
}
}
extend(Scene_Boot, 'start', function () {
Graphics._switchFullScreen();
})
var _Scene_Base_create = Scene_Base.prototype.create;
Scene_Base.prototype.create = function () {
const w = 640;
const h = 480;
_Scene_Base_create.call(this);
Graphics.width = w;
Graphics.height = h;
Graphics.boxHeight = h;
Graphics.boxWidth = w;
};
})()

View file

@ -0,0 +1,277 @@
//-----------------------------------------------------------------------------
// Galv's Animated Splash Screens
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// GALV_AnimatedSplashScreens.js
//-----------------------------------------------------------------------------
// 2016-10-22 - Version 1.1 - fixed database battle tst
// 2016-04-25 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_AnimatedSplashScreens = true;
var Galv = Galv || {}; // Galv's main object
Galv.ASPLASH = Galv.ASPLASH || {}; // Galv's stuff
//-----------------------------------------------------------------------------
/*:
* @plugindesc (v.1.1) Set up animated splash screens that show before the title screen.
*
* @author Galv - galvs-scripts.com
*
* @param ----- SPLASH SCREENS -----
* @desc
* @default
*
* @param Splash Images
* @desc image,timer,fade,animId - See help file for more info.
* @default image,150,8,0|image,150,8,0
*
* @param Splash Background
* @desc The color (eg. #000000) or image (from /img/system/) of background during splash images
* @default #333
*
* @param Splash Skip
* @desc Skip option can be: ALL (to skip all images), ONE (to skip just one), NONE (disable skipping)
* @default ONE
*
* @help
* Galv's Animated Splash Screens
* ----------------------------------------------------------------------------
* This plugin allows you to make animated splash screens that display before
* the title screen. All splash images used in this plugin are taken from:
* /img/system/
*
* The "Splash Images" plugin setting is where you set up all your splash
* images and you can have as many as you like.
* Each splash image has the following required values:
*
* image,timer,fade,animId
*
* image - the image name from /img/system/ folder
* timer - how many frames the image will remain on the screen
* fade - the speed the image fades in/out (lower is slower)
* animId - the animation played (from database) when image is faded in
*
* You can have multiple splash images separated by "|" symbol.
* EXAMPLE:
* image1,150,8,3|image2,150,8,2|image3,150,8,0
* ----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// CODE STUFFS
//-----------------------------------------------------------------------------
(function() {
Galv.ASPLASH.splashed = false;
// Splash Screens
Galv.ASPLASH.splashImgs = PluginManager.parameters('Galv_AnimatedSplashScreens')["Splash Images"].split("|");
for (i = 0; i < Galv.ASPLASH.splashImgs.length; i++) {
var array = new Object(Galv.ASPLASH.splashImgs[i].split(","));
Galv.ASPLASH.splashImgs[i] = {};
Galv.ASPLASH.splashImgs[i].image = array[0];
Galv.ASPLASH.splashImgs[i].timer = Number(array[1]);
Galv.ASPLASH.splashImgs[i].fade = Number(array[2]);
Galv.ASPLASH.splashImgs[i].anim = Number(array[3]);
};
Galv.ASPLASH.splashBg = PluginManager.parameters('Galv_AnimatedSplashScreens')["Splash Background"];
Galv.ASPLASH.splashSkip = PluginManager.parameters('Galv_AnimatedSplashScreens')["Splash Skip"].toLowerCase();
Galv.ASPLASH.Scene_Boot_loadSystemImages = Scene_Boot.loadSystemImages;
Scene_Boot.loadSystemImages = function() {
Galv.ASPLASH.Scene_Boot_loadSystemImages.call(this);
for (var i = 0; i < Galv.ASPLASH.splashImgs.length; i++) {
ImageManager.loadSystem(Galv.ASPLASH.splashImgs[i].image);
};
};
// SCENE SPLASHSCREENS
//-----------------------------------------------------------------------------
Galv.ASPLASH.SceneManager_goto = SceneManager.goto;
SceneManager.goto = function(sceneClass) {
if (!Galv.ASPLASH.splashed && $dataActors && !DataManager.isBattleTest()) {
if(!!StorageManager.exists(44)) {
Galv.ASPLASH.splashed = true;
return Galv.ASPLASH.SceneManager_goto.call(this,sceneClass);
}
sceneClass = Scene_SplashScreens
}; // if no splash has played this boot, steal scene
Galv.ASPLASH.SceneManager_goto.call(this,sceneClass);
};
// SCENE SPLASHSCREENS
//-----------------------------------------------------------------------------
function Scene_SplashScreens() {
this.initialize.apply(this, arguments);
}
Scene_SplashScreens.prototype = Object.create(Scene_Base.prototype);
Scene_SplashScreens.prototype.constructor = Scene_SplashScreens;
Scene_SplashScreens.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};
Scene_SplashScreens.prototype.create = function() {
Scene_Base.prototype.create.call(this);
this.setVars();
this.createBackground();
this.createSplashes();
};
Scene_SplashScreens.prototype.setVars = function() {
this._splashIndex = 0; // the splash being displayed
this._ticker = 0; // length timer
this._fadeIn = true; // fadein start
};
Scene_SplashScreens.prototype.createBackground = function() {
if (Galv.ASPLASH.splashBg[0] == "#") {
var w = Graphics.boxWidth;
var h = Graphics.boxHeight;
this._backSprite = new Sprite();
this._backSprite.bitmap = new Bitmap(w,h);
this._backSprite.bitmap.fillRect(0, 0, w, h, Galv.ASPLASH.splashBg);
} else {
this._backSprite = new Sprite(ImageManager.loadSystem(Galv.ASPLASH.splashBg));
this.centerSprite(this._backSprite);
};
this.addChild(this._backSprite);
};
Scene_SplashScreens.prototype.createSplashes = function() {
this._sprites = [];
for (i = 0; i < Galv.ASPLASH.splashImgs.length; i++) {
this._sprites[i] = new Sprite_SplashImage(i);
this.centerSprite(this._sprites[i]);
this.addChild(this._sprites[i]);
};
};
Scene_SplashScreens.prototype.centerSprite = function(sprite) {
sprite.x = Graphics.width / 2;
sprite.y = Graphics.height / 2;
sprite.anchor.x = 0.5;
sprite.anchor.y = 0.5;
};
Scene_SplashScreens.prototype.sprite = function() {
return this._sprites[this._splashIndex];
};
Scene_SplashScreens.prototype.splash = function() {
return Galv.ASPLASH.splashImgs[this._splashIndex];
};
Scene_SplashScreens.prototype.start = function() {
Scene_Base.prototype.start.call(this);
SceneManager.clearStack();
this.centerSprite(this._backSprite);
this.startFadeIn(this.fadeSpeed(), false);
};
Scene_SplashScreens.prototype.update = function() {
Scene_Base.prototype.update.call(this);
this.updateSplash();
};
Scene_SplashScreens.prototype.updateSplash = function() {
if (this._fadeIn) {
this.sprite().opacity += this.splash().fade;
if (this.sprite().opacity >= 255) {
this._fadeIn = false;
this.sprite().doAnim();
};
} else {
if (this._ticker < this.splash().timer) {
this._ticker++;
} else {
this.sprite().opacity -= this.splash().fade;
if (this.sprite().opacity <= 0) {
if (!this._sprites[this._splashIndex + 1]) return this.endSplashes();
this._splashIndex++;
this._fadeIn = true;
this._ticker = 0;
};
};
};
if (Input.isTriggered('ok')) {
if (Galv.ASPLASH.splashSkip == 'one') {
this._ticker = this.splash().timer;
this._fadeIn = false;
} else if (Galv.ASPLASH.splashSkip == 'all') {
this._ticker = this.splash().timer;
this._fadeIn = false;
this._sprites[this._splashIndex + 1] = null;
};
};
};
Scene_SplashScreens.prototype.endSplashes = function() {
Galv.ASPLASH.splashed = true;
// SceneManager.goto(Scene_Title);
SceneManager.goto(Scene_OmoriTitleScreen);
};
// SPRITE SPLASH
//-----------------------------------------------------------------------------
function Sprite_SplashImage() {
this.initialize.apply(this, arguments);
}
Sprite_SplashImage.prototype = Object.create(Sprite_Base.prototype);
Sprite_SplashImage.prototype.constructor = Sprite_SplashImage;
Sprite_SplashImage.prototype.initialize = function(index) {
Sprite_Base.prototype.initialize.call(this);
this.bitmap = ImageManager.loadSystem(Galv.ASPLASH.splashImgs[index].image)
this.opacity = 0;
this._index = index;
};
Sprite_SplashImage.prototype.doAnim = function() {
this._animId = Galv.ASPLASH.splashImgs[this._index].anim;
};
Sprite_SplashImage.prototype.update = function() {
Sprite_Base.prototype.update.call(this);
this.updateAnimation();
};
Sprite_SplashImage.prototype.updateAnimation = function() {
this.setupAnimation();
if (!this.isAnimationPlaying()) {
this._animationPlaying = false;
}
};
Sprite_SplashImage.prototype.setupAnimation = function() {
if (this._animId > 0) {
var animation = $dataAnimations[this._animId];
this.startAnimation(animation, false, 0);
this._animId = 0;
this._animationPlaying = true;
}
};
})();

View file

@ -0,0 +1,264 @@
//-----------------------------------------------------------------------------
// Galv's Cam Control
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// GALV_CamControl.js
// With some fixes by Anisoft
//-----------------------------------------------------------------------------
// 2016-05-02 - Version 2.0 - compatibilty with zooming and offset fixes
// - by Anisoft
// 2016-04-18 - Version 1.9 - fixed a bug with saving while cam disabled
// 2016-03-16 - Version 1.8 - transferring player to same map no longer moves
// - the camera if it has a different target.
// 2015-12-30 - Version 1.7 - another fix for shuttering issue
// 2015-12-17 - Version 1.6 - put in code to fix potential shuttering issue
// 2015-12-17 - Version 1.5 - fixed an issue that enabled the disabled cam
// 2015-12-01 - Version 1.4 - minor code changes
// 2015-12-01 - Version 1.3 - missed part of the last bug. Fixed now.
// 2015-11-30 - Version 1.2 - fixed bug with loading game and target breaking
// 2015-11-27 - Version 1.1 - added tile size option
// 2015-11-27 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_CamControl = true;
var Galv = Galv || {}; // Galv's main object
Galv.pCmd = Galv.pCmd || {}; // Plugin Command manager
Galv.CC = Galv.CC || {}; // Galv's stuff
//-----------------------------------------------------------------------------
/*:
* @plugindesc Allows greater control over where the game camera is focused. View HELP for plugin commands.
*
* @author Galv - galvs-scripts.com
*
* @param Tile Size
* @desc Default 48. Only change if you change tile size in your game
* @default 48
*
* @help
* Galv's Cam Control
* ----------------------------------------------------------------------------
* This plugin creates a sliding movement for the camera as well as allows you
* to set the target position of it to wherever required. (Player, event, xy)
*
* ----------------------------------------------------------------------------
* PLUGIN COMMANDS
* ----------------------------------------------------------------------------
* CAM PLAYER SPD // Set camera focus to player.
* // CAM - the plugin command word
* // PLAYER - command word to choose player
* // SPD - speed camera scrolls to target
* // v# to use a variable
* // default scroll speed is 800
* // leave speed blank for default
*
* CAM EVENT ID SPD // Set camera focus to an event.
* // CAM - the plugin command word
* // EVENT - command word to choose event
* // ID - the event's id
* // v# to use a variable
* // SPD - speed camera scrolls to target
* // v# to use a variable
* // default scroll speed is 800
* // leave speed blank for default
*
* CAM X Y SPD // Set camera focus to an x,y position.
* // CAM - the plugin command word
* // X - the position on the map
* // Y - the position on the map
* // v# to use variables
* // SPD - speed camera scrolls to target
* // v# to use a variable
* // default scroll speed is 800
* // leave speed blank for default
*
* CAM DISABLE // Sets the focus on player and disables the
* // sliding motion. (RPGMaker default);
* // Using any command above will enable again
*
* NOTE: The higher the SPD value for these commands, the slower the movement.
* Not recommended to use speeds that are too fast.
*
* EXAMPLES
* CAM PLAYER // Camera focuses on player at speed 800
* CAM PLAYER 1600 // Camera focuses on player at speed 1600 (slower)
* CAM EVENT 3 // Camera focuses on event 3 at speed 800
* CAM EVENT 12 400 // Camera focuses on event 12 at speed 400 (faster)
* CAM 23 18 // Camera focuses on x23, y18 position on the map
*/
//-----------------------------------------------------------------------------
// CODE STUFFS
//-----------------------------------------------------------------------------
(function() {
Galv.CC.size = Number(PluginManager.parameters('Galv_CamControl')["Tile Size"]);
// OVERWRITE - BECAUSE OF JITTER
Game_Map.prototype.displayX = function() {return Math.round(this._displayX * Galv.CC.size) / Galv.CC.size};
Game_Map.prototype.displayY = function() {return Math.round(this._displayY * Galv.CC.size) / Galv.CC.size};
// GALV'S PLUGIN MANAGEMENT. INCLUDED IN ALL GALV PLUGINS THAT HAVE PLUGIN COMMAND CALLS, BUT ONLY RUN ONCE.
if (!Galv.aliased) {
var Galv_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
if (Galv.pCmd[command]) {
Galv.pCmd[command](args);
return;
};
Galv_Game_Interpreter_pluginCommand.call(this, command, args);
};
Galv.aliased = true; // Don't keep aliasing for other Galv scripts.
};
// Direct to Plugin Object
Galv.pCmd.CAM = function(arguments) {
Galv.CC.camControl(arguments);
};
// END GALV'S PLUGIN MANAGEMENT
Galv.CC.camControl = function(args) {
var key = args[0].toLowerCase();
var speed = 100;
switch (key) {
case "player":
var target = $gamePlayer;
if (args[1]) speed = Galv.CC.getValue(args[1]);
break;
case "event":
var eId = Galv.CC.getValue(args[1]);
var target = $gameMap.event(eId);
if (args[2]) speed = Galv.CC.getValue(args[2]);
break;
case "disable":
$gameMap.camTarget = $gamePlayer;
$gameMap.camNorm = true;
$gameMap.savedCamTarget = null;
return;
default:
var px = Galv.CC.getValue(args[0]);
var py = Galv.CC.getValue(args[1]);
if (args[2]) speed = Galv.CC.getValue(args[2]);
var target = {
x: px,
y: py,
_realX: px,
_realY: py,
screenX: Game_CharacterBase.prototype.screenX,
screenY: function() {
var th = $gameMap.tileHeight();
return Math.round(this.scrolledY() * th + th);
},
scrolledX: Game_CharacterBase.prototype.scrolledX,
scrolledY: Game_CharacterBase.prototype.scrolledY
};
};
$gameMap.camTargetSet(target,speed);
$gameMap.savedCamTarget = args;
};
Galv.CC.getValue = function(string) {
if (string[0].toLowerCase() === "v") {
// Use variable
var varId = Number(string.replace("v",""));
return $gameVariables.value(varId);
} else {
return Number(string);
};
};
// GAME PLAYER
Galv.CC.Game_Player_updateScroll = Game_Player.prototype.updateScroll;
Game_Player.prototype.updateScroll = function(lastScrolledX, lastScrolledY) {
if ($gameMap.camNorm) return Galv.CC.Game_Player_updateScroll.call(this,lastScrolledX, lastScrolledY);
};
// GAME MAP
Galv.CC.Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function() {
Galv.CC.Scene_Map_onMapLoaded.call(this);
if (!$gameMap.camNorm) {
$gameMap.savedCamTarget = $gameMap.savedCamTarget || ["PLAYER"];
Galv.CC.camControl($gameMap.savedCamTarget);
};
};
Galv.CC.Game_Map_setup = Game_Map.prototype.setup;
Game_Map.prototype.setup = function(mapId) {
this.zoom = this.zoom || new PIXI.Point(1,1);
if (!this.camNorm) {
this.camTargetSet($gamePlayer,800);
this.savedCamTarget = ["PLAYER"];
};
Galv.CC.Game_Map_setup.call(this,mapId);
};
Game_Map.prototype.camTargetSet = function(target,speed) {
this.camTarget = target;
this.camNorm = false;
this.camSpeed = speed || 800;
};
Galv.CC.Game_Map_updateScroll = Game_Map.prototype.updateScroll;
Game_Map.prototype.updateScroll = function() {
if (this.camNorm) return Galv.CC.Game_Map_updateScroll.call(this);
this._scrollRest = 0;
var cw = (Graphics.boxWidth / 2);
var ch = (Graphics.boxHeight / 2);
var screenX = this.camTarget.screenX()*this.zoom.x;
var screenY = this.camTarget.screenY()*this.zoom.y;
var sx = Math.abs(screenX - cw) / this.camSpeed;
var sy = Math.abs(screenY - ch) / this.camSpeed;
if (sx < 0.005) (sx = 0);
if (sy < 0.005) (sy = 0);
var x_pos = screenX;
var y_pos = screenY;
if (y_pos < ch) {
this.scrollUp(sy);
} else if (y_pos > ch) {
this.scrollDown(sy);
};
if (x_pos < cw) {
this.scrollLeft(sx);
} else if (x_pos > cw) {
this.scrollRight(sx);
};
};
Galv.CC.Game_Player_center = Game_Player.prototype.center;
Game_Player.prototype.center = function(x, y) {
if ($gameMap.camTarget == $gamePlayer || $gameMap.camNorm) {
return Galv.CC.Game_Player_center.call(this,x,y);
};
};
Game_Player.prototype.centerX = function() {
return ((Graphics.width / $gameMap.tileWidth() - (1*$gameMap.zoom.x)) / 2.0)/$gameMap.zoom.x;
};
Game_Player.prototype.centerY = function() {
return ((Graphics.height / $gameMap.tileHeight() - 1.75*$gameMap.zoom.y) / 2.0)/$gameMap.zoom.y;
};
})();

View file

@ -0,0 +1,568 @@
//-----------------------------------------------------------------------------
// Galv's Event Detectors
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// GALV_EventDetectors.js
//-----------------------------------------------------------------------------
// 2016-08-21 - Version 1.2 - fixes to 'non detected' frequency
// 2016-08-20 - Version 1.1 - fixed bug when no terrain or regions specified
// 2016-08-01 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_EventDetectors = true;
var Galv = Galv || {}; // Galv's main object
Galv.DETECT = Galv.DETECT || {}; // Galv's stuff
//-----------------------------------------------------------------------------
/*:
* @plugindesc Have events activate when player gets in range and line of sight.
*
* @author Galv - galvs-scripts.com
*
* @param LOS Blocking Terrain
* @desc Terrain tag ID's for tiles that block line of sight, separated by commas
* @default 5,6
*
* @param LOS Blocking Regions
* @desc Region ID's for tiles that block line of sight, separated by commas
* @default 1,2
*
* @param Tile Size
* @desc The pixel size of the tiles you are using.
* Default: 48
* @default 48
*
* @param Search Limit
* @desc Amount of checks for default pathfinding. Larger might cause lag, smaller might make returning home fail
* Default: 12
* @default 24
*
* @param --- Behaviors ---
* @desc
* @default
*
* @param Behavior 0
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 1
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 2
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 3
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 4
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 5
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 6
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 7
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 8
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 9
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 10
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 11
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 12
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 13
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 14
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 15
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 16
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 17
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 18
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 19
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @param Behavior 20
* @desc Behavior of event if detecting. (see help file)
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
* @default
*
* @help
* Galv's Event Detectors
* ----------------------------------------------------------------------------
* This is a basic event detection plugin. It can allow events to detect the
* player within a certain range and within line of sight.
* Line of sight is 180 degrees in the event's front arc. Regions, terrain tags
* or events can be set to block line of sight to the player.
* Region Id's and terrain tag Id's are set using the plugin settings. To make
* an event block line of sight, you need to use a COMMENT inside an event
* page that has a text tag as follows:
*
* <block_los>
*
* An event that has an active page with this tag will block line of sight. If
* the page is changed to one without the tag, it will not block LOS.
*
* ----------------------------------------------------------------------------
*
* ----------------------------------------------------------------------------
* Conditional Branch SCRIPT
* ----------------------------------------------------------------------------
* You can use the below script call to check if an event can detect the player
* at the time the conditional branch is called. (Yes this can be used in a
* parallel process event if required)
*
* Galv.DETECT.event(id,dist,los) // id = event ID that is a detector
* // dist = tile distance from player
* // los = true or false for line of sight
*
* This will return true if the player is in distance range of the event and
* if los is true, it will also check if player is in line of sight to it.
* ----------------------------------------------------------------------------
*
* ----------------------------------------------------------------------------
* Event command SCRIPT
* ----------------------------------------------------------------------------
* $gameSystem._undetectable = x; // x can be true or false. When true
* // player cannot be detected
* ----------------------------------------------------------------------------
*
* ----------------------------------------------------------------------------
* Behaviors
* ----------------------------------------------------------------------------
* Behaviors can be used to set up an event's reaction from within the custom
* 'Autonomous Movement' settings of the event. The plugin settings has many
* behaviors you can set up with the following settings:
*
* moveTypeBefore,moveTypeAfter,dist,los,speed,freq,balloon
*
* moveTypes can be one of the following:
* approach, flee, search, freeze, rand, return
* approach - event moves toward player, no pathfinding
* flee - event moves away from player
* search - event moves toward player's last detected position with
* - default rpgmaker pathfinding. The 'search limit' sets
* - how far an event will find its way to player or return
* freeze - event doesn't move
* rand - event moves randomly
* return - event saves it's original position and returns to this
* position when not detecting the player.
* dist = distance in number of tiles from the event that it can detect
* los = 0 or 1... 1 to use line of sight or 0 to not for detecting
* speed = the change of move speed while detecting (1-6)
* freq = the change of move frequency while detecting (1-5)
* balloon = the balloon id to show when event detects player
*
* HOW TO USE
* To set an event to follow a behavior, you need to use a 'SCRIPT' command
* inside of a custom Autonomous Move Route as follows:
*
* this.detector(id);
*
* This will use the chosen Behavior id (from the numbers in the plugin setup).
* The 'moveTypeBefore' selection above and the event page's speed and freq
* control the event's default movement when not detecting.
*
* See demo for examples
*/
//-----------------------------------------------------------------------------
// CODE STUFFS
//-----------------------------------------------------------------------------
(function() {
// Blocking terrain tag array
var tmp = PluginManager.parameters('Galv_EventDetectors')["LOS Blocking Terrain"].split(",");
Galv.DETECT.bTerrain = [];
if (tmp && tmp[0]) {
for (var i = 0; i < tmp.length; i++) {
Galv.DETECT.bTerrain.push(Number(tmp[i]));
};
};
// Blocking regions array
tmp = PluginManager.parameters('Galv_EventDetectors')["LOS Blocking Regions"].split(",");
Galv.DETECT.bRegions = [];
if (tmp || tmp[0]) {
for (var i = 0; i < tmp.length; i++) {
Galv.DETECT.bRegions.push(Number(tmp[i]));
};
};
// tile size
Galv.DETECT.tile = Number(PluginManager.parameters('Galv_EventDetectors')["Tile Size"]);
Galv.DETECT.searches = Number(PluginManager.parameters('Galv_EventDetectors')["Search Limit"]);
// Behaviors
Galv.DETECT.behaviors = {};
var i = 0;
do {
tmp = PluginManager.parameters('Galv_EventDetectors')["Behavior " + i];
if (tmp) {
Galv.DETECT.behaviors[i] = tmp.split(",");
for (var i2 = 2; i2 < Galv.DETECT.behaviors[i].length; i2++) {
Galv.DETECT.behaviors[i][i2] = Number(Galv.DETECT.behaviors[i][i2]);
};
};
i++;
}
while (tmp);
Galv.DETECT.event = function(id,dist,los) {
if ($gameSystem._undetectable) return false;
return $gameMap.event(id).distDetect(dist,los);
};
Galv.DETECT.dist = function(x1,y1,x2,y2) {
return Math.sqrt(Math.pow(x1 - x2,2) + Math.pow(y1 - y2,2));
};
Galv.DETECT.isBlock = function(x,y) {
var x = Math.round(x);
var y = Math.round(y);
if (Galv.DETECT.bRegions.contains($gameMap.regionId(x,y))) return true;
if (Galv.DETECT.bTerrain.contains($gameMap.terrainTag(x,y))) return true;
// Blocking event
var blockEvent = false;
$gameMap.eventsXy(x, y).forEach(function(event) {
if (event._blockLos) return blockEvent = true;
});
return blockEvent;
};
Galv.DETECT.los = function(char1,char2) {
var a = {x:char1.x, y:char1.y};
var b = {x:char2.x, y:char2.y};
// If in front
switch (char2._direction) {
case 2:
if (b.y > a.y) return false;
break;
case 4:
if (b.x < a.x) return false;
break;
case 6:
if (b.x > a.x) return false;
break;
case 8:
if (b.y < a.y) return false;
break;
default:
};
// Direct Line
if (Math.abs(a.x - b.x) >= Math.abs(a.y - b.y)) {
// h slope
if (a.x == b.x) {
var slope = null;
var int = a.x;
} else {
var slope = (a.y - b.y) / (a.x - b.x);
var int = a.y - slope * a.x;
};
for (var x = a.x; x <= b.x; x++) {
var y = slope * x + int;
if (Galv.DETECT.isBlock(x,y)) return false;
}
for (var x = a.x; x >= b.x; x--) {
var y = slope * x + int;
if (Galv.DETECT.isBlock(x,y)) return false;
}
} else if (Math.abs(a.y - b.y) >= Math.abs(a.x - b.x)) {
// v slope
if (a.y == b.y) {
var slope = null;
var int = a.y;
} else {
var slope = (a.x - b.x) / (a.y - b.y);
var int = a.x - slope * a.y;
};
for (var y = a.y; y <= b.y; y++) {
var x = slope * y + int;
if (Galv.DETECT.isBlock(x,y)) return false;
}
for (var y = a.y; y >= b.y; y--) {
var x = slope * y + int;
if (Galv.DETECT.isBlock(x,y)) return false;
}
};
return true;
};
Game_Character.prototype.searchLimit = function() {
return Galv.DETECT.searches;
};
// GAME CHARACTER
//-----------------------------------------------------------------------------
Galv.DETECT.Game_Character_initMembers = Game_Character.prototype.initMembers;
Game_Character.prototype.initMembers = function() {
this.setDetectVars();
Galv.DETECT.Game_Character_initMembers.call(this);
};
Game_Character.prototype.distDetect = function(range,los,id,balloon) {
var balloon = balloon || 0;
var id = id || 0;
var range = range * Galv.DETECT.tile;
var target = id > 0 ? $gameMap.event(id) : $gamePlayer;
var x1 = this.screenX();
var y1 = this.screenY();
var x2 = target.screenX();
var y2 = target.screenY();
var dist = Galv.DETECT.dist(x1,y1,x2,y2);
if (dist <= range) { // If in radius range of target
if ((los && Galv.DETECT.los(target,this)) || !los) { // If LOS to target is not blocked
this._dTarget = {x:target.x,y:target.y}; // Set target x,y each step when detected so if los is broken, event still moves to last seen x,y
this.doDetected(id);
return true;
};
};
this.doUndetected(id);
return false;
};
Game_Character.prototype.isDetecting = function(id) {
return id ? this._detecting.contains(id) : this._detecting.length > 0;
};
Game_Character.prototype.doDetected = function(id) {
if (!this._detecting.contains(id)) {
this._detecting.push(id);
if (!this._searchXY[0]) this._balloonId = this._detectBalloon;
};
};
Game_Character.prototype.doUndetected = function(id) {
var index = this._detecting.indexOf(id);
if (index > -1) this._detecting.splice(index,1);
};
Game_Character.prototype.detector = function(id) {
if ($gameSystem._undetectable) return;
this._detectBalloon = Galv.DETECT.behaviors[id][6];
var detected = this.distDetect(Galv.DETECT.behaviors[id][2],Galv.DETECT.behaviors[id][3]);
if (detected) {
this.doDetectMove(id,1); // do detected movement
} else {
if (this._searchXY[0]) {
// do move toward last x,y position detected at
this.moveTowardLastDetect();
} else {
this.doDetectMove(id,0); // do original movement
};
};
};
Game_Character.prototype.doDetectMove = function(id,type) {
//type 1 = detect move
//type 0 = after detect move
if (type == 0) {
this._moveSpeed = this._origMovement._moveSpeed;
this._moveFrequency = this._origMovement._moveFrequency;
} else {
this._moveSpeed = Galv.DETECT.behaviors[id][4];
this._moveFrequency = Galv.DETECT.behaviors[id][5];
};
switch (Galv.DETECT.behaviors[id][type]) {
case 'approach':
this.moveTowardPlayer();
break;
case 'flee':
this.moveAwayFromPlayer();
break;
case 'search':
if (this._detectPause <= 0) {
this._moveFrequency = 5;
this._searchXY = [$gamePlayer.x,$gamePlayer.y]; // get last detected x,y coords
this.moveTowardLastDetect();
this._detectPause = 30 * (5 - this._origMovement._moveFrequency) + 3;
};
this._detectPause -= 1;
break;
case 'rand':
if (this._detectPause <= 0) {
this._moveFrequency = 5;
this.moveRandom();
this._detectPause = 30 * (5 - this._origMovement._moveFrequency) + 1;
};
this._detectPause -= 1;
break;
case 'return':
this._moveFrequency = 5;
this.returnToSavedXY(); // move to original position
case 'freeze':
default:
this.resetStopCount();
};
};
Game_CharacterBase.prototype.returnToSavedXY = function() {
if (this.x != this._origMovement.x || this.y != this._origMovement.y) {
direction = this.findDirectionTo(this._origMovement.x,this._origMovement.y);
if (direction > 0) {
this.moveStraight(direction);
}
} else {
this._direction = this._origMovement._direction;
this.resetStopCount();
};
};
Game_Character.prototype.setDetectVars = function() {
this._detecting = [];
this._searchXY = [];
this._detectPause = 0;
this._detectPauseTime = 40;
this._origMovement = {'_moveFrequency':this._moveFrequency,'_moveSpeed':this._moveSpeed,'x':0,'y':0};
this.searchActions = [
'turnRight90',
'turnLeft90',
'turnLeft90',
'turnRight90',
];
this.searchActions.reverse();
};
Game_Character.prototype.moveTowardLastDetect = function() {
if (!this._searchXY[0]) {
this._searchXY = [];
this.resetStopCount();
} else if (this._searchXY[0] == this.x && this._searchXY[1] == this.y) {
if (this._searchTurnIndex > -1) {
this[this.searchActions[this._searchTurnIndex]](); // run corresponding action
// set searchXY to destination in case search actions move it
this._searchXY[0] = this.x;
this._searchXY[1] = this.y;
this._searchTurnIndex -= 1;
this._waitCount = 20;
} else {
this._searchXY = [];
this.resetStopCount();
}
} else {
this._searchTurnIndex = this.searchActions.length - 1;
var direction = this.findDirectionTo(this._searchXY[0],this._searchXY[1]);
if (direction > 0) {
this.moveStraight(direction);
}
};
};
// GAME EVENT
//-----------------------------------------------------------------------------
Galv.DETECT.Game_Event_setupPageSettings = Game_Event.prototype.setupPageSettings;
Game_Event.prototype.setupPageSettings = function() {
Galv.DETECT.Game_Event_setupPageSettings.call(this);
this.setDetectStuff();
};
Game_Event.prototype.setDetectStuff = function() {
this._detectBalloon = 0;
var page = this.page();
this._blockLos = false;
if (page) {
for (var i = 0; i < page.list.length; i++) {
if (page.list[i].code == 108 && page.list[i].parameters[0].contains("<block_los>")) {
this._blockLos = true;
break;
};
};
this._origMovement._moveSpeed = page.moveSpeed;
this._origMovement._moveFrequency = page.moveFrequency;
this._origMovement._direction = this._direction;
this._origMovement.x = this.x;
this._origMovement.y = this.y;
};
};
})();

View file

@ -0,0 +1,271 @@
//-----------------------------------------------------------------------------
// Galv's Move Route Extras
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// GALV_MoveRouteExtras.js
//-----------------------------------------------------------------------------
// 2015-11-05 - Version 1.1 - added ability to change graphic to a frame
// 2015-10-23 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_MoveRouteExtras = true;
var Galv = Galv || {}; // Galv's main object
Galv.MRE = Galv.MRE || {}; // Galv's Move Route Extra's stuff
//-----------------------------------------------------------------------------
/*:
* @plugindesc Additional SCRIPT commands to use within MOVE ROUTES
* View the plugin "Help" to view available commands.
* @author Galv - galvs-scripts.com
* @help
* Galv's Move Route Extras
* ----------------------------------------------------------------------------
* This script enables users to use commands in the 'script' function of
* MOVE ROUTES. The available commands are listed below.
*
* ----------------------------------------------------------------------------
* SCRIPT calls for MOVE ROUTES
* ----------------------------------------------------------------------------
* this.jump_forward(x); // Jump forward x tiles
* this.jump_to(x,y); // Jump to x,y co-ordinates on the map
* this.jump_to(i); // Jump to character's x,y location
* // i = event id. Make it 0 for player
* this.step_toward(x,y); // Step toward x,y co-ordinates on the map
* this.step_toward(i); // Step toward a character's x,y location
* // i = event id. 0 works for player, too
* this.step_away(x,y); // Step away from x,y co-ordinates on the map
* this.step_away(i); // Step away from a character's x,y location
* // i = event id. 0 works for player, too
* this.turn_toward(x,y); // Face toward x,y co-ordinates on the map
* this.turn_toward(i); // Face toward a character's x,y location
* // i = event id. 0 works for player, too
* this.turn_away(x,y); // Turn away from x,y map co-ordinates
* this.turn_away(i); // Turn away from a character's x,y location
* // i = event id. 0 works for player, too
* this.sswitch("n",status); // Change self switch "n" to status true/false
* this.rwait(low,high); // wait a random time between low and high
*
* this.fade(s); // s is the fade speed.
* // Positive fades in, Negative fades out.
* this.step_rand(id,id,id); // Move randomly only on specified region id's
* // Multiple id's can be used, comma separated
* this.repeat_begin(n); // Repeat the next move commands between this..
* this.repeat_end(); // and repeat_end n number of times
*
* this.set_frame("name",index,pattern,direction) // set graphic to a frame
*
* // "name" - is the characterset file name
* // index - the number of the character in the characterset (1-8)
* // pattern - the stepping frame (1-3)
* // direction - the direction the event is facing (2,4,6,8)
* // Once a character has been set to a frame, it wont change when moving
* // until you restore the character using the below move route script:
*
* this.restore_frame() // unlocks the frame chosen in set_frame
*
*
* // Below are a couple of useful codes that work without this script
* this.requestBalloon(n); // Displays the balloon that has id of n
* this.requestAnimation(n); // Displays animation that has id of n
*
* ----------------------------------------------------------------------------
* EXAMPLES OF USE
* ----------------------------------------------------------------------------
* this.jump_forward(3); // Jumps 3 tiles the direction character faces
* this.jump_to(5); // Jump to event 5's position
* this.jump_to(10,16); // Jump to x10, y15
* this.step_toward(3); // Takes a step toward event 3's position
* this.step_away(12,8); // Takes a step away from x12, y8 co-ordinates
* this.sswitch("A",true); // Turns self switch "A" ON for event
* this.sswitch("B",false); // Turns self switch "B" OFF for event
* this.rwait(60,120); // Waits randomly between 60 and 120 frames
* this.fade(-10); // Fades out character
* this.step_rand(1,4,7); // Take a step randomly, only on regions 1,4,7
* this.requestAnimation(2); // Shows animation 2 on character
* ----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// CODE STUFFS
//-----------------------------------------------------------------------------
(function() {
Game_Character.prototype.repeat_times = 0;
Game_Character.prototype.repeat_start_index = 0;
// REPEATING COMMANDS
Game_Character.prototype.repeat_begin = function(times) {
this.repeats = times - 1;
this.repeat_start_index = this._moveRouteIndex;
};
Game_Character.prototype.repeat_end = function() {
if (this.repeats > 0) {
this._moveRouteIndex = this.repeat_start_index;
this.repeats -= 1;
};
};
// FADING
Game_Character.prototype.fade = function(speed) {
// Change opacity
this.setOpacity(this.opacity() + speed);
// Repeat until finished
if (speed > 0 && this.opacity() < 255) {
this._moveRouteIndex -= 1;
} else if (speed < 0 && this.opacity() > 0) {
this._moveRouteIndex -= 1;
};
};
// JUMP FORWARD
Game_Character.prototype.jump_forward = function(count) {
var sx = 0, sy = 0;
switch (this.direction()) {
case 2:
sy = count;
break;
case 4:
sx = -count;
break;
case 6:
sx = count;
break;
case 8:
sy = -count;
break;
};
this.jump(sx,sy);
};
// JUMP TO
Game_Character.prototype.jump_to = function() {
var sx = 0, sy = 0;
if (arguments.length > 1) {
// x,y coords
sx = this.x - arguments[0];
sy = this.y - arguments[1];
} else if (arguments.length === 1) {
// Character ID
if (arguments[0] === 0) {
// Is player
sx = this.x - $gamePlayer.x;
sy = this.y - $gamePlayer.y;
} else {
// Is event
sx = this.x - $gameMap._events[arguments[0]].x;
sy = this.y - $gameMap._events[arguments[0]].y;
};
};
this.jump(-sx,-sy);
};
// STEP TOWARD
Game_Character.prototype.step_toward = function() {
var char = Galv.MRE.getMrChar(arguments);
if (char) this.moveTowardCharacter(char);
};
// STEP AWAY
Game_Character.prototype.step_away = function() {
var char = Galv.MRE.getMrChar(arguments);
if (char) this.moveAwayFromCharacter(char);
};
// TURN TOWARD
Game_Character.prototype.turn_toward = function() {
var char = Galv.MRE.getMrChar(arguments);
if (char) this.turnTowardCharacter(char);
};
Game_Character.prototype.turn_away = function() {
var char = Galv.MRE.getMrChar(arguments);
if (char) this.turnAwayFromCharacter(char);
};
// GET MR CHARACTER
Galv.MRE.getMrChar = function(arguments) {
var char = null;
if (arguments.length > 1) {
// Move toward x,y
char = { x : arguments[0], y : arguments[1] };
} else if (arguments.length === 1) {
if (arguments[0] === 0) {
// Is player
char = $gamePlayer;
} else {
// Is event
char = $gameMap._events[arguments[0]];
};
};
return char;
};
// SELF SWITCHES
Game_Character.prototype.sswitch = function(letter,status,eid,mapid) {
var key = [mapid || $gameMap.mapId(), eid || this.eventId(), letter];
$gameSelfSwitches.setValue(key, status);
};
// RANDOM WAIT
Game_Character.prototype.rwait = function(low,high) {
this._waitCount = Math.randomInt(high - low) + low;
};
// MOVE RANDOM ON REGION
Game_Character.prototype.step_rand = function() {
var d = 2 + Math.randomInt(4) * 2;
// If region is not there, return false.
var x2 = $gameMap.roundXWithDirection(this.x, d);
var y2 = $gameMap.roundYWithDirection(this.y, d);
var region_test = false;
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] === $gameMap.regionId(x2, y2)) {
region_test = true;
break;
};
};
if (!region_test) return false;
if (!$gameMap.isValid(x2, y2)) return false;
if (this.canPass(this.x, this.y, d)) {
this.moveStraight(d);
};
};
// SET TO CHARACTER FRAME
Game_Character.prototype.set_frame = function(name,index,pattern,direction) {
this.gstop = true;
this._direction = direction;
this._pattern = pattern - 1;
this._characterName = name !== "" ? name : this._characterName;
this._characterIndex = index - 1;
};
// RESTORE CHAR ANIMATION
Game_Character.prototype.restore_frame = function() {
this.gstop = false;
};
// MOD
var Galv_Game_CharacterBase_updatePattern = Game_CharacterBase.prototype.updatePattern;
Game_CharacterBase.prototype.updatePattern = function() {
if (this.gstop) return;
Galv_Game_CharacterBase_updatePattern.call(this);
};
})();

View file

@ -0,0 +1,193 @@
//=============================================================================
// Gamefall Team Plugins - Optimization for Omori taking in account
// YEP_Core Updates;
// GTP_CoreUpdates.js VERSION 1.0.1
//=============================================================================
var Imported = Imported || {};
Imported.GTP_CoreUpdates = true;
var Gamefall = Gamefall || {};
Gamefall.CoreUpdates = Gamefall.CoreUpdates || {};
//=============================================================================
/*:
* @plugindesc v1.0.1 Optimization for Omori taking in account YEP Core Updates
* @author Gamefall Team || Luca Mastroianni
* @help
* CHANGELOG:
* VERSION 1.0.0: Plugin Released!
* VERSION 1.0.1: Reduced lag filtering events;
*/
//=============================================================================
(function ($) {
// Replaced ForEach
Sprite.prototype.update = function () {
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (!child) { continue; }
if (child && child.update) child.update();
};
};
// Replaced ForEach
Tilemap.prototype.update = function () {
this.animationCount++;
this.animationFrame = Math.floor(this.animationCount / 30);
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (!child) { continue; }
if (child && child.update) child.update();
}
var length = this.bitmaps.length;
for (var i = 0; i < length; ++i) {
if (this.bitmaps[i]) this.bitmaps[i].touch();
}
};
// Replaced ForEach
TilingSprite.prototype.update = function () {
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (child && child.update) child.update();
}
};
// Replaced ForEach
Window.prototype.update = function () {
if (this.active) this._animationCount++;
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (child && child.update) child.update();
}
};
// Replaced ForEach
WindowLayer.prototype.update = function () {
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (child && child.update) child.update();
}
};
// Replaced ForEach
Weather.prototype._updateAllSprites = function () {
var maxSprites = Math.floor(this.power * 10);
while (this._sprites.length < maxSprites) {
this._addSprite();
}
while (this._sprites.length > maxSprites) {
this._removeSprite();
}
var length = this._sprites.length;
for (var i = 0; i < length; ++i) {
var sprite = this._sprites[i];
this._updateSprite(sprite);
sprite.x = sprite.ax - this.origin.x;
sprite.y = sprite.ay - this.origin.y;
}
};
Game_Interpreter.prototype.setup = function (list, eventId) {
this.clear();
this._mapId = $gameMap.mapId();
this._eventId = eventId || 0;
this._list = list;
};
// Change Tileset Event: load instead of reserve
Game_Interpreter.prototype.command282 = function () {
var tileset = $dataTilesets[this._params[0]];
for (var i = 0; i < tileset.tilesetNames.length; i++) {
ImageManager.loadTileset(tileset.tilesetNames[i]);
}
if (ImageManager.isReady()) {
$gameMap.changeTileset(this._params[0]);
return true;
} else {
return false;
}
};
// Ready preparation now refers to fully loaded instead of reservation
Sprite_Animation.prototype.isReady = function () {
return ImageManager.isReady();
};
// Replaced ForEach
Sprite_Animation.prototype.updateFrame = function () {
if (this._duration > 0) {
var frameIndex = this.currentFrameIndex();
this.updateAllCellSprites(this._animation.frames[frameIndex]);
var length = this._animation.timings.length;
for (var i = 0; i < length; ++i) {
var timing = this._animation.timings[i];
if (timing.frame === frameIndex) this.processTimingData(timing);
};
}
};
// Cleaning algorithm up
Sprite_Animation.prototype.updateCellSprite = function (sprite, cell) {
var pattern = cell[0];
if (pattern >= 0) {
var sx = pattern % 5 * 192;
var sy = Math.floor(pattern % 100 / 5) * 192;
var mirror = this._mirror;
sprite.bitmap = pattern < 100 ? this._bitmap1 : this._bitmap2;
sprite.setFrame(sx, sy, 192, 192);
sprite.x = cell[1];
sprite.y = cell[2];
if (this._mirror) {
sprite.x *= -1;
}
sprite.rotation = cell[4] * Math.PI / 180;
sprite.scale.x = cell[3] / 100;
if ((cell[5] && !mirror) || (!cell[5] && mirror)) {
sprite.scale.x *= -1;
}
sprite.scale.y = cell[3] / 100;
sprite.opacity = cell[6];
sprite.blendMode = cell[7];
sprite.visible = true;
} else {
sprite.visible = false;
}
};
Scene_Base.prototype.updateChildren = function () {
var length = this.children.length;
for (var i = 0; i < length; ++i) {
var child = this.children[i];
if (!child) { continue; }
if (child.update) child.update();
}
};
Scene_Boot.prototype.isGameFontLoaded = function () {
if (Graphics.isFontLoaded('GameFont')) {
return true;
} else {
var elapsed = Date.now() - this._startDate;
if (elapsed >= 60000) {
throw new Error('Failed to load GameFont');
}
}
};
Game_Map.prototype.eventsXy = function (x, y) {
return this._events.filter(event => { return !!event && event.pos(x, y) })
}
Game_Map.prototype.eventsXyNt = function (x, y) {
return this._events.filter(event => { return !!event && event.posNt(x, y) })
}
})(Gamefall.CoreUpdates);

File diff suppressed because it is too large Load diff

578
www.eng/js/plugins/Gacha.js Normal file
View file

@ -0,0 +1,578 @@
//=============================================================================
// Gacha.js
//
// (c)2016 KADOKAWA CORPORATION./YOJI OJIMA
//=============================================================================
/*:
* @plugindesc Get the item at random
* @author Takeya Kimura
*
* @param Help Message Text
* @desc The help message for gacha window. "Required Amount" is replaced with the Required Amount.
* @default 1回Required Amount\Gでガチャを引きます
*
* @param Button Text
* @desc The button text for gacha commands.
* @default ガチャを引く
*
* @param Get Message Text
* @desc The message of After receiving. "Item Name" is replaced with the received item name.
* @default GET Item Name
*
* @param Show Item Description
* @desc The switch of item description display
* @default 0
*
* @param Effect
* @desc The animation number for get effect.
* @default 119
* @require 1
* @type animation
*
* @param Rank1 Effect
* @desc The animation number for rank 1 effect. If you specify -1, does not display the animation.
* @default -1
* @require 1
* @type animation
*
* @param Rank2 Effect
* @desc The animation number for rank 2 effect. If you specify -1, does not display the animation.
* @default -1
* @require 1
* @type animation
*
* @param Rank3 Effect
* @desc The animation number for rank 3 effect. If you specify -1, does not display the animation.
* @default -1
* @require 1
* @type animation
*
* @param Rank4 Effect
* @desc The animation number for rank 4 effect. If you specify -1, does not display the animation.
* @default -1
* @require 1
* @type animation
*
* @param Rank5 Effect
* @desc The animation number for rank 5 effect. If you specify -1, does not display the animation.
* @default -1
* @require 1
* @type animation
*
* @param ME
* @desc The ME name for get music effect.
* @default Organ
* @require 1
* @dir audio/me/
* @type file
*
* @param Required Amount
* @desc The Gold for gacha.
* @default 100
*
* @noteParam gachaImage
* @noteRequire 1
* @noteDir img/gacha/
* @noteType file
* @noteData items
*
* @help
*
* Plugin Command:
* Gacha open # Open the Gacha screen
* Gacha add item 1 # Add item #1 to the Gacha
* Gacha remove item 1 # Remove item #1 from the Gacha
* Gacha clear # Clear the Gacha
*
*
* Item Note:
* <gachaImage:image> # Gacha image file name. Please image put in "img/gacha/" folder.
* <gachaNumLot:10> # The number of the lottery.
* <gachaRank:5> # The rank of the item(1-5).
*/
/*:ja
* @plugindesc ランダムにアイテムを取得します
* @author Takeya Kimura
*
* @param Help Message Text
* @desc ガチャ画面のヘルプメッセージですRequired Amountは消費Gと置換されます
* @default 1回Required Amount\Gでガチャを引きます
*
* @param Button Text
* @desc ガチャボタンに表示するテキストです
* @default ガチャを引く
*
* @param Get Message Text
* @desc ガチャを引いた後のメッセージですItem Nameは取得アイテム名と置換されます
* @default GET Item Name
*
* @param Show Item Description
* @desc 1でアイテム取得時に説明を表示します[0: 説明非表示 1: 説明表示]
* @default 0
*
* @param Effect
* @desc アイテム取得時のアニメーションIDを指定します
* @default 119
* @require 1
* @type animation
*
* @param Rank1 Effect
* @desc ランク1の時のアニメーションIDを指定します-1を指定するとアニメーションを表示しません
* @default -1
* @require 1
* @type animation
*
* @param Rank2 Effect
* @desc ランク2の時のアニメーションIDを指定します-1を指定するとアニメーションを表示しません
* @default -1
* @require 1
* @type animation
*
* @param Rank3 Effect
* @desc ランク3の時のアニメーションIDを指定します-1を指定するとアニメーションを表示しません
* @default -1
* @require 1
* @type animation
*
* @param Rank4 Effect
* @desc ランク4の時のアニメーションIDを指定します-1を指定するとアニメーションを表示しません
* @default -1
* @require 1
* @type animation
*
* @param Rank5 Effect
* @desc ランク5の時のアニメーションIDを指定します-1を指定するとアニメーションを表示しません
* @default -1
* @require 1
* @type animation
*
* @param ME
* @desc アイテム取得時のMEを指定します
* @default Organ
* @require 1
* @dir audio/me/
* @type file
*
* @param Required Amount
* @desc ガチャを引くのに必要なGです
* @default 100
*
* @noteParam gachaImage
* @noteRequire 1
* @noteDir img/gacha/
* @noteType file
* @noteData items
*
* @help
*
* Plugin Command:
* Gacha open # ガチャ画面を開きます
* Gacha add item 1 # アイテム番号1をガチャ対象に追加します
* Gacha remove item 1 # アイテム番号1をガチャ対象から外します
* Gacha clear # 全てのガチャ対象をクリアします
*
*
* Item Note:
* <gachaImage:image> # ガチャアイテムの画像を指定します画像はimg/gacha/フォルダ内に入れてください
* <gachaNumLot:10> # ガチャアイテムのくじ数を指定します
* <gachaRank:5> # ガチャアイテムのランクを1から5の間で指定します
*/
(function () {
var parameters = PluginManager.parameters('Gacha');
var message;
var itemDescEnable = !!Number(parameters['Show Item Description'] || 0);
var rankEffect = [];
rankEffect.push(Number(parameters['Rank1 Effect'] || '-1'));
rankEffect.push(Number(parameters['Rank2 Effect'] || '-1'));
rankEffect.push(Number(parameters['Rank3 Effect'] || '-1'));
rankEffect.push(Number(parameters['Rank4 Effect'] || '-1'));
rankEffect.push(Number(parameters['Rank5 Effect'] || '-1'));
var me = String(parameters['ME'] || 'Organ');
var amount = Number(parameters['Required Amount'] || '100');
var reg = /Required Amount/gi;
Scene_Boot = class extends Scene_Boot {
start() {
super.start();
message = LanguageManager.getMessageData("gacha_minigame.message_0").text;
message = message.replace(reg, String(amount));
}
}
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === "Gacha") {
switch (args[0]) {
case "open":
SceneManager.push(Scene_Gacha);
break;
case 'add':
$gameSystem.addToGacha(args[1], Number(args[2]));
break;
case 'remove':
$gameSystem.removeFromGacha(args[1], Number(args[2]));
break;
case 'clear':
$gameSystem.clearGacha();
break;
}
}
};
// YIN
Game_Interpreter.prototype.initGacha = function() {
ImageManager.loadAtlas("gacha_prizes");
// INIT GACHA
this._gachaItem = null;
this._gachaLot = [];
this._rankSprite = new Sprite_GachaEffect();
this._rankSprite.keepDisplay(true);
SceneManager._scene.addChild(this._rankSprite);
var wy = 120;
var wh = 320;
this._getWindow = new Window_GachaGet(0, wy, 280, wh);
this._getWindow.itemDescEnable(itemDescEnable);
this._getWindow.hide();
SceneManager._scene.addWindow(this._getWindow);
var numLot;
var item, i, j;
for (i = 1; i < $dataItems.length; i++) {
item = $dataItems[i];
if ($gameSystem.isInGacha(item)) {
numLot = Number(item.meta.gachaNumLot || '0');
for (j = 0; j < numLot; j++) {
this._gachaLot.push(item);
}
}
}
for (i = 1; i < $dataWeapons.length; i++) {
item = $dataWeapons[i];
if ($gameSystem.isInGacha(item)) {
numLot = Number(item.meta.gachaNumLot || '0');
for (j = 0; j < numLot; j++) {
this._gachaLot.push(item);
}
}
}
for (i = 1; i < $dataArmors.length; i++) {
item = $dataArmors[i];
if ($gameSystem.isInGacha(item)) {
numLot = Number(item.meta.gachaNumLot || '0');
for (j = 0; j < numLot; j++) {
this._gachaLot.push(item);
}
}
}
this._gachaItem = this._gachaLot[(Math.random() * this._gachaLot.length) >> 0];
this._getWindow.setItem(this._gachaItem);
$gameParty.gainItem(this._gachaItem, 1);
}
// YIN
Game_Interpreter.prototype.displayGachaItem = function(item) {
this._getWindow._gachaSprite.opacity = 0;
this._moveGet = true;
this._getWindow.x = (Graphics.boxWidth - this._getWindow.width) / 2;
this._getWindow.y = 120;
this._getWindow.show();
}
// YIN
Game_Interpreter.prototype.removeGachaWindow = function() {
this._gachaClosing = true;
}
var yin_Interpreter_Update = Game_Interpreter.prototype.update;
Game_Interpreter.prototype.update = function () {
yin_Interpreter_Update.call(this);
if (this._gachaClosing) {
this._getWindow._gachaSprite.opacity -= 20;
this._rankSprite.opacity -= 28;
if (this._getWindow._gachaSprite.opacity <= 0) {
this._getWindow.close();
this._gachaItem = null;
this._gachaLot = [];
this._rankSprite.allRemove();
SceneManager._scene.removeChild(this._rankSprite);
SceneManager._scene.removeChild(this._getWindow);
this._getWindow = null;
this._rankSprite = null;
this._moveGet = null;
this._gachaClosing = null;
}
}
if (this._getWindow && this._getWindow._gachaSprite.opacity < 255 && this._moveGet) {
this._getWindow._gachaSprite.opacity += 4;
this._getWindow.y -= 5;
if (this._getWindow.y <= 32) {
this._getWindow.y = 32;
}
if (this._getWindow._gachaSprite.opacity >= 255) {
this._getWindow._gachaSprite.opacity = 255;
}
if (this._getWindow._gachaSprite.opacity === 255 && this._getWindow.y === 32) {
this._moveGet = false;
}
}
}
Game_System.prototype.addToGacha = function(type, dataId) {
if (!this._GachaFlags) {
this.clearGacha();
}
var typeIndex = this.gachaTypeToIndex(type);
if (typeIndex >= 0) {
this._GachaFlags[typeIndex][dataId] = true;
}
};
Game_System.prototype.removeFromGacha = function(type, dataId) {
if (this._GachaFlags) {
var typeIndex = this.gachaTypeToIndex(type);
if (typeIndex >= 0) {
this._GachaFlags[typeIndex][dataId] = false;
}
}
};
Game_System.prototype.gachaTypeToIndex = function(type) {
switch (type) {
case 'item':
return 0;
case 'weapon':
return 1;
case 'armor':
return 2;
default:
return -1;
}
};
Game_System.prototype.clearGacha = function() {
this._GachaFlags = [[], [], []];
};
Game_System.prototype.isInGacha = function(item) {
if (this._GachaFlags && item) {
var typeIndex = -1;
if (DataManager.isItem(item)) {
typeIndex = 0;
} else if (DataManager.isWeapon(item)) {
typeIndex = 1;
} else if (DataManager.isArmor(item)) {
typeIndex = 2;
}
if (typeIndex >= 0) {
return !!this._GachaFlags[typeIndex][item.id];
} else {
return false;
}
} else {
return false;
}
};
function Window_GachaGet() {
this.initialize.apply(this, arguments);
}
Window_GachaGet.prototype = Object.create(Window_Base.prototype);
Window_GachaGet.prototype.constructor = Window_GachaGet;
Window_GachaGet.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.opacity = 0;
this._item = null;
this._itemDescEnable = true;
this._gachaSprite = new Sprite();
this._gachaSprite.anchor.x = 0.5;
this._gachaSprite.anchor.y = 0.5; // bottom
this._gachaSprite.x = width / 2;
this._gachaSprite.y = Graphics.boxHeight - height - this._gachaSprite.height - this.standardPadding();
this._gachaSprite.opacity = 0;
this.addChildToBack(this._gachaSprite);
this.refresh();
};
Window_GachaGet.prototype.isUsingCustomCursorRectSprite = function () { return true; };
Window_GachaGet.prototype.itemDescEnable = function(value) {
if (this._itemDescEnable !== value) {
this._itemDescEnable = value;
this.refresh();
}
};
Window_GachaGet.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_GachaGet.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._gachaSprite.bitmap) {
var bitmapHeight = this._gachaSprite.bitmap.height;
var contentsHeight = this.contents.height;
if (this._itemDescEnable) {
contentsHeight -= this.lineHeight() * 3
}
var scale = 1;
if (bitmapHeight > contentsHeight) {
scale = contentsHeight / bitmapHeight;
}
this._gachaSprite.scale.x = scale;
this._gachaSprite.scale.y = scale;
}
};
Window_GachaGet.prototype.refresh = function() {
var item = this._item;
this.contents.clear();
if (this._itemDescEnable) {
var y = this.contentsHeight() - this.lineHeight() * 3;
this.drawHorzLine(y);
this.drawDescription(0, y + this.lineHeight());
}
if (!item || !item.meta.gachaImage) {
this._gachaSprite.bitmap = null;
return;
}
else {
var bitmap;
bitmap = ImageManager.loadPicture(this._item.meta.gachaImage);
this._gachaSprite.bitmap = bitmap;
bitmap.smooth = true;
if ([83,90,91,92,93].contains(this._item.id)) {
this._gachaSprite.y = this._gachaSprite.y - 32;
}
}
};
Window_GachaGet.prototype.drawDescription = function(x, y) {
if (this._item) this.drawTextEx(this._item.description, x, y);
};
Window_GachaGet.prototype.drawHorzLine = function(y) {
var lineY = y + this.lineHeight() / 2 - 1;
this.contents.paintOpacity = 48;
this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
this.contents.paintOpacity = 255;
};
Window_GachaGet.prototype.lineColor = function() {
return this.normalColor();
};
function Sprite_GachaEffect() {
this.initialize.apply(this, arguments);
}
Sprite_GachaEffect.prototype = Object.create(Sprite.prototype);
Sprite_GachaEffect.prototype.constructor = Sprite_GachaEffect;
Sprite_GachaEffect.prototype.initialize = function() {
Sprite.prototype.initialize.call(this);
this._animationSprites = [];
this._endSprites = [];
this._effectTarget = this;
this._hiding = false;
this._keepDisplay = false;
};
Sprite_GachaEffect.prototype.keepDisplay = function(value) {
this._keepDisplay = value;
};
Sprite_GachaEffect.prototype.update = function() {
Sprite.prototype.update.call(this);
this.updateVisibility();
this.updateAnimationSprites();
};
Sprite_GachaEffect.prototype.hide = function() {
this._hiding = true;
this.updateVisibility();
};
Sprite_GachaEffect.prototype.show = function() {
this._hiding = false;
this.updateVisibility();
};
Sprite_GachaEffect.prototype.updateVisibility = function() {
this.visible = !this._hiding;
};
Sprite_GachaEffect.prototype.updateAnimationSprites = function() {
if (this._animationSprites.length > 0) {
var sprites = this._animationSprites.clone();
this._animationSprites = [];
for (var i = 0; i < sprites.length; i++) {
var sprite = sprites[i];
if (sprite.isPlaying()) {
this._animationSprites.push(sprite);
} else {
if (!this._keepDisplay) {
sprite.remove();
}
else {
this._endSprites.push(sprite);
}
}
}
}
};
Sprite_GachaEffect.prototype.startAnimation = function(animation, mirror, delay) {
var sprite = new Sprite_Animation();
sprite.setup(this._effectTarget, animation, mirror, delay);
this.parent.addChild(sprite);
this._animationSprites.push(sprite);
};
Sprite_GachaEffect.prototype.isAnimationPlaying = function() {
return this._animationSprites.length > 0;
};
Sprite_GachaEffect.prototype.allRemove = function() {
var sprites, sprite, i;
if (this._animationSprites.length > 0) {
sprites = this._animationSprites.clone();
this._animationSprites = [];
for (i = 0; i < sprites.length; i++) {
sprite = sprites[i];
sprite.remove();
}
}
if (this._endSprites.length > 0) {
sprites = this._endSprites.clone();
this._endSprites = [];
for (i = 0; i < sprites.length; i++) {
sprite = sprites[i];
sprite.remove();
}
}
};
})();

View file

@ -0,0 +1,468 @@
//=============================================================================
// GachaBook.js
//
// (c)2016 KADOKAWA CORPORATION./YOJI OJIMA
//=============================================================================
/*:
* @plugindesc Displays detailed statuses of "gacha" items.
* @author Takeya Kimura
*
* @param Unknown Data
* @desc The index name for an unknown item.
* @default ??????
*
* @param Price Text
* @desc The text for "Price".
* @default Price
*
* @param Equip Text
* @desc The text for "Equip".
* @default Equip
*
* @param Type Text
* @desc The text for "Type".
* @default Type
*
* @param Rank Text
* @desc The text for "Rank".
* @default Rank
*
* @param Simple Display
* @desc The switch to display the name and description only.
* @default 0
*
* @help
*
* Plugin Command:
* GachaBook open # Open the gacha book screen
* GachaBook add weapon 3 # Add weapon #3 to the gacha book
* GachaBook add armor 4 # Add armor #4 to the gacha book
* GachaBook remove armor 5 # Remove armor #5 from the gacha book
* GachaBook remove item 6 # Remove item #6 from the gacha book
* GachaBook clear # Clear the item book
*/
/*:ja
* @plugindesc ガチャアイテム一覧を表示します
* @author Takeya Kimura
*
* @param Unknown Data
* @desc 未確認のガチャアイテムの名前です
* @default ??????
*
* @param Price Text
* @desc 価格の文字列です
* @default Price
*
* @param Equip Text
* @desc 装備の文字列です
* @default Equip
*
* @param Type Text
* @desc タイプの文字列です
* @default Type
*
* @param Rank Text
* @desc ランクの文字列です
* @default Rank
*
* @param Simple Display
* @desc 1と入力すると詳細表示が名前と説明だけになります[0: 通常表示 1: シンプル表示]
* @default 0
*
* @help
*
* Plugin Command:
* GachaBook open # ガチャブックを開きます
* GachaBook add weapon 3 # 武器3番をガチャブックに追加
* GachaBook add armor 4 # 防具4番をガチャブックに追加
* GachaBook remove armor 5 # 防具5番をガチャブックから削除
* GachaBook remove item 6 # アイテム6番をガチャブックから削除
* GachaBook clear # ガチャブックをクリアする
*/
(function() {
var parameters = PluginManager.parameters('GachaBook');
var unknownData;
var priceText;
var equipText;
var typeText;
var rankText;
Scene_Boot = class extends Scene_Boot {
start() {
super.start();
unknownData = LanguageManager.getMessageData("gacha_minigame.message_8").text;
priceText = LanguageManager.getMessageData("gacha_minigame.message_4").text;
equipText = LanguageManager.getMessageData("gacha_minigame.message_5").text;
typeText = LanguageManager.getMessageData("gacha_minigame.message_6").text;
rankText = LanguageManager.getMessageData("gacha_minigame.message_7").text;
}
}
var simpleDisplay = !!Number(parameters['Simple Display'] || 0);
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'GachaBook') {
switch (args[0]) {
case 'open':
SceneManager.push(Scene_GachaBook);
break;
case 'add':
$gameSystem.addToGachaBook(args[1], Number(args[2]));
break;
case 'remove':
$gameSystem.removeFromGachaBook(args[1], Number(args[2]));
break;
case 'complete':
$gameSystem.completeGachaBook();
break;
case 'clear':
$gameSystem.clearGachaBook();
break;
}
}
};
Game_System.prototype.addToGachaBook = function(type, dataId) {
if (!this._GachaBookFlags) {
this.clearGachaBook();
}
var typeIndex = this.gachaBookTypeToIndex(type);
if (typeIndex >= 0) {
this._GachaBookFlags[typeIndex][dataId] = true;
}
};
Game_System.prototype.removeFromGachaBook = function(type, dataId) {
if (this._GachaBookFlags) {
var typeIndex = this.gachaBookTypeToIndex(type);
if (typeIndex >= 0) {
this._GachaBookFlags[typeIndex][dataId] = false;
}
}
};
Game_System.prototype.gachaBookTypeToIndex = function(type) {
switch (type) {
case 'item':
return 0;
case 'weapon':
return 1;
case 'armor':
return 2;
default:
return -1;
}
};
Game_System.prototype.completeGachaBook = function() {
var i;
this.clearGachaBook();
for (i = 1; i < $dataItems.length; i++) {
this._GachaBookFlags[0][i] = true;
}
for (i = 1; i < $dataWeapons.length; i++) {
this._GachaBookFlags[1][i] = true;
}
for (i = 1; i < $dataArmors.length; i++) {
this._GachaBookFlags[2][i] = true;
}
};
Game_System.prototype.clearGachaBook = function() {
this._GachaBookFlags = [[], [], []];
};
Game_System.prototype.isInGachaBook = function(item) {
if (this._GachaBookFlags && item) {
var typeIndex = -1;
if (DataManager.isItem(item)) {
typeIndex = 0;
} else if (DataManager.isWeapon(item)) {
typeIndex = 1;
} else if (DataManager.isArmor(item)) {
typeIndex = 2;
}
if (typeIndex >= 0) {
return !!this._GachaBookFlags[typeIndex][item.id];
} else {
return false;
}
} else {
return false;
}
};
var _Game_Party_gainItem = Game_Party.prototype.gainItem;
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
_Game_Party_gainItem.call(this, item, amount, includeEquip);
if (item && amount > 0) {
var type;
if (DataManager.isItem(item)) {
type = 'item';
} else if (DataManager.isWeapon(item)) {
type = 'weapon';
} else if (DataManager.isArmor(item)) {
type = 'armor';
}
$gameSystem.addToGachaBook(type, item.id);
}
};
function Scene_GachaBook() {
this.initialize.apply(this, arguments);
}
Scene_GachaBook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_GachaBook.prototype.constructor = Scene_GachaBook;
Scene_GachaBook.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
ImageManager.loadAtlas("gacha_prizes");
};
Scene_GachaBook.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._indexWindow = new Window_GachaBookIndex(0, 0);
this._indexWindow.setHandler('cancel', this.popScene.bind(this));
var wy = this._indexWindow.height;
var ww = Graphics.boxWidth;
var wh = Graphics.boxHeight - wy;
this._statusWindow = new Window_GachaBookStatus(0, wy, ww, wh);
this.addWindow(this._indexWindow);
this.addWindow(this._statusWindow);
this._indexWindow.setStatusWindow(this._statusWindow);
};
function Window_GachaBookIndex() {
this.initialize.apply(this, arguments);
}
Window_GachaBookIndex.prototype = Object.create(Window_Selectable.prototype);
Window_GachaBookIndex.prototype.constructor = Window_GachaBookIndex;
Window_GachaBookIndex.lastTopRow = 0;
Window_GachaBookIndex.lastIndex = 0;
Window_GachaBookIndex.prototype.initialize = function(x, y) {
var width = Graphics.boxWidth;
var height = this.fittingHeight(6);
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.refresh();
this.setTopRow(Window_GachaBookIndex.lastTopRow);
this.select(Window_GachaBookIndex.lastIndex);
this.activate();
};
Window_GachaBookIndex.prototype.isUsingCustomCursorRectSprite = function () { return true; };
Window_GachaBookIndex.prototype.maxCols = function() {
return 3;
};
Window_GachaBookIndex.prototype.maxItems = function() {
return this._list ? this._list.length : 0;
};
Window_GachaBookIndex.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.updateStatus();
};
Window_GachaBookIndex.prototype.update = function() {
Window_Selectable.prototype.update.call(this);
this.updateStatus();
};
Window_GachaBookIndex.prototype.updateStatus = function() {
if (this._statusWindow) {
var item = this._list[this.index()];
this._statusWindow.setItem(item);
}
};
Window_GachaBookIndex.prototype.refresh = function() {
var i, item;
this._list = [];
for (i = 1; i < $dataItems.length; i++) {
item = $dataItems[i];
//if (item.name && item.itypeId === 1 && $gameSystem.isInGacha(item)) { //itypeIdはみない
if (item.name && $gameSystem.isInGacha(item)) { //itypeIdはみない
this._list.push(item);
}
}
for (i = 1; i < $dataWeapons.length; i++) {
item = $dataWeapons[i];
if (item.name && $gameSystem.isInGacha(item)) {
this._list.push(item);
}
}
for (i = 1; i < $dataArmors.length; i++) {
item = $dataArmors[i];
if (item.name && $gameSystem.isInGacha(item)) {
this._list.push(item);
}
}
this.createContents();
this.drawAllItems();
};
Window_GachaBookIndex.prototype.drawItem = function(index) {
var item = this._list[index];
var rect = this.itemRect(index);
var width = rect.width - this.textPadding();
if ($gameSystem.isInGachaBook(item)) {
this.drawItemName(item, rect.x, rect.y, width);
} else {
var iw = Window_Base._iconWidth + 4;
this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
}
};
Window_GachaBookIndex.prototype.processCancel = function() {
Window_Selectable.prototype.processCancel.call(this);
Window_GachaBookIndex.lastTopRow = this.topRow();
Window_GachaBookIndex.lastIndex = this.index();
};
function Window_GachaBookStatus() {
this.initialize.apply(this, arguments);
}
Window_GachaBookStatus.prototype = Object.create(Window_Base.prototype);
Window_GachaBookStatus.prototype.constructor = Window_GachaBookStatus;
Window_GachaBookStatus.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._itemSprite = new Sprite();
this._itemSprite.anchor.x = 0.5;
this._itemSprite.anchor.y = 0.5;
this._itemSprite.x = width / 2 - 20;
this._itemSprite.y = height / 2;
this.addChildToBack(this._itemSprite);
this.refresh();
};
Window_GachaBookIndex.prototype.isUsingCustomCursorRectSprite = function () { return true; };
Window_GachaBookStatus.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_GachaBookStatus.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._itemSprite.bitmap) {
var bitmapHeight = this._itemSprite.bitmap.height;
var contentsHeight = this.contents.height;
var scale = 1;
if (bitmapHeight > contentsHeight) {
scale = contentsHeight / bitmapHeight;
}
this._itemSprite.scale.x = scale;
this._itemSprite.scale.y = scale;
}
};
Window_GachaBookStatus.prototype.refresh = function() {
var item = this._item;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();
this.contents.clear();
if (!item || !$gameSystem.isInGachaBook(item)) {
this._itemSprite.bitmap = null;
return;
}
var bitmap;
if (!!item.meta.gachaImage) {
bitmap = ImageManager.loadPicture(item.meta.gachaImage);
bitmap.smooth = true;
}
this._itemSprite.bitmap = bitmap;
var iconBoxWidth = Window_Base._iconWidth + 4;
this.drawItemName(item, x, y);
this.drawItemNumber(item, x + this.textWidth(item.name) + iconBoxWidth, y);
x = this.textPadding();
y = lineHeight + this.textPadding();
if (!simpleDisplay) {
var rank = "-";
if (item.meta.gachaRank) rank = item.meta.gachaRank;
this.changeTextColor(this.systemColor());
this.drawText(rankText, x, y, 120);
this.resetTextColor();
this.drawText(rank, x + 120, y, 120, 'right');
y += lineHeight;
var price = item.price > 0 ? item.price : '-';
this.changeTextColor(this.systemColor());
this.drawText(priceText, x, y, 120);
this.resetTextColor();
this.drawText(price, x + 120, y, 120, 'right');
y += lineHeight;
if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
var etype = $dataSystem.equipTypes[item.etypeId];
this.changeTextColor(this.systemColor());
this.drawText(equipText, x, y, 120);
this.resetTextColor();
this.drawText(etype, x + 120, y, 120, 'right');
y += lineHeight;
var type;
if (DataManager.isWeapon(item)) {
type = $dataSystem.weaponTypes[item.wtypeId];
} else {
type = $dataSystem.armorTypes[item.atypeId];
}
this.changeTextColor(this.systemColor());
this.drawText(typeText, x, y, 120);
this.resetTextColor();
this.drawText(type, x + 120, y, 120, 'right');
//x = this.textPadding() + 300;
//y = lineHeight + this.textPadding();
var rewardsWidth = 220;
x = this.contents.width - rewardsWidth;
y = lineHeight + this.textPadding();
for (var i = 2; i < 8; i++) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(item.params[i], x + 160, y, 60, 'right');
y += lineHeight;
}
}
}
x = 0;
y = this.textPadding() * 2 + lineHeight * 7;
this.drawTextEx(item.description, x, y);
};
Window_GachaBookStatus.prototype.numberWidth = function() {
return this.textWidth('000');
};
Window_GachaBookStatus.prototype.drawItemNumber = function(item, x, y) {
this.drawText(':', x, y);
this.drawText($gameParty.numItems(item), x + this.textWidth('00'), y);
};
})();

View file

@ -0,0 +1,374 @@
/*:
-------------------------------------------------------------------------
@title Enemy Reinforcements
@author Hime --> HimeWorks (http://himeworks.com)
@date Aug 15, 2016
@version 1.3
@filename HIME_EnemyReinforcements.js
@url http://himeworks.com/2015/11/enemy-reinforcements-mv/
If you enjoy my work, consider supporting me on Patreon!
* https://www.patreon.com/himeworks
If you have any questions or concerns, you can contact me at any of
the following sites:
* Main Website: http://himeworks.com
* Facebook: https://www.facebook.com/himeworkscom/
* Twitter: https://twitter.com/HimeWorks
* Youtube: https://www.youtube.com/c/HimeWorks
* Tumblr: http://himeworks.tumblr.com/
-------------------------------------------------------------------------
@plugindesc Allows you to summon more enemies into the current battle
using event commands.
@help
-------------------------------------------------------------------------
== Description ==
Video: https://youtu.be/ROy4nEoao-I
Do you want to add new enemies to battle, during the battle? This plugin
provides you with a variety of commands that allow you to create
more dynamic battles through enemy reinforcements.
You can create enemy skills that will essentially summon new enemies
to battle. Enemies can be added as a single enemy, or entire troops
of enemies.
Do you want to make sure a particular reinforcement does not already
exist? With this plugin, methods are provided to allow you to check
whether a certain enemy from a certain troop exists at a certain position.
If you want reinforcements to automatically disappear after a certain
amount of time has passed, you can easily do so by making a single
command to remove all enemy reinforcements from another troop!
== Terms of Use ==
- Free for use in non-commercial projects with credits
- Contact me for commercial use
== Change Log ==
1.3 - Aug 15, 2016
* Fix checking whether a certain member existed
1.2 - Nov 21, 2015
* member ID's weren't normalized to 1-based
1.1 - Nov 17, 2015
* fixed "needs alive" condition for checking if added
1.0 - Nov 16, 2015
* initial release
== Usage ==
When enemies are added to the battle, there are two questions that
need to be answered: which enemy is added, and where are they placed?
This plugin uses troops in the database to set up the enemy positions.
The enemy that will be added depends on the enemy that you choose in a
troop, and their position will be based on where they are in the troop.
Keep this numbering system in mind as you read on.
-- Adding Enemy Troops --
You can add entire troops to the current battle. When a troop is added,
all enemies in the other troop will be added, whether they should appear
half-way or not. To add a troop into battle, use the plugin command:
add_enemy_troop TROOP_ID
Where the TROOP_ID is the ID of the troop that you want to add.
For example, if the three slimes is troop 4, you would write
add_enemy_troop 4
-- Adding Certain Enemies from Troops --
Instead of adding an entire troop, you may want to add a specific enemy
from a specific troop. To add a specific enemy, use the plugin command:
add_enemy TROOP_MEMBER_ID from troop TROOP_ID
The TROOP_MEMBER_ID uses the numbering system that I described earlier.
So for example, if you wanted to add the second slime from the three\
slimes troop to battle, you would write
add_enemy 2 from troop 4
-- Removing Enemy Troops --
If you wish to remove a troop that was added to the battle (for example,
they are all retreating or their summon time has expired), you can use
the plugin command
remove_enemy_troop TROOP_ID
So for example if you want to remove the three slimes troop which is
troop 4, you can write
remove_enemy_troop 4
-- Removing Certain Enemies from Troops --
You can also remove certain enemies from certain troops. Use the plugin
command:
remove_enemy TROOP_MEMBER_ID from troop TROOP_ID
So for example, if you added the three slimes into the battle, but want
to remove the second one, you can say
remove_enemy 2 from troop 4
And only that specific enemy will be removed.
-- Checking whether a troop exists --
To check whether an entire troop exists, you can use the script call
$gameTroop.isTroopReinforcementAdded(troopId, checkIsAlive)
Which will return true if the specific troop exists. If you pass in
`true` for checking whether it's alive or not, it will return true if
any of the members from that troop are alive. If you don't pass in
anything, then it will return true if ANY members of the troop exists.
This is useful if you wanted the summons to only appear once (unless
you explicitly remove them).
-- Checking whether an enemy from a certain troop exists --
There are methods available for checking whether a certain troop member
exists. You can use this in a script call (such as a conditional branch):
$gameTroop.isEnemyReinforcementAdded(troopID, memberId, checkIsAlive)
Which will return true if the specific member from the specified troop
exists, and whether it's alive or not. If you pass in `true` for whether
it's alive or not, you can force it to check whether the enemy exists and
is alive.
For example, if you want to check if the second slime from troop 4 is
alive, you would write
$gameTroop.isEnemyReinforcementAdded(4, 2, true)
-------------------------------------------------------------------------
*/
var Imported = Imported || {} ;
var TH = TH || {};
Imported.EnemyReinforcements = 1;
TH.EnemyReinforcements = TH.EnemyReinforcements || {};
(function ($) {
/* New. Refresh the spriteset to draw new enemies */
BattleManager.refreshEnemyReinforcements = function() {
if (this._spriteset) {
this._spriteset.refreshEnemyReinforcements();
}
}
/***************************************************************************/
Spriteset_Battle.prototype.removeEnemies = function() {
var sprites = this._enemySprites;
for (var i = 0; i < sprites.length; i++) {
this._battleField.removeChild(sprites[i]);
}
}
/* Delete all enemy sprites and re-draw them */
Spriteset_Battle.prototype.refreshEnemyReinforcements = function() {
this.removeEnemies();
this.createEnemies();
// this.createEnemyReinforcements();
}
Spriteset_Battle.prototype.createEnemyReinforcements = function() {
var enemies = $gameTroop.newReinforcements();
var sprites = [];
for (var i = 0; i < enemies.length; i++) {
sprites[i] = new Sprite_Enemy(enemies[i]);
}
sprites.sort(this.compareEnemySprite.bind(this));
for (var j = 0; j < sprites.length; j++) {
this._enemySprites.push(sprites[j]);
this._battleField.addChild(sprites[j]);
}
};
/***************************************************************************/
var TH_EnemyReinforcements_Game_Enemy_setup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
TH_EnemyReinforcements_Game_Enemy_setup.call(this, enemyId, x, y);
this._troopId = $gameTroop.troop.id;
}
Game_Enemy.prototype.troopId = function() {
return this._troopId;
}
Game_Enemy.prototype.troopMemberId = function() {
return this._troopMemberId;
}
Game_Enemy.prototype.setTroopId = function(troopId) {
this._troopId = troopId;
};
Game_Enemy.prototype.setTroopMemberId = function(memberId) {
this._troopMemberId = memberId;
};
Game_Enemy.prototype.setupReinforcements = function(troopId, enemyId, x, y) {
this.setup(enemyId, x, y);
this._troopId = troopId;
};
/***************************************************************************/
var TH_EnemyReinforcements_GameTroop_Setup = Game_Troop.prototype.setup;
Game_Troop.prototype.setup = function(troopId) {
TH_EnemyReinforcements_GameTroop_Setup.call(this, troopId);
this.clearReinforcements();
}
Game_Troop.prototype.newReinforcements = function() {
return this._newEnemies;
};
Game_Troop.prototype.clearReinforcements = function() {
this._newEnemies = [];
};
Game_Troop.prototype.addReinforcementMember = function(troopId, memberId, member) {
if ($dataEnemies[member.enemyId]) {
var enemyId = member.enemyId;
var x = member.x;
var y = member.y;
var enemy = new Game_Enemy(enemyId, x, y);
enemy.setTroopId(troopId);
enemy.setTroopMemberId(memberId);
if (member.hidden) {
enemy.hide();
}
this._enemies.push(enemy);
this._newEnemies.push(enemy);
}
}
Game_Troop.prototype.addEnemyReinforcement = function(troopId, memberId) {
var member = $dataTroops[troopId].members[memberId - 1];
this.addReinforcementMember(troopId, memberId, member);
this.makeUniqueNames();
BattleManager.refreshEnemyReinforcements();
};
Game_Troop.prototype.addTroopReinforcements = function(troopId) {
var troop = $dataTroops[troopId];
var enemyId;
for (var i = 0; i < troop.members.length; i++) {
var member = troop.members[i];
this.addReinforcementMember(troopId, i, member);
}
this.makeUniqueNames();
BattleManager.refreshEnemyReinforcements();
};
Game_Troop.prototype.removeEnemyReinforcement = function(troopId, memberId) {
var member = $dataTroops[troopId].members[memberId - 1];
var enemies = this._enemies;
/* Start from the end of the array to avoid indexing issues */
for (var i = enemies.length - 1; i > -1; i--) {
if (enemies[i].troopId() === troopId && enemies[i].troopMemberId() === memberId) {
this._enemies.splice(i, 1);
}
}
BattleManager.refreshEnemyReinforcements();
}
Game_Troop.prototype.removeTroopReinforcements = function(troopId) {
var enemies = this._enemies;
/* Start from the end of the array to avoid indexing issues */
for (var i = enemies.length - 1; i > -1; i--) {
if (enemies[i].troopId() === troopId) {
this._enemies.splice(i, 1);
}
}
BattleManager.refreshEnemyReinforcements();
};
Game_Troop.prototype.isEnemyReinforcementAdded = function(troopId, memberId, needsAlive) {
var enemies = this._enemies;
for (var i = 0; i < enemies.length; i++) {
if (enemies[i].troopId() === troopId && enemies[i].troopMemberId() === memberId) {
/* Needs to be alive */
if (needsAlive) {
if (enemies[i].isAlive()) {
return true;
}
}
/* Doesn't need to be alive */
else {
return true;
}
}
}
return false;
};
Game_Troop.prototype.isTroopReinforcementAdded = function(troopId, needsAlive) {
var enemies = this._enemies;
for (var i = 0; i < enemies.length; i++) {
if (enemies[i].troopId() === troopId) {
/* Needs to be alive */
if (needsAlive) {
if (enemies[i].isAlive()) {
return true;
}
}
/* Doesn't need to be alive */
else {
return true;
}
}
}
return false;
};
/***************************************************************************/
var TH_EnemyReinforcements_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
// specify enemy from a certain troop
if (command.toLowerCase() === "add_enemy") {
var troopId = Math.floor(args[3]);
var memberId = Math.floor(args[0]);
$gameTroop.addEnemyReinforcement(troopId, memberId)
}
// add entire troop
else if (command.toLowerCase() === "add_enemy_troop") {
var troopId = Math.floor(args[0]);
$gameTroop.addTroopReinforcements(troopId);
}
else if (command.toLowerCase() === "remove_enemy") {
var troopId = Math.floor(args[3]);
var memberId = Math.floor(args[0]);
$gameTroop.removeEnemyReinforcement(troopId, memberId);
}
else if (command.toLowerCase() === "remove_enemy_troop") {
var troopId = Math.floor(args[0]);
$gameTroop.removeTroopReinforcements(troopId);
}
else {
TH_EnemyReinforcements_Game_Interpreter_pluginCommand.call(this, command, args);
}
};
})(TH.EnemyReinforcements);

View file

@ -0,0 +1,32 @@
/*:
* @plugindesc v1.00 Plugin to display a picture with a specific ID below characters
* but above tilemap. (Even if used with YED_Tiled plugin).
* @author Kentou
*
* @param Picture ID
* @desc The ID of the picture which should be displayed below characters.
* Default: 99
* @default 99
*
* @param Picture Z
* @desc The Z-Index of the picture which should be displayed below characters.
* Default: 2
* @default 2
*
* @help
* If you display a picture with Show Picture command, use the configured Picture ID to
* display the picture below the characters. All other picture commands behave
* normally.
*/
var _createPictures = Spriteset_Base.prototype.createPictures;
Spriteset_Base.prototype.createPictures = function() {
_createPictures.call(this);
if (this._tilemap) {
var params = PluginManager.parameters("KEN_PictureBelowChars");
var picID = parseInt(params["Picture ID"]);
var sprite = this._pictureContainer.removeChildAt(picID - 1);
sprite.z = sprite.zIndex = parseInt(params["Picture Z"]);
this._tilemap.addChild(sprite);
}
};

View file

@ -0,0 +1,178 @@
//=============================================================================
// Liquid's Lovely Plugin - Game_Event Data
// Liquid_EventData.js
//=============================================================================
var Imported = Imported || {};
Imported.Liquid_EventData = true;
var Liquid = Liquid || {};
Liquid.EventData = Liquid.EventData || {};
Liquid.EventData.version = 1.00;
//=============================================================================
/*:
* @plugindesc v1.0 Easibly add saveable data to events
* @author Liquidize
*
* @help
* ============================================================================
* Introduction and Instructions
* ============================================================================
*
* This plugin adds a new data object that allows end users to store variables
* and values for any event on any map and access said value in any script or
* event through easy to use functions.
*
* Functions are called via the $eventData global. It is similar in structure to
* $gameVariables, $gameSwitches, and $gameSelfSwitches.
*
* To make it easier for non-coders to use these functions in script calls to get
* or set values, some of the functions that you are used to for $gameVariables
* and the like have been "extended". These are as follows:
*
* $eventData.valueExt(CATEGORY,MAP_ID,EVENT_ID) - This function works similar to
* $gameVariables.value but for non programmers you need to specifiy every argument
* and then the function will build the "special key" in order to access the value.
*
* $eventData.setValueExt(CATEGORY,MAP_ID,EVENT_ID,VALUE) - This function like the
* above "valueExt" function works similar to $gameVariable.setValue except, just like
* the "valueExt" function you need to specify the Map and Event ID's as the function
* will build the key for you.
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.00:
* - Finished plugin!
*/
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Liquid.Parameters = PluginManager.parameters('Liquid_EventData');
Liquid.Param = Liquid.Param || {};
// Define Global
var $eventData = null;
//=============================================================================
// DataManager
//=============================================================================
Liquid.EventData.DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
$eventData = new Game_EventData();
Liquid.EventData.DataManager_createGameObjects.call(this);
};
Liquid.EventData.DataManager_makeSaveContents = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
var contents = Liquid.EventData.DataManager_makeSaveContents.call(this);
contents.eventData = $eventData;
return contents;
};
Liquid.EventData.DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
Liquid.EventData.DataManager_extractSaveContents.call(this,contents);
$eventData = contents.eventData;
};
//=============================================================================
// Game_EventData
//=============================================================================
// Constructor
function Game_EventData() {
this.initialize.apply(this, arguments);
}
// Initializer, clears/builds the data object
Game_EventData.prototype.initialize = function () {
this.clearAll();
};
// Adds a category to the data, specified by the argument "category"
// If no such category exists already
Game_EventData.prototype.addCategory = function (category) {
if (category && !this._data[category]) {
this._data[category] = {};
}
};
// Removes a category from the data, specified by the "category"
// argument if said category exists. This deletes ALL the values and
// information for said category.
Game_EventData.prototype.removeCategory = function(category) {
if (category && this._data[category]) {
delete this._data[category];
}
};
// This is basically a reset function, it clears
// the data and resets the object to default state
// removing all categories and information
Game_EventData.prototype.clearAll = function () {
this._data = {};
};
// This clears the specific category specified by
// "category".
Game_EventData.prototype.clear = function (category) {
if (category) {
this._data[category] = {};
}
};
// Checks if the data contains the specified category
// Returns true if it does, false if not
Game_EventData.prototype.hasCategory = function(category) {
if (category && this._data[category]) {
return true;
}
return false;
};
// Gets the value of the specified key in the specified category.
// Key is formatted as an array of MAP ID and EVENT ID.
// e.g: [1,1] - Map 1 Event Id 1
Game_EventData.prototype.value = function(category, key) {
return this._data[category][key];
};
// Extension of the value property to make calling the function easier for non-coders.
Game_EventData.prototype.valueExt = function(category, map, event, key) {
if (category && map && event) {
var key = [map, event];
return this.value(category,key);
}
};
// Sets the value of the specified key in the specified category with the specified value.
// The key is formated as an array of MAP ID and EVENT ID.
// e.g: [1,5] - For Map 1, Event 5
Game_EventData.prototype.setValue = function(category, key, value) {
if (value) {
this._data[category][key] = value;
} else {
delete this._data[category][key];
}
this.onChange();
};
// Extension of the setvalue function to make calling the function easier for non-coders.
Game_EventData.prototype.setValueExt = function(category,map,event,value) {
if (category && map && event) {
var key = [map, event];
this.setValue(category,key,value);
}
};
// This function is called when a value is changed to refresh the map.
Game_EventData.prototype.onChange = function () {
$gameMap.requestRefresh();
};

View file

@ -0,0 +1,355 @@
//=============================================================================
// Liquid's Lovely Plugin for Jasmin - Event Icons
// Liquid_EventIcons.js
//=============================================================================
var Imported = Imported || {};
Imported.Liquid_EventIcons = true;
var Liquid = Liquid || {};
Liquid.Eventcons = Liquid.Eventcons || {};
Liquid.Eventcons.version = 2.01;
//=============================================================================
/*:
* @plugindesc v2 adds persistent balloon icons.
* @author Liquidize
*
* @param ---General---
* @default
*
* @param Icon Width
* @parent ---General---
* @type number
* @min 0
* @desc Determines the width of each icon frame.
* Default: 32
* @default 32
*
* @param Icon Height
* @parent ---General---
* @type number
* @min 0
* @desc Determines the height of each icon frame.
* Default: 24
* @default 24
*
* @param Default Sprite Sheet
* @parent ---General---
* @type string
* @desc Determines the default sprite sheet to use for eventcons.
* Default: quest
* @default quest
*
* @param Speed
* @parent ---General---
* @type number
* @min 0
* @desc Determines the speed at which the frame is updated.
* Default: 16
* @default 16
*
* @param Wait Time
* @parent ---General---
* @type number
* @min 0
* @desc Helps determine the wait between each icon frame.
* Default: 64
* @default 64
*
* @help
* ============================================================================
* Introduction and Instructions
* ============================================================================
*
* To add an indicator add a note to the event with the following:
* Indicator: IMAGE_NAME,INDEX
*
* Example:
* Indicator: quest,1
*
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 2.01:
* - Fixed an issue where icons wouldn't change on the same map.
*
* Version 2.00:
* - Plugin redo!
*
* Version 1.02:
* - Added Plugin Command to change event icon
*
* Version 1.01:
* - Changed it so icons can be added via notes.
* - Made icons persist through saves properly.
*
* Version 1.00:
* - Finished plugin!
*/
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Liquid.Parameters = PluginManager.parameters('Liquid_EventIcons');
Liquid.Param = Liquid.Param || {};
Liquid.Param.EventconWidth = Number(Liquid.Parameters['Icon Width'] || 32);
Liquid.Param.EventconHeight = Number(Liquid.Parameters['Icon Height'] || 24);
Liquid.Param.EventconSheet = String(Liquid.Parameters['Default Sprite Sheet'] || 'quest');
Liquid.Param.EventconSpeed = Number(Liquid.Parameters['Speed'] || 16);
Liquid.Param.EventconWaitTime = Number(Liquid.Parameters['Wait Time'] || 64);
Liquid.Eventcons.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
// Plugin Commands
if (command === "ChangeEventcon") {
if (args.length !== 4) {
return;
}
var map = parseInt(args[0]);
var event = parseInt(args[1]);
var img = args[2];
var index = parseInt(args[3]);
if (!$eventData.hasCategory("eventcon")) $eventData.addCategory("eventcon");
$eventData.setValueExt("eventcon", map, event, [img, index]);
if (map === $gameMap.mapId()) {
if ($gameMap._events[event]) {
$gameMap._events[event].removeEventcon();
$gameMap._events[event].setupEventcon(img,index);
}
}
} else if (command === "RemoveEventcon") {
if (args.length !== 2) {
return;
}
var map = parseInt(args[0]);
var event = parseInt(args[1]);
if (!$eventData.hasCategory("eventcon")) $eventData.addCategory("eventcon");
$eventData.setValueExt("eventcon", map, event);
if (map === $gameMap.mapId()) {
if ($gameMap._events[event]) {
$gameMap._events[event].removeEventcon();
}
}
}
Liquid.Eventcons.Game_Interpreter_pluginCommand.call(this, command, args);
};
//=============================================================================
// TDS PATCH : USE SCRIPT CALL
// this.setEventIcon(42, 'quest', 1);
//=============================================================================
Game_Interpreter.prototype.setEventIcon = function(eventId, img, index) {
var map = $gameMap.mapId();
var event = $gameMap.event(eventId);
if (!$eventData.hasCategory("eventcon")) $eventData.addCategory("eventcon");
$eventData.setValueExt("eventcon", map, eventId, [img, index]);
event.removeEventcon();
event.setupEventcon(img, index);
event.refresh();
};
//=============================================================================
// Game_CharacterBase
//=============================================================================
Game_CharacterBase.prototype.setupEventcon = function (img, index) {
if (this.isEventconPlaying()) {
this.removeEventcon();
}
this._eventImg = img;
this._eventIndex = index;
};
Game_CharacterBase.prototype.startEventcon = function () {
this._eventconPlaying = true;
};
Game_CharacterBase.prototype.isEventconPlaying = function () {
return this._eventIndex > 0 || this._eventconPlaying;
};
Game_CharacterBase.prototype.removeEventcon = function () {
this._eventImg = null;
this._eventIndex = -1;
this._eventconPlaying = false;
};
Game_CharacterBase.prototype.eventconId = function () {
return this._eventIndex;
};
Game_CharacterBase.prototype.eventconImg = function () {
return this._eventImg;
};
Game_CharacterBase.prototype.endEventcon = function () {
this._eventconPlaying = false;
};
//=============================================================================
// Game_Event
//=============================================================================
Liquid.Eventcons.Game_Event_refresh = Game_Event.prototype.refresh;
Game_Event.prototype.refresh = function () {
if (!this._eventIndex) {
if ($eventData.hasCategory("eventcon")) {
var eventIconInfo = $eventData.value("eventcon", [this._mapId, this._eventId]);
if (eventIconInfo) {
this.setupEventcon(eventIconInfo[0], eventIconInfo[1]);
}
} else if (this.event().note.match(/(?:INDICATOR):[ ](.+)[,](\d+)/i)) {
var img = String(RegExp.$1);
var index = Number(RegExp.$2);
this.setupEventcon(img, index);
if (!$eventData.hasCategory("eventcon")) {
$eventData.addCategory("eventcon");
}
$eventData.setValueExt("eventcon", this._mapId, this._eventId, [img, index]);
}
}
Liquid.Eventcons.Game_Event_refresh.call(this);
};
//=============================================================================
// Sprite_Character
//=============================================================================
Liquid.Eventcons.Sprite_Character_update = Sprite_Character.prototype.update;
Sprite_Character.prototype.update = function () {
Liquid.Eventcons.Sprite_Character_update.call(this);
this.updateEventcon();
};
Sprite_Character.prototype.setupEventcon = function () {
if (this._character.eventconId() > 0) {
this.startEventcon();
this._character.startEventcon();
if (!this.currentEventcondId) {
this.currentEventcondId = this._character.eventconId();
}
if (!this.currentEventcondImg) {
this.currentEventcondImg = this._character.eventconImg();
}
}
};
Sprite_Character.prototype.startEventcon = function () {
if (!this._eventconSprite || (this.currentEventcondId != this._character.eventconId()) || (this.currentEventcondImg != this._character.eventconImg())) {
this.endEventcon();
this._eventconSprite = new Sprite_EventCon();
this._eventconSprite.setup(this._character.eventconImg(), this._character.eventconId());
this.parent.addChild(this._eventconSprite);
this.currentEventcondId = this._character.eventconId();
this.currentEventcondImg = this._character.eventconImg();
}
};
Sprite_Character.prototype.updateEventcon = function () {
this.setupEventcon();
if (this._eventconSprite) {
this._eventconSprite.x = this.x;
this._eventconSprite.y = this.y - this.height;
if (!this._character.isEventconPlaying()) {
this.endEventcon();
}
}
};
Sprite_Character.prototype.endEventcon = function () {
if (this._eventconSprite) {
this.parent.removeChild(this._eventconSprite);
this._eventconSprite = null;
}
};
Sprite_Character.prototype.isEventconPlaying = function () {
return !!this._eventconSprite;
};
Liquid.Eventcons.Sprite_Character_updateAnimation = Sprite_Character.prototype.updateAnimation;
Sprite_Character.prototype.updateAnimation = function () {
Liquid.Eventcons.Sprite_Character_updateAnimation.call(this);
if (!this.isEventconPlaying()) {
this._character.endEventcon();
}
};
//=============================================================================
// Sprite_EventCon
//=============================================================================
function Sprite_EventCon() {
this.initialize.apply(this, arguments);
}
Sprite_EventCon.prototype = Object.create(Sprite_Base.prototype);
Sprite_EventCon.prototype.constructor = Sprite_EventCon;
Sprite_EventCon.prototype.initialize = function () {
Sprite_Base.prototype.initialize.call(this);
this.initMembers();
};
Sprite_EventCon.prototype.initMembers = function () {
this._eventconId = 0;
this._eventconImg = Liquid.Param.EventconSheet
this._duration = 0;
this.anchor.x = 0.5;
this.anchor.y = 1;
this.z = 7;
};
Sprite_EventCon.prototype.loadBitmap = function () {
this.bitmap = ImageManager.loadSystem(this._eventconImg);
this.setFrame(0, 0, 0, 0);
};
Sprite_EventCon.prototype.setup = function (img, index) {
this._eventconImg = img;
this._eventconId = index;
this._duration = 4 * this.speed() + this.waitTime();
this.loadBitmap();
};
Sprite_EventCon.prototype.update = function () {
Sprite_Base.prototype.update.call(this);
if (this._duration > 0) {
this._duration--;
if (this._duration > 0) {
this.updateFrame();
} else {
this._duration = 4 * this.speed() + this.waitTime();
}
}
};
Sprite_EventCon.prototype.updateFrame = function () {
var w = Liquid.Param.EventconWidth;
var h = Liquid.Param.EventconHeight;
var sx = this.frameIndex() * w;
var sy = (this._eventconId - 1) * h;
this.setFrame(sx, sy, w, h);
};
Sprite_EventCon.prototype.speed = function () {
return Liquid.Param.EventconSpeed;
};
Sprite_EventCon.prototype.waitTime = function () {
return Liquid.Param.EventconWaitTime;
};
Sprite_EventCon.prototype.frameIndex = function () {
var index = (this._duration - this.waitTime()) / this.speed();
return 3 - Math.max(Math.floor(index), 0);
};
Sprite_EventCon.prototype.isPlaying = function () {
return this._duration > 0;
};

View file

@ -0,0 +1,638 @@
//=============================================================================
// TDS Map Character Tag
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_MapCharacterTag = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.MapCharacterTag = _TDS_.MapCharacterTag || {};
//=============================================================================
/*:
* @plugindesc
* Shortcut for tag system
*
* @author TDS
*
*
* @param Common Event ID
* @desc ID of the common event to run after tagging.
* @default 1
*
* @param Selected Variable ID
* @desc ID of the variable to set selected tagged actor ID.
* @default 1
*
*
* @param Disable Switch ID
* @desc ID of the switch used to disable the tagging system.
* @default 1
*
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Map_Character_Tag");
// Initialize Parameters
_TDS_.MapCharacterTag.params = {};
_TDS_.MapCharacterTag.params.commonEventID = Number(parameters['Common Event ID'] || 1);
_TDS_.MapCharacterTag.params.selectedVariableID = Number(parameters['Selected Variable ID'] || 1);
_TDS_.MapCharacterTag.params.disableSwitchID = Number(parameters['Disable Switch ID'] || 1);
//=============================================================================
// ** Input
//-----------------------------------------------------------------------------
// The static class that handles input data from the keyboard and gamepads.
//=============================================================================
// Set Key Mapper A Key
Input.keyMapper[65] = 'tag';
//=============================================================================
// ** Scene_Map
//-----------------------------------------------------------------------------
// The scene class of the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapCharacterTag.Game_Player_canMove = Game_Player.prototype.canMove;
_TDS_.MapCharacterTag.Game_Player_canStartLocalEvents = Game_Player.prototype.canStartLocalEvents;
//=============================================================================
// * Can Use Map Character Tag
//=============================================================================
Game_Player.prototype.canUseCharacterTag = function() {
// Get Scene
const scene = SceneManager._scene;
// If scene exists and has can use character tag function return it
if (scene && scene.canUseCharacterTag) { return scene.canUseCharacterTag(); };
return false;
};
//=============================================================================
// * Determine if player can start local events
//=============================================================================
Game_Player.prototype.canStartLocalEvents = function() {
// If Map Character tag is visible
if (SceneManager._scene._mapCharacterTag.opacity > 0) { return false; };
// Return Original Function
return _TDS_.MapCharacterTag.Game_Player_canStartLocalEvents.call(this);
};
//=============================================================================
// * Can Move
//=============================================================================
Game_Player.prototype.canMove = function() {
// Input A is being pressed
let scene = SceneManager._scene;
let isTagging = scene._mapCharacterTag ? scene._mapCharacterTag.opacity > 0 : false;
if (!!isTagging) { return false; };
// return Original Function
return _TDS_.MapCharacterTag.Game_Player_canMove.call(this);
};
//=============================================================================
// ** Scene_Map
//-----------------------------------------------------------------------------
// The scene class of the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapCharacterTag.Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
_TDS_.MapCharacterTag.Scene_Map_update = Scene_Map.prototype.update;
_TDS_.MapCharacterTag.Scene_Map_terminate = Scene_Map.prototype.terminate;
//=============================================================================
// * Create Display Objects
//=============================================================================
Scene_Map.prototype.createDisplayObjects = function() {
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_createDisplayObjects.call(this);
// Create Map Character Tag
this.createMapCharacterTag();
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_Map.prototype.terminate = function() {
// Hide Map Character Tag
this._mapCharacterTag.visible = false;
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_terminate.call(this);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_Map.prototype.update = function() {
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_update.call(this);
// Update Character Tag
this.updateCharacterTagInput();
};
//=============================================================================
// * Create Map Character Tag
//=============================================================================
Scene_Map.prototype.createMapCharacterTag = function() {
// Create Map Character Tag Sprite
this._mapCharacterTag = new Sprite_MapCharacterTag();
this.addChild(this._mapCharacterTag);
};
//=============================================================================
// * Determine if Character Tag can be used
//=============================================================================
Scene_Map.prototype.canUseCharacterTag = function() {
// If Event is running return false
if ($gameMap.isEventRunning()) { return false; };
// If Party size is 1 or less
if ($gameParty.size() <= 1) { return false;};
// If Disable Switch is on return false
if ($gameSwitches.value(_TDS_.MapCharacterTag.params.disableSwitchID)) { return false; }
let scene = SceneManager._scene;
let isProcessingAnyMovement = !!$gamePlayer.isMoving() || !!$gamePlayer.followers().areMoving() || Input.isPressed("left") || Input.isPressed("right") || Input.isPressed("up") || Input.isPressed("down");
if (!!isProcessingAnyMovement) {return false;}
// Return true by default
return true;
};
//=============================================================================
// * Update Character Tag
//=============================================================================
Scene_Map.prototype.updateCharacterTagInput = function() {
// If Input Trigger A
if (Input.isTriggered('tag')) {
// If Can use Character Tag
if (this.canUseCharacterTag()) {
// Get Tag
var tag = this._mapCharacterTag;
// If Tag is Finished
if (tag._finished) {
// Show Tag
tag.show();
};
};
};
};
//=============================================================================
// ** Sprite_MapCharacterTag
//-----------------------------------------------------------------------------
// Ring Menu for Omori's tag system on the map.
//=============================================================================
function Sprite_MapCharacterTag() { this.initialize.apply(this, arguments);}
Sprite_MapCharacterTag.prototype = Object.create(Sprite.prototype);
Sprite_MapCharacterTag.prototype.constructor = Sprite_MapCharacterTag;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_MapCharacterTag.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Initialize Settings
this.initSettings();
// Create Background
this.createBackground();
// Create Party Sprites
this.createPartySprites();
};
//=============================================================================
// * Create Background
//=============================================================================
Sprite_MapCharacterTag.prototype.createBackground = function() {
// Create Background
this._backgroundSprite = new Sprite();
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Initialize Settings
//=============================================================================
Sprite_MapCharacterTag.prototype.initSettings = function() {
// Amount of Frames for Startup Animation
this._startUpFrames = 13;
// Animation Frames for Movement Animation
this._movingFrames = 10;
// Radius of the ring
this._ringRadius = 160;
// Animation Steps
this._steps = -1;
// Set Center X & Y Valeus
this._centerX = Graphics.width / 2;
this._centerY = (Graphics.height / 2) - 10;
// Animation Type (Start, Wait, Move Right, Move Left)
this._anim = '';
// Set Index to
this._index = 0;
// Set Opacity to 0
this.opacity = 0;
// Set Released To false
this._released = false;
// Finished Flag
this._finished = true;
};
//=============================================================================
// * Create Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.createPartySprites = function() {
// Initialize Party Sprites
this._partySprites = [];
// Create Party Sprites Container
this._partySpritesContainer = new Sprite()
this._partySpritesContainer.opacity = 0;
this.addChild(this._partySpritesContainer);
// Iterate
for (var i = 0; i < 4; i++) {
var sprite = new Sprite_MapCharacterTagFace();
let text = LanguageManager.getMessageData("XX_BLUE.Map_Character_Tag").leader
sprite.setText(text);
sprite.x = this._centerX;
sprite.y = this._centerY;
this._partySprites[i] = sprite;
this._partySpritesContainer.addChild(sprite)
};
// Create Leader Sprite
this._leaderSprite = new Sprite_MapCharacterTagFace();
this._leaderSprite.x = this._centerX;
this._leaderSprite.y = this._centerY;
this._leaderSprite.showText();
let tagtext = LanguageManager.getMessageData("XX_BLUE.Map_Character_Tag").tag_who
this._leaderSprite.setText(tagtext)
this.addChild(this._leaderSprite);
// Refresh Party Sprites
this.refreshPartySprites();
};
//=============================================================================
// * Refresh Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.refreshPartySprites = function() {
for (var i = 0; i < this._partySprites.length; i++) {
// Get Sprite
var sprite = this._partySprites[i];
// Get Actor
var actor = $gameParty.members()[i];
sprite._faceSprite.actor = actor;
// Set Visibility
sprite.visible = actor !== undefined;
};
// Set Leader Sprite Face Sprite
this._leaderSprite._faceSprite.actor = $gameParty.leader();
};
//=============================================================================
// * Reset Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.resetPartySprites = function() {
for (var i = 0; i < this._partySprites.length; i++) {
// Get Sprite
var sprite = this._partySprites[i];
sprite.x = this._centerX;
sprite.y = this._centerY;
};
};
//=============================================================================
// * Activate & Deactivate
//=============================================================================
Sprite_MapCharacterTag.prototype.activate = function() { this._active = true; };
Sprite_MapCharacterTag.prototype.deactivate = function() { this._active = false; };
//=============================================================================
// * Determine if Animating
//=============================================================================
Sprite_MapCharacterTag.prototype.isAnimating = function() { return this._steps > -1; };
//=============================================================================
// * Determine if Inputs can be made
//=============================================================================
Sprite_MapCharacterTag.prototype.isInputable = function() {
if (this.isAnimating()) { return false; };
if (this._released) { return false; };
return true;
};
//=============================================================================
// * Get Max Items
//=============================================================================
Sprite_MapCharacterTag.prototype.maxItems = function() { return $gameParty.size(); };
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_MapCharacterTag.prototype.update = function() {
// Super Call
Sprite.prototype.update.call(this);
// Update Animations
this.updateAnimations();
// Update Input
this.updateInput()
};
//=============================================================================
// * Move Left
//=============================================================================
Sprite_MapCharacterTag.prototype.moveLeft = function() {
// Set Steps
this._steps = this._movingFrames;
// Set Max
var max = this.maxItems();
// Set Index
this._index = (this._index - 1 + max) % max;
// Set Animation
this._anim = 'moveLeft';
};
//=============================================================================
// * Move Right
//=============================================================================
Sprite_MapCharacterTag.prototype.moveRight = function() {
// Set Steps
this._steps = this._movingFrames;
// Set Index
this._index = (this._index + 1) % this.maxItems();
// Set Animation
this._anim = 'moveRight'
};
//=============================================================================
// * Show
//=============================================================================
Sprite_MapCharacterTag.prototype.show = function() {
// Set Index to
this._index = 0;
// Refresh Party Sprites
this.refreshPartySprites();
// Reset Party Sprites
this.resetPartySprites();
// Snap Background Bitmap
SceneManager.snapForBackground(false);
// Set Background Bitmap
this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
this._backgroundSprite.opacity = 0;
this._backgroundSprite.blur = new PIXI.filters.BlurFilter();
this._backgroundSprite.filters = [this._backgroundSprite.blur];
this._backgroundSprite.blur.blur = 1;
this._backgroundSprite.blur.padding = 0;
// Set Party Sprites container Opacity
this._partySpritesContainer.opacity = 0;
// Start Startup Animation
this.startStartupAnim();
// Set Released To false
this._released = false;
// Finished Flag
this._finished = false;
};
//=============================================================================
// * Update Animations
//=============================================================================
Sprite_MapCharacterTag.prototype.onFinish = function() {
this._anim = null;
this._steps = -1;
this._backgroundSprite.bitmap = null;
this._released = false;
// Finished Flag
this._finished = true;
// If Index is more than 0
if (this._index > 0) {
// Get Actor ID
var actorId = $gameParty.members()[this._index].actorId();
// Set Actor ID Variable
$gameVariables.setValue(_TDS_.MapCharacterTag.params.selectedVariableID, actorId);
// Reserve Common Event
$gameTemp.reserveCommonEvent(_TDS_.MapCharacterTag.params.commonEventID);
};
// Reset Index
this._index = 0;
};
//=============================================================================
// * Update Animations
//=============================================================================
Sprite_MapCharacterTag.prototype.updateAnimations = function() {
// Set Release Flag
if (!this._released) {
// Set Active Flag
this._active = Input.isPressed('tag');
if (!this._active) {
this._released = true;
return;
};
} else if (!this._finished && this._released) {
// If Not Active
this.opacity -= 30;
// If Opacity is 0 or less set showing to false
if (this.opacity <= 0) {
// On Finish
this.onFinish();
};
return;
};
// If Steps is more than -1
if (!this._released && this._steps > -1) {
// Animation Switch Case
switch (this._anim) {
case 'start':
this.updateStartupAnim();
break;
case 'moveLeft':
this.updateMoveAnim(1);
break;
case 'moveRight':
this.updateMoveAnim(0)
break;
default:
// statements_def
break;
};
}
};
//=============================================================================
// * Update Input
//=============================================================================
Sprite_MapCharacterTag.prototype.updateInput = function() {
// If Inputable
if (this.isInputable()) {
// Left Input
if (Input.isRepeated('left')) { this.moveLeft(); };
// Right Input
if (Input.isRepeated('right')) { this.moveRight(); };
};
};
//=============================================================================
// * Start Startup Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.startStartupAnim = function() {
// Animation Steps
this._steps = this._startUpFrames;
// Set Animation Type
this._anim = 'start';
};
//=============================================================================
// * Update Startup Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateStartupAnim = function() {
// If Opacity is not at max
if (this.opacity < 255) {
// Increase Opacity
this.opacity += 60;
this._backgroundSprite.opacity += 60;
return;
}
var max = this.maxItems();
var d1 = 2.0 * Math.PI / max;
var d2 = 1.0 * Math.PI / this._startUpFrames;
var r = this._ringRadius - 1.0 * this._ringRadius * this._steps / this._startUpFrames;
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var d = d1 * i + d2 * this._steps;
sprite.x = this._centerX + (r * Math.sin(d));
sprite.y = this._centerY - (r * Math.cos(d));
sprite.hideText();
sprite._faceSprite.deactivate();
};
// If Steps are more than 0
if (this._steps > 0) {
// Set party container opacity
this._partySpritesContainer.opacity = (this._partySpritesContainer.opacity * (this._steps - 1) + 255) / this._steps;
};
// Decrease Steps
this._steps--;
// If Animation is over
if (this._steps < 0) { this.updateWaitAnim(); };
};
//=============================================================================
// * Update Wait Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateWaitAnim = function() {
var max = this.maxItems();
var d = 2.0 * Math.PI / max;
// Go Through Sprites
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var j = i - this._index;
sprite.x = (this._centerX + (this._ringRadius * Math.sin(d * j)));
sprite.y = this._centerY - ((this._ringRadius * Math.cos(d * j)))
if (i === this._index) {
sprite.showText();
sprite._faceSprite.activate();
} else {
sprite._faceSprite.deactivate();
sprite.hideText();
}
};
};
//=============================================================================
// * Update Move Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateMoveAnim = function(mode) {
var max = this.maxItems();
var d1 = 2.0 * Math.PI / max;
var d2 = d1 / this._movingFrames;
if (mode !== 0) { d2 *= -1; };
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var j = i - this._index;
var d = d1 * j + d2 * this._steps;
sprite.x = (this._centerX + (this._ringRadius * Math.sin(d)));
sprite.y = this._centerY - ((this._ringRadius * Math.cos(d)))
sprite.hideText();
};
// Decrease Steps
this._steps--;
// If Animation is over
if (this._steps < 0) { this.updateWaitAnim(); };
};
//=============================================================================
// ** Sprite_MapCharacterTagFace
//-----------------------------------------------------------------------------
// Animated Face Sprite for menus.
//=============================================================================
function Sprite_MapCharacterTagFace() { this.initialize.apply(this, arguments);}
Sprite_MapCharacterTagFace.prototype = Object.create(Sprite.prototype);
Sprite_MapCharacterTagFace.prototype.constructor = Sprite_MapCharacterTagFace;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_MapCharacterTagFace.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Set Center Position
this.anchor.set(0.5, 0.5);
// Create Sprites
this.createBackgroundSprite();
this.createTextSprite();
this.createFaceSprite();
// Hide Text
this.hideText();
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createBackgroundSprite = function() {
var bitmap = new Bitmap(110, 110 + 34)
bitmap.fillAll('rgba(0, 0, 0, 1)')
bitmap.fillRect(1, 1, bitmap.width - 2, bitmap.height - 2, 'rgba(255, 255, 255, 1)')
bitmap.fillRect(4, 4, bitmap.width - 8, 105, 'rgba(0, 0, 0, 1)')
bitmap.fillRect(0, 113, bitmap.width, 1, 'rgba(0, 0, 0, 1)')
bitmap.fillRect(4, 117, bitmap.width - 8, 22, 'rgba(0, 0, 0, 1)')
this._backgroundSprite = new Sprite(bitmap);
this._backgroundSprite.x = -(bitmap.width / 2);
this._backgroundSprite.y = -(110 / 2);
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Text Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createTextSprite = function() {
var bitmap = new Bitmap(110, 32);
this._textSprite = new Sprite(bitmap);
this._textSprite.anchor.set(0.5, 0);
this._textSprite.y = (144 / 2) - 18;
this.addChild(this._textSprite);
};
//=============================================================================
// * Create Face Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createFaceSprite = function() {
// Create Face Sprite
this._faceSprite = new Sprite_OmoMenuStatusFace();
this._faceSprite.anchor.set(0.5, 0.5)
this._faceSprite.actor = $gameParty.members()[0];
this._faceSprite.deactivate();
this.addChild(this._faceSprite);
this._faceMask = new Sprite(new Bitmap(110,110))
this._faceMask.x = -(110 / 2) + 2;
this._faceMask.y = -(110 / 2) + 2;
let white = 'rgba(255, 255, 255, 1)';
this._faceMask.bitmap.fillRect(0,0,106,2, white)
this._faceMask.bitmap.fillRect(104,0,2,106, white)
this.addChild(this._faceMask);
};
//=============================================================================
// * Activate & Deactivate
//=============================================================================
Sprite_MapCharacterTagFace.prototype.activate = function() { this._active = true; };
Sprite_MapCharacterTagFace.prototype.deactivate = function() { this._active = false; };
//=============================================================================
// * Show Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.setText = function(text) {
var bitmap = this._textSprite.bitmap;
bitmap.fontSize = LanguageManager.getMessageData("XX_BLUE.Sprite_MapCharacterTagFace").setText_fontsize;
bitmap.drawText(text, 0, 0, bitmap.width, bitmap.height, 'center');
};
//=============================================================================
// * Show Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.showText = function() {
this._backgroundSprite.setFrame(0, 0, 110, this._backgroundSprite.bitmap.height);
this._textSprite.visible = true;
};
//=============================================================================
// * Hide Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.hideText = function() {
this._backgroundSprite.setFrame(0, 0, 110, 114);
this._textSprite.visible = false;
};

View file

@ -0,0 +1,13 @@
/*=============================================================================
* OMORI -- Battle Formulas
* By Archeia - http://www.archeia.moe
*=============================================================================
//* -----------------------------------------------------------------------*/
//* Release Stress/Energy
//* this.omoriStressReleaseFormula(a, b)
//* -----------------------------------------------------------------------*/
Game_Action.prototype.omoriStressReleaseFormula = function(a, b) {
var value = a.level >= 30 ? 1000 : a.level >= 15 ? 600 : 300
return value;
};

View file

@ -0,0 +1,125 @@
//=============================================================================
// OggOnly.js
// PUBLIC DOMAIN
// ----------------------------------------------------------------------------
// 2018/07/23 国際化と微修正
//=============================================================================
/*:
* @plugindesc Use only ogg files to play the audio.
* @author krmbn0576
*
* @param deleteM4a
* @type boolean
* @text Delete all m4a files
* @desc Delete all m4a files the next time you playtest. Backup your files before execute.
* @default false
*
* @help
* Use only ogg files to play the audio such as BGM and SE.
* You need no longer to prepare m4a files.
*
* Usage:
* Locate stbvorbis.js, stbvorbis_asm.js, and this plugin in plugins directory.
* Turn ON Only this plugin, but DO NOT register the others to plugin manager.
*
*
* License:
* PUBLIC DOMAIN
*
* Thanks:
* This plugin uses stbvorbis.js(https://github.com/hajimehoshi/stbvorbis.js)
* as a ogg decoder. Thanks!
*/
/*:ja
* @plugindesc 音声ファイルの再生にoggファイルのみを使用します
* @author くらむぼん
*
* @param deleteM4a
* @type boolean
* @text m4aファイルを消去
* @desc 次にテストプレイを開始した時すべてのm4aファイルを削除します念の為バックアップを取った上でご活用ください
* @default false
*
* @help
* BGMや効果音などの音声ファイルにoggファイルのみを使用します
* 本プラグインを入れている場合m4aファイルを用意しなくても音声を再生できます
*
* 使い方
* pluginsフォルダに本プラグインとstbvorbis.jsとstbvorbis_asm.jsを配置してください
* 3つのうち本プラグインだけをプラグイン管理でONに設定してください
* 他のつはOFFでも構いませんしプラグイン管理に登録しなくても構いません
*
*
* ライセンス
* このプラグインの利用法に制限はありませんお好きなようにどうぞ
*
* 謝辞
* このプラグインはoggデコーダーとしてstbvorbis.jsを使用しています
* (https://github.com/hajimehoshi/stbvorbis.js)
* ありがとうございますみんなどんどん使ってね
*/
(function() {
'use strict';
var parameters = PluginManager.parameters('OggOnly');
var deleteM4a = parameters['deleteM4a'] === 'true';
// ただただ互換性回復のため再定義。 / Recover compatiblity.
Utils.isOptionValid = function(name) {
if (location.search.slice(1).split('&').contains(name)) return true;
return typeof window.nw !== "undefined" && nw.App.argv.length > 0 && nw.App.argv[0].split('&').contains(name);
};
if (deleteM4a && Utils.isOptionValid('test') && Utils.isNwjs()) {
var exec = require('child_process').exec;
var messages, success, failure;
if (navigator.language.contains('ja')) {
messages = [
'すべてのm4aファイルを削除しますか',
'本当に削除しますか?念のため、先にプロジェクトフォルダのバックアップをとっておくことをおすすめします。',
'こうかいしませんね?'
];
success = 'すべてのm4aファイルを削除しました。';
failure = 'm4aファイルの削除中にエラーが発生しました。 ';
} else {
messages = [
'Delete all m4a files?',
'Are you sure?',
'This cannot be undone. Are you really, REALLY sure?'
];
success = 'All m4a files have been deleted.';
failure = 'Error occured while deleting m4a files.';
}
if (messages.every(function(message) { return confirm(message); })) {
var command = process.platform === 'win32' ? 'del /s *.m4a' : 'find . -name "*.m4a" -delete';
exec(command, function(error) {
alert(error ? failure : success);
});
}
}
PluginManager.loadScript('stbvorbis.js');
AudioManager.audioFileExt = function() {
return '.ogg';
};
if (!WebAudio.canPlayOgg()) {
WebAudio._context.decodeAudioData = function(arrayBuffer, callback, errorback) {
return stbvorbis.decode(arrayBuffer).then(function(result) {
var channels = result.data.length;
var buffer = this.createBuffer(result.data.length, result.data[0].length, result.sampleRate);
for (var i = 0; i < channels; i++) {
if (buffer.copyToChannel) {
buffer.copyToChannel(result.data[i], i);
} else {
buffer.getChannelData(i).set(result.data[i]);
}
}
return buffer;
}.bind(this)).then(callback, errorback);
};
}
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,438 @@
//=============================================================================
// Olivia Engine - Map Display Name Core - for RPG Maker MV version 1.6.1
// Olivia_MapDisplayNameCore.js
//=============================================================================
/*:
* @plugindesc <MapDisplayNameCore> for RPG Maker MV version 1.6.1.
* @author Fallen Angel Olivia
*
* @help
* This is a RPG Maker MV plugin that lets you control Map Display Names.
* They can now use text codes, have unique gradient colors, and can have
* custom defined fade times and duration.
*
* -----------------
* Plugin Parameters
* -----------------
*
* Change the plugin parameters to adjust the way your map name windows look.
*
* - Text Distance: The amount of distance between the edge of the gradient to
* the text in pixels.
*
* - Window Height: This is the height of the window.
*
* - Y Position:
* Starting Y: This is the Y coordinate for the map display window when it
* starts fades in.
* Middle Y: This is the Y coordinate for the map display window when it
* finishes fading in.
* Ending Y: This is the Y coordinate for the map display window when it
* finishes fading out.
*
* - Fade:
* Fade In Time: The number of frames to fade in the map display name.
* MIddle Time: The number of frames to wait before fading out.
* Fade Out Time: The number of frames to fade out the map display name.
*
* - Dim Color
* Dim Color 1: This is the default dim color 1 used. Use values in order of
* Red, Green, Blue, Alpha.
* Dim Color 2: This is the default dim color 2 used. Use values in order of
* Red, Green, Blue, Alpha.
*
* -----------------
* Custom Dim Colors
* -----------------
*
* You can use custom Dim Colors for special maps. Put these notetags into
* the map's note box.
*
* <Dim Color 1: r, g, b, a>
* <Dim Color 2: r, g, b, a>
*
* r = red (0-255)
* g = green (0-255)
* b = blue (0-255)
* a = alpha (0-100)
*
* For example, a yellow Dim Color 1 notetag would look like this:
*
* <Dim Color 1: 255, 255, 0, 60>
*
* -----------------
* Text Code Support
* -----------------
*
* Text codes like \n[1] and \v[2] are supported for map names. You can now
* put them inside of the map name to have them display the data shown with
* the text codes used.
*
* For example, "\n[1] Town" will be displayed as Harold Town.
*
* -----------------
* Override Map Name
* -----------------
*
* If you want to override the next map name that will be displayed, then use
* this Script Call event:
*
* var text = "Next Name Displayed";
* $gameMap.overrideMapName(text);
*
* The next map you enter will have the map name displaying the string in the
* text variable you put inside the Script Call Event. Then, it will clear
* itself and the next map you enter will have its usual name again and will no
* longer have an override map name.
*
* If you want to clear the override map name, then make a Script Call Event
* with this code:
*
* $gameMap.clearOverrideMapName();
*
* This will clear the override map name that is currently stored and the next
* map you enter will have the regular name instead.
*
* -------------------
* W A R N I N G ! ! !
* -------------------
*
* This plugin is made for RPG Maker MV versions 1.6.1 and below. If you update
* RPG Maker MV past that and this plugin breaks, I am NOT responsible for it.
*
* ------------
* Terms of Use
* ------------
*
* 1. These plugins may be used in free or commercial games.
* 2. 'Fallen Angel Olivia' must be given credit in your games.
* 3. You are allowed to edit the code.
* 4. Do NOT change the filename, parameters, and information of the plugin.
* 5. You are NOT allowed to redistribute these Plugins.
* 6. You may NOT take code for your own released Plugins without credit.
*
* -------
* Credits
* -------
*
* If you are using this plugin, credit the following people:
*
* - Fallen Angel Olivia
*
* @param
* @param
* @param ATTENTION!!!
* @default READ THE HELP FILE
* @param
* @param
*
* @param Text Distance
* @type number
* @desc The amount of distance between the edge of the gradient to the text in pixels.
* @default 80
*
* @param
*
* @param Window Height
* @type number
* @desc This is the height of the window.
* @default 36
*
* @param
*
* @param Y Position
*
* @param Starting Y
* @parent Y Position
* @type number
* @desc This is the Y coordinate for the map display window when it starts fades in.
* @default 18
*
* @param Middle Y
* @parent Y Position
* @type number
* @desc This is the Y coordinate for the map display window when it finishes fading in.
* @default 48
*
* @param Ending Y
* @parent Y Position
* @type number
* @desc This is the Y coordinate for the map display window when it finishes fading out.
* @default 78
*
* @param
*
* @param Fade
*
* @param Fade In Time
* @parent Fade
* @type number
* @desc The number of frames to fade in the map display name.
* @default 60
*
* @param Middle Time
* @parent Fade
* @type number
* @desc The number of frames to wait before fading out.
* @default 60
*
* @param Fade Out Time
* @parent Fade
* @type number
* @desc The number of frames to fade out the map display name.
* @default 60
*
* @param
*
* @param Dim Color
*
* @param Dim Color 1
* @parent Dim Color
* @desc This is the default dim color 1 used. Use values in order of Red, Green, Blue, Alpha.
* @default rgba(0, 0, 0, 0.6)
*
* @param Dim Color 2
* @parent Dim Color
* @desc This is the default dim color 2 used. Use values in order of Red, Green, Blue, Alpha.
* @default rgba(0, 0, 0, 0)
*
*
*/
//=============================================================================
var Imported = Imported || {};
Imported.Olivia_MapDisplayNameCore = true;
var Olivia = Olivia || {};
Olivia.MapDisplayNameCore = Olivia.MapDisplayNameCore || {};
var parameters = $plugins.filter(function(p) { return p.description.contains('<MapDisplayNameCore>') })[0].parameters;
Olivia.MapDisplayNameCore.TextDistance = Number(parameters['Text Distance'] || 80);
Olivia.MapDisplayNameCore.WindowHeight = Number(parameters['Window Height'] || 36);
Olivia.MapDisplayNameCore.YPosition = {
Starting: Number(parameters['Starting Y'] || 0),
Middle: Number(parameters['Middle Y'] || 0),
Ending: Number(parameters['Ending Y'] || 0)
}
Olivia.MapDisplayNameCore.Fade = {
In: Number(parameters['Fade In Time'] || 1),
Middle: Number(parameters['Middle Time'] || 1),
Out: Number(parameters['Fade Out Time'] || 1)
}
Olivia.MapDisplayNameCore.DimColor = {
Color1: String(parameters['Dim Color 1'] || 'rgba(0, 0, 0, 0.6)'),
Color2: String(parameters['Dim Color 2'] || 'rgba(0, 0, 0, 0)')
}
//-----------------------------------------------------------------------------
// Game_Map
//
// The game object class for a map. It contains scrolling and passage
// determination functions.
Game_Map.prototype.overrideMapName = function(text) {
this.overrideDisplayName(text);
};
Game_Map.prototype.overrideDisplayName = function(text) {
this._overrideDisplayName = text;
};
Game_Map.prototype.clearOverrideMapName = function() {
this.clearOverrideDisplayName();
};
Game_Map.prototype.clearOverrideDisplayName = function() {
this._overrideDisplayName = undefined;
};
Game_Map.prototype.displayName = function() {
if (this._overrideDisplayName) {
return this._overrideDisplayName;
} else {
return $dataMap.displayName;
}
};
Game_Map.prototype.displayNameDimColor1 = function() {
if ($dataMap.note.match(/<DIM COLOR 1:[ ]*(\d+(?:\s*,\s*\d+)*)>/i)) {
var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
var color = 'rgba(';
color += parseInt(array[0]).clamp(0, 255) + ',';
color += parseInt(array[1]).clamp(0, 255) + ',';
color += parseInt(array[2]).clamp(0, 255) + ',';
color += parseFloat(array[3] * 0.01).clamp(0, 1);
return color + ')';
} else {
return Olivia.MapDisplayNameCore.DimColor.Color1;
}
};
Game_Map.prototype.displayNameDimColor2 = function() {
if ($dataMap.note.match(/<DIM COLOR 2:[ ]*(\d+(?:\s*,\s*\d+)*)>/i)) {
var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
var color = 'rgba(';
color += parseInt(array[0]).clamp(0, 255) + ',';
color += parseInt(array[1]).clamp(0, 255) + ',';
color += parseInt(array[2]).clamp(0, 255) + ',';
color += parseFloat(array[3] * 0.01).clamp(0, 1);
return color + ')';
} else {
return Olivia.MapDisplayNameCore.DimColor.Color2;
}
};
//-----------------------------------------------------------------------------
// Window_MapName
//
// The window for displaying the map name on the map screen.
Window_MapName.prototype.initialize = function() {
var x = 0;
var y = Olivia.MapDisplayNameCore.YPosition.Starting;
var width = this.windowWidth();
var height = this.windowHeight();
this.setupFadeRate();
this.setupDisplayName();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._step = 'Fade In';
this.opacity = 0;
this.contentsOpacity = 0;
this._showCount = 0;
this.refresh();
};
Window_MapName.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_MapName.prototype.windowHeight = function() {
return Olivia.MapDisplayNameCore.WindowHeight;
};
Window_MapName.prototype.standardPadding = function() {
return 0;
};
Window_MapName.prototype.setupFadeRate = function() {
this._fadeInRate = Math.ceil(255 / Olivia.MapDisplayNameCore.Fade.In);
this._fadeOutRate = Math.ceil(255 / Olivia.MapDisplayNameCore.Fade.Out);
};
Window_MapName.prototype.setupDisplayName = function() {
this._text = $gameMap.displayName();
$gameMap.clearOverrideDisplayName();
};
Window_MapName.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this.isOpen() && this._showCount > 0 && $gameMap.isNameDisplayEnabled()) {
this.updateStep();
} else {
this.updateFadeOut();
}
};
Window_MapName.prototype.updateStep = function() {
this._showCount--;
var d = this._showCount;
if (this._step === 'Fade In') {
this.updateFadeIn();
var targetY = Olivia.MapDisplayNameCore.YPosition.Middle;
if (this._showCount <= 0) {
this._showCount = Olivia.MapDisplayNameCore.Fade.Middle;
this._step = 'Fade Middle';
}
} else if (this._step === 'Fade Middle') {
this.contentsOpacity = 255;
var targetY = Olivia.MapDisplayNameCore.YPosition.Middle;
if (this._showCount <= 0) {
this._showCount = Olivia.MapDisplayNameCore.Fade.Out;
this._step = 'Fade Out';
}
} else {
this.updateFadeOut();
var targetY = Olivia.MapDisplayNameCore.YPosition.Ending;
if (this._showCount <= 0) {
this.close();
}
}
if (d > 0) {
this.y = (this.y * (d - 1) + targetY) / d;
}
};
Window_MapName.prototype.updateFadeIn = function() {
this.contentsOpacity += this._fadeInRate;
};
Window_MapName.prototype.updateFadeOut = function() {
this.contentsOpacity -= this._fadeOutRate;
};
Window_MapName.prototype.open = function() {
this._step = 'Fade In';
this.refresh();
this._showCount = Olivia.MapDisplayNameCore.Fade.In;
};
Window_MapName.prototype.refresh = function() {
this.contents.clear();
var text = this._text;
if (text) {
var width = this.textWidthEx(text);
var distance = Olivia.MapDisplayNameCore.TextDistance;
width += distance * 2;
this.drawBackground(0, 0, width, this.windowHeight());
this.drawTextEx(text, distance, 0);
}
};
Window_MapName.prototype.dimColor1 = function() {
return $gameMap.displayNameDimColor1();
};
Window_MapName.prototype.dimColor2 = function() {
return $gameMap.displayNameDimColor2();
};
Window_MapName.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};

View file

@ -0,0 +1,494 @@
//=============================================================================
// Olivia Engine - Skip Cutscene - for RPG Maker MV version 1.6.1
// Olivia_SkipCutscene.js
//=============================================================================
/*:
* @plugindesc <SkipCutscene> for RPG Maker MV version 1.6.1.
* @author Fallen Angel Olivia
*
* @help
* This is a RPG Maker MV plugin that provides the functionality to skip ahead
* in a cutscene. This is a quality of life addition for players that may have
* played a certain scene already and would like to skip ahead. The player would
* hold the cancel button (X on the keyboard or Right Click on the mouse) if the
* ability to skip the cutscene is available. By holding it until the skip gauge
* is full, the scene skips forward to the next available section.
*
*
*
* -----------------
* Plugin Parameters
* -----------------
*
* Hold Duration: Duration in frames to hold Cancel button to skip a cutscene
*
* Filling Speed: Speed used while filling up the skip gauge
*
* Emptying Speed: Speed used while emptying out the skip gauge
*
* Skip Text: Text displayed for the skip gauge. You can use text codes here.
*
* Gauge Colors: Gauge colors used for the gradients. These use hex color codes.
*
* Gauge Position: X and Y positions for where the gauge would appear. You can
* use 'auto' to have the plugin automatically calculate it for you, or you can
* use JS code to determine the position yourself. Exact numbers are also fine.
*
* Fade Speed: How fast the skip gauge would fade out.
*
*
*
* ------------------------
* Instructions: Label Tags
* ------------------------
*
* Not all scenes are skippable from the start. They need to be set up in a
* certain way for it to properly work. The setup involves Labels and require a
* specific naming convention for the labels to allow skipping cutscenes.
*
* Label Tags:
*
* <Enable Skip>
* - Once the scene has passed a label named <Enable Skip> the player will be
* able to hold down the Cancel Button (X on the keyboard or Right Click on the
* mouse) and skip forward to the next available <Skip Target> Label.
*
* <Disable Skip>
* - If the scene has passed a label named <Disable Skip> then skipping the
* cutscene will no longer become available for the player.
*
* <Skip Target>
* - If the player decides to skip forward, then the screen will fade out. After
* that, the scene will skip to the next available <Skip Target> label. You will
* have to manually fade the screen back in afterwards.
*
* These labels cannot be used in tandem with parallel events. Parallel events
* cannot have cutscene skipping capability.
*
*
*
* --------
* Examples
* --------
*
* I highly recommend that you take a look at the sample project that could be
* downloaded with this plugin on how to use it. It will teach you many core
* basics on how to properly create your cutscene events to be usable with the
* Skip Cutscene function.
*
*
*
* -------------------
* W A R N I N G ! ! !
* -------------------
*
* This plugin is made for RPG Maker MV versions 1.6.1 and below. If you update
* RPG Maker MV past that and this plugin breaks, I am NOT responsible for it.
*
* ------------
* Terms of Use
* ------------
*
* 1. These plugins may be used in free or commercial games.
* 2. 'Fallen Angel Olivia' must be given credit in your games.
* 3. You are allowed to edit the code.
* 4. Do NOT change the filename, parameters, and information of the plugin.
* 5. You are NOT allowed to redistribute these Plugins.
* 6. You may NOT take code for your own released Plugins without credit.
*
* -------
* Credits
* -------
*
* If you are using this plugin, credit the following people:
*
* - Fallen Angel Olivia
*
* @param
* @param
* @param ATTENTION!!!
* @default READ THE HELP FILE
* @param
* @param
*
* @param Hold Duration
* @type number
* @min 1
* @desc Duration in frames to hold Cancel button to skip a cutscene
* @default 180
*
* @param
*
* @param Filling Speed
* @type number
* @min 1
* @desc Speed used while filling up the skip gauge
* @default 1
*
* @param Emptying Speed
* @type number
* @min 1
* @desc Speed used while emptying out the skip gauge
* @default 4
*
* @param
*
* @param Skip Text
* @desc Text displayed for the skip gauge. You can use text codes here.
* @default Hold \c[27]X\c[0] to skip cutscene
*
* @param
*
* @param Gauge Color 1
* @desc Gauge color used for the left half of the gauge gradient
* This is a hex color code
* @default #8781bd
*
* @param Gauge Color 2
* @desc Gauge color used for the right half of the gauge gradient
* This is a hex color code
* @default #bd8cbf
*
* @param Gauge Position X
* @desc X position for the gauge.
* Use 'auto' if you want the plugin to automatically calculate the position X. Otherwise, it will use code to calculate the position.
* @default auto
*
* @param Gauge Position Y
* @desc Y position for the gauge.
* Use 'auto' if you want the plugin to automatically calculate the position Y. Otherwise, it will use code to calculate the position.
* @default auto
*
* @param
*
* @param Fade Speed
* @type number
* @min 1
* @desc How fast you wish for the skip gauge to fade out
* @default 24
*
*
*/
//=============================================================================
var Imported = Imported || {};
Imported.Olivia_SkipCutscene = true;
var Olivia = Olivia || {};
var parameters = $plugins.filter(function(p) { return p.description.contains('<SkipCutscene>') })[0].parameters;
Olivia.SkipCutscene = {
holdDuration: Number(parameters['Hold Duration']),
increaseSpeed: Number(parameters['Filling Speed']),
decreaseSpeed: Number(parameters['Emptying Speed']),
message: String(parameters['Skip Text']),
gaugeColor1: String(parameters['Gauge Color 1']),
gaugeColor2: String(parameters['Gauge Color 2']),
gaugePositionX: String(parameters['Gauge Position X']),
gaugePositionY: String(parameters['Gauge Position Y']),
fadeSpeed: Number(parameters['Fade Speed']),
};
//-----------------------------------------------------------------------------
// Game_Interpreter
//
// The interpreter for running event commands.
Olivia.SkipCutscene.___Game_Interpreter_setup___ = Game_Interpreter.prototype.setup;
Game_Interpreter.prototype.setup = function(list, eventId) {
if (!$gameParty.inBattle() && this._depth === 0) {
if (!!eventId && !!$gameMap.event(eventId) && $gameMap.event(eventId)._trigger !== 4) {
$gameTemp._canSkipCutscene = false;
$gameTemp._skippingCutscene = false;
SceneManager._scene._skipCutsceneDuration = 0;
}
}
Olivia.SkipCutscene.___Game_Interpreter_setup___.call(this, list, eventId);
};
Olivia.SkipCutscene.___Game_Interpreter_terminate___ = Game_Interpreter.prototype.terminate;
Game_Interpreter.prototype.terminate = function() {
if (!$gameParty.inBattle() && this._depth === 0) {
if (!!this._eventId && !!$gameMap.event(this._eventId) && $gameMap.event(this._eventId)._trigger !== 4) {
$gameTemp._canSkipCutscene = undefined;
$gameTemp._skippingCutscene = undefined;
SceneManager._scene._skipCutsceneDuration = 0;
}
}
Olivia.SkipCutscene.___Game_Interpreter_terminate___.call(this);
};
Olivia.SkipCutscene.___Game_Interpreter_command118___ = Game_Interpreter.prototype.command118;
Game_Interpreter.prototype.command118 = function() {
if (this._params[0].match(/<Enable Skip>/i)) {
$gameTemp._canSkipCutscene = true;
$gameTemp._skippingCutscene = false;
} else if (this._params[0].match(/<Disable Skip>/i)) {
$gameTemp._canSkipCutscene = false;
$gameTemp._skippingCutscene = false;
} else if (this._params[0].match(/<Skip Target>/i)) {
$gameTemp._canSkipCutscene = false;
$gameTemp._skippingCutscene = false;
}
return Olivia.SkipCutscene.___Game_Interpreter_command118___.call(this);
};
Game_Interpreter.prototype.processSkipCutscene = function() {
var interpreter = this.getLatestInterpreter();
if (!!interpreter._list) {
for (var i = interpreter._index; i < interpreter._list.length; i++) {
var command = interpreter._list[i];
if (command.code === 118 && command.parameters[0].match(/<Skip Target>/i)) {
interpreter.stopSkipCutscene(interpreter, i, true);
return;
}
}
}
if (interpreter === this) {
interpreter.stopSkipCutscene(interpreter, this._list.length - 1, false);
} else {
interpreter.terminate();
this.processSkipCutscene();
}
};
Game_Interpreter.prototype.getLatestInterpreter = function() {
var interpreter = this;
while (!!interpreter._childInterpreter && !!interpreter._childInterpreter._list) {
interpreter = interpreter._childInterpreter;
}
return interpreter;
};
Game_Interpreter.prototype.stopSkipCutscene = function(interpreter, targetLine, foundTarget) {
interpreter._waitMode = '';
interpreter.wait(interpreter.fadeSpeed());
$gameScreen.startFadeOut(interpreter.fadeSpeed());
if (interpreter === this) {
$gameTemp._canSkipCutscene = false;
$gameTemp._skippingCutscene = true;
}
SceneManager._scene._skipCutsceneDuration = 0;
interpreter.jumpTo(targetLine);
if (!foundTarget) {
$gameScreen.startFadeIn(interpreter.fadeSpeed());
if ($gameTemp.isPlaytest()) {
alert('You do not have a <Skip Target> Label Tag for this event!\nAdd the <Skip Target> Label to your event to make Skip Cutscene work properly.');
}
}
};
//-----------------------------------------------------------------------------
// Window_Message
//
// The window for displaying text messages.
Olivia.SkipCutscene.___Scene_Map_updateMainMultiply___ = Scene_Map.prototype.updateMainMultiply;
Scene_Map.prototype.updateMainMultiply = function() {
Olivia.SkipCutscene.___Scene_Map_updateMainMultiply___.call(this);
if (!!$gameTemp._canSkipCutscene) {
this.updateSkipCutscene();
}
};
Scene_Map.prototype.isSkipCutscene = function() {
return ($gameMap.isEventRunning() && !SceneManager.isSceneChanging() && Input.isLongPressed('cancel'));
};
Scene_Map.prototype.updateSkipCutscene = function() {
this._skipCutsceneDuration = this._skipCutsceneDuration || 0;
if (this.isSkipCutscene()) {
this._skipCutsceneDuration += Olivia.SkipCutscene.increaseSpeed;
if (this._skipCutsceneDuration >= Olivia.SkipCutscene.holdDuration) {
this.processSkipCutscene();
}
} else {
this._skipCutsceneDuration = Math.max(0, this._skipCutsceneDuration - Olivia.SkipCutscene.decreaseSpeed);
}
};
Scene_Map.prototype.processSkipCutscene = function() {
// Switch check to see if skip cutscene was processed.
$gameSwitches.setValue(40, true);
$gameMap._interpreter.processSkipCutscene();
};
Olivia.SkipCutscene.___Scene_Map_createAllWindows___ = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function() {
Olivia.SkipCutscene.___Scene_Map_createAllWindows___.call(this);
this._skipCutsceneWindow = new Window_SkipCutscene();
this.addChild(this._skipCutsceneWindow);
};
//-----------------------------------------------------------------------------
// Window_Selectable
//
// The window for displaying text messages.
Olivia.SkipCutscene.___Window_Selectable_isOkTriggered___ = Window_Selectable.prototype.isOkTriggered;
Window_Selectable.prototype.isOkTriggered = function() {
if (!!$gameTemp._skippingCutscene) {
return true;
} else {
return Olivia.SkipCutscene.___Window_Selectable_isOkTriggered___.call(this);
}
};
//-----------------------------------------------------------------------------
// Window_Message
//
// The window for displaying text messages.
Olivia.SkipCutscene.___Window_Message_isTriggered___ = Window_Message.prototype.isTriggered;
Window_Message.prototype.isTriggered = function() {
if (!!$gameTemp._skippingCutscene) {
return true;
} else if (!!$gameTemp._canSkipCutscene && Input.isRepeated('cancel')) {
return false;
} else {
return Olivia.SkipCutscene.___Window_Message_isTriggered___.call(this);
}
};
//-----------------------------------------------------------------------------
// Window_ChoiceList
//
// The window used for the event command [Show Choices].
Olivia.SkipCutscene.___Window_ChoiceList_isOkTriggered___ = Window_ChoiceList.prototype.isOkTriggered;
Window_ChoiceList.prototype.isOkTriggered = function() {
if (!!$gameTemp._skippingCutscene) {
return true;
} else {
return Olivia.SkipCutscene.___Window_ChoiceList_isOkTriggered___.call(this);
}
};
//-----------------------------------------------------------------------------
// Window_NumberInput
//
// The window used for the event command [Input Number].
Olivia.SkipCutscene.___Window_NumberInput_isOkTriggered___ = Window_NumberInput.prototype.isOkTriggered;
Window_NumberInput.prototype.isOkTriggered = function() {
if (!!$gameTemp._skippingCutscene) {
return true;
} else {
return Olivia.SkipCutscene.___Window_NumberInput_isOkTriggered___.call(this);
}
};
//-----------------------------------------------------------------------------
// Window_SkipCutscene
//
// The window for displaying the description of the selected item.
function Window_SkipCutscene() {
this.initialize.apply(this, arguments);
}
Window_SkipCutscene.prototype = Object.create(Window_Base.prototype);
Window_SkipCutscene.prototype.constructor = Window_SkipCutscene;
Window_SkipCutscene.prototype.initialize = function() {
var width = Graphics.boxWidth;
var height = this.fittingHeight(1);
Window_Base.prototype.initialize.call(this, this.textPadding() * 4, 0, width, height);
if (Olivia.SkipCutscene.gaugePositionY === 'auto') {
this.y = Graphics.boxHeight - 240;
} else {
this.y = eval(Olivia.SkipCutscene.gaugePositionY);
}
this.opacity = 0;
this.contentsOpacity = 0;
this.refresh();
};
Window_SkipCutscene.prototype.standardPadding = function() {
return 0;
};
Window_SkipCutscene.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};
Window_SkipCutscene.prototype.createChildSprite = function() {
var width = this.textWidthEx(Olivia.SkipCutscene.message);
width += this.textPadding() * 4;
var height = this.lineHeight();
this._gaugeSpriteRate = new Sprite();
this._gaugeSpriteRate.bitmap = new Bitmap(width - 2, height - 2);
var color1 = Olivia.SkipCutscene.gaugeColor1;
var color2 = Olivia.SkipCutscene.gaugeColor2;
this._gaugeSpriteRate.bitmap.gradientFillRect(0, 0, width - 2, height - 2, color1, color2);
this._gaugeSpriteRate.x = 1;
this._gaugeSpriteRate.y = 1;
this.addChildToBack(this._gaugeSpriteRate);
this._gaugeSpriteBack = new Sprite();
this._gaugeSpriteBack.bitmap = new Bitmap(width, height);
this._gaugeSpriteBack.bitmap.fillRect(0, 0, width, height, this.gaugeBackColor());
this.addChildToBack(this._gaugeSpriteBack);
if (Olivia.SkipCutscene.gaugePositionX === 'auto') {
this.x = Math.round((Graphics.boxWidth - width) / 2);
} else {
this.x = eval(Olivia.SkipCutscene.gaugePositionX);
}
};
Window_SkipCutscene.prototype.refresh = function() {
this.drawTextEx(Olivia.SkipCutscene.message, this.textPadding() * 2, 0);
this.createChildSprite();
};
Window_SkipCutscene.prototype.update = function() {
Window_Base.prototype.update.call(this);
this.updateOpacity();
if (!!this._gaugeSpriteRate) {
this.updateGaugeSprites();
}
};
Window_SkipCutscene.prototype.updateOpacity = function() {
if (!!$gameTemp._canSkipCutscene && !!SceneManager._scene._skipCutsceneDuration) {
var change = Olivia.SkipCutscene.fadeSpeed;
} else {
var change = -1 * Olivia.SkipCutscene.fadeSpeed;
}
this.contentsOpacity += change;
};
Window_SkipCutscene.prototype.updateGaugeSprites = function() {
this._gaugeSpriteRate.opacity = this.contentsOpacity;
this._gaugeSpriteBack.opacity = this.contentsOpacity;
if (!!$gameTemp._skippingCutscene) {
var rate = 1.0;
} else {
var rate = SceneManager._scene._skipCutsceneDuration / Olivia.SkipCutscene.holdDuration;
}
var width = rate * this._gaugeSpriteRate.bitmap.width;
this._gaugeSpriteRate.setFrame(0, 0, width, this._gaugeSpriteRate.height);
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,707 @@
//=============================================================================
// TDS Omori Bestiary
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriBestiary = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriBestiary = _TDS_.OmoriBestiary || {};
//=============================================================================
/*:
* @plugindesc
* Bestiary for Omori.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Game_Party
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriBestiary.Game_Party_initialize = Game_Party.prototype.initialize;
//=============================================================================
// * Object Initialize
//=============================================================================
Game_Party.prototype.initialize = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Party_initialize.call(this);
// Create List of Defeated Enemies
this._defeatedEnemies = [];
};
//=============================================================================
// * Add Defeated Enemy
//=============================================================================
Game_Party.prototype.addDefeatedEnemy = function(id) {
// Of Defeated Enemies array does not contain ID
if (!this._defeatedEnemies.contains(id)) {
// Add ID to defeated enemies array
this._defeatedEnemies.push(id);
};
let allEnemies = Object.keys(LanguageManager.getTextData('Bestiary', 'Information')).map(Number);
if(allEnemies.every(enemyId => this._defeatedEnemies.contains(enemyId))) {
$gameSystem.unlockAchievement("FOES_FILED"); // Unlock complete bestiary achievement;
}
};
//=============================================================================
// ** Game_Enemy
//-----------------------------------------------------------------------------
// The game object class for an enemy.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriBestiary.Game_Enemy_die = Game_Enemy.prototype.die;
_TDS_.OmoriBestiary.Game_Enemy_appear = Game_Enemy.prototype.appear;
_TDS_.OmoriBestiary.Game_Enemy_onBattleStart = Game_Enemy.prototype.onBattleStart
//=============================================================================
// * Die
//=============================================================================
Game_Enemy.prototype.die = function() {
// Run Original Fucntion
_TDS_.OmoriBestiary.Game_Enemy_die.call(this);
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
//=============================================================================
// * Appear
//=============================================================================
Game_Enemy.prototype.appear = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Enemy_appear.call(this);
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
//=============================================================================
// * On battle start processing
//=============================================================================
Game_Enemy.prototype.onBattleStart = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Enemy_onBattleStart.call(this);
// If enemy has appeared
if (this.isAppeared()) {
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
};
//=============================================================================
// ** Scene_OmoriBestiary
//-----------------------------------------------------------------------------
// This scene is used to show the bestiary.
//=============================================================================
function Scene_OmoriBestiary() { this.initialize.apply(this, arguments);}
Scene_OmoriBestiary.prototype = Object.create(Scene_BaseEX.prototype);
Scene_OmoriBestiary.prototype.constructor = Scene_OmoriBestiary;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriBestiary.prototype.initialize = function() {
// Set Image reservation id
this._imageReservationId = 'bestiary';
// Create Enemy Object
this._enemy = new Game_Enemy(1, 0, 0);
// Super Call
Scene_BaseEX.prototype.initialize.call(this);
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriBestiary.prototype.initAtlastLists = function() {
// Super Call
Scene_BaseEX.prototype.initAtlastLists.call(this);
// // Go Through List of Entries
// for (let [id, obj] of Object.entries(LanguageManager.getTextData('Bestiary', 'Information'))) {
// // Reserve Battleback
// ImageManager.reserveBattleback1(obj.background.name, 0, this._imageReservationId);
// // Get Filename
// var name = $dataEnemies[Number(id)].sideviewBattler[0];
// // If name
// if (name) { ImageManager.reserveSvActor(name, 0, this._imageReservationId); };
// }
};
//=============================================================================
// * Start
//=============================================================================
Scene_OmoriBestiary.prototype.start = function() {
// Super Call
Scene_BaseEX.prototype.start.call(this);
// Start Fade in
this.startFadeIn(this.slowFadeSpeed(), false);
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriBestiary.prototype.create = function() {
// Super Call
Scene_BaseEX.prototype.create.call(this);
this.createEnemyWindow();
this.createEnemyNameWindow();
this.createEnemyListWindow();
// Create Enemy Text Window
this._enemyTextWindow = new Window_OmoBestiaryEnemyText();
this._enemyTextWindow.y = Graphics.height - this._enemyTextWindow.height
this._enemyTextWindow.x = Graphics.width - this._enemyTextWindow.width;
this._enemyTextWindow.visible = false;
this.addChild(this._enemyTextWindow)
this.onListChangeUpdate();
};
//=============================================================================
// * Create Enemy Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyWindow = function() {
// Create Enemy Window
this._enemyWindow = new Window_OmoBestiaryEnemy(this._enemy);
this.addChild(this._enemyWindow);
};
//=============================================================================
// * Create Enemy Name Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyNameWindow = function() {
// Create Enemy Name Window
this._enemyNameWindow = new Window_OmoBestiaryEnemyName();
this._enemyNameWindow.x = Graphics.width - this._enemyNameWindow.width;
this.addChild(this._enemyNameWindow)
};
//=============================================================================
// * Create Enemy List Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyListWindow = function() {
// Create Enemy List Window
this._enemyListWindow = new Window_OmoBestiaryEnemyList();
this._enemyListWindow.x = Graphics.width - this._enemyListWindow.width;
this._enemyListWindow.y = Graphics.height - this._enemyListWindow.height;
this._enemyListWindow.setHandler('ok', this.onEnemyListOk.bind(this))
this._enemyListWindow.setHandler('cancel', this.popScene.bind(this))
this._enemyListWindow._onCursorChangeFunct = this.onListChangeUpdate.bind(this);
this.addChild(this._enemyListWindow);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriBestiary.prototype.update = function() {
// Super Call
Scene_BaseEX.prototype.update.call(this);
// If Enemy Text Window is visible
if (this._enemyTextWindow.visible) {
if (Input.isTriggered('cancel')) {
SoundManager.playCancel();
this._enemyListWindow._onCursorChangeFunct = undefined;
this._enemyListWindow.activate();
this._enemyTextWindow.visible = false;
this._enemyListWindow._onCursorChangeFunct = this.onListChangeUpdate.bind(this);
return;
}
if (Input.isTriggered('left')) {
this._enemyListWindow.selectPreviousEnemy();
this.onListChangeUpdate();
this.onEnemyListOk();
};
if (Input.isTriggered('right')) {
this._enemyListWindow.selectNextEnemy();
this.onListChangeUpdate();
this.onEnemyListOk()
};
};
};
//=============================================================================
// * On List Change Update
//=============================================================================
Scene_OmoriBestiary.prototype.onListChangeUpdate = function() {
// Get Enemy ID
var enemyId = this._enemyListWindow.enemyId();
// Get Enemy Sprite
var enemySprite = this._enemyWindow._enemySprite;
// If the enemy ID is more than 0
if (enemyId > 0) {
this._enemyWindow.clearOpacity();
enemySprite.removeChildren();
// If enemy ID has changed transform
this._enemy.transform(enemyId);
// Get Data
var data = LanguageManager.getTextData('Bestiary', 'Information')[enemyId];
// Get Background Data
var background = data.background;
// Draw Name
this._enemyNameWindow.drawName(this._enemyListWindow.enemyName(data));
// Set Home Position
enemySprite.setHome(data.position.x, data.position.y)
// Set Enemy Sprite to visible
enemySprite.visible = true;
// Start Enemy Sprite Motion
enemySprite.startMotion("other");
// Update Enemy Sprite
enemySprite.update();
// Set Background
this._enemyWindow.setBackground(background.name, background.x, background.y)
} else {
// Make Enemy Sprite invisible
enemySprite.setHome(-Graphics.width, -Graphics.height)
// Draw Name
this._enemyNameWindow.drawName(LanguageManager.getTextData('Bestiary', 'EmptyEnemyName'))
// Set Background
this._enemyWindow.setBackground(null);
};
};
//=============================================================================
// * [OK] Enemy List
//=============================================================================
Scene_OmoriBestiary.prototype.onEnemyListOk = function() {
// Get Enemy ID
var enemyId = this._enemyListWindow.enemyId();
// Get Data
var data = LanguageManager.getTextData('Bestiary', 'Information')[enemyId];
// Make Enemy Text Window Visible
this._enemyTextWindow.visible = true;
// Get Lines
var lines = data.text.split(/[\r\n]/g);
// Get Conditional Text
var conditionalText = data.conditionalText;
// If Conditional Text Exists
if (conditionalText) {
// Go through conditional text
for (var i = 0; i < conditionalText.length; i++) {
// Get text Data
var textData = conditionalText[i];
// Check if all switches are active
if (textData.switchIds.every(function(id) { return $gameSwitches.value(id); })){
// Get Line Index
var lineIndex = textData.line === null ? lines.length : textData.line;
// Get Extra Lines
var extraLines = textData.text.split(/[\r\n]/g);
// Add extra lines to main lines array
lines.splice(lineIndex, 0, ...extraLines)
};
};
}
// Draw Lines
this._enemyTextWindow.drawLines(lines);
// Get Character
var character = this._enemyTextWindow._enemyCharacter;
let sprite = this._enemyTextWindow._characterSprite;
// If Character Data Exists
if (data.character) {
// Set Character Image
character.setImage(data.character.name, data.character.index);
} else {
// Set Character Image to nothing
character.setImage('', 0);
};
// Update Sprite
sprite.update()
// Update Character
this._enemyTextWindow.updateCharacter();
this._enemyTextWindow._characterSprite.update();
};
//=============================================================================
// ** Window_OmoBestiaryEnemy
//-----------------------------------------------------------------------------
// This window is used to show the enemy and the background for it.
//=============================================================================
function Window_OmoBestiaryEnemy() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemy.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemy.prototype.constructor = Window_OmoBestiaryEnemy;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemy.prototype.initialize = function(enemy) {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, Graphics.height);
// Get Enemy Object
this._enemy = enemy
// Create Cover Mask
this.createCoverMask();
// Create Background Sprite
this.createBackgroundSprite();
// Create Enemy Sprite
this.createEnemySprite();
};
//=============================================================================
// * Standard Padding
//=============================================================================
Window_OmoBestiaryEnemy.prototype.standardPadding = function() { return 5; }
Window_OmoBestiaryEnemy.prototype.isUsingCustomCursorRectSprite = function() { return true; }
Window_OmoBestiaryEnemy.prototype.customCursorRectYOffset = function() { return -7; }
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoBestiaryEnemy.prototype._refreshArrows = function() { };
//=============================================================================
// * Create Cover Mask
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createCoverMask = function() {
// Get Padding
var padding = this.standardPadding();
// Face Mask
this._coverMask = new PIXI.Graphics();
this._coverMask.beginFill(0xFFF);
this._coverMask.drawRect(padding, padding, this.width - (padding * 2), this.height - (padding * 2));
this._coverMask.endFill();
this.addChild(this._coverMask)
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createBackgroundSprite = function() {
// Create Background Sprite
this._backgroundSprite = new Sprite(ImageManager.loadBattleback1('battleback_vf_default'));
this._backgroundSprite.mask = this._coverMask;
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Enemy Sprite
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createEnemySprite = function() {
// Create Background Sprite
this._enemySprite = new Sprite_Enemy(this._enemy);
this._enemySprite.mask = this._coverMask;
this._enemySprite.createShadowSprite = function() { this._shadowSprite = new Sprite(); }
this._enemySprite.getCurrentMotion = function() {
let other = this._enemy.getSideviewMotion("other");
if(!other) {return this._enemy.getSideviewMotion("walk")}
return other;
}
this.addChild(this._enemySprite);
};
//=============================================================================
// * Set Background
//=============================================================================
Window_OmoBestiaryEnemy.prototype.setBackground = function(name = null, x = 0, y = 0) {
// If name
if (name) {
// Set Background Bitmap
this._backgroundSprite.bitmap = ImageManager.loadBattleback1(name)
this._backgroundSprite.x = x;
this._backgroundSprite.y = y;
} else {
// Set Background Bitmap to null
this._backgroundSprite.bitmap = null;
}
this._opDelay = 6;
};
//=============================================================================
// * Clear Opacity
//=============================================================================
Window_OmoBestiaryEnemy.prototype.clearOpacity = function() {
this._enemySprite.opacity = 0;
this._backgroundSprite.opacity = 0;
}
//=============================================================================
// * Update Opacity
//=============================================================================
Window_OmoBestiaryEnemy.prototype.updateBEOpacity = function() {
if(this._enemySprite.opacity >= 255 && this._backgroundSprite.opacity >= 255) {return;}
this._enemySprite.opacity = Math.min(this._enemySprite.opacity + 8, 255);
this._backgroundSprite.opacity = Math.min(this._backgroundSprite.opacity + 8, 255);
}
//=============================================================================
// * Main Update Method
//=============================================================================
Window_OmoBestiaryEnemy.prototype.update = function() {
Window_Base.prototype.update.call(this);
if(--this._opDelay > 0) {return;}
this.updateBEOpacity();
}
//=============================================================================
// ** Window_OmoBestiaryEnemyName
//-----------------------------------------------------------------------------
// This window is used to show the enemy name as a header
//=============================================================================
function Window_OmoBestiaryEnemyName() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyName.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemyName.prototype.constructor = Window_OmoBestiaryEnemyName;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.initialize = function() {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, 48);
};
//=============================================================================
// * Standard Padding
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.standardPadding = function() { return 4; }
//=============================================================================
// * Draw Name
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.drawName = function(name) {
// Clear Contents
this.contents.clear()
// Draw Name
this.contents.drawText(name, 15, -5, this.contents.width - 30, this.contents.height);
};
//=============================================================================
// ** Window_OmoBestiaryEnemyText
//-----------------------------------------------------------------------------
// This window is used to show the enemy information text.
//=============================================================================
function Window_OmoBestiaryEnemyText() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyText.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemyText.prototype.constructor = Window_OmoBestiaryEnemyText;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.initialize = function() {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, Graphics.height - 48);
// Create Character
this.createCharacter();
};
//=============================================================================
// * Create Character
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.createCharacter = function() {
// Create Character Object
this._enemyCharacter = new Game_Character();
// Set Character Image Properties
this._enemyCharacter.setImage('', 0)
this._enemyCharacter.setWalkAnime(true)
this._enemyCharacter.setStepAnime(true)
// Create Sprite Character
this._characterSprite = new Sprite_Character(this._enemyCharacter);
this._characterSprite.updatePosition = function() {};
this.addChild(this._characterSprite);
};
//=============================================================================
// * Draw Information
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.drawInformation = function(information) {
// Clear Contents
this.contents.clear();
// Get Lines
var lines = information.split(/[\r\n]/g);
// Go Through Lines
for (var i = 0; i < lines.length; i++) {
// Draw Line
this.drawText(lines[i], 0, -10 + (i * 24), this.contents.width, 24);
};
};
//=============================================================================
// * Draw Information
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.drawLines = function(lines) {
// Clear Contents
this.contents.clear();
// Go Through Lines
for (var i = 0; i < lines.length; i++) {
// Draw Line
this.drawText(lines[i], 0, -10 + (i * 28), this.contents.width, 24);
};
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.update = function() {
// Super Call
Window_Base.prototype.update.call(this);
// Update Character
this.updateCharacter();
};
//=============================================================================
// * Update Character
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.updateCharacter = function() {
// Update Character
this._enemyCharacter.update();
// Get Sprite
var sprite = this._characterSprite;
// Set Sprite Position
sprite.x = this.width - (sprite._frame.width / 2) - 10;
sprite.y = this.height - 10;
};
//=============================================================================
// ** Window_OmoBestiaryEnemyList
//-----------------------------------------------------------------------------
// This window is used to show a list of enemy names.
//=============================================================================
function Window_OmoBestiaryEnemyList() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyList.prototype = Object.create(Window_Command.prototype);
Window_OmoBestiaryEnemyList.prototype.constructor = Window_OmoBestiaryEnemyList;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.initialize = function() {
// Get Entries for Sorted Bestiary list
this._sortedBestiaryList = Object.entries(LanguageManager.getTextData('Bestiary', 'Information'));
// Sort list
this._sortedBestiaryList.sort(function(a, b) {
var indexA = a[1].listIndex === undefined ? Number(a[0]) : a[1].listIndex
var indexB = b[1].listIndex === undefined ? Number(b[0]) : b[1].listIndex
return indexA - indexB
});
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.windowWidth = function() { return Graphics.width / 2; };
Window_OmoBestiaryEnemyList.prototype.windowHeight = function() { return Graphics.height - 48; };
Window_OmoBestiaryEnemyList.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoBestiaryEnemyList.prototype.customCursorRectXOffset = function() { return 14; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectYOffset = function() { return 0; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextXOffset = function() { return 30; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextYOffset = function() { return -7; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextWidthOffset = function() { return 0; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectBitmapName = function() { return 'cursor_menu'; }
//=============================================================================
// * Get Enemy ID
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.enemyId = function(index = this._index) {
return this._list[index].ext;
};
//=============================================================================
// * Select Next Enemy
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.selectNextEnemy = function() {
// Get Starting Index
var index = (this.index() + 1)
if(index >= this.maxItems()) {
index = 0;
}
var selected = false;
// Go Through Items
for (var i = index; i < this.maxItems(); i++) {
// If item has a valid ID
if (this._list[i].ext !== 0) {
// audio
AudioManager.playSe({name: "SE_turn_page", pan: 0, pitch: 100, volume: 90});
// Select it
this.select(i);
selected = true;
break;
};
};
if(!!selected) {return;}
};
//=============================================================================
// * Select Previous Enemy
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.selectPreviousEnemy = function() {
// Get Starting Index
var index = (this.index() - 1) < 0 ? this.maxItems() - 1 : this.index() - 1;
// Go Through Items
for (var i = index; i >= 0; i--) {
// If item has a valid Id
if (this._list[i].ext !== 0) {
// audio
AudioManager.playSe({name: "SE_turn_page", pan: 0, pitch: 100, volume: 90});
// Select it
this.select(i);
break;
};
};
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.makeCommandList = function() {
// Get List
var list = $gameParty._defeatedEnemies;
// Go Through List of Entries
for (let [id, obj] of this._sortedBestiaryList) {
// Get Index
var index = Number(id);
// If Defeated Enemy list contains id
if (list.contains(index)) {
// Add Command
this.addCommand(this.enemyName(obj), 'ok', true, index)
} else {
// Add Empty Command
this.addCommand('------------------------------', 'nothing', false, 0)
};
};
};
//=============================================================================
// * Get Enemy Name
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.enemyName = function(obj) {
// If object has conditional names
if (obj.conditionalNames) {
// Get Names
const names = obj.conditionalNames
// Go Through Names
for (var i = 0; i < names.length; i++) {
// Get Data
const data = names[i];
// Check Switches
let switches = data.switches.every(arr => $gameSwitches.value(arr[0]) === arr[1])
if (switches) {
return data.name;
};
};
};
// Return default name
return obj.name
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
var align = this.itemTextAlign();
this.resetTextColor();
this.changePaintOpacity(true);
this.drawText(this.commandName(index), rect.x, rect.y, rect.width - rect.x, align);
};
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoBestiaryEnemyList.prototype._refreshArrows = function() {
// Run Original Function
Window_Command.prototype._refreshArrows.call(this);
var w = this._width;
var h = this._height;
var p = 28;
var q = p/2;
this._downArrowSprite.move(w - q, h - q);
this._upArrowSprite.move(w - q, q);
};
//=============================================================================
// * Call Update Help
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.callUpdateHelp = function() {
// Super Call
Window_Command.prototype.callUpdateHelp.call(this);
// If active
if (this.active) {
// If On Cursor Change Function Exists
if (this._onCursorChangeFunct) { this._onCursorChangeFunct(); };
};
};

View file

@ -0,0 +1,290 @@
//=============================================================================
// TDS Omori BlackLetter Map
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriBlackLetterMap = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriBlackLetterMap = _TDS_.OmoriBlackLetterMap || {};
//=============================================================================
/*:
* @plugindesc
* This plugin shows the Omori Black Letter map.
*
* @author TDS
*
*/
//=============================================================================
// ImageManager.loadSystem('blackletter_bg');
// ImageManager.loadSystem('blackLetter_map_atlas');
//=============================================================================
// ** Input
//-----------------------------------------------------------------------------
// The static class that handles input data from the keyboard and gamepads.
//=============================================================================
// * Key Mapper Keys
//=============================================================================
// Input.keyMapper['81'] = 'q';
// //=============================================================================
// // ** Scene_Map
// //-----------------------------------------------------------------------------
// // The scene class of the map screen.
// //=============================================================================
// // Alias Listing
// //=============================================================================
// _TDS_.OmoriBlackLetterMap.Scene_Map_updateScene = Scene_Map.prototype.updateScene;
// //=============================================================================
// // * Update Scene
// //=============================================================================
// Scene_Map.prototype.updateScene = function() {
// // Run Original Function
// _TDS_.OmoriBlackLetterMap.Scene_Map_updateScene.call(this);
// if (!SceneManager.isSceneChanging()) {
// this.updateCallBlackLetterMap();
// };
// };
// //=============================================================================
// // * Update Call Black Letter Map
// //=============================================================================
// Scene_Map.prototype.updateCallBlackLetterMap = function() {
// // If Q Is triggered
// if (Input.isTriggered('pageup')) {
// // If Disable switch is off
// if (!$gameSwitches.value(18)) {
// // Go to Black Letter Map Scene
// SceneManager.push(Scene_OmoriBlackLetterMap);
// };
// };
// };
_TDS_.OmoriBlackLetterMap.Scene_Map_needsFadeIn = Scene_Map.prototype.needsFadeIn;
Scene_Map.prototype.needsFadeIn = function() {
return (_TDS_.OmoriBlackLetterMap.Scene_Map_needsFadeIn.call(this) || SceneManager.isPreviousScene(Scene_OmoriBlackLetterMap));
};
//=============================================================================
// ** Scene_OmoriBlackLetterMap
//-----------------------------------------------------------------------------
// This scene shows the Black Letter map
//=============================================================================
function Scene_OmoriBlackLetterMap() { this.initialize.apply(this, arguments);}
Scene_OmoriBlackLetterMap.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriBlackLetterMap.prototype.constructor = Scene_OmoriBlackLetterMap;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.initialize = function() {
// Super Call
Scene_Base.prototype.initialize.call(this);
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.initAtlastLists = function() {
// Run Original Function
Scene_Base.prototype.initAtlastLists.call(this);
// Add Required Atlas
// this.addRequiredAtlas('blackletter_bg');
this.addRequiredAtlas('blackLetter_map_atlas');
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.create = function() {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Map Sprite
this._mapSprite = new Sprite_OmoBlackLetterMap();
this.addChild(this._mapSprite);
};
Scene_OmoriBlackLetterMap.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this.startFadeIn(this.slowFadeSpeed());
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.update = function() {
// Super Call
Scene_Base.prototype.update.call(this);
// If Cancel or Q is pressed
if (Input.isTriggered('cancel') || Input.isTriggered('q')) {
// If not busy
if (!this.isBusy()) {
// Play Cancel Sound
// SoundManager.playCancel();
// Pop Scene
this.popScene();
};
};
};
//=============================================================================
// ** Sprite_OmoBlackLetterMap
//-----------------------------------------------------------------------------
// This sprite is used to display the black letter map.
//=============================================================================
function Sprite_OmoBlackLetterMap() { this.initialize.apply(this, arguments);}
Sprite_OmoBlackLetterMap.prototype = Object.create(Sprite.prototype);
Sprite_OmoBlackLetterMap.prototype.constructor = Sprite_OmoBlackLetterMap;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Create Background Sprite
this.createBackgroundSprite();
// Create Overlay Sprites
this.createOverlaySprites();
// Create Text Counter Sprite
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createBackgroundSprite = function() {
// Create Background Sprite
this._backgroundSprite = new Sprite(ImageManager.loadSystem('blackletter_bg'));
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Overlay Sprites
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createOverlaySprites = function() {
// Create Overlay Bitmap
var bitmap = new Bitmap(Graphics.width, Graphics.height);
// Get Background Bitmap
var bgBitmap = ImageManager.loadAtlas('blackLetter_map_atlas');
var bgBitmap50 = ImageManager.loadAtlas('blackLetter_map_50_atlas');
// Get Map Data
bgBitmap.addLoadListener(() => {
bgBitmap50.addLoadListener(() => {
var mapData = [
{name: 'PYREFLY FOREST', namePos: new Point(80, 195), rect: new Rectangle(0, 0, 193, 139), pos: new Point(111, 103), blackSwitchId: 23, nameSwitchId: 30, blackSwitch50Id: 900 },
// {name: 'Forgotten Pier', namePos: new Point(200, 27), rect: new Rectangle(194, 0, 155, 120), pos: new Point(225, 52), blackSwitchId: 21, nameSwitchId: 29 },
{name: 'PINWHEEL FOREST', namePos: new Point(440, 240), rect: new Rectangle(350, 0, 99, 107), pos: new Point(471, 128), blackSwitchId: 24, nameSwitchId: 31, blackSwitch50Id: 901 },
{name: 'SPROUT MOLE TOWN', namePos: new Point(25, 340), rect: new Rectangle(450, 0, 94, 80), pos: new Point(54, 267), blackSwitchId: 25, nameSwitchId: 32, blackSwitch50Id: 902 },
{name: 'VAST FOREST', namePos: new Point(250, 300), rect: new Rectangle(0, 124, 640, 201), pos: new Point(-2, 143), blackSwitchId: 26, nameSwitchId: 33, blackSwitch50Id: 903 },
{name: 'DEEP WELL', namePos: new Point(450, 355), rect: new Rectangle(0, 326, 418, 113), pos: new Point(119, 366), blackSwitchId: 27, nameSwitchId: 34, blackSwitch50Id: 904 },
{name: 'ORANGE OASIS', namePos: new Point(20, 55), rect: new Rectangle(545, 0, 122, 102), pos: new Point(31, 85), blackSwitchId: 28, nameSwitchId: 35, blackSwitch50Id: 905 },
{name: 'OTHERWORLD', namePos: new Point(450, 75), rect: new Rectangle(419, 326, 140, 209), pos: new Point(390, 21), blackSwitchId: 29, nameSwitchId: 36, blackSwitch50Id: 906 },
]
// Initialize Name Windows Array
this._nameWindows = [];
// Create Container for Name Windows
this._nameWindowsContainer = new Sprite();
// Go Through Map Data
for (var i = 0; i < mapData.length; i++) {
// Get Data
var data = mapData[i];
// Get Rect & Position
var rect = data.rect, pos = data.pos;
var test = Math.randomInt(100) > 50;
// If Black switch ID is not on
/*if (!$gameSwitches.value(data.blackSwitchId)) {
if (!$gameSwitches.value(data.blackSwitch50Id)) {
// Draw Black onto Bitmap
bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);
} else {
}
};*/
//if(!!$gameSwitches.value(data.blackSwitchId)) {bitmap.blt(bgBitmap, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
//else if(!!$gameSwitches.value(data.blackSwitch50Id)) {bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
if(!!$gameSwitches.value(data.blackSwitch50Id)) {bitmap.blt(bgBitmap, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
else {
if(!$gameSwitches.value(data.blackSwitchId)) {
bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);
}
}
// Get Name Position
var namePos = data.namePos;
var name = $gameSwitches.value(data.nameSwitchId) ? data.name : "???"
// Create Window
var win = new Window_OmoBlackLetterMapName(name);
// Set Window Position
win.x = namePos.x; win.y = namePos.y;
this._nameWindows.push(win);
this._nameWindowsContainer.addChild(win);
};
// Create Black Overlay Sprite
this._blackOverlay = new Sprite(bitmap);
this.addChild(this._blackOverlay)
// Add Name Window container as a child
this.addChild(this._nameWindowsContainer);
this.createTextCounterSprite();
})
})
};
//=============================================================================
// * Create Text Counter Sprite
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createTextCounterSprite = function() {
// Get Background Bitmap
var bgBitmap = ImageManager.loadAtlas('blackLetter_map_atlas');
// Create Bitmap
var bitmap = new Bitmap(200, 40);
bitmap.blt(bgBitmap, 450, 81, 39, 37, 5, 10);
bitmap.textColor = '#000000';
bitmap.outlineColor = 'rgba(255, 255, 255, 1)'
bitmap.outlineWidth = 3;
bitmap.drawText('%1/%2'.format($gameVariables.value(19), 26), 48, 0, 70, 55);
this._textCounterSprite = new Sprite(bitmap);
this._textCounterSprite.y = Graphics.height - 50;
this.addChild(this._textCounterSprite);
};
//=============================================================================
// ** Window_OmoBlackLetterMapName
//-----------------------------------------------------------------------------
// The window for displaying the name of a map section in the black letter map.
//=============================================================================
function Window_OmoBlackLetterMapName() { this.initialize.apply(this, arguments); }
Window_OmoBlackLetterMapName.prototype = Object.create(Window_Base.prototype);
Window_OmoBlackLetterMapName.prototype.constructor = Window_OmoBlackLetterMapName;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBlackLetterMapName.prototype.initialize = function(name) {
// Set Name
this._name = name;
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, 300, 38);
this.refresh();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoBlackLetterMapName.prototype.standardPadding = function() { return 4; };
Window_OmoBlackLetterMapName.prototype.windowWidth = function() { return Graphics.width; };
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoBlackLetterMapName.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Get Text Width
var textWidth = this.textWidth(this._name);
// Adjust Width
this.width = textWidth + (this._name === "???" ? 24 : this.padding*2);
this.contents.fontSize = 22;
// Draw Name
this.drawText(this._name, 0, -7, this.contentsWidth(), 'center');
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,929 @@
//=============================================================================
// ** Scene_OmoMenuItem
//-----------------------------------------------------------------------------
// The scene class of the item menu.
//=============================================================================
function Scene_OmoMenuItem() { this.initialize.apply(this, arguments); }
Scene_OmoMenuItem.prototype = Object.create(Scene_OmoMenuBase.prototype);
Scene_OmoMenuItem.prototype.constructor = Scene_OmoMenuItem;
//=============================================================================
// * Create
//=============================================================================
Scene_OmoMenuItem.prototype.create = function() {
// Super Call
Scene_OmoMenuBase.prototype.create.call(this);
// Create Windows
this.createItemConfirmationWindow();
this.createItemTrashPromptWindow();
this.createHelpWindow();
this.createStatusWindows();
this.createCategoryWindow();
this.createItemListWindow();
this.createCommandWindow();
};
//=============================================================================
// * Determine if Busy
//=============================================================================
Scene_OmoMenuItem.prototype.isBusy = function() {
if (this.move.isMoving()) { return true; }
return Scene_OmoMenuBase.prototype.isBusy.call(this);
};
//=============================================================================
// * Start
//=============================================================================
Scene_OmoMenuItem.prototype.start = function() {
// Super Call
Scene_OmoMenuBase.prototype.start.call(this);
this.queue('showWindow', this._itemCategoryWindow, 15)
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemCategoryWindow.activate();
}.bind(this))
};
//=============================================================================
// * Create Status Window
//=============================================================================
Scene_OmoMenuItem.prototype.createStatusWindows = function() {
// Super Call
Scene_OmoMenuBase.prototype.createStatusWindows.call(this);
this._statusWindow._okSoundEnabled = false;
this._statusWindow.setHandler('ok', this.onStatusWindowOk.bind(this));
this._statusWindow.setHandler('cancel', this.onStatusWindowCancel.bind(this));
this._statusWindow.refresh();
};
//=============================================================================
// * Create Help Window
//=============================================================================
Scene_OmoMenuItem.prototype.createHelpWindow = function() {
// Super Call
Scene_OmoMenuBase.prototype.createHelpWindow.call(this);
// Adjust Help Window
this._helpWindow.width = 384
this._helpWindow.height = 90
this._helpWindow.x = 10;
this._helpWindow.y = 64;
this._helpWindow._hideY = 64;
this._helpWindow._hideHeight = 0;
this._helpWindow._showY = 108;
this._helpWindow._showHeight = 90;
this._helpWindow.createContents();
this._helpWindow.height = 0;
this._helpWindow._iconRate = 0.75;
};
//=============================================================================
// * Create Category Window
//=============================================================================
Scene_OmoMenuItem.prototype.createCategoryWindow = function() {
// Create Item Category Window
this._itemCategoryWindow = new Window_OmoMenuItemCategory();
this._itemCategoryWindow.x = 10 ;
this._itemCategoryWindow.y = 20;
this._itemCategoryWindow._hideY = 20;
this._itemCategoryWindow._hideHeight = this._itemCategoryWindow.height;
this._itemCategoryWindow._showY = 64;
this._itemCategoryWindow._showHeight = this._itemCategoryWindow.height;
this._itemCategoryWindow.update();
this._itemCategoryWindow.deactivate();
this._itemCategoryWindow.setHandler('ok', this.onItemCategoryOk.bind(this));
this._itemCategoryWindow.setHandler('cancel', this.onItemCategoryCancel.bind(this));
this.addChild(this._itemCategoryWindow);
};
//=============================================================================
// * Create Item List Window
//=============================================================================
Scene_OmoMenuItem.prototype.createItemListWindow = function() {
// Create Item List Window
this._itemListWindow = new Window_OmoMenuItemList();
this._itemListWindow.x = 394;
this._itemListWindow.y = 0;
this._itemListWindow.height = 0;
this._itemListWindow.openness = 255;
this._itemListWindow._hideY = 0;
this._itemListWindow._hideHeight = 0;
this._itemListWindow._showY = 64;
this._itemListWindow._showHeight = this._itemListWindow.windowHeight();
this._itemListWindow.setHandler('ok', this.onItemListOk.bind(this));
this._itemListWindow.setHandler('cancel', this.onItemListCancel.bind(this));
this._itemListWindow.setHelpWindow(this._helpWindow);
this._itemCategoryWindow._itemWindow = this._itemListWindow;
this._itemCategoryWindow.callUpdateHelp();
this.addChild(this._itemListWindow);
};
//=============================================================================
// * Create Item Confirmation Window
//=============================================================================
Scene_OmoMenuItem.prototype.createItemConfirmationWindow = function() {
// Create Item Confirmation Window
this._itemComfirmationWindow = new Window_OmoMenuItemConfirmation();
this._itemComfirmationWindow.x = 10;
this._itemComfirmationWindow.y = 198 - this._itemComfirmationWindow.height;
this._itemComfirmationWindow._hideY = 198 - this._itemComfirmationWindow.height;
this._itemComfirmationWindow._hideHeight = this._itemComfirmationWindow.height;
this._itemComfirmationWindow._showY = 198;
this._itemComfirmationWindow._showHeight = this._itemComfirmationWindow.height
this._itemComfirmationWindow.openness = 255;
this._itemComfirmationWindow.visible = false;
this._itemComfirmationWindow.setHandler('use', this.onItemConfirmationUse.bind(this));
this._itemComfirmationWindow.setHandler('trash', this.onItemConfirmationTrash.bind(this));
this._itemComfirmationWindow.setHandler('cancel', this.onItemConfirmationCancel.bind(this));
this.addChild(this._itemComfirmationWindow);
};
//=============================================================================
// * Create Item Trash Prompt Window
//=============================================================================
Scene_OmoMenuItem.prototype.createItemTrashPromptWindow = function() {
// Create Item Trash Prompt Window
this._itemTrashPromptWindow = new Window_OmoMenuItemTrashPromptWindow();
this._itemTrashPromptWindow.x = this._itemComfirmationWindow.x + this._itemComfirmationWindow.width;
this._itemTrashPromptWindow.y = 198 - this._itemTrashPromptWindow.height;
this._itemTrashPromptWindow._hideY = 198 - this._itemTrashPromptWindow.height;
this._itemTrashPromptWindow._hideHeight = this._itemTrashPromptWindow.height;
this._itemTrashPromptWindow._showY = 198;
this._itemTrashPromptWindow._showHeight = this._itemTrashPromptWindow.height
this._itemTrashPromptWindow.openness = 255;
this._itemTrashPromptWindow.visible = false;
this._itemTrashPromptWindow.setHandler('ok', this.onItemTrashPromptOk.bind(this));
this._itemTrashPromptWindow.setHandler('cancel', this.onItemTrashPromptCancel.bind(this));
this.addChild(this._itemTrashPromptWindow);
};
//=============================================================================
// * Item
//=============================================================================
Scene_OmoMenuItem.prototype.item = function() { return this._itemListWindow.item(); };
//=============================================================================
// * User
//=============================================================================
Scene_OmoMenuItem.prototype.user = function() {
var members = $gameParty.movableMembers();
var bestActor = members[0];
var bestPha = 0;
for (var i = 0; i < members.length; i++) {
if (members[i].pha > bestPha) {
bestPha = members[i].pha;
bestActor = members[i];
};
};
return bestActor;
};
//=============================================================================
// * Play Sound for Item
//=============================================================================
Scene_OmoMenuItem.prototype.playSeForItem = function() {
SoundManager.playUseItem();
};
//=============================================================================
// * Item Category - Ok
//=============================================================================
Scene_OmoMenuItem.prototype.onItemCategoryOk = function() {
// this._itemListWindow.open();
// this._itemListWindow.activate();
// this._itemListWindow.select(0)
// this._helpWindow.open();
// Show Item & Help Window
this.queue(function() {
this._itemListWindow.select(0);
// Reset Height so when the window is recreated it will have properly sized contents
this._itemListWindow.height = this._itemListWindow.windowHeight();
this._itemListWindow.resetScroll()
this._itemListWindow.refresh();
this._itemListWindow.height = 0;
this._itemListWindow.updateHelp();
this.showWindow(this._helpWindow, 15);
this.showWindow(this._itemListWindow, 15)
}.bind(this))
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemListWindow.activate();
}.bind(this))
};
//=============================================================================
// * Item Category - Cancel
//=============================================================================
Scene_OmoMenuItem.prototype.onItemCategoryCancel = function() {
this._statusWindow.deselect();
this._statusWindow.deactivate();
this.queue('hideWindow', this._itemCategoryWindow, 15)
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this.popScene();
SceneManager._nextScene._commandWindow = this._commandWindow;
SceneManager._nextScene._statusWindow = this._statusWindow;
}.bind(this))
};
//=============================================================================
// * Item List - Ok
//=============================================================================
Scene_OmoMenuItem.prototype.onItemListOk = function() {
this._itemComfirmationWindow.select(0);
this._itemComfirmationWindow.setItem(this._itemListWindow.item());
this._itemComfirmationWindow.visible = true;
this.queue('showWindow', this._itemComfirmationWindow, 15);
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemComfirmationWindow.activate();
}.bind(this))
};
//=============================================================================
// * Item List - Cancel
//=============================================================================
Scene_OmoMenuItem.prototype.onItemListCancel = function() {
// Wait (For Trash and Confirm windows in case they're moving)
this.queue('setWaitMode', 'movement');
// Show Item & Help Window
this.queue(function() {
this._itemTrashPromptWindow.visible = false;
this._itemComfirmationWindow.visible = false;
this.hideWindow(this._helpWindow, 15);
this.hideWindow(this._itemListWindow, 15);
}.bind(this))
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
// Activate Item
this._itemCategoryWindow.activate();
}.bind(this))
};
//=============================================================================
// * Item Confirmation - Use
//=============================================================================
Scene_OmoMenuItem.prototype.onItemConfirmationUse = function() {
// Get Item
var item = this.item();
let noTarget = !!item.meta["NoTarget"];
let BeforeApplyEval = item.meta["BeforeApplyEval"];
// If Item is a bestiary
if (item.meta.Bestiary) {
SceneManager.push(Scene_OmoriBestiary);
return;
};
// If Item is a book
if (item.meta.AlbumGroup) {
SceneManager.push(Scene_OmoriPhotoAlbum);
SceneManager.prepareNextScene($dataItems[item.id], 1);
return;
};
this.queue('hideWindow', this._itemComfirmationWindow, 15);
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemComfirmationWindow.visible = false;
// Get Commands Text
var text = LanguageManager.getPluginText('itemMenu', 'itemUse').confirm;
// Get Text Index
var textIndex = item ? item.meta.ItemCommandTextIndex ? Number(item.meta.ItemCommandTextIndex) : 0 : 0;
// If Item is for all
if(!!BeforeApplyEval) {
eval(BeforeApplyEval.trim());
}
if(!!noTarget) {return this.onStatusWindowOk()}
if (this.isItemForAll()) {
this._statusWindow.setCursorText(text.all[textIndex]);
this._statusWindow.setCursorAll(true);
} else {
this._statusWindow.setCursorText(text.single[textIndex]);
this._statusWindow.setCursorAll(false);
};
this._statusWindow.select(0);
this._statusWindow.activate();
}.bind(this))
};
//=============================================================================
// * Item Confirmation - Trash
//=============================================================================
Scene_OmoMenuItem.prototype.onItemConfirmationTrash = function() {
this._itemTrashPromptWindow.select(1);
this._itemTrashPromptWindow.visible = true;
this.queue('showWindow', this._itemTrashPromptWindow, 15);
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemTrashPromptWindow.activate();
}.bind(this))
};
//=============================================================================
// * Item Confirmation - Cancel
//=============================================================================
Scene_OmoMenuItem.prototype.onItemConfirmationCancel = function() {
// this._itemComfirmationWindow.close();
this._itemListWindow.refresh();
// Get Item Count
var itemCount = this._itemListWindow.maxItems();
// If Item count is more than 0
if (itemCount > 0) {
this.queue('hideWindow', this._itemComfirmationWindow, 15);
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemComfirmationWindow.visible = false;
this._itemListWindow.activate();
this._itemListWindow.selectAvailable();
}.bind(this))
} else {
this._itemTrashPromptWindow.close();
this._itemComfirmationWindow.close();
this._itemListWindow.close();
this._itemCategoryWindow.refresh();
this._itemCategoryWindow.activate();
this._helpWindow.close();
};
};
//=============================================================================
// * Item Trash Prompt - Ok
//=============================================================================
Scene_OmoMenuItem.prototype.onItemTrashPromptOk = function() {
// Get Item
var item = this.item();
// Lose Item
this.queue('wait', 10);
this.queue(() => AudioManager.playSe({ name: "GEN_multi1", volume: 90, pitch: 100, pan: 0}))
this.queue('wait', 20);
this.queue(() => {
$gameParty.loseItem(item, 1, false);
// If there's no items left
if ($gameParty.numItems(item) <= 0) {
// this._itemTrashPromptWindow.close();
// this._itemComfirmationWindow.close();
this._itemListWindow.refresh()
// Get Item Count
var itemCount = this._itemListWindow.maxItems();
// If Item count is more than 0
if (itemCount > 0) {
this.hideWindow(this._itemTrashPromptWindow, 15);
this.hideWindow(this._itemComfirmationWindow, 15);
this._itemListWindow.activate();
this._itemListWindow.selectAvailable()
} else {
this._helpWindow.contents.clear();
this._itemCategoryWindow.refresh();
// Wait for Movement
this.queue('setWaitMode', 'movement');
// Hide Windows
this.queue(function() {
this.hideWindow(this._itemTrashPromptWindow, 15);
this.hideWindow(this._itemComfirmationWindow, 15);
}.bind(this))
this.queue('setWaitMode', 'movement');
// Hide Windows
this.queue(function() {
this._itemTrashPromptWindow.visible = false;
this._itemComfirmationWindow.visible = false;
this.hideWindow(this._itemListWindow, 15);
this.hideWindow(this._helpWindow, 15);
}.bind(this));
// Show Command Window
this.queue(function() {
this._itemCategoryWindow.activate();
}.bind(this))
};
} else {
this.hideWindow(this._itemTrashPromptWindow, 15);
this._itemListWindow.refresh();
// this._itemTrashPromptWindow.close();
this._itemComfirmationWindow.activate();
};
})
};
//=============================================================================
// * Item Trash Prompt - Cancel
//=============================================================================
Scene_OmoMenuItem.prototype.onItemTrashPromptCancel = function() {
this.queue('hideWindow', this._itemTrashPromptWindow, 15);
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemTrashPromptWindow.visible = false;
this._itemComfirmationWindow.activate();
}.bind(this))
};
//=============================================================================
// * Status Window - Ok
//=============================================================================
Scene_OmoMenuItem.prototype.onStatusWindowOk = function() {
// Get ITem
var item = this.item();
// If Item Can be used
if (this.canUse()) {
// Use Item
this.useItem();
if (item.animationId === 212) {
AudioManager.playSe({ name: "BA_Heart_Heal", volume: 90, pitch: 100, pan: 0});
} else if (item.animationId === 213) {
AudioManager.playSe({ name: "BA_heal_juice", volume: 90, pitch: 100, pan: 0});
} else if (item.animationId === 114) {
AudioManager.playSe({ name: "BA_Heart_Heal", volume: 90, pitch: 100, pan: 0});
}
//this.playSeForItem();
// Redraw Current Item
this._itemListWindow.refresh();
// Get Item Count
var itemCount = $gameParty.numItems(item);
// If Item Count is 0 or less
if (itemCount <= 0) {
// Refresh Item List Window
this._itemListWindow.refresh();
// Get Max Item Count
var maxCount = this._itemListWindow.maxItems();
// If Item count is more than 0
if (maxCount > 0) {
this._itemListWindow.selectAvailable();
this._statusWindow.setCursorAll(false);
this._statusWindow.deselect();
this._statusWindow.deactivate();
this._itemListWindow.refresh();
this._itemListWindow.activate();
} else {
this._statusWindow.setCursorAll(false);
this._statusWindow.deselect();
this._statusWindow.deactivate();
this._helpWindow.contents.clear();
this._itemCategoryWindow.refresh();
// Wait for Movement
this.queue('setWaitMode', 'movement');
// Hide Windows
this.queue(function() {
this.hideWindow(this._itemListWindow, 15);
this.hideWindow(this._helpWindow, 15);
}.bind(this))
this.queue('setWaitMode', 'movement');
// Show Command Window
this.queue(function() {
this._itemCategoryWindow.activate();
}.bind(this))
};
return;
}
} else {
// Play Buzzer Sound
SoundManager.playBuzzer();
}
// Activate Status Window
this._statusWindow.activate();
};
//=============================================================================
// * Status Window - Cancel
//=============================================================================
Scene_OmoMenuItem.prototype.onStatusWindowCancel = function() {
this._statusWindow.setCursorAll(false);
this._statusWindow.deselect();
this._itemListWindow.activate();
};
//=============================================================================
// * Show Window
//=============================================================================
Scene_OmoMenuItem.prototype.showWindow = function(obj, duration, newData) {
// Create Movement Data
var data = {
obj: obj,
properties: ['y', 'height'],
from: {y: obj.y, height: obj.height},
to: { y: obj._showY, height: obj._showHeight},
durations: {y: duration, height: duration},
easing: Object_Movement.easeOutCirc,
};
if (newData) { Object.assign(data, newData); };
this.move.startMove(data);
};
//=============================================================================
// * Hide Window
//=============================================================================
Scene_OmoMenuItem.prototype.hideWindow = function(obj, duration, newData) {
// Create Movement Data
var data = {
obj: obj,
properties: ['y', 'height'],
from: {y: obj.y, height: obj.height},
to: { y: obj._hideY, height: obj._hideHeight},
durations: {y: duration, height: duration},
easing: Object_Movement.easeInCirc,
};
if (newData) { Object.assign(data, newData); };
this.move.startMove(data);
};
//=============================================================================
// ** Window_OmoMenuItemCategory
//-----------------------------------------------------------------------------
// The window for selecting item categories in the item menu
//=============================================================================
function Window_OmoMenuItemCategory() { this.initialize.apply(this, arguments); }
Window_OmoMenuItemCategory.prototype = Object.create(Window_Command.prototype);
Window_OmoMenuItemCategory.prototype.constructor = Window_OmoMenuItemCategory;
//=============================================================================
// * Settings
//=============================================================================
Window_OmoMenuItemCategory.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoMenuItemCategory.prototype.standardPadding = function() { return 10; }
Window_OmoMenuItemCategory.prototype.windowWidth = function() { return 384; }
Window_OmoMenuItemCategory.prototype.maxCols = function() { return 3; };
Window_OmoMenuItemCategory.prototype.lineHeight = function() { return 24; };
Window_OmoMenuItemCategory.prototype.standardFontSize = function() { return LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemCategory").standardFontSize; };
Window_Selectable.prototype.customCursorRectYOffset = function() { return 4; }
Window_OmoMenuItemCategory.prototype.customCursorRectTextXOffset = function() { return 25; }
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoMenuItemCategory.prototype.makeCommandList = function() {
// Get Commands Text
var text = LanguageManager.getPluginText('itemMenu', 'categories')
// Add Commands
this.addCommand(text[0], 'consumables', $gameParty.hasConsumableItems());
this.addCommand(text[1], 'toys', $gameParty.hasToyItems());
this.addCommand(text[2], 'important', $gameParty.hasKeyItems());
};
//=============================================================================
// * Item Rect
//=============================================================================
Window_OmoMenuItemCategory.prototype.itemRect = function(index) {
// Get rect
var rect = Window_Command.prototype.itemRect.call(this, index);
rect.width += 20;
rect.y -= 3;
// If Index 1 (For Visual centering)
if (index === 1) { rect.x += 5 };
// Return Rect
return rect;
};
//=============================================================================
// * Call Update Help
//=============================================================================
Window_OmoMenuItemCategory.prototype.callUpdateHelp = function() {
// Run Original Function
Window_Command.prototype.callUpdateHelp.call(this);
if (this.active && this._itemWindow) {
// Set Item Window Category
this._itemWindow.setCategory(this.currentSymbol());
};
};
//=============================================================================
// ** Window_OmoMenuItemList
//-----------------------------------------------------------------------------
// The window for selecting equipment for an actor
//=============================================================================
function Window_OmoMenuItemList() { this.initialize.apply(this, arguments); }
Window_OmoMenuItemList.prototype = Object.create(Window_ItemList.prototype);
Window_OmoMenuItemList.prototype.constructor = Window_OmoMenuItemList;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoMenuItemList.prototype.initialize = function() {
// Super Call
Window_ItemList.prototype.initialize.call(this, 0, 0, this.windowWidth(), this.windowHeight());
// Set Category
this.setCategory('consumables');
this.deselect(0)
this.deactivate()
this.openness = 0;
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoMenuItemList.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoMenuItemList.prototype.standardPadding = function() { return 4;}
Window_OmoMenuItemList.prototype.windowWidth = function() { return 383 - 147; }
Window_OmoMenuItemList.prototype.windowHeight = function() { return 144 - 10; }
Window_OmoMenuItemList.prototype.maxCols = function() { return 1; };
Window_OmoMenuItemList.prototype.itemHeight = function() { return 26; };
Window_OmoMenuItemList.prototype.itemWidth = function() { return 200; };
//Window_OmoMenuItemList.prototype.spacing = function() { return 14; };
Window_OmoMenuItemList.prototype.customCursorRectXOffset = function() { return -2; }
Window_OmoMenuItemList.prototype.isEnabled = function() { return true; };
Window_OmoMenuItemList.prototype.customCursorRectTextXOffset = function() { return 24; }
Window_OmoMenuItemList.prototype.contentsWidth = function() { return this.windowWidth() - this.standardPadding() * 2; };
Window_OmoMenuItemList.prototype.contentsHeight = function() { return this.windowHeight() - this.standardPadding() * 2; };
//=============================================================================
// * Set Category
//=============================================================================
Window_OmoMenuItemList.prototype.setCategory = function(category) {
// If Category has changed
if (this._category !== category) {
this._category = category;
this.refresh();
};
};
//=============================================================================
// * Determine if item should be included
//=============================================================================
Window_OmoMenuItemList.prototype.includes = function(item) {
// If Item Exists and it's an item
if (item && DataManager.isItem(item)) {
if (item.meta.HideInMenu) { return false; };
switch (this._category) {
case 'consumables': return DataManager.isConsumableItem(item);
case 'toys': return DataManager.isToyItem(item);
case 'important': return DataManager.isKeyItem(item);
};
};
return false;
};
//=============================================================================
// * Make Item List
//=============================================================================
Window_OmoMenuItemList.prototype.makeItemList = function() {
// Run Original Function
Window_ItemList.prototype.makeItemList.call(this);
// Sort list
this._data.sort(function(a, b) {
var indexA = a.meta.ListIndex === undefined ? a.id : Number(a.meta.ListIndex);
var indexB = b.meta.ListIndex === undefined ? b.id : Number(b.meta.ListIndex);
// console.log(a, indexA);
// console.log(b, indexB)
return indexA - indexB;
});
if(this._category === "important") {
this._data.sort((a,b) => {
let priorityA = !!a.meta["ItemPriority"] ? parseInt(a.meta["ItemPriority"]) : 0;
let priorityB = !!b.meta["ItemPriority"] ? parseInt(b.meta["ItemPriority"]) : 0;
return priorityB - priorityA;
})
}
};
//=============================================================================
// * Get Item Rect
//=============================================================================
Window_OmoMenuItemList.prototype.itemRect = function(index) {
// Get Item Rect
var rect = Window_ItemList.prototype.itemRect.call(this, index);
// Adjust Rect
rect.x += 12;
rect.y += 8;
// Return rect
return rect;
};
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoMenuItemList.prototype._refreshArrows = function() {
// Super Call
Window_ItemList.prototype._refreshArrows.call(this);
var w = this._width;
var h = this._height;
var p = 24;
var q = p/2;
this._downArrowSprite.move(w - q, h - q);
this._upArrowSprite.move(w - q, q);
};
Window_OmoMenuItemList.prototype._updateArrows = function() {
Window.prototype._updateArrows.call(this);
this._downArrowSprite.visible = this._downArrowSprite.visible && !!this.active;
this._upArrowSprite.visible = this._upArrowSprite.visible && !!this.active;
};
//=============================================================================
// * Clear Item
//=============================================================================
Window_OmoMenuItemList.prototype.clearItem = function(index) {
var rect = this.itemRect(index);
this.contents.clearRect(rect.x, rect.y, rect.width + 5, rect.height);
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoMenuItemList.prototype.drawItem = function(index) {
// Get Rect
var rect = this.itemRectForText(index);
// Get Item
var item = this._data[index]
// If Item
if (item) {
// Set Font Size
this.contents.fontSize = LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemList").drawItem_contents_fontsize;
rect.width -= 20;
// Draw Text
this.contents.drawText(item.name, rect.x, rect.y, rect.width, rect.height);
rect.width += 5
const loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemList").drawItem_drawText_position;
this.contents.drawText('x' + $gameParty.numItems(item), eval(loc_position[0]), eval(loc_position[1]), rect.width, rect.height);
};
};
//=============================================================================
// ** Window_OmoMenuItemConfirmation
//-----------------------------------------------------------------------------
// The window for selection actions to perform for items in the item menu.
//=============================================================================
function Window_OmoMenuItemConfirmation() { this.initialize.apply(this, arguments); }
Window_OmoMenuItemConfirmation.prototype = Object.create(Window_Command.prototype);
Window_OmoMenuItemConfirmation.prototype.constructor = Window_OmoMenuItemConfirmation;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoMenuItemConfirmation.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
this.deactivate();
this.openness = 0;
// Set Item to null
this.setItem(null);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoMenuItemConfirmation.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoMenuItemConfirmation.prototype.standardPadding = function() { return 5; }
Window_OmoMenuItemConfirmation.prototype.windowWidth = function() { return 115; }
Window_OmoMenuItemConfirmation.prototype.windowHeight = function() { return 68; }
Window_OmoMenuItemConfirmation.prototype.lineHeight = function() { return 24; };
Window_OmoMenuItemConfirmation.prototype.standardFontSize = function() { return LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemConfirmation").standardFontSize; };
Window_OmoMenuItemConfirmation.prototype.spacing = function() { return 0; };
Window_OmoMenuItemConfirmation.prototype.customCursorRectTextXOffset = function() { return 30; }
//=============================================================================
// * Set Item
//=============================================================================
Window_OmoMenuItemConfirmation.prototype.setItem = function(item) {
// Set Item
if (item !== this._item) { this._item = item; this.refresh(); }
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoMenuItemConfirmation.prototype.makeCommandList = function() {
// Get Item
var item = this._item;
var enableUse = item ? this.parent.canUse($gameParty.members()) : false;
var enableTrash = item ? !DataManager.isKeyItem(item) : false;
// Get Commands Text
var text = LanguageManager.getPluginText('itemMenu', 'itemUse').commands;
// Get Text Index
var textIndex = item ? item.meta.ItemCommandTextIndex ? Number(item.meta.ItemCommandTextIndex) : 0 : 0;
// Add Commands
this.addCommand(text[0][textIndex], 'use', enableUse);
this.addCommand(text[1], 'trash', enableTrash);
};
//=============================================================================
// ** Window_OmoMenuItemTrashPromptWindow
//-----------------------------------------------------------------------------
// This Window is used to show a prompt for trashing items
//=============================================================================
function Window_OmoMenuItemTrashPromptWindow() { this.initialize.apply(this, arguments); }
Window_OmoMenuItemTrashPromptWindow.prototype = Object.create(Window_Command.prototype);
Window_OmoMenuItemTrashPromptWindow.prototype.constructor = Window_OmoMenuItemTrashPromptWindow;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
// Prompt Text
this._promptText = LanguageManager.getPluginText('itemMenu', 'itemTrash').text;
// Refresh Contents
this.refresh();
this.openness = 0;
this.deactivate();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoMenuItemTrashPromptWindow.prototype.windowHeight = function() { return 84 - 16; };
Window_OmoMenuItemTrashPromptWindow.prototype.windowWidth = function() { return 125 + 50; };
Window_OmoMenuItemTrashPromptWindow.prototype.maxCols = function() { return 2; };
Window_OmoMenuItemTrashPromptWindow.prototype.spacing = function() { return 0; };
Window_OmoMenuItemTrashPromptWindow.prototype.standardPadding = function() { return 0; };
Window_OmoMenuItemTrashPromptWindow.prototype.itemHeight = function() { return 20; };
Window_OmoMenuItemTrashPromptWindow.prototype.itemWidth = function() { return 75 + 10; };
Window_OmoMenuItemTrashPromptWindow.prototype.standardFontSize = function() { return LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemTrashPromptWindow").standardFontSize; };
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.makeCommandList = function() {
// Get Commands Text
var text = LanguageManager.getPluginText('itemMenu', 'itemTrash').commands;
this.addCommand(text[0], 'yes');
this.addCommand(text[1], 'cancel');
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.refresh = function() {
// Super Call
Window_Command.prototype.refresh.call(this);
this.drawText(this._promptText, 0, 0, this.contents.width, 'center');
};
//=============================================================================
// * Get Item Rect
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.itemRect = function(index) {
var rect = Window_Command.prototype.itemRect.call(this, index);
// rect.x += 10;
rect.y += this.lineHeight() - 5;
return rect;
};
//=============================================================================
// * Get Item Rect For Text
//=============================================================================
Window_OmoMenuItemTrashPromptWindow.prototype.itemRectForText = function(index) {
var rect = this.itemRect(index);
rect.x += eval(LanguageManager.getMessageData("XX_BLUE.Window_OmoMenuItemTrashPromptWindow").itemRectForText_rectx);
rect.y -= 10;
rect.width -= this.textPadding() * 2;
return rect;
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,902 @@
//=============================================================================
// TDS Map QTE's
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_MapQTE = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.MapQTE = _TDS_.MapQTE || {};
//=============================================================================
/*:
* @plugindesc
* This plugin add event Quick Time Events.
*
* @author TDS
*
* @param Active QTE Switch ID
* @desc ID of the switch to turn ON or OFF when QTE's are active.
* @default 1
*
* @param QTE Result Variable ID
* @desc ID of the variable to put QTE results into.
* @default 1
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Omori Map QTE");
// Initialize Parameters
_TDS_.MapQTE.params = {};
_TDS_.MapQTE.params.activeQTESwitchID = Number(parameters['Active QTE Switch ID'] || 1);
_TDS_.MapQTE.params.QTEResultVariableID = Number(parameters['QTE Result Variable ID'] || 1);
//ImageManager.reserveSystem('QTE Arrow', 0, 1);
//ImageManager.reserveSystem('QTE_OMORI_ATLAS', 0, 1);
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapQTE.Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
//=============================================================================
// * Update Wait Mode
//=============================================================================
Game_Interpreter.prototype.updateWaitMode = function() {
// If Input Mode is for wait
if (this._waitMode === 'QTE') {
// If Input has been pressed
if (!$gameSwitches.value(_TDS_.MapQTE.params.activeQTESwitchID)) { return false; }
return true;
};
// Return Original Function
return _TDS_.MapQTE.Game_Interpreter_updateWaitMode.call(this);
};
//=============================================================================
// * Start Smash QTE
//=============================================================================
Game_Interpreter.prototype.startSmashQTE = function(segments, time, width) {
// Turn ON QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, true);
// Get Window
var win = SceneManager._scene._QTEWindowSmash;
// If Window Exists
if (win) {
win.open();
win.activate();
win.setup(segments, time, width)
};
this.setWaitMode('QTE');
};
//=============================================================================
// * Start Stop the Arrow QTE
//=============================================================================
Game_Interpreter.prototype.startStopTheArrowQTE = function(direction, delay, x, y) {
// Turn ON QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, true);
// Get Window
var win = SceneManager._scene._QTEWindowStopTheArrow;
// If Window Exists
if (win) {
win.open();
win.activate();
win.setup(direction, delay)
if (x !== undefined) { win.x = x; };
if (y !== undefined) { win.y = y; };
};
this.setWaitMode('QTE');
};
//=============================================================================
// * Start Hit the Mark QTE
//=============================================================================
Game_Interpreter.prototype.startHitTheMarkQTE = function(speed, index, x, y) {
// Turn ON QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, true);
// Get Window
var win = SceneManager._scene._QTEWindowHitTheMark;
// If Window Exists
if (win) {
if (index === undefined) { index = Math.randomInt(12); };
win.open();
win.activate();
win.setup(speed, index);
if (x !== undefined) { win.x = x; };
if (y !== undefined) { win.y = y; };
};
this.setWaitMode('QTE');
};
//=============================================================================
// ** Scene_Map
//-----------------------------------------------------------------------------
// The scene class of the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapQTE.Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
//=============================================================================
// * Create Display Objects
//=============================================================================
Scene_Map.prototype.createDisplayObjects = function() {
// Run Original Function
_TDS_.MapQTE.Scene_Map_createDisplayObjects.call(this);
// Create QTE Windows
this.createQTEWindows();
};
//=============================================================================
// * Create QTE Windows
//=============================================================================
Scene_Map.prototype.createQTEWindows = function() {
// Create Smash QTE Window
this._QTEWindowSmash = new Window_OmoriMapQTESmash();
this.addChild(this._QTEWindowSmash);
// Create Stop the Arrow QTE window
this._QTEWindowStopTheArrow = new Window_OmoriStopTheArrow();
this.addChild(this._QTEWindowStopTheArrow);
// // Create Hit The Mark QTE Window
this._QTEWindowHitTheMark = new Window_OmoriHitTheMark();
this.addChild(this._QTEWindowHitTheMark)
};
//=============================================================================
// ** Window_OmoriMapQTESmash
//-----------------------------------------------------------------------------
// This window is used to display the Smash QTE.
//=============================================================================
function Window_OmoriMapQTESmash() { this.initialize.apply(this, arguments); }
Window_OmoriMapQTESmash.prototype = Object.create(Window_Base.prototype);
Window_OmoriMapQTESmash.prototype.constructor = Window_OmoriMapQTESmash;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriMapQTESmash.prototype.initialize = function() {
// Completed Segments
this._segment = 0;
// Press Count
this._pressCount = 0;
// Press Timer
this._timer = 300;
// Max Timer
this._maxTimer = 300;
// Segment Presses
this._segmentPresses = [5];
// Alt State & Alt Delay
this._altState = 0; this._altDelay = 0;
// Close Delay
this._closeDelay = 30;
// Super Call
Window_Base.prototype.initialize.call(this, 14, 14, this.windowWidth(), this.windowHeight());
// Create Bar Sprite
this.createBarSprite();
// Create Parallax BAckground
this.createParallaxBack();
this.deactivate();
this.openness = 0;
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriMapQTESmash.prototype.standardPadding = function() { return 0; };
Window_OmoriMapQTESmash.prototype.windowWidth = function() { return 300; };
Window_OmoriMapQTESmash.prototype.windowHeight = function() { return 42 + 5; };
//=============================================================================
// * Define Openness
//=============================================================================
Object.defineProperty(Window_OmoriMapQTESmash.prototype, 'openness', {
get: function() { return this._openness; },
set: function(value) {
// Super Call
Object.getOwnPropertyDescriptor(Window.prototype, 'openness').set.call(this, value);
// If Background Exists
if (this._smashBarSprite) {
var scale = this._openness / 255;
this._smashBarSprite.scale.y = scale
this._smashBarSprite.y = 5 + (this.height / 2 * (1 - this._openness / 255));
this._parallaxBack.y = 4 + (this.height / 2 * (1 - this._openness / 255));
this._parallaxBack.scale.y = scale
this._timeBarSprite.y = (this.height - 7) + (this.height / 2 * (1 - this._openness / 255));
this._timeBarSprite.scale.y = scale;
};
},
configurable: true
});
//=============================================================================
// * Create Bar Sprite
//=============================================================================
Window_OmoriMapQTESmash.prototype.createParallaxBack = function() {
this._parallaxBack = new TilingSprite();
this._parallaxBack.bitmap = ImageManager.loadSystem('QTE Smash Background');
this._parallaxBack.move(5, 5, this.width - 10, 32);
this._parallaxBack.opacity = 180
this.addChildToBack(this._parallaxBack);
}
//=============================================================================
// * Create Bar Sprite
//=============================================================================
Window_OmoriMapQTESmash.prototype.createBarSprite = function() {
// Create Bitmap
var bitmap = new Bitmap(this.width - 8, this.height - 37);
bitmap.fillAll('rgba(255, 0, 0, 1)');
// Create Bar Sprite
this._smashBarSprite = new Sprite(bitmap);
this._smashBarSprite.width = 0
this._smashBarSprite.opacity = 180
this._smashBarSprite.x = 5;
this._smashBarSprite.y = 5;
this.addChildToBack(this._smashBarSprite);
// Create Time Bar Sprite
this._timeBarSprite = new Sprite();
this._timeBarSprite.x = 5;
this._timeBarSprite.y = this.height - 7;
this.addChild(this._timeBarSprite);
};
//=============================================================================
// * Setup
//=============================================================================
Window_OmoriMapQTESmash.prototype.setup = function(segments = [5], time = 10, width = 400) {
// Set Values
this._segment = 0;
this._pressCount = 0;
this._timer = time
this._maxTimer = time;
this._segmentPresses = segments.clone();
this._closeDelay = 61;
// Alt State & Alt Delay
this._altState = 0; this._altDelay = 0;
// Reset Blend Color
this._smashBarSprite.setBlendColor([0, 0, 0, 0]);
// Refresh Contents
this.refresh();
// Update Smash Bar
this.updateSmashBar();
// Update Timer Bar
this.updateTimeBar();
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriMapQTESmash.prototype.refresh = function() {
// Create Bitmap
var bitmap = new Bitmap(this.width - 10, this.height - 15);
bitmap.fillAll('rgba(255, 0, 0, 1)');
// Create Bar Sprite
this._smashBarSprite.bitmap = bitmap;
// Recreate Contents
this.createContents();
// Create Time Bar Bitmap
bitmap = new Bitmap(this.width - 10, 2);
bitmap.fillAll('rgba(255, 255, 0, 1)');
this._timeBarSprite.bitmap = bitmap;
var segments = this._segmentPresses.length;
this._segmentWidth = this.width / segments;
this.contents.fillRect(4, this.height - 11, this.width - 8, 2, 'rgba(0, 0, 0, 1)');
this.contents.fillRect(4, this.height - 10, this.width - 8, 2, 'rgba(255, 255, 255, 1)');
// console.log( this._segmentWidth )
for (var i = 1; i < segments; i++) {
var x = i * this._segmentWidth;
this.contents.fillRect(x - 1, 4, 3, this.height - 14, 'rgba(0, 0, 0, 1)');
this.contents.fillRect(x, 4, 1, this.height - 14, 'rgba(255, 255, 255, 1)');
};
this.x = (Graphics.width - this.width) / 2;
this.y = (Graphics.height - this.height) / 2;
};
//=============================================================================
// * Finish Processing
//=============================================================================
Window_OmoriMapQTESmash.prototype.finish = function() {
// Turn ON QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, false);
// Set Achieved Segment
$gameVariables.setValue(_TDS_.MapQTE.params.QTEResultVariableID, this._segment);
// Close & Deactivate
this.close(); this.deactivate();
};
//=============================================================================
// * Are Smash Keys Being Triggered
//=============================================================================
Window_OmoriMapQTESmash.prototype.isSmashTriggered = function() {
return Input.isTriggered('ok');
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_OmoriMapQTESmash.prototype.update = function() {
// Super Call
Window_Base.prototype.update.call(this);
// If not open or active
if (!this.isOpen() || !this.active) { return; };
// Get Background Speed Rate
var rate = this._segment / (Math.max(this._segmentPresses.length-1,1));
// Get Speed
var speed = Math.max(rate * 5, 1.5);
// Move Parallax Back
this._parallaxBack.origin.x -= speed;
// If Timer is 0 or less
if (this._timer <= 0) {
// Finish
this.finish();
return;
}
if (this._timer > 0) { this._timer--; this.updateTimeBar(); };
if (this._segment < this._segmentPresses.length) {
if (this.isSmashTriggered()) {
// Increase Press Count
this._pressCount++;
if (this._pressCount >= this._segmentPresses[this._segment]) {
this._segment++;
this._pressCount = 0;
this.updateSmashBar();
};
};
} else {
// Decrease alt delay
this._altDelay--;
if (this._altDelay <= 0) {
if (this._altState === 0) {
this._smashBarSprite.setBlendColor([255, 255, 255, 255])
} else {
this._smashBarSprite.setBlendColor([0, 0, 0, 0]);
};
this._altState = (this._altState + 1) % 2
this._altDelay = 10;
};
// Decrease Close Delay
if (this._closeDelay > 0) { this._closeDelay--; }
// If Timer is 0 or less or close delay is 0 or less
if (this._timer <= 0 || this._closeDelay <= 0) { this.finish() }
};
};
//=============================================================================
// * Update Smash Bar
//=============================================================================
Window_OmoriMapQTESmash.prototype.updateSmashBar = function() {
// Get Original Width
var width = this._segment * (this._segmentWidth );
this._smashBarSprite.width = width - 3;
};
//=============================================================================
// * Update Time Bar
//=============================================================================
Window_OmoriMapQTESmash.prototype.updateTimeBar = function() {
// Get Original Width
var width = this._timeBarSprite.bitmap.width;
var rate = this._timer / this._maxTimer;
// Set Timer Width
this._timeBarSprite.width = rate * width;
};
//=============================================================================
// ** Window_OmoriStopTheArrow
//-----------------------------------------------------------------------------
// This window is used to display the stop the arrow QTE.
//=============================================================================
function Window_OmoriStopTheArrow() { this.initialize.apply(this, arguments); }
Window_OmoriStopTheArrow.prototype = Object.create(Window_Base.prototype);
Window_OmoriStopTheArrow.prototype.constructor = Window_OmoriStopTheArrow;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriStopTheArrow.prototype.initialize = function(index) {
this._arrowIndex = 0;
this._arrowDelay = 10;
this._arrowDelayCount = 0;
// Arrow Direction (0: Right, 1: Left)
this._arrowDirection = 0;
// Facing Direction
this._facingDirection = 'up';
// Set Container Y
this._containerY = 0;
// Super Call
Window_Base.prototype.initialize.call(this, 14, 200, this.windowWidth(), this.windowHeight());
ImageManager.loadSystem('QTE Arrow')
// Create Background Sprite
this.createBackgroundSprite();
this.createArrowSprites();
// Center Window
this.x = (Graphics.width - this.width) / 2;
this.y = (Graphics.height - this.height) / 2;
// Close
this.openness = 0;
this.deactivate();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriStopTheArrow.prototype.standardPadding = function() { return 0; };
Window_OmoriStopTheArrow.prototype.windowWidth = function() { return 96; };
Window_OmoriStopTheArrow.prototype.windowHeight = function() { return 83; };
//=============================================================================
// * Define Openness
//=============================================================================
Object.defineProperty(Window_OmoriStopTheArrow.prototype, 'openness', {
get: function() { return this._openness; },
set: function(value) {
// Super Call
Object.getOwnPropertyDescriptor(Window.prototype, 'openness').set.call(this, value);
// If Background Exists
if (this._arrowContainer) {
var scale = this._openness / 255;
if (['up', 'down'].contains(this._facingDirection)) {
this._arrowContainer.scale.x = 1;
this._arrowContainer.scale.y = scale;
} else {
this._arrowContainer.scale.x = scale;
this._arrowContainer.scale.y = 1;
}
};
},
configurable: true
});
//=============================================================================
// * Create Background Sprite
//=============================================================================
Window_OmoriStopTheArrow.prototype.createBackgroundSprite = function() {
// Create Arrow Container
this._arrowContainer = new Sprite();
// this._arrowContainer.bitmap.fillAll('rgba(255, 0, 0, 1)');
this._arrowContainer.pivot.x = 43;
this._arrowContainer.pivot.y = 36.5;
this._arrowContainer.x = this.width / 2;
this._arrowContainer.y = this.height / 2;
this.addChildToBack(this._arrowContainer);
// Create Background Sprite
// this._backgroundSprite = new Sprite(ImageManager.loadSystem('QTE Arrow'));
this._backgroundSprite = new Sprite(ImageManager.loadSystem('QTE Arrow'));
this._backgroundSprite.bitmap.addLoadListener(() => {this._backgroundSprite.setFrame(0, 0, 86,this._backgroundSprite.height)})
// this._backgroundSprite.opacity = 120;
// this._backgroundSprite.pivot.x = 43;
// this._backgroundSprite.pivot.y = 36.5;
// this._backgroundSprite.rotation = Math.PI / 16;
// this._backgroundSprite.x = this.width / 2;
// this._backgroundSprite.y = this.height / 2;
this._arrowContainer.addChild(this._backgroundSprite);
// this._backgroundSprite.rotation = (0 * 90) * Math.PI / 180
};
//=============================================================================
// * Create Arrow Sprites
//=============================================================================
Window_OmoriStopTheArrow.prototype.createArrowSprites = function() {
// Initialize Arrow Sprites Array
this._arrowSprites = [];
var bit = ImageManager.loadSystem('QTE Arrow');
// Create Sprites
bit.addLoadListener(() => {
for (var i = 0; i < 3; i++) {
var sprite = new Sprite(ImageManager.loadSystem('QTE Arrow'));
this._arrowSprites[i] = sprite;
this._arrowContainer.addChild(sprite);
};
var sprite = this._arrowSprites[0];
sprite.setFrame(86, 0, 39, sprite.bitmap.height);
sprite.x = 7 - 5; sprite.y = 17 - 5;
sprite = this._arrowSprites[1];
sprite.setFrame(125, 0, 36, sprite.bitmap.height);
sprite.x = 35 - 5; sprite.y = 12 - 5;
sprite = this._arrowSprites[2];
sprite.setFrame(163, 0, 36, sprite.bitmap.height);
sprite.x = 63 - 5; sprite.y = 17 - 5;
// Update Arrows Visibility
this.updateArrowsVisibility();
})
};
//=============================================================================
// * Setup
//=============================================================================
Window_OmoriStopTheArrow.prototype.setup = function(direction = 'up', delay = 10) {
// Direction Switch Case
switch (direction.toLowerCase()) {
case 'up':
this._arrowContainer.rotation = (0 * 90) * Math.PI / 180
this.width = 96; this.height = 83;
break;
case 'left':
this._arrowContainer.rotation = (3 * 90) * Math.PI / 180
this.width = 96 - 14; this.height = 83 + 12;
break;
case 'right':
this._arrowContainer.rotation = (1 * 90) * Math.PI / 180
this.width = 96 - 14; this.height = 83 + 12;
break;
case 'down':
this.width = 96; this.height = 83;
this._arrowContainer.rotation = (2 * 90) * Math.PI / 180
break;
};
// Set Facing Direction
this._facingDirection = direction;
// Reset Delay
this._arrowIndex = Math.randomInt(this._arrowSprites.length);
this._arrowDelay = delay;
this._arrowDelayCount = 0;
// Set Arrow Direction
this._arrowDirection = 0;
// Center Background Sprite
this._arrowContainer.x = this.width / 2;
this._arrowContainer.y = this.height / 2;
// Update Arrow Visibility
this.updateArrowsVisibility();
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_OmoriStopTheArrow.prototype.update = function() {
// Super Call
Window_Base.prototype.update.call(this);
// if (Input.isTriggered('control')) {
// if (this.isOpen()) { this.close(); };
// if (this.isClosed()) { this.open();};
// };
// var directions = ['up', 'down', 'left', 'right'];
// for (var i = 0; i < directions.length; i++) {
// // Get Direction
// var direction = directions[i];
// if (Input.isTriggered(direction)) {
// this.setup(directions[i])
// break;
// }
// }
// If Open & Active
if (this.active && this.isOpen()) {
// If OK Input
if (Input.isTriggered('ok')) {
this.finish();
return
};
// Increase Arrow Delay Count
this._arrowDelayCount++;
// If Arrow Delay Count is equal or more than arrow delay
if (this._arrowDelayCount >= this._arrowDelay) {
// Reset Arrow Delay Count
this._arrowDelayCount = 0;
// If Arrow Direction is 0
if (this._arrowDirection === 0) {
// If Arrow has reached the other side
if (this._arrowIndex >= this._arrowSprites.length-1) {
// Reduce Index
this._arrowIndex--;
AudioManager.playSe({name: "sys_cursor1", pan: 0, pitch: 100, volume: 90});
// Set Arrow Direction
this._arrowDirection = 1;
} else {
// Increase Index
AudioManager.playSe({name: "SYS_cursor", pan: 0, pitch: 100, volume: 90});
this._arrowIndex++;
};
} else {
if (this._arrowIndex <= 0) {
// Increase Index
AudioManager.playSe({name: "sys_cursor1", pan: 0, pitch: 100, volume: 90});
this._arrowIndex++;
// Set Arrow Direction
this._arrowDirection = 0;
} else {
AudioManager.playSe({name: "SYS_cursor", pan: 0, pitch: 100, volume: 90});
// Reduce Index
this._arrowIndex--;
};
}
this.updateArrowsVisibility();
};
};
};
//=============================================================================
// * Update Visibility of Arrows
//=============================================================================
Window_OmoriStopTheArrow.prototype.updateArrowsVisibility = function() {
for (var i = 0; i < this._arrowSprites.length; i++) {
this._arrowSprites[i].visible = (this._arrowIndex === i);
};
};
//=============================================================================
// * Finish Processing
//=============================================================================
Window_OmoriStopTheArrow.prototype.finish = function() {
// Turn ON QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, false);
// Set Achieved Segment
$gameVariables.setValue(_TDS_.MapQTE.params.QTEResultVariableID, this._arrowIndex);
// Close & Deactivate
this.close(); this.deactivate();
};
//=============================================================================
// ** Window_OmoriHitTheMark
//-----------------------------------------------------------------------------
// This window is used to display the hit the mark QTE.
//=============================================================================
function Window_OmoriHitTheMark() { this.initialize.apply(this, arguments); }
Window_OmoriHitTheMark.prototype = Object.create(Window_Base.prototype);
Window_OmoriHitTheMark.prototype.constructor = Window_OmoriHitTheMark;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriHitTheMark.prototype.initialize = function() {
// Pointer Move Speed
this._speed = 3;
// Movement Direction
this._direction = 0;
// Set Target Index
this._targetIndex = 0;
// Set Target Width
this._targetWidth = 3 + (this._speed * 2);
// Target X
this._targetX = 0;
// Super Call
Window_Base.prototype.initialize.call(this, 14, 0, this.windowWidth(), this.windowHeight());
// Create Background Sprite
this.createBackgroundSprite();
// Create Pointer
this.createPointer();
// Center Window
this.x = (Graphics.width - this.width) / 2;
this.y = (Graphics.height - this.height) / 2;
// Refresh Contents
this.refresh();
this.deactivate();
this.openness = 0;
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriHitTheMark.prototype.standardPadding = function() { return 0; };
Window_OmoriHitTheMark.prototype.windowWidth = function() { return 216; };
Window_OmoriHitTheMark.prototype.windowHeight = function() { return 66; };
//=============================================================================
// * Define Openness
//=============================================================================
Object.defineProperty(Window_OmoriHitTheMark.prototype, 'openness', {
get: function() { return this._openness; },
set: function(value) {
// Super Call
Object.getOwnPropertyDescriptor(Window.prototype, 'openness').set.call(this, value);
// If Background Sprite Exists
if (this._backgroundSprite) {
var scale = this._openness / 255;
this._backgroundSprite.scale.y = scale;
};
// If Background Exists
if (this._smashBarSprite) {
var scale = this._openness / 255;
this._smashBarSprite.scale.y = scale
this._smashBarSprite.y = 5 + (this.height / 2 * (1 - this._openness / 255));
this._parallaxBack.y = 4 + (this.height / 2 * (1 - this._openness / 255));
this._parallaxBack.scale.y = scale
this._timeBarSprite.y = (this.height - 7) + (this.height / 2 * (1 - this._openness / 255));
this._timeBarSprite.scale.y = scale;
};
},
configurable: true
});
//=============================================================================
// * Create Background Sprite
//=============================================================================
Window_OmoriHitTheMark.prototype.createBackgroundSprite = function() {
// Create Background Sprite
this._backgroundSprite = new Sprite(ImageManager.loadSystem('QTE_OMORI_ATLAS'));
this._backgroundSprite.bitmap.addLoadListener(() => {
this._backgroundSprite.setFrame(0, 0, 206, 56);
this._backgroundSprite.x = 5;
this._backgroundSprite.y = 33;
this._backgroundSprite.anchor.y = 0.5;
})
this.addChildToBack(this._backgroundSprite);
};
//=============================================================================
// * Create Pointer Sprite
//=============================================================================
Window_OmoriHitTheMark.prototype.createPointer = function() {
// // Create Pointer Bitmap
// var bitmap = new Bitmap(12, 6);
// for (var i = 0; i < 6; i++) {
// var x = i
// var y = bitmap.height - i;
// var w = bitmap.width - (i * 2)
// bitmap.fillRect(x, y, w, 1, 'rgba(255, 255, 255, 1)');
// };
// // Create Pointer
// this._pointer = new Sprite(bitmap);
// this._pointer.x = 32
// this._pointer.anchor.set(0.5, 0.5)
// this._pointer.y = this.height - 8;
// this._pointer.visible = false;
// this.addChild(this._pointer);
// Create Pointer
this._pointer = new Sprite(ImageManager.loadSystem('ACSArrows'));
this._pointer.setFrame(3 * 32, 0, 32, 29);
this._pointer.x = 32
this._pointer.anchor.set(0.5, 0.5)
this._pointer.y = this.height + 5;
this._pointer.visible = false;
this.addChild(this._pointer);
};
//=============================================================================
// * Setup
//=============================================================================
Window_OmoriHitTheMark.prototype.setup = function(speed, index) {
// Pointer Move Speed
this._speed = speed;
// Movement Direction
this._direction = 0;
// Set Target Index Randomly
this._targetIndex = index;
// Set Stop Flag to false
this._stop = false;
// Redraw Contents
this.refresh();
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriHitTheMark.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Get Bitmap
var bitmap = ImageManager.loadSystem('QTE_OMORI_ATLAS');
// console.log(lineSpaceWidth)
var index = this._targetIndex;
// Get X Position
var x = 11 + (index * 17) - index;
// Set Paint Opacity
this.contents.paintOpacity = 160;
bitmap.addLoadListener(() => {
switch (this._speed) {
case 2:
// Set Target Width
this._targetWidth = 9;
// Adjust X Position by speed
x -= 4;
// Transfer Bitmap to window
this.contents.blt(bitmap, 209, 0, this._targetWidth, bitmap.height, x, 0);
break;
case 4:
// Adjust X Position by speed
x -= 7;
// Set Target Width
this._targetWidth = 15;
// Transfer Bitmap to window
this.contents.blt(bitmap, 225, 0, this._targetWidth, bitmap.height, x, 0);
break;
};
this.contents.paintOpacity = 255;
})
// Set Target X
this._targetX = x;
// Set Paint Opacity
};
//=============================================================================
// * Finish Processing
//=============================================================================
Window_OmoriHitTheMark.prototype.finish = function() {
var padding = 4;
var startX = this._targetX - padding;
var endX = this._targetX + this._targetWidth + padding;
// Check if in Area
var inArea = (startX < this._pointer.x && this._pointer.x < endX);
// Turn Off QTE Switch
$gameSwitches.setValue(_TDS_.MapQTE.params.activeQTESwitchID, false);
// Set Achieved Segment
$gameVariables.setValue(_TDS_.MapQTE.params.QTEResultVariableID, inArea ? 1 : 0);
// Close & Deactivate
this.close(); this.deactivate();
// Set Visibility to true
this._pointer.visible = false;
}
//=============================================================================
// * Frame Update
//=============================================================================
Window_OmoriHitTheMark.prototype.update = function() {
// Super Call
Window_Base.prototype.update.call(this);
// Return if Stopped
if (this._stop || !this.active) { return }
// Set Visibility to true
this._pointer.visible = true;
// If Ok Triggered
if (Input.isTriggered('ok')) {
// Set stop flag to true
this._stop = true;
// Finish
this.finish();
return
};
// Get Speed
var speed = this._speed;
// Get Left & Right Borders
var left = 11;
var right = this.width - 11;
// If Direction is 0 (Left)
if (this._direction === 0) {
if (this._pointer.x <= left ) {
this._direction = 1;
} else {
this._pointer.x = Math.max(this._pointer.x - speed, left);
};
} else {
if (this._pointer.x >= right) {
this._direction = 0;
} else {
this._pointer.x = Math.min(this._pointer.x + speed, right);
};
};
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,745 @@
//=============================================================================
// TDS Omori Quest Menu
// Version: 1.3
//=============================================================================
// Add to Imported List
var Imported = Imported || {}; Imported.TDS_QuestMenu = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {}; _TDS_.QuestMenu = _TDS_.QuestMenu || {};
//=============================================================================
/*:
* @plugindesc
* Quest Menu for OMORI.
*
* @author TDS
*
* @param Opening Message
* @desc The Message to show when the quest menu is called.
* @default ""
*
*
* @param World Variable ID
* @desc ID of the variable used to track the current world.
* @default 1
*
* @help
* ============================================================================
* * Script Calls
* ============================================================================
*
* Use this script call to call the quest menu.
*
* this.callQuestMenu();
*
*
*
* Use this script call to add a quest.
*
* this.addQuest(ID);
*
* ID
* ^ Id of the quest.
*
* Example:
*
* this.addQuest('Quest4');
*
*
*
* Use this script call to remove a quest.
*
* this.removeQuest(ID);
*
* ID
* ^ Id of the quest.
*
* Example:
*
* this.removeQuest('Quest4');
*
*
*
* Use this script call to set the complete state of a quest.
*
* this.setQuestCompleteState(ID, STATE);
*
* ID
* ^ Id of the quest.
*
* STATE
* ^ State of the quest. (true/false) (Optiona: Defaults to true)
*
* Example:
*
* this.setQuestCompleteState('Quest1');
*
* this.setQuestCompleteState('Quest4', true);
*
* this.setQuestCompleteState('Quest5', false);
*
*
* Use this script call to set a quest's message index.
*
* this.setQuestMessageIndex(ID, INDEX);
*
* ID
* ^ Id of the quest.
*
* INDEX
* ^ Index value.
*
* Example:
*
* this.setQuestMessageIndex('Quest4', 1);
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Omori Quest Menu");
// Initialize Parameters
_TDS_.QuestMenu.params = {};
_TDS_.QuestMenu.params.worldVariableID = Number(parameters['World Variable ID'] || 1);
_TDS_.QuestMenu.params.openingMessage = String(parameters['Opening Message'] || '');
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.QuestMenu.DataManager_loadDatabase = DataManager.loadDatabase;
//=============================================================================
// * Load Database
//=============================================================================
DataManager.loadDatabase = function () {
// Run Original Function
_TDS_.QuestMenu.DataManager_loadDatabase.call(this);
var path = require('path');
var fs = require('fs');
var yaml = require('./js/libs/js-yaml-master')
// Load Quests
window['$dataQuests'] = jsyaml.load(fs.readFileSync('data/Quests.yaml', 'utf8'));
};
//=============================================================================
// ** Game_Party
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.QuestMenu.Game_Party_initialize = Game_Party.prototype.initialize;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Party.prototype.initialize = function () {
// Run Original Function
_TDS_.QuestMenu.Game_Party_initialize.call(this);
// Initialize Quest List
this._questList = [];
// Quest Stand By Message
this._questStandByMessage = null;
};
//=============================================================================
// * Set Stand By Message
//=============================================================================
Game_Party.prototype.setQuestStandByMessage = function (message) {
this._questStandByMessage = message;
};
//=============================================================================
// * Add Quest
//=============================================================================
Game_Party.prototype.addQuest = function (id, data = {}) {
// If You don't have quest already
if (!this.hasQuest(id, false)) {
// Get World
var world = $dataQuests.quests[id].world;
// Create Quest Object
var quest = { id: id, messageIndex: 0, world: world, complete: false };
// Assign Data to Quest
Object.assign(quest, data);
// Add Quest to Quest List
this._questList.push(quest)
// Return Added Quest
return quest;
};
// Return False
return false;
};
//=============================================================================
// * Remove Quest
//=============================================================================
Game_Party.prototype.removeQuest = function (id) {
// Get List of Quests to remove
var list = this._questList.filter(function (quest) { return quest.id === id; })
// Go Through List
for (var i = 0; i < list.length; i++) {
// Get Index of Quest to remove
var index = this._questList.indexOf(list[i]);
// Remove Quest
if (index >= 0) { this._questList.splice(index, 1); };
};
};
//=============================================================================
// * Determine if you have quest already
//=============================================================================
Game_Party.prototype.hasQuest = function (id, completed = true) {
return this._questList.some(function (quest) { return quest.id === id });
};
//=============================================================================
// * Get Completed Quest List
//=============================================================================
Game_Party.prototype.completedQuestList = function (world = 0) {
return this._questList.filter(function (quest) { return quest.complete && quest.world === world; });
};
//=============================================================================
// * Get Incomplete Quest List
//=============================================================================
Game_Party.prototype.incompleteQuestList = function (world = 0) {
return this._questList.filter(function (quest) { return !quest.complete && quest.world === world; });
};
//=============================================================================
// * Set Quest Complete State
//=============================================================================
Game_Party.prototype.setQuestCompleteState = function (id, state = true) {
for (var i = 0; i < this._questList.length; i++) {
var quest = this._questList[i];
if (quest.id === id) { quest.complete = state; };
};
};
//=============================================================================
// * Set Quest Message Index
//=============================================================================
Game_Party.prototype.setQuestMessageIndex = function (id, index) {
// Get Quest
var quest = this._questList.find(function (q) { return q.id === id; });
// Set Quest Message Index
if (quest) { quest.messageIndex = index; };
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Call Quest Menu
//=============================================================================
Game_Interpreter.prototype.callQuestMenu = function () {
SceneManager.push(Scene_OmoriQuest);
};
//=============================================================================
// * Add Quest
//=============================================================================
Game_Interpreter.prototype.addQuest = function (id, data) {
$gameParty.addQuest(id, data);
};
//=============================================================================
// * Remove Quest
//=============================================================================
Game_Interpreter.prototype.removeQuest = function (id) {
$gameParty.removeQuest(id);
};
//=============================================================================
// * Set Quest Complete State
//=============================================================================
Game_Interpreter.prototype.setQuestCompleteState = function (id, state) {
$gameParty.setQuestCompleteState(id, state);
};
//=============================================================================
// * Set Quest Message Index
//=============================================================================
Game_Interpreter.prototype.setQuestMessageIndex = function (id, index) {
$gameParty.setQuestMessageIndex(id, index);
};
//=============================================================================
// ** Scene_OmoriQuest
//-----------------------------------------------------------------------------
// Base Class for Omori Menu Scenes
//=============================================================================
function Scene_OmoriQuest() { this.initialize.apply(this, arguments); }
Scene_OmoriQuest.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriQuest.prototype.constructor = Scene_OmoriQuest;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriQuest.prototype.initialize = function () {
// Super Call
Scene_Base.prototype.initialize.call(this);
// Update Window Cursors Flag
this._updateWindowCursors = false;
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriQuest.prototype.create = function () {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Background
this.createBackground();
// Create Quest Windows
this.createQuestWindows();
// Create Message Window
this.createMessageWindow();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriQuest.prototype.start = function () {
// Super Call
Scene_Base.prototype.start.call(this);
// If there's an opening message
if (_TDS_.QuestMenu.params.openingMessage.length > 0) {
// Set Starting Message
$gameMessage.showLanguageMessage(_TDS_.QuestMenu.params.openingMessage);
};
// Set Update Wait Cursors Flag to true
this._updateWindowCursors = true;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriQuest.prototype.createBackground = function () {
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Quest Windows
//=============================================================================
Scene_OmoriQuest.prototype.createQuestWindows = function () {
// Create Quest Header Window
this._questHeaderWindow = new Window_OmoriQuestHeader()
this.addChild(this._questHeaderWindow);
// Create Quest Types Window
this._questTypesWindows = new Window_OmoriQuestTypes();
this._questTypesWindows.y = this._questHeaderWindow.y + this._questHeaderWindow.height + 2;
this._questTypesWindows.setHandler('ok', this.onQuestTypesOk.bind(this));
this._questTypesWindows.setHandler('cancel', this.popScene.bind(this));
this.addChild(this._questTypesWindows);
// Create Quest List Window
this._questListWindow = new Window_OmoriQuestList();
this._questListWindow.x = this._questTypesWindows.x + this._questTypesWindows.width + 2;
this._questListWindow.y = this._questTypesWindows.y;
this._questListWindow.setHandler('ok', this.onQuestListOk.bind(this));
this._questListWindow.setHandler('cancel', this.onQuestListCancel.bind(this));
this.addChild(this._questListWindow);
// Set Quest List Window
this._questTypesWindows._questlistWindow = this._questListWindow;
this._questTypesWindows.callUpdateHelp();
};
//=============================================================================
// * Create Message Window
//=============================================================================
Scene_OmoriQuest.prototype.createMessageWindow = function () {
this._messageWindow = new Window_OmoriQuestMessage();
this.addChild(this._messageWindow);
this._messageWindow.subWindows().forEach(function (window) {
this.addChild(window);
}, this);
// Add Facebox Window Container as a Child
this.addChild(this._messageWindow._faceBoxWindowContainer);
};
//=============================================================================
// * [OK] Quest Type
//=============================================================================
Scene_OmoriQuest.prototype.onQuestTypesOk = function () {
this._questListWindow.select(0);
this._questListWindow.activate();
};
//=============================================================================
// * [OK] Quest List
//=============================================================================
Scene_OmoriQuest.prototype.onQuestListOk = function () {
this._questListWindow.activate();
this._messageWindow._setStandbyMessage = true;
// Get Messages
var messages = this._questListWindow.selectedQuestMessages();
$gameMessage.showLanguageMessage(messages[0]);
// Clear Message List
this._messageWindow.clearMessageList();
for (var i = 1; i < messages.length; i++) {
this._messageWindow.addMessage(messages[i]);
};
// Set Update Wait Cursors Flag to true
this._updateWindowCursors = true;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
//=============================================================================
// * [Cancel] Quest List
//=============================================================================
Scene_OmoriQuest.prototype.onQuestListCancel = function () {
// Activate Quest Types Window
this._questTypesWindows.activate();
this._questListWindow.deselect();
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriQuest.prototype.update = function () {
// Super Call
Scene_Base.prototype.update.call(this);
if (this._updateWindowCursors && !$gameMessage.isBusy()) {
this._updateWindowCursors = false;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
// if (Input.isTriggered('control')) {
// }
};
//=============================================================================
// ** Window_OmoriQuestHeader
//-----------------------------------------------------------------------------
// This window displays the quest list header.
//=============================================================================
function Window_OmoriQuestHeader() { this.initialize.apply(this, arguments); }
Window_OmoriQuestHeader.prototype = Object.create(Window_Base.prototype);
Window_OmoriQuestHeader.prototype.constructor = Window_OmoriQuestHeader;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestHeader.prototype.initialize = function () {
// Super Call
Window_Base.prototype.initialize.call(this, 12, 12, this.windowWidth(), this.windowHeight());
// // Close Window
// this.openness = 0;
// Draw Contents
this.refresh();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestHeader.prototype.standardPadding = function () { return 0; };
Window_OmoriQuestHeader.prototype.windowWidth = function () { return 164; };
Window_OmoriQuestHeader.prototype.windowHeight = function () { return 44; };
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriQuestHeader.prototype.refresh = function () {
// Clear Contents
this.contents.clear();
// Draw Header
this.contents.drawText(LanguageManager.getPluginText('questMenu', 'header'), 0, -6, this.contents.width, this.contents.height, 'center');
};
//=============================================================================
// ** Window_OmoriQuestTypes
//-----------------------------------------------------------------------------
// This window displays quest types (Completed, Incomplete).
//=============================================================================
function Window_OmoriQuestTypes() { this.initialize.apply(this, arguments); }
Window_OmoriQuestTypes.prototype = Object.create(Window_Command.prototype);
Window_OmoriQuestTypes.prototype.constructor = Window_OmoriQuestTypes;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestTypes.prototype.initialize = function () {
// Super Call
Window_Command.prototype.initialize.call(this, 12, 0);
this.activate();
this.select(0);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestTypes.prototype.isUsingCustomCursorRectSprite = function () { return true; };
Window_OmoriQuestTypes.prototype.windowWidth = function () { return 184; };
Window_OmoriQuestTypes.prototype.windowHeight = function () { return 81; };
Window_OmoriQuestTypes.prototype.standardPadding = function () { return 8; };
Window_OmoriQuestTypes.prototype.customCursorRectTextXOffset = function () { return 35; };
Window_OmoriQuestTypes.prototype.customCursorRectXOffset = function () { return 10; };
Window_OmoriQuestTypes.prototype.lineHeight = function () { return 28; };
Window_OmoriQuestTypes.prototype.standardFontSize = function () { return 24; };
//=============================================================================
// * Get Current World
//=============================================================================
Window_OmoriQuestTypes.prototype.currentWorld = function () {
return $gameVariables.value(_TDS_.QuestMenu.params.worldVariableID);
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriQuestTypes.prototype.makeCommandList = function () {
var world = this.currentWorld();
let questStates = LanguageManager.getPluginText('questMenu', 'questStates');
this.addCommand(questStates[0], 'incomplete', $gameParty.incompleteQuestList(world).length > 0);
this.addCommand(questStates[1], 'complete', $gameParty.completedQuestList(world).length > 0);
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoriQuestTypes.prototype.drawItem = function (index) {
// Get Item Rect
var rect = this.itemRectForText(index);
var align = this.itemTextAlign();
this.resetTextColor();
// Set Text Color
this.changeTextColor(index === 1 ? 'rgba(0, 161, 4, 1)' : 'rgba(228, 50, 14, 1)');
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
};
//=============================================================================
// * Call Update Help
//=============================================================================
Window_OmoriQuestTypes.prototype.callUpdateHelp = function () {
// Run Original Function
Window_Command.prototype.callUpdateHelp.call(this);
// if Quest List Window Exists
if (this._questlistWindow) {
var world = this.currentWorld();
// Get List
var list = this.index() === 0 ? $gameParty.incompleteQuestList(world) : $gameParty.completedQuestList(world);
// Set Quest List
this._questlistWindow.setQuestList(list);
};
};
//=============================================================================
// * Process Cursor Move
//=============================================================================
Window_OmoriQuestTypes.prototype.processCursorMove = function () {
// If a message is displaying
if ($gameMessage.isBusy()) { return; };
// Run Original Function
Window_Command.prototype.processCursorMove.call(this);
};
//=============================================================================
// * Process Handling
//=============================================================================
Window_OmoriQuestTypes.prototype.processHandling = function () {
// If a message is displaying
if ($gameMessage.isBusy()) { return; };
// Run Original Function
Window_Command.prototype.processHandling.call(this);
};
//=============================================================================
// * Update Custom Cursor Rect Sprite
//=============================================================================
Window_OmoriQuestTypes.prototype.updateCustomCursorRectSprite = function (sprite, index) {
// Set Sprite
sprite = this._customCursorRectSprite;
// If Custom Rect Sprite Exists
if (sprite && $gameMessage.isBusy()) {
// Set Sprite Tone Color
sprite.setColorTone([-80, -80, -80, 255]);
// Set Sprite active flag
sprite._active = false;
return;
};
// Run Original Function
Window_Command.prototype.updateCustomCursorRectSprite.call(this, sprite, index);
};
//=============================================================================
// ** Window_OmoriQuestList
//-----------------------------------------------------------------------------
// This window displays the list of available and completed quests
//=============================================================================
function Window_OmoriQuestList() { this.initialize.apply(this, arguments); }
Window_OmoriQuestList.prototype = Object.create(Window_Command.prototype);
Window_OmoriQuestList.prototype.constructor = Window_OmoriQuestList;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestList.prototype.initialize = function () {
// Quest List
this._questList = [];
// Super Call
Window_Command.prototype.initialize.call(this, 12, 0);
// this.openness = 0;
this.deactivate();
this.deselect();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestList.prototype.isUsingCustomCursorRectSprite = function () { return true; };
Window_OmoriQuestList.prototype.windowWidth = function () { return 360 };
Window_OmoriQuestList.prototype.windowHeight = function () { return 177; };
Window_OmoriQuestList.prototype.standardPadding = function () { return 8; };
Window_OmoriQuestList.prototype.customCursorRectTextXOffset = function () { return 35; };
Window_OmoriQuestList.prototype.lineHeight = function () { return 25; };
Window_OmoriQuestList.prototype.standardFontSize = function () { return 24; };
//=============================================================================
// * Set Quest List
//=============================================================================
Window_OmoriQuestList.prototype.setQuestList = function (list) {
// Set List
this._questList = list;
// Refresh
this.refresh();
// Reset Scroll
this.resetScroll();
};
//=============================================================================
// * Get Selected Quest Messages
//=============================================================================
Window_OmoriQuestList.prototype.selectedQuestMessages = function (index = this._index) {
// Get Quest
var quest = this._questList[index];
// Return Quest
return $dataQuests.quests[quest.id].text[quest.messageIndex];
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriQuestList.prototype.makeCommandList = function () {
// Get Language
var language = LanguageManager._language;
// Go Through Quest List
for (var i = 0; i < this._questList.length; i++) {
// Get Quest
var quest = this._questList[i];
// Get Data
const loc = LanguageManager.getMessageData("XX_BLUE.Quest_Names")[quest.id]
var data = $dataQuests.quests[quest.id];
const questname = !loc ? data.name[language] : loc
this.addCommand(questname, 'quest', true, quest)
};
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoriQuestList.prototype.drawItem = function (index) {
// Run Original Function
Window_Command.prototype.drawItem.call(this, index);
// Get Item Rect
var rect = this.itemRect(index);
};
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoriQuestList.prototype._refreshArrows = function () {
// Super Call
Window_Command.prototype._refreshArrows.call(this);
var w = this._width;
var h = this._height;
var p = 24;
var q = (p / 2) + 5;
this._downArrowSprite.move(w - q, h - q);
this._upArrowSprite.move(w - q, q);
};
//=============================================================================
// * Process Cursor Move
//=============================================================================
Window_OmoriQuestList.prototype.processCursorMove = function () {
// If a message is displaying
if ($gameMessage.isBusy()) { return; };
// Run Original Function
Window_Command.prototype.processCursorMove.call(this);
};
//=============================================================================
// * Process Handling
//=============================================================================
Window_OmoriQuestList.prototype.processHandling = function () {
// If a message is displaying
if ($gameMessage.isBusy()) { return; };
// Run Original Function
Window_Command.prototype.processHandling.call(this);
};
//=============================================================================
// * Update Custom Cursor Rect Sprite
//=============================================================================
Window_OmoriQuestList.prototype.updateCustomCursorRectSprite = function (sprite, index) {
// Set Sprite
sprite = this._customCursorRectSprite;
// If Custom Rect Sprite Exists
if (sprite && $gameMessage.isBusy()) {
// Set Sprite Tone Color
sprite.setColorTone([-80, -80, -80, 255]);
// Set Sprite active flag
sprite._active = false;
return;
};
// Run Original Function
Window_Command.prototype.updateCustomCursorRectSprite.call(this, sprite, index);
};
//=============================================================================
// ** Window_OmoriQuestMessage
//-----------------------------------------------------------------------------
// This window displays quest message dialogue.
//=============================================================================
function Window_OmoriQuestMessage() { this.initialize.apply(this, arguments); }
Window_OmoriQuestMessage.prototype = Object.create(Window_Message.prototype);
Window_OmoriQuestMessage.prototype.constructor = Window_OmoriQuestMessage;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestMessage.prototype.initialize = function () {
// Clear Message List
this.clearMessageList();
// Set Standby Message Flag
this._setStandbyMessage = false;
// Super Call
Window_Message.prototype.initialize.call(this);
};
//=============================================================================
// * Clear Message List
//=============================================================================
Window_OmoriQuestMessage.prototype.clearMessageList = function () {
this._messageList = [];
};
//=============================================================================
// * Clear Message List
//=============================================================================
Window_OmoriQuestMessage.prototype.addMessage = function (message) {
this._messageList.push(message);
};
//=============================================================================
// * Set Stand By Message
//=============================================================================
Window_OmoriQuestMessage.prototype.setStandByMessage = function () { this._setStandbyMessage = true; }
//=============================================================================
// * Terminate Message
//=============================================================================
Window_OmoriQuestMessage.prototype.terminateMessage = function () {
// Clear Game Message
$gameMessage.clear();
// If Message List Length is more than 0
if (this._messageList.length > 0) {
// Get Message
var message = this._messageList.shift();
// Show Language Message
$gameMessage.showLanguageMessage(message);
return;
};
// If set Standy Message Flag is true
if (this._setStandbyMessage) {
// If Stand By Message for Quests Exist
if ($gameParty._questStandByMessage) {
// Set Quest Standby Message
$gameMessage.showLanguageMessage($gameParty._questStandByMessage);
}
// Set Standby Message to false
this._setStandbyMessage = false;
};
};

View file

@ -0,0 +1,791 @@
//=============================================================================
// TDS Message Save & Load
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriSaveLoad = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriSaveLoad = _TDS_.OmoriSaveLoad || {};
//=============================================================================
/*:
* @author TDS
* @plugindesc
* Combo Skills port from ACE.
*
*
*/
//=============================================================================
Game_Actor.prototype.faceSaveLoad = function() {
var actor = this.actor();
// When changing these the .png should not be required.
switch (actor.id) {
case 1: // Omori
return "01_OMORI_BATTLE";
case 2: // Aubrey
return "02_AUBREY_BATTLE";
case 3: // Kel
return "03_KEL_BATTLE";
case 4: // Hero
return "04_HERO_BATTLE";
case 8: // Omori
return "01_FA_OMORI_BATTLE";
case 9: // Aubrey
return "02_FA_AUBREY_BATTLE";
case 10: // Kel
return "03_FA_KEL_BATTLE";
case 11: // Hero
return "04_FA_HERO_BATTLE";
default:
return "default_face_image_here"; // if ther is one?
}
};
Game_Actor.prototype.faceSaveLoadIndex = function() {
var actor = this.actor();
// When changing these the .png should not be required.
switch (actor.id) {
case 1: // Omori
return 0;
case 2: // Aubrey
return 0;
case 3: // Kel
return 0;
case 4: // Hero
return 0;
default:
return 0;
}
};
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The static class that manages the database and game objects.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriSaveLoad.DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
//=============================================================================
// * Make Save File Information
//=============================================================================
DataManager.makeSavefileInfo = function() {
// Get Original Info
var info = _TDS_.OmoriSaveLoad.DataManager_makeSavefileInfo.call(this);
// Get Leader
var actor = $gameParty.leader();
info.actorData = {name: actor.name(), level: actor.level, faceName: actor.faceSaveLoad(), faceIndex: actor.faceSaveLoadIndex()};
info.chapter = $gameVariables.value(23);
info.location = $gameMap.displayName();
// Return Info
return info;
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Call Save Menu
//=============================================================================
Game_Interpreter.prototype.callSaveMenu = function(save = true, load = true) {
// Call Save Menu
SceneManager.push(Scene_OmoriFile);
SceneManager._nextScene.setup(save, load);
};
//=============================================================================
// ** Scene_OmoriFile
//-----------------------------------------------------------------------------
// This scene is used to handle saving & loading.
//=============================================================================
function Scene_OmoriFile() { this.initialize.apply(this, arguments); }
Scene_OmoriFile.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriFile.prototype.constructor = Scene_OmoriFile;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriFile.prototype.initialize = function() {
this._imageReservationId = 'file';
// Super Call
Scene_Base.prototype.initialize.call(this);
// Save Index
this._saveIndex = -1;
// If Can Select Flag is true
this._canSelect = false;
// Set Load Success Flag
this._loadSuccess = false;
// Set Save & Load Flags
this._canSave = true; this._canLoad = true;
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriFile.prototype.initAtlastLists = function() {
// Super Call
Scene_Base.prototype.initAtlastLists.call(this);
};
//=============================================================================
// * Load Reserved Bitmaps
//=============================================================================
Scene_OmoriFile.prototype.loadReservedBitmaps = function() {
// Super Call
Scene_Base.prototype.loadReservedBitmaps.call(this);
// Go through save files
for (var i = 1; i < 5; i++) {
// Get Save Info
const info = DataManager.loadSavefileInfo(i);
// If Information Exists
if (info) {
// Get Actor Data
const actor = info.actorData;
// Reserve Face Image
ImageManager.reserveFace(actor.faceName, actor.faceIndex, this._imageReservationId);
};
}
ImageManager.reserveSystem('faceset_states', 0, this._imageReservationId);
ImageManager.reserveParallax('polaroidBG_BS_sky', 0, this._imageReservationId);
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_OmoriFile.prototype.setup = function(save, load) {
// Set Save & Load Flags
this._canSave = save; this._canLoad = load;
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_OmoriFile.prototype.terminate = function() {
Scene_Base.prototype.terminate.call(this);
if (this._loadSuccess) {
$gameSystem.onAfterLoad();
};
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriFile.prototype.create = function() {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Background
this.createBackground();
this.createCommandWindow();
this.createfileWindows();
// Create Prompt Window
this.createPromptWindow();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriFile.prototype.createBackground = function() {
// Create Background Sprite
this._backgroundSprite = new TilingSprite();
this._backgroundSprite.bitmap = ImageManager.loadParallax('SAVE_MENU_BG');
this._backgroundSprite.move(0, 0, Graphics.width, Graphics.height);
this.addChild(this._backgroundSprite);
// let centerWidth = 42
// let bitmap = new Bitmap(Graphics.width, Graphics.height);
// bitmap.fillRect(0, 0, centerWidth, bitmap.height, 'rgba(255, 0, 0, 1)');
// bitmap.fillRect(bitmap.width - centerWidth, 0, centerWidth, bitmap.height, 'rgba(255, 0, 0, 1)');
// this._centerSprite = new Sprite(bitmap);
// this.addChild(this._centerSprite);
};
//=============================================================================
// * Create Command Window
//=============================================================================
Scene_OmoriFile.prototype.createCommandWindow = function() {
// Create Command Window
this._commandWindow = new Window_OmoriFileCommand();
this._commandWindow.setupFile(this._canSave, this._canLoad);
this._commandWindow.setHandler('ok', this.onCommandWindowOk.bind(this));
this._commandWindow.setHandler('cancel', this.onCommandWindowCancel.bind(this));
this.addChild(this._commandWindow);
};
//=============================================================================
// * Create File Windows
//=============================================================================
Scene_OmoriFile.prototype.createfileWindows = function() {
// Initialize File Windows Array
this._fileWindows = [];
let sx = this._commandWindow.x + this._commandWindow.width + 1;
// Iterate 3 times
for (var i = 0; i < 6; i++) {
// Create Window
var win = new Window_OmoriFileInformation(i);
win.x = sx;
win.y = 28 + (i * (win.height + 1))
// Set Window
this._fileWindows[i] = win;
this.addChild(win);
};
};
//=============================================================================
// * Create Prompt Window
//=============================================================================
Scene_OmoriFile.prototype.createPromptWindow = function() {
// Create Prompt Window
this._promptWindow = new Window_OmoriFilePrompt();
// Set Handlers
this._promptWindow.setHandler('ok', this.onPromptWindowOk.bind(this));
this._promptWindow.setHandler('cancel', this.onPromptWindowCancel.bind(this));
this._promptWindow.close();
this._promptWindow.openness = 0;
this._promptWindow.deactivate();
this.addChild(this._promptWindow);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriFile.prototype.update = function() {
// Super Call
Scene_Base.prototype.update.call(this);
// Update Background
this.updateBackground();
// Update Select Input
if (this._canSelect) { this.updateSelectInput(); };
// if (Input.isTriggered('control')) {
// // this.onSavefileOk();
// for (var i = 0; i < this._fileWindows.length; i++) {
// // Set Window
// this._fileWindows[i].refresh();
// };
// };
};
//=============================================================================
// * Get Save File ID
//=============================================================================
Scene_OmoriFile.prototype.savefileId = function() { return this._saveIndex + 1; };
//=============================================================================
// * Check if out of bounds
//=============================================================================
Scene_OmoriFile.prototype.isOutOfBounds = function() {
let index = this._saveIndex;
let win = this._fileWindows[index];
if(win.y + win.height > Graphics.boxHeight) {return -28}
if(index === 0) {
if(win.y < 28) {return 28}
}
if(win.y < 0) {return 28}
return 0;
}
//=============================================================================
// * Update Save Index Cursor
//=============================================================================
Scene_OmoriFile.prototype.updateSaveIndexCursor = function() {
// Go Through File Windows
for (var i = 0; i < this._fileWindows.length; i++) {
// Get Window
var win = this._fileWindows[i];
// Set Selected STate
this._saveIndex === i ? win.select() : win.deselect();
};
};
//=============================================================================
// * Update Background
//=============================================================================
Scene_OmoriFile.prototype.updateBackground = function() {
this._backgroundSprite.origin.y += 1;
};
//=============================================================================
// * Update Select Background
//=============================================================================
Scene_OmoriFile.prototype.updateSelectInput = function() {
// If Ok
if (Input.isTriggered('ok')) {
// Call On Select Input Ok
this.onSelectInputOk();
return;
};
// If Cancel
if (Input.isTriggered('cancel')) {
// Play Cancel Sound
SoundManager.playCancel();
// On Select Input Cancel
this.onSelectInputCancel();
return;
};
// If Input Is repeated Up
if (Input.isRepeated('up')) {
// Play Cursor
SoundManager.playCursor();
// If Save index is 0
if (this._saveIndex === 0) {
// Set Save Index at the end
this._saveIndex = this._fileWindows.length-1;
} else {
// Decrease Save Index
this._saveIndex = (this._saveIndex - 1) % this._fileWindows.length;
}
// Update Save Index Cursor
this.updateSaveIndexCursor();
return;
};
// If Input Is repeated Down
if (Input.isRepeated('down')) {
// Play Cursor
SoundManager.playCursor();
// Increase Save Index
this._saveIndex = (this._saveIndex + 1) % this._fileWindows.length;
// Update Save Index Cursor
this.updateSaveIndexCursor();
return;
};
this.updatePlacement();
};
Scene_OmoriFile.prototype.updatePlacement = function() {
if(this._saveIndex < 0) {return;}
let bounds = this.isOutOfBounds();
if(!bounds) {return;}
for(let win of this._fileWindows) {
win.y += bounds;
}
}
//=============================================================================
// * On Command Window Ok
//=============================================================================
Scene_OmoriFile.prototype.onCommandWindowOk = function() {
// Set Can select Flag to true
this._canSelect = true;
// Set Save Index to 0
let latestFile = !!this._canSave ? DataManager.lastAccessedSavefileId() : DataManager.latestSavefileId();
let maxSavefiles = 6;
this._saveIndex = (latestFile - 1) % maxSavefiles;
// Update Save Index Cursor
this.updateSaveIndexCursor();
};
//=============================================================================
// * On Command Window Cancel
//=============================================================================
Scene_OmoriFile.prototype.onCommandWindowCancel = function() {
// If Previous scene is title screen
var isTitleScreen = SceneManager.isPreviousScene(Scene_OmoriTitleScreen);
// Pop Scene
this.popScene();
// If Previous scene is tile scene
if (isTitleScreen) {
// Prepare Title Scene
SceneManager._nextScene.prepare(1);
}
};
//=============================================================================
// * On Select Input Ok
//=============================================================================
Scene_OmoriFile.prototype.onSelectInputOk = function() {
// Get Index
var index = this._commandWindow.index();
// Get Save File ID
var saveFileid = this.savefileId();
// If Save
if (index === 0) {
// If File Exists
if (StorageManager.exists(saveFileid)) {
// Show Prompt Window
this.showPromptWindow(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").overwrite_file);
// Set Can select Flag to false
this._canSelect = false;
} else {
// Save The Game
this.saveGame();
};
} else {
// If File Exists
if (StorageManager.exists(saveFileid)) {
// Show Prompt Window
this.showPromptWindow(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").load_file);
// Set Can select Flag to false
this._canSelect = false;
} else {
// Play Buzzer Sound
SoundManager.playBuzzer();
};
};
};
//=============================================================================
// * On Select Input Cancel
//=============================================================================
Scene_OmoriFile.prototype.onSelectInputCancel = function() {
// Set Can select Flag to false
this._canSelect = false;
// Set Save Index to -1
this._saveIndex = -1;
// Update Save Index Cursor
this.updateSaveIndexCursor();
// Activate Command Window
this._commandWindow.activate();
};
//=============================================================================
// * Show Prompt Window
//=============================================================================
Scene_OmoriFile.prototype.showPromptWindow = function(text) {
// Set Prompt Window Text
this._promptWindow.setPromptText(text);
// Show Prompt Window
this._promptWindow.open();
this._promptWindow.select(1);
this._promptWindow.activate();
};
//=============================================================================
// * On Prompt Window Ok
//=============================================================================
Scene_OmoriFile.prototype.onPromptWindowOk = function() {
// Get Index
var index = this._commandWindow.index();
// If Save
if (index === 0) {
// Save The Game
this.saveGame();
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
} else {
// Load Game
this.loadGame();
};
};
//=============================================================================
// * On Prompt Window Cancel
//=============================================================================
Scene_OmoriFile.prototype.onPromptWindowCancel = function() {
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
};
//=============================================================================
// * Save Game
//=============================================================================
Scene_OmoriFile.prototype.saveGame = function() {
// On Before Save
$gameSystem.onBeforeSave();
// Get Save File ID
var saveFileid = this.savefileId();
// Get File Window
var fileWindow = this._fileWindows[this._saveIndex];
// Save Game
if (DataManager.saveGame(saveFileid)) {
SoundManager.playSave();
StorageManager.cleanBackup(saveFileid);
fileWindow.refresh();
} else {
SoundManager.playBuzzer();
};
// Deactivate Prompt Window
this._promptWindow.deactivate();
this._promptWindow.close();
// Set Can select Flag to false
this._canSelect = true;
// Update Save Index Cursor
this.updateSaveIndexCursor();
};
//=============================================================================
// * Load Game
//=============================================================================
Scene_OmoriFile.prototype.loadGame = function() {
if (DataManager.loadGame(this.savefileId())) {
SoundManager.playLoad();
this.fadeOutAll();
// Reload Map if Updated
if ($gameSystem.versionId() !== $dataSystem.versionId) {
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
};
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
} else {
// Play Buzzer
SoundManager.playBuzzer();
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
};
};
//=============================================================================
// ** Window_OmoriFileInformation
//-----------------------------------------------------------------------------
// The window for showing picture items for sorting
//=============================================================================
function Window_OmoriFileInformation() { this.initialize.apply(this, arguments); };
Window_OmoriFileInformation.prototype = Object.create(Window_Base.prototype);
Window_OmoriFileInformation.prototype.constructor = Window_OmoriFileInformation;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFileInformation.prototype.initialize = function(index) {
// Set Index
this._index = index;
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, this.windowWidth(), this.windowHeight());
// Create Cursor Sprite
this.createCursorSprite();
// Refresh
this.refresh();
// Deselect
this.deselect();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFileInformation.prototype.standardPadding = function() { return 4}
Window_OmoriFileInformation.prototype.windowWidth = function () { return 382 + 54; };
Window_OmoriFileInformation.prototype.windowHeight = function() { return 142; }
//=============================================================================
// * Create Cursor Sprite
//=============================================================================
Window_OmoriFileInformation.prototype.createCursorSprite = function() {
// Create Cursor Sprite
this._cursorSprite = new Sprite_WindowCustomCursor();
this._cursorSprite.x = 10//-32;
this._cursorSprite.y = 20;
this.addChild(this._cursorSprite);
};
//=============================================================================
// * Select
//=============================================================================
Window_OmoriFileInformation.prototype.select = function() {
this._cursorSprite.visible = true;
this.contentsOpacity = 255;
};
//=============================================================================
// * Deselect
//=============================================================================
Window_OmoriFileInformation.prototype.deselect = function() {
this._cursorSprite.visible = false;
this.contentsOpacity = 100;
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriFileInformation.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Get Color
var color = 'rgba(255, 255, 255, 1)';
// Get ID
var id = this._index + 1;
var valid = DataManager.isThisGameFile(id);
var info = DataManager.loadSavefileInfo(id);
// Draw Lines
this.contents.fillRect(0, 29, this.contents.width, 3, color);
for (var i = 0; i < 3; i++) {
var y = 55 + (i * 25)
this.contents.fillRect(113, y, this.contents.width - 117, 1, color);
};
// Draw File
this.contents.fontSize = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").refresh_contents_fontsize;
let loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").file_position
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").file.format(id), loc_position[0], loc_position[1], 100, this.contents.fontSize);
// If Valid
if (valid) {
loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").refresh_drawText_position;
let chap = LanguageManager.getMessageData("XX_BLUE.Chapter_Names")[info.chapter]
if(!chap) {
chap = info.chapter
}
this.contents.drawText(chap, loc_position[0], loc_position[1], this.contents.width, this.contents.fontSize);
this.contents.fontSize = 28;
let backBitmap = ImageManager.loadSystem('faceset_states');
let width = backBitmap.width / 4;
let height = backBitmap.height / 5;
// this.contents.blt(backBitmap, 0, 0, width, height, 0, 34, width + 10, height);
this.contents.blt(backBitmap, 0, 0, width, height, 1, 33);
// Get Actor
var actor = info.actorData
// Draw Actor Face
let bit = ImageManager.loadFace(actor.faceName);
bit.addLoadListener(() => this.drawFace(actor.faceName, actor.faceIndex, -2, this.contents.height - Window_Base._faceHeight + 7, Window_Base._faceWidth, height - 2));
// Draw Actor Name
this.contents.fontSize = 24;
this.contents.drawText(actor.name, 118, 30, 100, 24);
// Draw Level
loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").level_position;
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").level, loc_position[0], loc_position[1], 100, 24);
this.contents.drawText(actor.level, loc_position[0], loc_position[1], 70, 24, 'right');
// Draw Total PlayTime
loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").playtime_position;
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").playtime, 118, 55, 200, 24);
this.contents.drawText(info.playtime, loc_position[0], loc_position[1], 100, 24);
// Draw Location
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").location, 118, 80, 200, 24);
this.contents.drawText(info.location, 205, 80, 210, 24, 'right');
};
// Draw Border
this.contents.fillRect(102, 32, 3, 102, 'rgba(255, 255, 255, 1)')
this.contents.fillRect(0, 29, 108, 3, 'rgba(255, 255, 255, 1)')
};
//=============================================================================
// ** Window_OmoriFileCommand
//-----------------------------------------------------------------------------
// The window for selecting a command on the menu screen.
//=============================================================================
function Window_OmoriFileCommand() { this.initialize.apply(this, arguments); }
Window_OmoriFileCommand.prototype = Object.create(Window_Command.prototype);
Window_OmoriFileCommand.prototype.constructor = Window_OmoriFileCommand;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFileCommand.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 42, 28);
// Setup File
this.setupFile(true, true);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFileCommand.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriFileCommand.prototype.lineHeight = function () { return 24; };
Window_OmoriFileCommand.prototype.windowWidth = function () { return 119; };
Window_OmoriFileCommand.prototype.windowHeight = function () { return 64; };
Window_OmoriFileCommand.prototype.standardPadding = function () { return 4; };
Window_OmoriFileCommand.prototype.numVisibleRows = function () { return 2; };
Window_OmoriFileCommand.prototype.maxCols = function () { return 1; };
Window_OmoriFileCommand.prototype.customCursorRectYOffset = function() { return 5; }
Window_OmoriFileCommand.prototype.customCursorRectTextXOffset = function() { return 40; }
//=============================================================================
// * Setup File
//=============================================================================
Window_OmoriFileCommand.prototype.setupFile = function (save, load) {
// Set Save & Load Flags
this._canSave = save; this._canLoad = load;
if(!!this._canSave) {this.select(0);}
else if(!!this._canLoad) {this.select(1)}
// Refresh
this.refresh();
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriFileCommand.prototype.makeCommandList = function () {
const loc = LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load")
this.addCommand(loc.save_command, 'save', this._canSave);
this.addCommand(loc.load_command, 'load', this._canLoad);
};
//=============================================================================
// ** Window_OmoriFilePrompt
//-----------------------------------------------------------------------------
// The window for selecting a command on the menu screen.
//=============================================================================
function Window_OmoriFilePrompt() { this.initialize.apply(this, arguments); }
Window_OmoriFilePrompt.prototype = Object.create(Window_Command.prototype);
Window_OmoriFilePrompt.prototype.constructor = Window_OmoriFilePrompt;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFilePrompt.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
// Center Window
this.x = (Graphics.width - this.width) / 2;
this.y = (Graphics.height - this.height) / 2;
// Create Cover Sprite
this.createCoverSprite();
};
//=============================================================================
// * Create Background
//=============================================================================
Window_OmoriFilePrompt.prototype.createCoverSprite = function() {
var bitmap = new Bitmap(Graphics.width, Graphics.height);
bitmap.fillAll('rgba(0, 0, 0, 0.5)')
this._coverSprite = new Sprite(bitmap);
this._coverSprite.x = -this.x;
this._coverSprite.y = -this.y;
this.addChildAt(this._coverSprite, 0);
};
//=============================================================================
// * Openness
//=============================================================================
Object.defineProperty(Window.prototype, 'openness', {
get: function() { return this._openness; },
set: function(value) {
if (this._openness !== value) {
this._openness = value.clamp(0, 255);
this._windowSpriteContainer.scale.y = this._openness / 255;
this._windowSpriteContainer.y = this.height / 2 * (1 - this._openness / 255);
if (this._coverSprite) { this._coverSprite.opacity = this._openness; };
}
},
configurable: true
});
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFilePrompt.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriFilePrompt.prototype.lineHeight = function () { return 22; };
Window_OmoriFilePrompt.prototype.windowWidth = function () { return 220; };
Window_OmoriFilePrompt.prototype.windowHeight = function () { return 70 + 20; };
Window_OmoriFilePrompt.prototype.standardPadding = function () { return 4; };
Window_OmoriFilePrompt.prototype.numVisibleRows = function () { return 2; };
Window_OmoriFilePrompt.prototype.maxCols = function () { return 1; };
Window_OmoriFilePrompt.prototype.customCursorRectXOffset = function() { return 50; }
Window_OmoriFilePrompt.prototype.customCursorRectYOffset = function() { return 33; }
Window_OmoriFilePrompt.prototype.customCursorRectTextXOffset = function() { return 80; }
Window_OmoriFilePrompt.prototype.customCursorRectTextYOffset = function() { return 28; }
//=============================================================================
// * Setup File
//=============================================================================
Window_OmoriFilePrompt.prototype.setPromptText = function (text) {
// Set Prompt Text
this._promptText = text;
// Refresh Contents
this.refresh();
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriFilePrompt.prototype.makeCommandList = function () {
this.addCommand(LanguageManager.getMessageData("XX_SYSTEM.message_10").text, 'ok');
this.addCommand(LanguageManager.getMessageData("XX_SYSTEM.message_11").text, 'cancel');
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriFilePrompt.prototype.refresh = function () {
// Super Call
Window_Command.prototype.refresh.call(this);
this.contents.drawText(this._promptText, 0, 0, this.contents.width, 24, 'center');
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,33 @@
//=============================================================================
// Region Randomize
//=============================================================================
/*:
* @plugindesc
* Places an event on specificied region randomly.
*
*
* Script Call:
* $gameMap.randomPos(eventId, regionId);
*
*/
//=============================================================================
Game_Map.prototype.randomPos = function(eventId, regionId) {
var coords = [];
for (var x = 0; x < $dataMap.width; x++) {
for (var y = 0; y < $dataMap.height; y++) {
var region = this.regionId(x, y);
if (region == regionId) {
coords.push([x, y]);
}
}
}
if (coords.length === 0) return;
var idx = Math.randomInt(coords.length);
var randomCoord = coords[idx];
var event = this._events[eventId];
event.setPosition(randomCoord[0], randomCoord[1]);
};

View file

@ -0,0 +1,158 @@
//=============================================================================
// RotatePictureEx.js
//=============================================================================
/*:
* @plugindesc Rotate picture with specified angle and frame
* @author Sasuke KANNAZUKI
*
* @help Plugin Command:
* RotatePictureEx <pictureId> <angle> <frame> <waitFlag>
* where <pictureId> must be the number of picture id.
* <angle> must be the number to rotate angle. when positive value,
* it rotates clockwise. when negative value, it rotates reverse.
* <frame> must be the natural number that frame to rotate.
* <waitFlag> must be 0 or 1. when it is 1, wait until rotate is finished.
*
* for any parameter, you can set variable ID for following notation:
* V20 # the value of game variable #20.
*
* ex:
* RotatePictureEx 1 720 60 1 # rotate picture #1 720 degree in 60 frames
* and wait until rotation finished.
* RotatePictureEx V10 720 V20 0 # rotate picutre whose number is the value of
* game variable #10, rotate 720 frames in the frames of the value of
* game variable #20
*
* note:
* - command is invalid when the picture is not displayed.
* - if you execute command when older rotation is not finished,
* older rotation is cancelled.
* - if you execute command when the picture is rolling by event command,
* temporary stop event rolling and execute command instead.
* - You can rotate picture with moving and/or changing tint,
* by operating event command and plugin command simultaneously.
*
* Copyright:this plugin is released under MIT license.
* http://opensource.org/licenses/mit-license.php
*/
/*:ja
* @plugindesc ピクチャを指定した角度とフレーム数で回転させます
* @author 神無月サスケ
*
* @help プラグインコマンド:
* RotatePictureEx <pictureId> <angle> <frame> <waitFlag>
* <pictureId> ピクチャIDにしてください
* <angle>は回転させたい角度(一周360)にしてください
* 正の値なら時計回り負の値なら反時計回りになります
* <frame>は回転にかかるフレーム数(1以上)にしてください(160フレーム)
* 0か負の値を指定した場合回転は行われません
* <waitFlag> 1 なら回転が終わるまでウェイトします0 ならウェイトしません
*
* 各パラメータで以下の書式で数字の代わりに変数IDを指定することが出来ます
* V20 # 変数20番の値
*
*
* RotatePictureEx 1 720 60 1 # 60フレームかけて720度回転させます回転中は
* ウェイトします
* RotatePictureEx V10 720 V20 0 # 変数10番の値のIDのピクチャを
* 変数20番の値のフレーム数で720度回転させます
*
* 注意:
* - ピクチャが表示されていない時はプラグインコマンドは無効です
* - プラグインコマンドでの回転が終わらないうちに新たにプラグインコマンドで
* 同じピクチャを回転させた場合前の回転はキャンセルされます
* - イベントコマンドで回転させているピクチャにプラグインコマンドを実行した
* 場合イベントコマンドの回転を一旦休止してこちらの回転を優先させます
* - 連続してピクチャの色調変更ピクチャの移動を実行することで
* 回転とそれらの操作を同時に行うことも可能です
*
* このプラグインは MIT ライセンスで配布されます
* ご自由にお使いください
* http://opensource.org/licenses/mit-license.php
*/
(function() {
//
// process plugin commands
//
function argToNumber(arg) {
var reg = (/^V([0-9]+)/i).exec(arg);
if(reg){
return $gameVariables.value(Number(reg[1])) || 0;
} else {
return Number(arg) || 0;
}
}
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'RotatePictureEx') {
var pictureId = argToNumber(args[0]);
var picture = $gameScreen.picture(pictureId);
var angle = argToNumber(args[1]);
var frame = argToNumber(args[2]);
var needsWait = !!argToNumber(args[3]);
if (angle !== 0 && frame > 0 && picture) {
picture.setRotationWithFrame(angle, frame);
if (needsWait) {
$gameMap._interpreter.wait(frame);
}
}
}
};
//
// setting 'rotation with frame' mode.
//
var _Game_Picture_initRotation = Game_Picture.prototype.initRotation;
Game_Picture.prototype.initRotation = function() {
_Game_Picture_initRotation.call(this);
this.resetRotationWithFrame();
};
Game_Picture.prototype.resetRotationWithFrame = function() {
this._maxFrame = 0;
this._frame = 0;
this._maxAngle = 0;
};
Game_Picture.prototype.setRotationWithFrame = function(angle, frame) {
this._maxFrame = frame;
this._frame = 0;
this._maxAngle = angle;
};
Game_Picture.prototype.isFrameSetMode = function() {
this._maxFrame = this._maxFrame || 0;
return this._maxFrame > 0;
};
//
// find current angle
//
var _Game_Picture_updateRotation = Game_Picture.prototype.updateRotation;
Game_Picture.prototype.updateRotation = function() {
if (this.isFrameSetMode()) {
if (++this._frame === this._maxFrame) {
this._angle += this._maxAngle;
this.resetRotationWithFrame();
}
return;
}
_Game_Picture_updateRotation.call(this);
};
var _Game_Picture_angle = Game_Picture.prototype.angle;
Game_Picture.prototype.angle = function() {
if (this.isFrameSetMode()) {
var currenAngle = this._maxAngle * (this._frame / this._maxFrame);
return _Game_Picture_angle.call(this) + currenAngle;
}
return _Game_Picture_angle.call(this);
};
})();

View file

@ -0,0 +1,236 @@
/*:
* @plugindesc Adds more options for waiting in your events.
* @author SumRndmDde
*
* @param SE Wait Buffer
* @desc This is a guarenteed amount of waiting frames that occur when checking for SE to end.
* @default 4
*
* @help
*
* Wait Options
* Version 1.01
* SumRndmDde
*
*
* This is a plugin that adds more options for waiting during events.
*
*
* ==========================================================================
* Plugin Commands
* ==========================================================================
*
* How to wait for a specific amount of time:
*
*
* Wait [number] Frames
*
* Allows you to wait for a certain amount of frames.
*
*
* Wait [number] Seconds
*
* Allows you to wait for a certain amount of seconds.
*
*
* Wait [number] Minutes
*
* Allows you to wait for a certain amount of minutes.
*
*
* ==========================================================================
*
*
* Wait for Route
*
* Waits for all movement routes to complete.
*
*
* Wait for Animation
*
* Waits for all animations to complete.
*
*
* Wait for Balloon
*
* Waits for all balloon animations to complete.
*
*
* Wait for Message
*
* Waits for all messages to complete (best for parallel processes).
*
*
* Wait for Transfer
*
* Waits for map transfer to complete
*
*
* Wait for Scroll
*
* Waits for scrolling to complete.
*
*
* Wait for Gather
*
* Waits for all followers to gather.
*
*
* Wait for Action
*
* Waits for battle action to complete.
*
*
* Wait for Video
*
* Waits for all videos to complete playing.
*
*
* Wait for Image
*
* Waits for images to load.
*
*
* Wait for SE
*
* Waits for all sound effects to stop playing.
*
*
* Wait for ME
*
* Waits for all music effects to stop playing.
*
*
* ==========================================================================
*
*
* Cancel Wait
*
* Cancels all waiting.
*
*
* ==========================================================================
* How to Make Custom Waiting Conditions
* ==========================================================================
*
* Wait for Condition [condition]
*
* Waits for a custom coindition.
*
*
* Example:
*
* Wait for Condition $gameVariable.value(3) > 5
*
* This will wait until Variable 3 is greater than 5.
*
*
* ==========================================================================
* 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.WaitOptions = SRD.WaitOptions || {};
var Imported = Imported || {};
Imported["SumRndmDde Wait Options"] = 1.01;
(function(_) {
"use strict";
var params = PluginManager.parameters('SRD_WaitOptions');
_.seWait = parseInt(params['SE Wait Buffer']);
var _Game_Interpreter_clear = Game_Interpreter.prototype.clear;
Game_Interpreter.prototype.clear = function() {
_Game_Interpreter_clear.apply(this, arguments);
this._waitConditions = [];
};
var _Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
Game_Interpreter.prototype.updateWaitMode = function() {
if(this._waitMode === 'se') {
if(AudioManager._seBuffers.length === 0) {
this._waitMode = '';
} else {
var playing = false;
for(var i = 0; i < AudioManager._seBuffers.length; i++) {
if(AudioManager._seBuffers[i].isPlaying()) {
playing = true;
}
}
if(playing) return true;
}
} else if(this._waitMode === 'me') {
if(AudioManager._meBuffer) {
return true;
} else {
this._waitMode = '';
}
}
var waiting = _Game_Interpreter_updateWaitMode.apply(this, arguments);
for(var i = 0; i < this._waitConditions.length; i++) {
if(!eval(this._waitConditions[i])) {
waiting = true;
if(!this._waitMode) this._waitMode = 'condition';
break;
} else {
this._waitConditions.pop(i, 1);
i--;
}
}
return waiting;
};
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.apply(this, arguments);
if(command.trim().toLowerCase() === 'wait') {
if(args[0].trim().toLowerCase() === 'for') {
if(args[1].trim().toLowerCase() === 'condition') {
var condition = '';
for(var i = 2; i < args.length; i++) {
condition += args[i] + ' ';
}
this._waitConditions.push(condition);
} else {
this.setWaitMode(args[1].trim().toLowerCase());
if(this._waitMode === 'se') {
this.wait(_.seWait);
}
}
} else if(args[0].match(/(\d+)/i)) {
var value = parseInt(RegExp.$1);
if(args[1].trim().toLowerCase() === 'frames') {
this.wait(value);
} else if(args[1].trim().toLowerCase() === 'seconds') {
this.wait(value * 60);
} else if(args[1].trim().toLowerCase() === 'minutes') {
this.wait(value * 60 * 60);
}
}
} else if(command.trim().toLowerCase() === 'cancel' && args[0].trim().toLowerCase() === 'wait') {
this.setWaitMode('');
this.wait(0);
}
};
})(SRD.WaitOptions);

View file

@ -0,0 +1,105 @@
//=============================================================================
// Simple Event Fade
// SimpleEventFade.js
// Version: 1.1
// Author: Kuoushi
//=============================================================================
//=============================================================================
/*:
* @plugindesc v1.1 Makes fading events in or out easier.
* @author Kuoushi
*
* @param Default Fade Time
* @desc The default number of frames to fade an event in or out. (1 - 255)
* @default 30
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin is meant to make events fading in or out a much simpler process
* than having to set the opacity over and over. Not sure if anyone else has
* that issue or not, (or if it's actually fixable in engine), but I made a
* plugin to help simplify the process.
*
* In the move route of the event you want to fade, add a script call where
* you want the fade to occur. The script call would be one of the following:
*
* this.fadeIn(x)
* this.fadeOut(x)
*
* x is the number of frames you want the fade to last. If you just want to use
* the default in the plugin parameters then you can just say this.fadeIn() for
* even further convenience. The fade will start on whatever your character's
* current opacity is set at.
*
* ============================================================================
* Changelog
* ============================================================================
*
* 1.1 Fixed possible bug where we didn't move the moveroute index back
* after splicing in the new fade commands. Also added in a new fadeTo
* command that'll allow you to fade to a specific opacity instead of
* just in or out.
* 1.01 Fixed the issue which required the call to be at the end of the
* route list. Now it can be called in any location in a movement route.
* 1.00 Plugin with basic functionality created.
*
*/
//=============================================================================
(function() {
var Parameters = PluginManager.parameters('SimpleEventFade');
var DefaultFadeTime = Number(Parameters['Default Fade Time']);
Game_CharacterBase.prototype.fadeOut = function(numFrames) {
this.fadeTo(0,numFrames);
};
Game_CharacterBase.prototype.fadeIn = function(numFrames) {
this.fadeTo(255,numFrames);
};
Game_CharacterBase.prototype.fadeTo = function(fadeOpac, numFrames) {
var time = DefaultFadeTime;
if(numFrames)
time = numFrames;
var route = {};
route.list = [];
var waitObj = {};
waitObj.code = Game_Character.ROUTE_WAIT;
waitObj.parameters = [1];
var step = (fadeOpac - this._opacity) / time;
if(step < 0)
step = Math.ceil(Math.abs(step)) * -1;
else
step = Math.ceil(step);
for(var i = this._opacity; i != fadeOpac; i += step) {
var command = new Object();
command.code = Game_Character.ROUTE_CHANGE_OPACITY;
command.parameters = [i];
route.list.push(command);
route.list.push(waitObj);
if(i != fadeOpac) {
if((step > 0 && (i + step) > fadeOpac) || (step < 0 && (i + step) < fadeOpac)) {
var last = new Object();
last.code = Game_Character.ROUTE_CHANGE_OPACITY;
last.parameters = [fadeOpac];
route.list.push(last);
i = fadeOpac - step;
}
}
}
route.list = this._moveRoute.list.slice(0,this._moveRouteIndex).concat(route.list).concat(this._moveRoute.list.slice(this._moveRouteIndex+1));
this._moveRoute.list = route.list;
this._moveRouteIndex--;
};
})();

View file

@ -0,0 +1,243 @@
//=============================================================================
// TDS Sketchbook
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_SketchBook = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.SketchBook = _TDS_.SketchBook || {};
//=============================================================================
/*:
* @plugindesc
* Sketchbook scene.
*
* @author TDS
*
*/
//=============================================================================
// Use Strict
"use strict";
//=============================================================================
// ** Scene_Sketchbook
//-----------------------------------------------------------------------------
// Scene for handling sketchbook processing.
//=============================================================================
function Scene_Sketchbook() { this.initialize.apply(this, arguments); };
Scene_Sketchbook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Sketchbook.prototype.constructor = Scene_Sketchbook;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_Sketchbook.prototype.initialize = function() {
// Album Settings
this._page = 0;
this._maxPages = $gameVariables.value(42);
this._sketchBookName = $gameVariables.value(43);
// Get Size
var size = $gameVariables.value(41);
this._width = size[0];
this._height = size[1];
// Super Call
Scene_MenuBase.prototype.initialize.call(this);
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_Sketchbook.prototype.initAtlastLists = function() {
// Run Original Function
Scene_MenuBase.prototype.initAtlastLists.call(this);
// Get Bitmap Name
var bitmapName = this._sketchBookName + this._page;
// Get Atlas Path
var atlasPath = 'img/pictures/' + bitmapName + '.png';
// Get Atlas Name
var atlasName = AtlasManager.getImageAtlasName(atlasPath);
// If Atlas name exists
if (atlasName) { this.addRequiredAtlas(atlasName); }
};
//=============================================================================
// * Create
//=============================================================================
Scene_Sketchbook.prototype.create = function() {
// Super Call
Scene_MenuBase.prototype.create.call(this);
// Create Objects
this.createSketchWindow();
this.createSketchBookSprite();
this.createCursorSprites();
this.onPageChange();
};
//=============================================================================
// * Create Sketch Window
//=============================================================================
Scene_Sketchbook.prototype.createSketchWindow = function() {
// Create Back Window
this._backWindow = new Window_Base(0, 0, this._width, this._height);
this._backWindow.x = (Graphics.width - this._backWindow.width) / 2;
this._backWindow.y = (Graphics.height - this._backWindow.height) / 2;
this.addChild(this._backWindow);
};
//=============================================================================
// * Create SketchBook Sprite
//=============================================================================
Scene_Sketchbook.prototype.createSketchBookSprite = function() {
this._sketchBookSprite = new Sprite();
this._sketchBookSprite.x = this._backWindow.x + 10;
this._sketchBookSprite.y = this._backWindow.y + 10;
this.addChild(this._sketchBookSprite);
};
//=============================================================================
// * Create Cursor Sprites
//=============================================================================
Scene_Sketchbook.prototype.createCursorSprites = function() {
// Get Cursor Bitmap
var bitmap = ImageManager.loadSystem("ACSArrows");
this._leftCursorSprite = new Sprite(bitmap);
this._leftCursorSprite.anchor.set(0.5, 0.5);
this._leftCursorSprite.setFrame(64, 0, 32, 29);
this._leftCursorSprite.x = this._backWindow.x - 10;
this._leftCursorSprite.y = this._backWindow.y + (this._backWindow.height / 2)
this.addChild(this._leftCursorSprite);
this._rightCursorSprite = new Sprite(bitmap);
this._rightCursorSprite.anchor.set(0.5, 0.5);
this._rightCursorSprite.setFrame(32, 0, 32, 29);
this._rightCursorSprite.x = this._backWindow.x + this._backWindow.width + 10;
this._rightCursorSprite.y = this._backWindow.y + (this._backWindow.height / 2)
this.addChild(this._rightCursorSprite);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_Sketchbook.prototype.update = function() {
// Super call
Scene_MenuBase.prototype.update.call(this);
// Update Cursor Animation
this._leftCursorSprite.anchor.x = 0.5 - (Math.sin(Graphics.frameCount * 0.2) * 0.1);
this._rightCursorSprite.anchor.x = 0.5 + (Math.sin(Graphics.frameCount * 0.2) * 0.1);
if (Input.isRepeated('left')) {
if (this._page > 0) {
// Play Cursor sound
SoundManager.playCursor();
// Reduce Page
this._page--;
// On Page Change
this.onPageChange();
};
return
}
if (Input.isRepeated('right')) {
if (this._page < this._maxPages) {
// Play Cursor sound
SoundManager.playCursor();
// Increase Page
this._page++;
// On Page Change
this.onPageChange();
};
return
}
if (Input.isTriggered('menu')) {
this.popScene();
return
}
};
//=============================================================================
// * On Page Change
//=============================================================================
Scene_Sketchbook.prototype.onPageChange = function() {
// Update Cursor Visibility
this._leftCursorSprite.visible = this._page > 0;
this._rightCursorSprite.visible = this._page < this._maxPages;
// Set Sketcbook Sprite Bitmap
this._sketchBookSprite.bitmap = ImageManager.loadPicture(this._sketchBookName + this._page)
};
// //=============================================================================
// /*:
// * @plugindesc
// * Sketchbook menu
// *
// * @author rhyme
// */
// //-----------------------------------------------------------------------------
// // Scene_Sketchbook
// //-----------------------------------------------------------------------------
// function Scene_Sketchbook() {
// this.initialize.apply(this, arguments);
// }
// Scene_Sketchbook.prototype = Object.create(Scene_MenuBase.prototype);
// Scene_Sketchbook.prototype.constructor = Scene_Sketchbook;
// // Initialize
// //-----------------------------------------------------------------------------
// Scene_Sketchbook.prototype.initialize = function() {
// Scene_MenuBase.prototype.initialize.call(this);
// };
// Scene_Sketchbook.prototype.create = function() {
// Scene_MenuBase.prototype.create.call(this);
// this.createSketchWindow();
// this.createSprites();
// };
// Scene_Sketchbook.prototype.createSketchWindow = function() {
// this._sketchWindow = new Window_Sketchbook();
// this.addWindow(this._sketchWindow);
// };
// Scene_Sketchbook.prototype.createSprites = function() {
// var cursorImage = ImageManager.loadSystem("ACSArrows", 0);
// this._spriteForeground = new Sprite();
// this._spriteForeground.setFrame(0, 0, Graphics.width, Graphics.height);
// this._spriteCursorLeft = new Sprite(cursorImage);
// this._spriteCursorLeft.setFrame(32, 0, 32, 29);
// this._spriteCursorLeft.x = Math.min(this._sketchWindow.x + this._sketchWindow.width - 16, Graphics.width - 36);
// this._spriteCursorLeft.y = (Graphics.height / 2) - 15;
// this._spriteCursorRight = new Sprite(cursorImage);
// this._spriteCursorRight.setFrame(64, 0, 32, 29);
// this._spriteCursorRight.x = Math.max(this._sketchWindow.x - 16, 36);
// this._spriteCursorRight.y = (Graphics.height / 2) - 15;
// this.addChild(this._spriteForeground);
// this._spriteForeground.addChild(this._spriteCursorLeft);
// this._spriteForeground.addChild(this._spriteCursorRight);
// this._customCursorAngle = 0;
// };
// // Update
// //-----------------------------------------------------------------------------
// Scene_Sketchbook.prototype.update = function() {
// Scene_MenuBase.prototype.update.call(this);
// this._customCursorAngle = ((this._customCursorAngle + 0.15) % 50);
// this._spriteCursorLeft.anchor.x = 0.5 - 0.1 * Math.sin(this._customCursorAngle);
// this._spriteCursorRight.anchor.x = 0.5 + 0.1 * Math.sin(this._customCursorAngle);
// if (this._sketchWindow.page() == 0) {
// this._spriteCursorRight.visible = false;
// } else {
// this._spriteCursorRight.visible = true;
// }
// if (this._sketchWindow.page() == $gameVariables.value(10)) {
// this._spriteCursorLeft.visible = false;
// } else {
// this._spriteCursorLeft.visible = true;
// }
// if (Input.isTriggered('left')) {
// this._sketchWindow.prevPage();
// }
// if (Input.isTriggered('right')) {
// this._sketchWindow.nextPage();
// }
// if (Input.isTriggered('menu')) {
// this.popScene();
// }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
// //=============================================================================
// // * Increase Game FPS
// //=============================================================================
// var _faster_ = Scene_Map_updateMainMultiply = Scene_Map.prototype.updateMainMultiply;
// Scene_Map.prototype.updateMainMultiply = function() {
// _faster_.call(this);
// this.updateMain();
// };
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Key Item Culling (Force to 1)
//=============================================================================
Game_Interpreter.prototype.keyItemCull = function() {
// List of Items to cull
var list = [850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875];
// Set Quantity of Items in list to 1
for (var i = 0; i < list.length; i++) {
// Get Item Id
var id = list[i];
// If Item Exists
if ($gameParty._items[id]) { $gameParty._items[id] = 1; };
};
};
//=============================================================================
// * Hide Event Markers
//=============================================================================
var Archeia = Archeia || {};
Archeia.Game_CharacterBase_isTransparent = Game_CharacterBase.prototype.isTransparent;
Game_CharacterBase.prototype.isTransparent = function() {
if (this.characterName() === 'DEV_TEST') return true;
return Archeia.Game_CharacterBase_isTransparent.call(this);;
};

View file

@ -0,0 +1,897 @@
var Imported = Imported || {};
Imported.TDDP_AnimationCurves = "1.0.3";
/*:
@author Tor Damian Design / Galenmereth
@plugindesc 1.0.3b Apply animation curves (easing functions) to Move Picture commands using simple Plugin Commands
@help
How it works
------------------------------------------------------------------------------
This plugin allows you to set animation curves (so-called easing functions)
to be used with Move Picture and Tint Picture events.
Demo mode
------------------------------------------------------------------------------
When playtesting your game, you can hit the demo key (default F11) to show
a visual representation of all the supported animation curves and their names.
If you hover over these with your mouse an animation plays, showing how the
curve affects a red ball's Y axis movement
General use
------------------------------------------------------------------------------
The Plugin Commands must be placed *before* the Move Picture or Tint Picture
events that they are to affect. They do not have to be placed within the same
event window, however, so you can put them in Common Events if you wish.
Once a Move Picture or Tint Picture event is fired off, the curves you
specified using the Plugin Commands are reset to use MV's default until you
add new Plugin Command entries.
Use the following Plugin Command syntax:
AnimationCurve <CurveFunction> <Property(optional)>
Example:
AnimationCurve QuadOut x
See the bottom of this help text for all available animation curves.
# Set curve for all properties
If you omit the property at the end in the Plugin Command (the x in the above
example), then the plugin will use the animation curve for all properties: x,
y, scaleX, scaleY, and opacity.
# Linear is the default fallback
When you do include a property, but have not added any Plugin Command entry
without a property, then all other properties are animated using linear
interpolation, which is MV's default.
# Different curves for different properties
This can be done by adding multiple Plugin Commands with an animation curve
for individual properties.
For example:
AnimationCurve ElasticInOut x
AnimationCurve QuadOut y
AnimationCurve CubicInOut opacity
If the above three PluginCommands are placed before a Move Picture event, then
the x, y and opacity properties are animated with their respective curves,
whilst the remainder (scaleX, scaleY) are animated with the default linear
interpolation.
Move Picture specific properties
------------------------------------------------------------------------------
The following properties are available for Move Picture events:
x, y, scaleX, scaleY, and opacity
scaleX corresponds to the "Width" property in the Move Picture event window,
and scaleY corresponds to the "Height" property.
Tint Picture specific properties
------------------------------------------------------------------------------
The following properties are available for Tint Picture events:
red, green, blue, gray
These correspond with the color sliders in the Tint Picture event window.
Supported animation curve functions
------------------------------------------------------------------------------
QuadIn QuadOut QuadInOut
CubicIn CubicOut CubicInOut
QuartIn QuartOut QuartInOut
QuintIn QuintOut QuintInOut
SineIn SineOut SineInOut
ExpoIn ExpoOut ExpoInOut
CircIn CircOut CircInOut
ElasticIn ElasticOut ElasticInOut
BackIn BackOut BackInOut
BounceIn BounceOut BounceInOut
Linear (MV default)
Key codes
------------------------------------------------------------------------------
Visit this URL for a complete overview:
https://keycode.info/
Some common key codes:
F10: 121
F11: 122 (default)
F12: 123
License
------------------------------------------------------------------------------
In short: Completely free, including for commercial use. Please consider
donating for further development of plugins and other material if you find
this plugin useful. See https://mvplugins.tordamian.com
MIT License
Copyright (c) 2019 Tor Damian Design
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@param Demo hotkey
@desc Key code for the hotkey used to display ingame curve demo overlay. See help for codes. Default 122 = F11 key
@type number
@default 122
@param Plugin Command key
@desc The plugin's "key" to use in Plugin Commands. You can customize this if you want to type less, or have a conflict
@type string
@default AnimationCurve
*/
/**
* @callback EasingFunction
* @param {number} t The current time
* @param {number} b The beginning value
* @param {number} c The change in value (target value - beginning value)
* @param {number} d Duration
*/
/**
* Wrapper object for all globally available properties of this plugin
* @namespace
*/
var TDDP_AnimationCurves = {
/**
* @property {Object} easingFunctions The available easing functions. Can be extended
*/
easingFunctions: {
// Easing unctions below from open source reference by McGinley Smith
// https://github.com/danro/jquery-easing/blob/master/jquery.easing.js
/**
* @type {EasingFunction}
*/
QuadIn: function(t, b, c, d) {
return c*(t/=d)*t + b;
},
/**
* @type {EasingFunction}
*/
QuadOut: function(t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
/**
* @type {EasingFunction}
*/
QuadInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
/**
* @type {EasingFunction}
*/
CubicIn: function(t, b, c, d) {
return c*(t/=d)*t*t + b;
},
/**
* @type {EasingFunction}
*/
CubicOut: function(t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
/**
* @type {EasingFunction}
*/
CubicInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
/**
* @type {EasingFunction}
*/
QuartIn: function(t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
/**
* @type {EasingFunction}
*/
QuartOut: function(t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
/**
* @type {EasingFunction}
*/
QuartInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
/**
* @type {EasingFunction}
*/
QuintIn: function(t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
/**
* @type {EasingFunction}
*/
QuintOut: function(t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
/**
* @type {EasingFunction}
*/
QuintInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
/**
* @type {EasingFunction}
*/
SineIn: function(t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
/**
* @type {EasingFunction}
*/
SineOut: function(t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
/**
* @type {EasingFunction}
*/
SineInOut: function(t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
/**
* @type {EasingFunction}
*/
ExpoIn: function(t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
/**
* @type {EasingFunction}
*/
ExpoOut: function(t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
/**
* @type {EasingFunction}
*/
ExpoInOut: function(t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
/**
* @type {EasingFunction}
*/
CircIn: function(t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
/**
* @type {EasingFunction}
*/
CircOut: function(t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
/**
* @type {EasingFunction}
*/
CircInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
/**
* @type {EasingFunction}
*/
ElasticIn: function(t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
/**
* @type {EasingFunction}
*/
ElasticOut: function(t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
/**
* @type {EasingFunction}
*/
ElasticInOut: function(t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
/**
* @type {EasingFunction}
*/
BackIn: function(t, b, c, d) {
var s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
/**
* @type {EasingFunction}
*/
BackOut: function(t, b, c, d) {
var s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
/**
* @type {EasingFunction}
*/
BackInOut: function(t, b, c, d) {
var s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
/**
* @type {EasingFunction}
*/
BounceIn: function(t, b, c, d) {
return c - TDDP_AnimationCurves.easingFunctions.BounceOut(d-t, 0, c, d) + b;
},
/**
* @type {EasingFunction}
*/
BounceOut: function(t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
/**
* @type {EasingFunction}
*/
BounceInOut: function(t, b, c, d) {
if (t < d/2) return TDDP_AnimationCurves.easingFunctions.BounceIn(t*2, 0, c, d) * .5 + b;
return TDDP_AnimationCurves.easingFunctions.BounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
},
/**
* @type {EasingFunction}
*/
Linear: function(t, b, c, d) {
return c * (t/d) + b;
}
},
/**
* @type {Object} The easingFunctions to use for the next call to Move Picture, if any
*/
nextEasingFunctions: undefined,
/**
* @property {Function} origin Store of the original overwritten methods
* @returns {object}
*/
origin: undefined,
/**
* @function setEasingFunction
* @param {EasingFunction} easingFunction The animation easingFunction function to use. @see TDDP_AnimationCurves.easingFunctions
* @param {string} [property='general'] The property to tie the animation curve to
*/
setEasingFunction: function(easingFunction, property) {},
/**
* Toggle showing demo and testing overlay ingame
* @function demo
*/
demo: function() {}
};
(function($) {
//=============================================================================
// Setting up plugin parameters
//=============================================================================
var parameters = $plugins.filter(function(p){return p.name == "TDDP_AnimationCurves"})[0].parameters;
var demoHotkey = Number(parameters['Demo hotkey']);
var pluginCommand = String(parameters['Plugin Command key']);
//=============================================================================
// Publicly accessible methods and variables (within namespace)
//=============================================================================
/**
* The easing function to use for the next Move Picture or MoveTint event
* @const {{Object.<string, EasingFunction>}}
* @example
* nextEasingFunctions['x'] => EasingFunction
*/
var nextEasingFunctions = undefined;
$.nextEasingFunctions = function() { return nextEasingFunctions }
/**
* Store of original overwritten methods
* @const {Object}
*/
var origin = {};
$.origin = function() { return origin };
/**
* @function setEasingFunction
* @param {EasingFunction|string} easingFunction The animation easingFunction to use. @see TDDP_AnimationCurves.easingFunctions
* @param {string} [property='general'] The property to tie the animation curve to
*/
function setEasingFunction(easingFunction, property) {
if (typeof easingFunction == 'string') {
_validateEasingFunction(easingFunction);
easingFunction = $.easingFunctions[easingFunction];
}
var property = property || 'general';
_validateEasingProperty(property);
_pushEasingFunction(property, easingFunction);
};
$.setEasingFunction = setEasingFunction;
/**
* @const {PIXI.Application}
*/
var demoSurface = undefined;
/**
* Toggle the ingame demo overlay
*/
function demo() {
if (demoSurface) {
document.body.removeChild(demoSurface.view);
demoSurface = undefined;
return;
}
_drawDemo();
}
$.demo = demo;
//=============================================================================
// Private internal functions
//=============================================================================
/**
* Validate an easing function. Throws an error if it doesn't match any
* key found. @see TDDP_AnimationCurves.easingFunctions
* @param {EasingFunction} easingFunction
*/
function _validateEasingFunction(easingFunction) {
var valid = Object.keys($.easingFunctions).find(function(value){
return value == easingFunction;
}) !== undefined;
if (!valid) throw new Error('TDDP_AnimationCurves | Invalid animation curve argument: "' + easingFunction + '". See plugin help for valid options.');
}
/**
* Whitelist of supported properties, to catch splelling ellols
* @type {string[]}
*/
var _propertyWhitelist = [
'general',
'x',
'y',
'scaleX',
'scaleY',
'opacity',
'red',
'blue',
'green',
'gray'
]
/**
* Validate an easing property using the _propertyWhitelist
* @param {string} easingProperty Property to validate
*/
function _validateEasingProperty(easingProperty) {
var valid = _propertyWhitelist.indexOf(easingProperty) >= 0
if (!valid) throw new Error('TDDP_AnimationCurves | Invalid target property: "' + easingProperty + '". See plugin help for valid options.');
}
/**
* Handle Plugin Command.
* Expects the following structure:
* args[0] = QuadOut - @see TDDP_AnimationCurves.easingFunctions
* args[1] = x, y, scaleX, scaleY, opacity - Default is 'general', meaning all
* @param {string[]} args
*/
function _handleCommand(args) {
var easingFunction = args[0];
if (easingFunction) {
setEasingFunction(easingFunction, args[1]);
}
}
/**
* @private
* @param {string} property
* @param {EasingFunction} easingFunction
*/
function _pushEasingFunction(property, easingFunction) {
nextEasingFunctions = nextEasingFunctions || {};
nextEasingFunctions[property] = easingFunction;
}
/**
* @callback EasingFunctionFactory
* @param {string} property The property to apply curve to
* @param {number} t Current time variable to pass on to EasingFunction
* @param {number} b Beginning value to pass on to EasingFunction
* @param {number} c The change in value to pass on to EasingFunction
* @param {number} d Duration to pass on to EasingFunction
*/
/**
*
* @param {Object.<string, EasingFunction>} easingFuncs The map of EasingFunctions
* @param {string} property
* @param {number} t Current time variable to pass on to EasingFunction
* @param {number} b Beginning value to pass on to EasingFunction
* @param {number} c The change in value to pass on to EasingFunction
* @param {number} d Duration to pass on to EasingFunction
*/
function _easingFunctionsFactory(easingFuncs, property, t, b, c, d) {
var easingFunction = undefined;
if (easingFuncs[property]) {
easingFunction = easingFuncs[property];
}
else if (easingFuncs['general']) {
easingFunction = easingFuncs['general'];
}
else {
// Fall back to default 'Linear' EasingFunction if there's no general function defined. Linear is equal to MV's default.
easingFunction = $.easingFunctions['Linear'];
}
return easingFunction(t, b, c, d);
}
/**
* Pluck the list of EasingFunctions, removing the list and wrapping them. @see _easingFunctionsFactory
* Resets nextEasingFunctions to undefined
* @return {(EasingFunctionFactory|undefined)}
*/
function _pluckEasingFunctions() {
if (nextEasingFunctions) {
var easingFunctions = _easingFunctionsFactory.bind(this, nextEasingFunctions);
nextEasingFunctions = undefined;
return easingFunctions;
}
else {
return undefined;
}
}
/**
* @callback ExecutableAnimFunction
* @param {number} time Current time
* @param {number} totalDuration
*/
/**
* Update movement of a Game_Picture instance using wrapped animation curve functions
* **this** is a *Game_Picture* instance
* @param {number} totalDuration
* @param {ExecutableAnimFunction[]} executableMoveFunctions
*/
var _updateMoveCurves = function(totalDuration, executableMoveFunctions) {
if (this._duration < 0) return;
var time = totalDuration - this._duration;
executableMoveFunctions.forEach(function(func) {
func(time, totalDuration);
})
this._duration--;
}
/**
* Update the tone of a Game_Picture instance using animation curve functions
* **this** is a *Game_Picture* instance
* @param {number} totalDuration
* @param {ExecutableAnimFunction[]} executableTintFunctions
*/
var _updateToneCurves = function(totalDuration, executableTintFunctions) {
if (this._toneDuration < 0) return;
var time = totalDuration - this._toneDuration;
executableTintFunctions.forEach(function(func) {
func(time, totalDuration);
})
this._toneDuration--;
}
//=============================================================================
// Game_Interpreter - register plugin command
//=============================================================================
origin.Game_Interpreter = {};
origin.Game_Interpreter.pluginCommand = Game_Interpreter.prototype.pluginCommand;
/**
* @param {string} command
* @param {string[]} args
*/
Game_Interpreter.prototype.pluginCommand = function(command, args) {
origin.Game_Interpreter.pluginCommand.call(this, command, args);
if (command === pluginCommand) _handleCommand(args);
}
//=============================================================================
// Game_Picture - extend methods
//=============================================================================
origin.Game_Picture = {};
/**
* List of overwritten or extended methods
*/
origin.Game_Picture.move = Game_Picture.prototype.move;
origin.Game_Picture.tint = Game_Picture.prototype.tint;
/**
* @param {number} originMode The picture ID origin - 0 = upper left, 1 = center
* @param {number} targetX
* @param {number} targetY
* @param {number} targetScaleX
* @param {number} targetScaleY
* @param {number} targetOpacity
* @param {number} blendMode
* @param {number} duration In frames
*/
Game_Picture.prototype.move = function(originMode, targetX, targetY, targetScaleX, targetScaleY, targetOpacity, blendMode, duration) {
origin.Game_Picture.move.call(this, originMode, targetX, targetY, targetScaleX, targetScaleY, targetOpacity, blendMode, duration);
var easingFunctions = _pluckEasingFunctions();
/** @type {ExecutableAnimFunction[]} */
var executableMoveFunctions = [];
// Preconfiguring these anonymous functions means we avoid doing unnecessary if/else checks during each update steps.
// This improves performance at the cost of an arguably negligible memory footprint.
if (targetX != this._x) executableMoveFunctions.push(function(x, time, totalDuration) {
this._x = easingFunctions('x', time, x, targetX - x, totalDuration);
}.bind(this, this._x))
if (targetY != this._y) executableMoveFunctions.push(function(y, time, totalDuration) {
this._y = easingFunctions('y', time, y, targetY - y, totalDuration);
}.bind(this, this._y))
if (targetScaleX != this._scaleX) executableMoveFunctions.push(function(scaleX, time, totalDuration) {
this._scaleX = easingFunctions('scaleX', time, scaleX, targetScaleX - scaleX, totalDuration);
}.bind(this, this._scaleX))
if (targetScaleY != this._scaleY) executableMoveFunctions.push(function(scaleY, time, totalDuration) {
this._scaleY = easingFunctions('scaleX', time, scaleY, targetScaleY - scaleY, totalDuration);
}.bind(this, this._scaleY))
if (targetOpacity != this._opacity) executableMoveFunctions.push(function(opacity, time, totalDuration) {
this._opacity = easingFunctions('opacity', time, opacity, targetOpacity - opacity, totalDuration);
}.bind(this, this._opacity))
if (easingFunctions) {
this.updateMove = _updateMoveCurves.bind(this, duration, executableMoveFunctions);
}
else {
this.updateMove = Game_Picture.prototype.updateMove.bind(this);
}
}
/**
* @const {string[]}
*/
var toneKeys = ['red', 'green', 'blue', 'gray']
/**
* @param {number[]} tone
* @param {number} duration
*/
Game_Picture.prototype.tint = function(tone, duration) {
origin.Game_Picture.tint.call(this, tone, duration);
var easingFunctions = _pluckEasingFunctions();
/** @type {ExecutableAnimFunction[]} */
var executableTintFunctions = [];
// As with Game_Picture.prototype.move, we preconfigure executable functions here for greater performance
tone.forEach(function(toneTarget, index) {
var toneKey = toneKeys[index];
var toneOrigin = this._tone[index];
if (toneTarget != this._tone[index]) {
executableTintFunctions.push(function(time, totalDuration) {
this._tone[index] = easingFunctions(toneKey, time, toneOrigin, toneTarget - toneOrigin, totalDuration);
}.bind(this))
}
}.bind(this))
if (easingFunctions) {
this.updateTone = _updateToneCurves.bind(this, duration, executableTintFunctions);
}
else {
this.updateTone = Game_Picture.prototype.updateTone.bind(this);
}
}
//=============================================================================
// Demo drawing method and key listener
//=============================================================================
/**
* Draws an ingame demo overlay to preview the animation curves
* This is a big function but it's only relevant during development. I'll
* likely compress it in the future.
*/
function _drawDemo() {
var screenWidth = window.innerWidth;
var screenHeight = window.innerHeight;
var surface = new PIXI.Application({
width: screenWidth,
height: screenHeight,
autoResize: true,
resolution: devicePixelRatio,
transparent: true
});
demoSurface = surface;
surface.view.style.overflow = 'hidden';
surface.view.style.position = 'absolute';
surface.view.style.top = 0;
surface.view.style.left = 0;
surface.view.style['z-index'] = 999;
document.body.appendChild(surface.view);
var container = new PIXI.Container();
surface.stage.addChild(container);
var bg = new PIXI.Graphics()
.beginFill(0x333333, 0.8)
.drawRect(0, 0, screenWidth, screenHeight)
.endFill();
container.addChild(bg);
var easingFunctions = Object.keys($.easingFunctions);
easingFunctions.pop() // Remove Linear
var total = easingFunctions.length;
var perRow = 5;
var rows = Math.ceil(total / perRow);
var margin = 10;
var width = (screenWidth - (margin * perRow)) / perRow;
var height = (screenHeight - (margin * rows)) / rows;
easingFunctions.forEach(function(name, index) {
var easingFunction = $.easingFunctions[name];
var col = index % perRow;
var row = Math.floor(index / perRow);
var x = col * (width + margin);
var y = row * (height + margin);
var sprite = new PIXI.Sprite()
.setTransform(x, y);
sprite.interactive = true;
sprite.buttonMode = true;
var graph = new PIXI.Graphics()
.beginFill(0xcdcdcd)
.drawRect(0, 0, width, height)
.endFill();
var innerPadding = 15;
graph
.lineStyle(3, 0x999999)
.moveTo(innerPadding, height - innerPadding);
var graphResolution = width + height / 100;
for (var i = 0; i < graphResolution; i++) {
var cx = $.easingFunctions.Linear(i, innerPadding, width - (innerPadding * 2), graphResolution);
var cy = easingFunction(i, height - innerPadding, -(height - (innerPadding * 2)), graphResolution);
graph.lineTo(cx, cy);
}
sprite.addChild(graph);
var text = new PIXI.Text(name, {
fontFamily: 'Helvetica',
fontSize: 24,
fill: 0xffffff,
align: 'center',
dropShadow: true,
dropShadowBlur: 6,
dropShadowDistance: 2,
dropShadowAlpha: 0.5
})
text.setTransform((width - text.width) / 2, (height - text.height) / 2);
text.alpha = 0.85;
sprite.addChild(text);
var ball1 = new PIXI.Graphics()
.beginFill(0x08080ff, 0.8)
.drawCircle(0, 0, 5)
.endFill()
.setTransform(innerPadding, height - innerPadding);
sprite.addChild(ball1);
var ball2 = new PIXI.Graphics()
.beginFill(0xee3333, 0.8)
.drawCircle(0, 0, 5)
.endFill()
.setTransform(innerPadding, height - innerPadding);
sprite.addChild(ball2);
sprite.on('pointerover', function() {
var time = 0;
var duration = 90;
var animator = function() {
if (time >= duration) surface.ticker.remove(animator);
var bx = $.easingFunctions.Linear(time, innerPadding, width - (innerPadding * 2), duration);
var by = easingFunction(time, height - innerPadding, -(height - (innerPadding * 2)), duration);
ball1.setTransform(bx, by);
bx = easingFunction(time, innerPadding, width - (innerPadding * 2), duration);
by = height - innerPadding;
ball2.setTransform(bx, by);
time++;
}
surface.ticker.add(animator);
})
container.addChild(sprite);
})
}
/**
* Enable demo hotkey if game is in test mode
*/
if (Utils.isOptionValid('test')) {
document.addEventListener('keydown', function(event) {
if (event.keyCode == demoHotkey) { demo() }
})
}
})(TDDP_AnimationCurves);

View file

@ -0,0 +1,327 @@
var Imported = Imported || {};
Imported.TDDP_MovePictureEx = "1.0.1";
/*:
@author Tor Damian Design / Galenmereth
@plugindesc 1.0.1 Plugin Command to use variables and relative values with Move Picture
@help
How it works
------------------------------------------------------------------------------
This plugin allows you to use variables for the values of Move Picture events,
as well as enabling you to omit properties (like x, opacity, and width) that
you do not want to change. It also allows you to use relative modifiers "+"
and "-" in your values, so you can for example make a picture move 100 pixels
from where it currently is, without having to keep track.
Integration with TDDP_AnimationCurves.
General usage
------------------------------------------------------------------------------
The Move Picture plugin command looks like this:
MovePicture <id> <property:value>
The id of the picture must come first. After that, the properties themselves
can be entered in any order you wish. Here's an example:
MovePicture 1 x:100 opacity:125 blendMode:Multiply duration:10
Any omitted properties default to their current values.
Values can also be relative, for example:
MovePicture 1 x:+150
This would move the picture 150 pixels to the right of where it currently is.
Likewise, negative values are supported as well:
MovePicture 99 y:-100 opacity:+25 width:-50
You can also use variables as values. This is done by simply typing a "v" and
the variable id, like so:
MovePicture 1 x:v1 y:v2
Blend Mode, Origin and Wait
------------------------------------------------------------------------------
For these properties, you do not have to use numbers as values. Instead, you
can use words as in the editor.
Property | Possible values
- - - - - -|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Blend Mode | "normal", "additive", "multiply", "screen"
Origin | "top_left", "center"
Wait | true, false
Wait can also be written without ":<value>", as simply "wait". This makes it
true. Example:
MovePicture 1 y:500 wait
The alues will be lower-cased internally, so feel free to write them however
you want.
List of properties
------------------------------------------------------------------------------
Property in editor | Property name / shorthand | Default value if omitted
- - - - - - - - - -|- - - - - - - - - - - - - -|- - - - - - - - - - - - - - -
Origin | origin / or | Current value
X | x | Current value
Y | y | Current value
Width | width / w / scaleX | Current value
Height | height / h / scaleY | Current value
Blend Mode | blendMode / b | Current value
Opacity | opacity / op | Current value
Wait | wait | False
Duration | duration / d | 60
- - - - - - - - - -|- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Curve | curve / c | Linear
Shorthands are shorter property names you can use if you find typing the whole
property name cumbersome.
NOTE: The "curve" property requires TDDP_AnimationCurves plugin.
TDDP_AnimationCurves integration
------------------------------------------------------------------------------
If you have the TDDP_AnimationCurves plugins installed, this plugin's
MovePicture Plugin Command works with it just like the built-in Move Picture
event command does.
You can also use the animation curves functions with this plugin directly
instead of having to make a separate Plugin Command entry in advance for it.
Simply type curve:<CurveFunction> and it'll work, like so:
MovePicture 1 curve:QuadInOut x: 200 y:100
However, if you want to have different curve for different properties, you'll
need separate Plugin Commands using TDDP_AnimationCurves' Plugin Command. This
is to avoid this plugin's Plugin Commands becoming very long and cumbersome to
read.
You can download TDDP_AnimationCurves here:
https://forums.rpgmakerweb.com/index.php?threads/animation-curves.108388/
Changelog
------------------------------------------------------------------------------
Date | Version | Description
- - - - - -|- - - - -|- - - - - - - - - - - - - - - - - - - - - - - - - - - -
03/05/2019 | 1.0.1 | Fix issue with unscoped origin var causing crashes with
| | my other plugins.
License
------------------------------------------------------------------------------
In short: Completely free, including for commercial use. Please consider
donating for further development of plugins and other material if you find
this plugin useful. See https://mvplugins.tordamian.com
MIT License
Copyright (c) 2019 Tor Damian Design
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@param movePictureCommand
@text Move Picture command key
@desc If you want to use a shorter Plugin Command key for, set it here. Default is "MovePicture"
@type string
@default MovePicture
*/
var TDDP_MovePictureEx = {};
(function($) {
"use strict";
//=============================================================================
// Setting up plugin parameters
//=============================================================================
var parameters = PluginManager.parameters("TDDP_MovePictureEx");
//=============================================================================
// Set up general variables
//=============================================================================
var origin = {};
//=============================================================================
// Game_Interpreter - register plugin command
//=============================================================================
origin.Game_Interpreter = {};
origin.Game_Interpreter.prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand;
/**
* @param {string} command
* @param {string[]} args
*/
Game_Interpreter.prototype.pluginCommand = function(command, args) {
origin.Game_Interpreter.prototype_pluginCommand.call(this, command, args);
if (command === parameters.movePictureCommand) _handleCommand(this, _movePicture, args);
}
//=============================================================================
// Private methods
//=============================================================================
var _relativeProperties = ['x', 'y', 'scaleX', 'scaleY', 'opacity'];
/**
* @typedef {Object} MovePictureParams
* @property {number} id The Picture ID
* @property {number} x
* @property {number} y
* @property {number} opacity
* @property {number} scaleX
* @property {number} scaleY
* @property {number} blendMode
* @property {number} origin
* @property {Boolean} wait
*/
/**
* @callback CommandHandler
* @param {Game_Interpreter} interpreter
* @param {MovePictureParams} p
*/
/**
* @param {Game_Interpreter} interpreter
* @param {CommandHandler} callback
* @param {string[]} args
*/
function _handleCommand(interpreter, callback, args) {
var id = args.shift();
if (id[0] == "v") {
id = $gameVariables.value(Number(id.slice(1)));
}
else {
id = Number(id);
}
var picture = $gameScreen.picture(id);
// Picture not added, ignore command
if (!picture) return;
var params = {
id: id
};
args.forEach(function(str) {
var param = _parseCommandParam(str);
if (param) {
if (param.value[0] == "v") param.value = $gameVariables.value(Number(param.value.slice(1)));
params[param.key] = param.value;
}
});
// Check alternative syntax before considering curve animations
params.scaleX = params.w || params.width || params.scaleX;
params.scaleY = params.h || params.height || params.scaleY;
params.opacity = params.op || params.opacity;
params.curve = params.c || params.curve;
if (params.curve && Imported.TDDP_AnimationCurves) {
TDDP_AnimationCurves.setEasingFunction(params.curve, 'general');
}
// Fallback to alternative syntax or defaults if undefined
params.x = params.x || picture.x();
params.y = params.y || picture.y();
params.scaleX = params.scaleX || picture.scaleX();
params.scaleY = params.scaleY || picture.scaleY();
params.opacity = params.opacity || picture.opacity();
params.duration = Number(params.d || params.duration || 60);
params.wait = params.wait || false;
params.origin = params.or || params.origin || picture.origin();
params.blendMode = params.b || params.blendMode || picture.blendMode();
// Resolve relative property values
_relativeProperties.forEach(function(prop) {
if (params[prop][0] == '+') return params[prop] = picture[prop]() + Number(params[prop].slice(1));
if (params[prop][0] == '-') return params[prop] = picture[prop]() - Number(params[prop].slice(1));
params[prop] = Number(params[prop]);
})
// Convert blend mode to integer value if string
if (typeof params.blendMode == "string") params.blendMode = _convertBlendModeString(params.blendMode);
// Convert origin to integer value if string
if (typeof params.origin == "string") params.origin = _convertOriginString(params.origin);
callback(interpreter, params);
}
var _blendModes = ["normal", "additive", "multiply", "screen"];
/**
*
* @param {string} str String to convert
*/
function _convertBlendModeString(str) {
return _blendModes.indexOf(str.toLowerCase()) || 0;
}
var _originIndices = ["upper_left", "center"]
/**
*
* @param {string} str String to convert
*/
function _convertOriginString(str) {
return _originIndices.indexOf(str.toLowerCase()) || 0;
}
/**
* @param {Game_Interpreter} interpreter
* @param {MovePictureParams} p
*/
function _movePicture(interpreter, p) {
$gameScreen.movePicture(p.id, p.origin, p.x, p.y, p.scaleX,
p.scaleY, p.opacity, p.blendMode, p.duration);
if (p.wait) {
interpreter.wait(p.duration);
}
}
/**
* CommandParam type
* @typedef {Object} CommandParam
* @param {string} key
* @param {any} value
*/
/**
* @type {RegExp} _pluginCommandParseRegExp
*/
var _pluginCommandParseRegExp = /([A-zA-Z]+):(\S+)/;
/**
* Parse Plugin Command arguments
* @param {string} str String to parse
* @return {(CommandParam|undefined)}
*/
function _parseCommandParam(str) {
if (str == "wait") return {key: "wait", value: true};
if (str.length > 0) var parsed = _pluginCommandParseRegExp.exec(str);
if (parsed && parsed[1]) {
return {
key: parsed[1],
value: parsed[2]
}
}
else {
return undefined;
}
}
})(TDDP_MovePictureEx);

View file

@ -0,0 +1,116 @@
//=============================================================================
// TDDP_NoFastForward
// Version: 2.1.0
//=============================================================================
var Imported = Imported || {};
Imported.TDDP_NoFastForward = "2.1.0";
/*:
* @plugindesc 2.1.0 Disables the ability to fast forward move routes and/or text. id:TDDP_NoFastForward
* @author Tor Damian Design / Galenmereth
*
* @param Disable for Move Routes
* @desc If set to true this will disable fast-forwarding for Move Routes globally. Default is false.
* @default false
*
* @param Disable for Show Text
* @desc If set to true this will disable fast-forwarding for Show Text globally. Default is false.
* @default false
*
* @help =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
* Information
* =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
* For updates and easy to use documentation, please go to the plugin's website:
* http://mvplugins.tordamian.com/?p=376
*
* There you can also download a PDF of the documentation for offline use, and
* having the documentation in one cleanly presented place means you can always
* be sure it's the most recent available.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Terms & Conditions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* This plugin is free for both non-commercial and commercial use. Please see
* http://mvplugins.tordamian.com/terms-of-use for the full terms of use.
*/
TDDP_NoFastForward = {};
(function($) {
//=============================================================================
// Setting up parameters and internal funcs. All bound to TDDP_NoFastForward object
//=============================================================================
$._parameters = $plugins.filter(function(p){return p.description.contains("id:TDDP_NoFastForward")})[0].parameters;
$._disableGlobalMoveRouteFF = Boolean($._parameters['Disable for Move Routes'] === 'true' || false);
$._disableGlobalTextFF = Boolean($._parameters['Disable for Show Text'] === 'true' || false);
/**
* Disable text Fast Forwarding
* @method disableTextFF
*/
$.disableTextFF = function() {
this._textFfDisabled = true;
}
/**
* Enable text Fast Forwarding
* @method enableTextFF
*/
$.enableTextFF = function() {
this._textFfDisabled = false;
}
$.disableNextTextFF = function() {
this._nextTextFfDisabled = true;
}
$.resetDisableNextTextFF = function() {
this._nextTextFfDisabled = false;
}
/**
* Get if text Fast Forwarding is disabled
* @method isTextFfDisabled
*/
$.isTextFfDisabled = function() {
if (this._nextTextFfDisabled || this._textFfDisabled || this._disableGlobalTextFF) return true;
return false;
}
//=============================================================================
// Game_Interpreter - register plugin commands
//=============================================================================
/**
* @CHANGED Adding DisableTextFF command
*/
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args)
command = command.toUpperCase();
if (command === 'ENABLETEXTFF') $.enableTextFF();
if (command === 'DISABLETEXTFF') $.disableTextFF();
if (command === 'DISABLENEXTTEXTFF') $.disableNextTextFF();
};
//=============================================================================
// Scene_Map
//=============================================================================
/**
* @CHANGED Adding support for disabling move route fast forward
*/
Scene_Map_prototype_isFastForward = Scene_Map.prototype.isFastForward;
Scene_Map.prototype.isFastForward = function() {
if ($._disableGlobalMoveRouteFF) return false;
return Scene_Map_prototype_isFastForward.call(this);
};
//=============================================================================
// Window_Message
//=============================================================================
/**
* @CHANGED Extending to run resetDisableNextTextFF()
*/
Window_Message_prototype_onEndOfText = Window_Message.prototype.onEndOfText;
Window_Message.prototype.onEndOfText = function() {
$.resetDisableNextTextFF(); // Re-enable local text FF
Window_Message_prototype_onEndOfText.call(this);
};
/**
* @CHANGED Supports disabling text fast forward
*/
var Window_Message_prototype_updateShowFast = Window_Message.prototype.updateShowFast;
Window_Message.prototype.updateShowFast = function() {
//if ($.isTextFfDisabled()) return false;
if(!ConfigManager.textSkip) {return false;}
return Window_Message_prototype_updateShowFast.call(this);
};
})(TDDP_NoFastForward);

View file

@ -0,0 +1,567 @@
//=============================================================================
// TDS Footprints
// Version: 1.6
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_Footprints = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.Footprints = _TDS_.Footprints || {};
//=============================================================================
/*:
* @plugindesc
* Adds footprints for characters.
*
* @author TDS
*
*/
//=============================================================================
(function($) {
// Use Strict
"use strict";
//=============================================================================
// ** SceneManager
//-----------------------------------------------------------------------------
// The static class that manages scene transitions.
//=============================================================================
// * Add Footprint
//=============================================================================
SceneManager.addFootprint = function(footprint) {
// If on Scene Map
if (SceneManager._scene.constructor === Scene_Map) {
// Add Footprint object to map
$gameMap.addFootprint(footprint);
// Get Container
let container = SceneManager._scene._spriteset._footprintsContainer;
// Add Footprint to container
container.addFootprint(footprint);
};
};
//=============================================================================
// ** Game_CharacterBase
//-----------------------------------------------------------------------------
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.
//=============================================================================
// Alias Listing
//=============================================================================
$.Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
$.Game_CharacterBase_moveStraight = Game_CharacterBase.prototype.moveStraight;
//=============================================================================
// * Initialize Members
//=============================================================================
Game_CharacterBase.prototype.initMembers = function() {
// Run Original Function
$.Game_CharacterBase_initMembers.call(this);
// Set Disable Footprints flag
this._disableFootprints = true;
// Initialize Footprint position
this._footprintPos = new Point();
// Set Last Direction
this._lastDirection = this._direction;
};
//=============================================================================
// * Determine if Character can create footprints
//=============================================================================
Game_CharacterBase.prototype.canCreateFootprints = function() {
return !this._disableFootprints;
};
//=============================================================================
// * Move Straight
//=============================================================================
Game_CharacterBase.prototype.moveStraight = function(d) {
// Get Old Values
let oldX = this._realX, oldY = this._realY, oldDir = d;
// Set Last Direction
this._lastDirection = this._direction;
// Run Original Function
$.Game_CharacterBase_moveStraight.call(this, d);
// If position has changed
if (!!this.isMoving()) {
// Set Footprint Position
if(typeof this._footprintPos === "undefined") {
this._footprintPos = new Point();
}
this._footprintPos.set(oldX, oldY);
// Process Footprint Movement
this.footprintMovement();
};
};
//=============================================================================
// * Process Footprint Movement
//=============================================================================
Game_CharacterBase.prototype.footprintMovement = function() {
// If Can Create Footprints
if (this.canCreateFootprints()) {
// Generate Footprint
let footprint = this.genererateFootprint();
if(!footprint) {return;}
// Add Footprint
SceneManager.addFootprint(footprint);
};
};
//=============================================================================
// * Name of Character Footprints Graphic
//=============================================================================
Game_CharacterBase.prototype.footprintGraphicsName = function() {
return 'footprints_turn';
}
//=============================================================================
// * Generate Footprint Object
//=============================================================================
Game_CharacterBase.prototype.genererateFootprint = function() {
if($gameMap.regionId(this._footprintPos.x, this._footprintPos.y) !== 28) {return null;}
// Create Footprint Object
let footprint = new Game_Footprint();
footprint._graphicsName = this.footprintGraphicsName();
footprint._frame = this.pattern();
footprint._direction = this._direction;
footprint._lastDirection = this._lastDirection;
footprint.setPosition(this._footprintPos.x, this._footprintPos.y);
// Return Footprint
return footprint;
};
//=============================================================================
// ** Game_Player
//-----------------------------------------------------------------------------
// The game object class for the player. It contains event starting
// determinants and map scrolling functions.
//=============================================================================
// * Determine if Character can create footprints
//=============================================================================
Game_Player.prototype.canCreateFootprints = function() {
if ($gameSwitches.value(881)) { return false; };
if (this.regionId() !== 28) { return false; };
return true;
};
//=============================================================================
// * Name of Character Footprints Graphic
//=============================================================================
Game_Player.prototype.footprintGraphicsName = function() {
if ($gameSwitches.value(84)) { return 'bloody_footprints'}
return 'footprints_turn';
};
//=============================================================================
// ** Game_Follower
//-----------------------------------------------------------------------------
// The game object class for a follower. A follower is an allied character,
// other than the front character, displayed in the party.
//=============================================================================
// * Determine if Character can create footprints
//=============================================================================
Game_Follower.prototype.canCreateFootprints = function() {
return false
};
//=============================================================================
// ** Game_Map
//-----------------------------------------------------------------------------
// The game object class for a map. It contains scrolling and passage
// determination functions.
//=============================================================================
// Alias Listing
//=============================================================================
$.Game_Map_initialize = Game_Map.prototype.initialize;
$.Game_Map_setup = Game_Map.prototype.setup;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Map.prototype.initialize = function() {
// Run Original Function
$.Game_Map_initialize.call(this);
// Initialize Footprints
this.initFootprints();
};
//=============================================================================
// * Setup
//=============================================================================
Game_Map.prototype.setup = function(mapId) {
// Run Original Function
$.Game_Map_setup.call(this, mapId);
// Initialize Footprints
this.initFootprints();
};
//=============================================================================
// * Initialize Footprints
//=============================================================================
Game_Map.prototype.initFootprints = function() {
// Initialize Footprints Array
this._footprints = [];
};
//=============================================================================
// * Get Footprints
//=============================================================================
Game_Map.prototype.footprints = function() { return this._footprints; };
//=============================================================================
// * Add Footprints
//=============================================================================
Game_Map.prototype.addFootprint = function(footprint) {
// If Footprint exist add it to array
if (footprint) { this._footprints.push(footprint); };
};
//=============================================================================
// * Remove Footprints
//=============================================================================
Game_Map.prototype.removeFootprint = function(footprint) {
// Get Fooprint Index
var index = this._footprints.indexOf(footprint);
// If Index is more than 0
if (index >= 0) {
footprint.remove();
this._footprints.splice(index, 1);
};
};
//=============================================================================
// ** Game_Footprint
//-----------------------------------------------------------------------------
// The game object class for footprints and other stepping effects.
//=============================================================================
function Game_Footprint() { this.initialize.apply(this, arguments); }
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Footprint.prototype.initialize = function() {
// Set X & Y Coordinates
this._x = 0; this._y = 0;
// Rows and Colums
this._rows = 4;
this._columns = 3;
// Graphics Properties
this._graphicsName = 'footprints_turn';
this._index = 0;
this._frame = 0;
this._direction = 0;
// Duration
this._duration = 60;
// Set Opacity
this._opacity = 255;
// Fading Speed
this._fadeSpeed = 20;
// Removed Flag
this._removed = false;
};
//=============================================================================
// * Determine if finished
//=============================================================================
Game_Footprint.prototype.isFinished = function() {
if (this._opacity <= 0) { return true;}
if (this._removed) { return true; }
return false;
};
//=============================================================================
// * Set Position
//=============================================================================
Game_Footprint.prototype.setPosition = function(x, y) { this._x = x, this._y = y};
//=============================================================================
// * Remove
//=============================================================================
Game_Footprint.prototype.remove = function() { this._removed = true; };
//=============================================================================
// * Setup Graphics
//=============================================================================
Game_Footprint.prototype.setupGraphics = function(name, rows = 4, columns = 4) {
// Set Graphics Properties
this._graphicsName = name;
this._rows = rows;
this._columns = columns;
};
//=============================================================================
// * Frame Update
//=============================================================================
Game_Footprint.prototype.update = function() {
// Decrease Duration
if (this._duration > 0 ) {
// Reduce duration
this._duration--;
} else {
// Reduce Opacity by fade speed
this._opacity -= this._fadeSpeed;
};
};
//=============================================================================
// ** Spriteset_Map
//-----------------------------------------------------------------------------
// The set of sprites on the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
$.Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
//=============================================================================
// * Create Screen Sprites
//=============================================================================
Spriteset_Map.prototype.createLowerLayer = function() {
// Run Original Function
$.Spriteset_Map_createLowerLayer.call(this);
// Create Footprints Layer
this.createFootprintsLayer();
};
//=============================================================================
// * Create Footprints Layer
//=============================================================================
Spriteset_Map.prototype.createFootprintsLayer = function() {
// Create Footprints Layer
this._footprintsContainer = new Footprints_Container();
this._footprintsContainer.z = 3;
this._tilemap.addChild(this._footprintsContainer);
};
//=============================================================================
// ** Footprints Container
//-----------------------------------------------------------------------------
// Container for Footprints.
//=============================================================================
function Footprints_Container() { this.initialize.apply(this, arguments); }
Footprints_Container.prototype = Object.create(PIXI.Container.prototype);
Footprints_Container.prototype.constructor = Footprints_Container;
//=============================================================================
// * Object Initialization
//=============================================================================
Footprints_Container.prototype.initialize = function() {
// Super Call
PIXI.Container.call(this);
// Set Width & Height
this._width = Graphics.width;
this._height = Graphics.height;
// Origin Position
this.origin = new Point();
// Initialize Sprites Array
this._sprites = [];
// Get Footprints
let footprints = $gameMap.footprints();
// Go through Footprint Objects
for (let i = 0; i < footprints.length; i++) {
// Get Footprint
let footprint = footprints[i];
// If footprint is not finished
if (!footprint.isFinished()) {
// Create Footprint
this.addFootprint(footprint)
};
};
};
//=============================================================================
// * Add Footprint
//=============================================================================
Footprints_Container.prototype.addFootprint = function(footprint) {
// Create Footprint Sprite
var sprite = new Sprite_Footprint(footprint);
// Add new Footprint Sprite
this._sprites.push(sprite);
// Add child
this.addChild(sprite);
// Return created sprite
return sprite;
};
//=============================================================================
// * Remove Footprint
//=============================================================================
Footprints_Container.prototype.removeFootprint = function(sprite) {
// Get Sprite Index
let index = this._sprites.indexOf(sprite);
// If Index is more than 0
if (index >= 0) {
// Remove footprint object from map
$gameMap.removeFootprint(sprite._footprint);
this._sprites.splice(index, 1);
this.removeChild(sprite);
};
};
//=============================================================================
// * Frame Update
//=============================================================================
Footprints_Container.prototype.update = function() {
// Go through sprites
/*this._sprites.forEach( function(sprite) {
// Update Sprite Position
sprite.x = sprite.screenX() - this.origin.x;
sprite.y = sprite.screenY() - this.origin.y;
// Update Sprite
sprite.update();
// If Sprite is Finished remove it
if (sprite.isFinished()) { this.removeFootprint(sprite); };
}, this);*/
if(this._sprites.length <= 0) {return;}
for(let sprite of this._sprites) {
sprite.x = sprite.screenX() - this.origin.x;
sprite.y = sprite.screenY() - this.origin.y;
sprite.update();
if(!!sprite.isFinished()) {this.removeFootprint(sprite)}
}
};
//=============================================================================
// * Remove all footprints
//=============================================================================
Footprints_Container.prototype.removeAll = function() {
if(this._sprites.length <= 0) {return;}
for(let sprite of this._sprites) {
this.removeFootprint(sprite);
}
}
//=============================================================================
// ** Sprite_Footprint
//-----------------------------------------------------------------------------
// Sprite for displaying footprints
//=============================================================================
function Sprite_Footprint() { this.initialize.apply(this, arguments);}
Sprite_Footprint.prototype = Object.create(Sprite.prototype);
Sprite_Footprint.prototype.constructor = Sprite_Footprint;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_Footprint.prototype.initialize = function(footprint) {
// Super Call
Sprite.prototype.initialize.call(this);
// Set Footprint Object
this._footprint = footprint;
// Setup Bitmap
this.bitmap = ImageManager.loadCharacter(footprint._graphicsName);
// Set Finished Flag
this._finished = false;
this._mapPos = new Point(footprint._x, footprint._y);
// Set Opacity
this.opacity = footprint._opacity;
this.bitmap.addLoadListener(() => {
this.setupBitmap(footprint);
})
};
//=============================================================================
// * Determine if Finished
//=============================================================================
Sprite_Footprint.prototype.isFinished = function() { return this._finished; };
//=============================================================================
// * Screen X Position
//=============================================================================
Sprite_Footprint.prototype.screenX = function() {
const scrolledX = $gameMap.adjustX(this._mapPos.x);
const tw = $gameMap.tileWidth();
return Math.round(scrolledX * tw);
};
//=============================================================================
// * Screen Y Position
//=============================================================================
Sprite_Footprint.prototype.screenY = function() {
const scrolledY = $gameMap.adjustY(this._mapPos.y);
const th = $gameMap.tileHeight();
return Math.round(scrolledY * th) ;
};
//=============================================================================
// * Setup Bitmap
//=============================================================================
Sprite_Footprint.prototype.setupBitmap = function(footprint = this._footprint) {
// Get Bitmap
let lastDirection = footprint._lastDirection;
let direction = footprint._direction
let dIndex = (direction / 2) - 1;
let width = this.bitmap.width / (footprint._columns + 2);
let height = this.bitmap.height / footprint._rows;
let sy = dIndex * height;
let sx = (footprint._frame % 3) * width;
// If Direction does not match last direction
if (direction !== lastDirection) {
// Set Index
let index = 0;
// Set Skip Flag
let skip = false;
switch (lastDirection) {
case 2:
switch (direction) {
case 4: index = 1 ;break;
case 6: index = 0 ;break;
case 2:
case 8: skip = true ;break;
};
break;
case 4:
switch (direction) {
case 2: index = 0 ;break;
case 8: index = 1 ;break;
case 4:
case 6: skip = true ;break;
};
break;
case 6:
switch (direction) {
case 2: index = 0 ;break;
case 8: index = 1 ;break;
case 4:
case 6: skip = true ;break;
};
break;
case 8:
switch (direction) {
case 4: index = 1 ;break;
case 6: index = 0 ;break;
case 2:
case 8: skip = true ;break;
};
}
// If not skipping
if (!skip) {
sx = (footprint._columns * width) + (index * width);
sy = ((lastDirection / 2) - 1) * height;
};
};
// Set Frame
this.setFrame(sx, sy, width, height);
};
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_Footprint.prototype.update = function() {
// Super Call
Sprite.prototype.update.call(this);
// If it has footprint object
if (this._footprint) {
// Update Footprint
this._footprint.update();
// Set Opacity
this.opacity = this._footprint._opacity;
// If footprint is finished
if (this._footprint.isFinished()) {
// Set Finished flag to true
this._finished = true;
}
} else {
// Set Finished flag to true
this._finished = true;
};
};
})(_TDS_.Footprints);

View file

@ -0,0 +1,557 @@
//=============================================================================
// TDS Map Fog
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_MapFog = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.MapFog = _TDS_.MapFog || {};
//=============================================================================
/*:
* @plugindesc
* Adds fog sprites to map.
*
* @author TDS
*
*/
//=============================================================================
(function($) {
// Use Strict
"use strict";
//=============================================================================
// ** ImageManager
//-----------------------------------------------------------------------------
// The static class that loads images, creates bitmap objects and retains them.
//=============================================================================
// * Load Overlay Image
//=============================================================================
ImageManager.loadOverlay = function(filename, hue) {
return this.loadBitmap('img/overlays/', filename, hue, true);
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Generate Map Fog
//=============================================================================
Game_Interpreter.prototype.generateMapFog = function() { return new Game_MapFog(); };
//=============================================================================
// * Create Map Fog
//=============================================================================
Game_Interpreter.prototype.createMapFog = function(id, fog) {
// Get Container
let container = SceneManager._scene._spriteset._mapFogContainer;
// Add Map Fog
$gameMap.addMapFog('fog1', fog);
if (container) { container.addFog(id); };
};
//=============================================================================
// ** Game_Map
//-----------------------------------------------------------------------------
// The game object class for a map. It contains scrolling and passage
// determination functions.
//=============================================================================
// Alias Listing
//=============================================================================
$.Game_Map_initialize = Game_Map.prototype.initialize;
$.Game_Map_setup = Game_Map.prototype.setup;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Map.prototype.initialize = function() {
// Run Original Function
$.Game_Map_initialize.call(this);
// Initialize Map Fog
this.clearMapFogs();
};
//=============================================================================
// * Clear Map Fogs
//=============================================================================
Game_Map.prototype.clearMapFogs = function() {
if (this._mapFogs) { delete this._mapFogs; };
// Initialize Map Fogs Object
this._mapFogs = {}
};
//=============================================================================
// * Get Map Fog
//=============================================================================
Game_Map.prototype.getMapFog = function(name) { return this._mapFogs[name]; };
//=============================================================================
// * Add Map Fog
//=============================================================================
Game_Map.prototype.addMapFog = function(name, fog) { this._mapFogs[name] = fog; };
//=============================================================================
// * Remove Map Fog
//=============================================================================
Game_Map.prototype.removeMapFog = function(name) { delete this._mapFogs[name]; };
//=============================================================================
// ** Game_MapFog
//-----------------------------------------------------------------------------
// The game object class for Map Fog.
//=============================================================================
function Game_MapFog() { this.initialize.apply(this, arguments); }
//=============================================================================
// * Object Initialization
//=============================================================================
Game_MapFog.prototype.initialize = function(id) {
this._id = id;
this.name = '';
this.opacity = 255;
this.blendMode = 0;
this.scaleX = 1;
this.scaleY = 1;
this.moveX = 0;
this.moveY = 0;
this.width = Graphics.width;
this.height = Graphics.height;
this.mapBind = true;
this.visible = true;
this.deactivateOnInvisible = true;
this.active = true;
this.priority = 0;
this.origin = new Point();
this.move = new Point();
};
//=============================================================================
// * Show
//=============================================================================
Game_MapFog.prototype.show = function() {
this.visible = true;
this.active = true;
}
//=============================================================================
// ** Spriteset_Map
//-----------------------------------------------------------------------------
// The set of sprites on the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
$.Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
//=============================================================================
// * Create Lower Layer
//=============================================================================
Spriteset_Map.prototype.createLowerLayer = function() {
// Run Original Function
$.Spriteset_Map_createLowerLayer.call(this);
// Create Map Fog Container
this.createMapFogContainer();
};
//=============================================================================
// * Create Map Fog Container
//=============================================================================
Spriteset_Map.prototype.createMapFogContainer = function() {
// Create Map Fog Container
this._mapFogContainer = new Sprite_MapFogContainer();
this.addChild(this._mapFogContainer);
};
//=============================================================================
// ** MapFog Container
//-----------------------------------------------------------------------------
// Container for Map Fog.
//=============================================================================
function Sprite_MapFogContainer() { this.initialize.apply(this, arguments); }
Sprite_MapFogContainer.prototype = Object.create(PIXI.Container.prototype);
Sprite_MapFogContainer.prototype.constructor = Sprite_MapFogContainer;
//=============================================================================
// * Object Initialization
//=============================================================================
Sprite_MapFogContainer.prototype.initialize = function() {
// Super Call
PIXI.Container.call(this);
// Initialize Sprites Array
this._sprites = []
// Get Map Fogs
let mapFogs = Object.entries($gameMap._mapFogs)
// Sort Map Fogs
mapFogs = mapFogs.sort(function(a, b) {
return a[1].priority - b[1].priority;
});
// Add Map Fog
for (let i = 0; i < mapFogs.length; i++) { this.addFog(mapFogs[i][0]); };
// this.addFog('titties');
// this.addFog('fog2');
// // Set Width & Height
// this._width = Graphics.width;
// this._height = Graphics.height;
// // Origin Position
// this.origin = new Point();
// // Initialize Sprites Array
// this._sprites = [];
// // Get MapFog
// let MapFog = $gameMap.MapFog();
// // Go through Footprint Objects
// for (let i = 0; i < MapFog.length; i++) {
// // Get Footprint
// let footprint = MapFog[i];
// // If footprint is not finished
// if (!footprint.isFinished()) {
// // Create Footprint
// this.addFootprint(footprint)
// };
// };
// this._fogSprite = new Sprite_MapFog();
// this.addChild(this._fogSprite)
};
//=============================================================================
// * Add Fog
//=============================================================================
Sprite_MapFogContainer.prototype.addFog = function(id) {
// Check for ID duplicates
let idCheck = this._sprites.some(function(sprite) { return sprite._id === id });
// If ID check then return
if (idCheck) { return; };
// Get Map fog data
let data = $gameMap.getMapFog(id);
// If Data Exists
if (data) {
let sprite = new Sprite_MapFog(id);
this._sprites.push(sprite);
this.addChild(sprite);
};
};
//=============================================================================
// * Remove Fog
//=============================================================================
Sprite_MapFogContainer.prototype.removeFog = function(fog) {
// Get Sprite Index
let index = this._sprites.indexOf(fog);
// If Index is more than 0
if (index >= 0) {
this._sprites.splice(index, 1);
this.removeChild(fog);
};
};
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_MapFogContainer.prototype.update = function() {
// Go through sprites
this._sprites.forEach( function(sprite) {
// Update Sprite
sprite.update();
}, this);
};
//=============================================================================
// ** Sprite_MapFog
//-----------------------------------------------------------------------------
// Sprite for displaying Map Fog.
//=============================================================================
function Sprite_MapFog() { this.initialize.apply(this, arguments);}
Sprite_MapFog.prototype = Object.create(TilingSprite.prototype);
Sprite_MapFog.prototype.constructor = Sprite_MapFog;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_MapFog.prototype.initialize = function(id) {
// Super Call
TilingSprite.prototype.initialize.call(this);
// Set ID
this._id = id;
// Set Bitmap name
this._bitmapName = '';
// Update
this.update();
};
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_MapFog.prototype.update = function() {
// Super Call
TilingSprite.prototype.update.call(this);
// Get Data
let data = $gameMap.getMapFog(this._id);
// If Data Exists
if (data && data.active) {
// If Bitmap name has changed
if (this._bitmapName !== data.name) {
// Set bitmap
this.bitmap = ImageManager.loadOverlay(data.name);
this.move(0, 0, data.width, data.height);
this._bitmapName = data.name;
};
// Apply Data
this.opacity = data.opacity;
this.blendMode = data.blendMode;
this.scale.x = data.scaleX;
this.scale.y = data.scaleY;
this.visible = data.visible;
// Deactivate if not visible
if (!data.visible && data.deactivateOnInvisible) { data.active = false; };
// If Bitmap width is more than 0
if (this.bitmap.width > 0) {
// Set Base Origin Position
data.origin.x = (data.origin.x + data.move.x) % this.bitmap.width;
data.origin.y = (data.origin.y + data.move.y) % this.bitmap.height;
// Set Origin
this.origin.x = data.origin.x;
this.origin.y = data.origin.y;
// If Fog should be boudn to map
if (data.mapBind) {
this.origin.x += ($gameMap.displayX() * $gameMap.tileWidth())
this.origin.y += ($gameMap.displayY() * $gameMap.tileHeight());
};
};
} else {
// Remove From parent
this.parent.removeFog(this);
};
};
})(_TDS_.MapFog);
/*
//=============================================================================
// ** SceneManager
//-----------------------------------------------------------------------------
// The static class that manages scene transitions.
//=============================================================================
// * Add Footprint
//=============================================================================
SceneManager.addFootprint = function(footprint) {
// If on Scene Map
if (SceneManager._scene.constructor === Scene_Map) {
// Add Footprint object to map
$gameMap.addFootprint(footprint);
// Get Container
let container = SceneManager._scene._spriteset._MapFogContainer;
// Add Footprint to container
container.addFootprint(footprint);
};
};
//=============================================================================
// ** Game_CharacterBase
//-----------------------------------------------------------------------------
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.
//=============================================================================
// Alias Listing
//=============================================================================
$.Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
$.Game_CharacterBase_moveStraight = Game_CharacterBase.prototype.moveStraight;
//=============================================================================
// * Initialize Members
//=============================================================================
Game_CharacterBase.prototype.initMembers = function() {
// Run Original Function
$.Game_CharacterBase_initMembers.call(this);
// Set Disable MapFog flag
this._disableMapFog = true;
// Initialize Footprint position
this._footprintPos = new Point();
// Set Last Direction
this._lastDirection = this._direction;
};
//=============================================================================
// * Determine if Character can create MapFog
//=============================================================================
Game_CharacterBase.prototype.canCreateMapFog = function() {
return this._disableMapFog;
};
//=============================================================================
// * Move Straight
//=============================================================================
Game_CharacterBase.prototype.moveStraight = function(d) {
// Get Old Values
let oldX = this._x, oldY = this._y, oldDir = d;
// Set Last Direction
this._lastDirection = this._direction;
// Run Original Function
$.Game_CharacterBase_moveStraight.call(this, d);
// If position has changed
if (oldX !== this._x || oldY !== this._y || oldDir !== this._direction) {
// Set Footprint Position
this._footprintPos.set(oldX, oldY);
// Process Footprint Movement
this.footprintMovement();
};
};
//=============================================================================
// * Process Footprint Movement
//=============================================================================
Game_CharacterBase.prototype.footprintMovement = function() {
// If Can Create MapFog
if (this.canCreateMapFog()) {
// Add Footprint
SceneManager.addFootprint(this.genererateFootprint());
};
};
//=============================================================================
// * Generate Footprint Object
//=============================================================================
Game_CharacterBase.prototype.genererateFootprint = function() {
// Create Footprint Object
let footprint = new Game_MapFog();
footprint._frame = this.pattern();
footprint._direction = this._direction;
footprint._lastDirection = this._lastDirection;
footprint.setPosition(this._footprintPos.x, this._footprintPos.y);
// Return Footprint
return footprint;
};
//=============================================================================
// ** Game_Follower
//-----------------------------------------------------------------------------
// The game object class for a follower. A follower is an allied character,
// other than the front character, displayed in the party.
//=============================================================================
// * Determine if Character can create MapFog
//=============================================================================
Game_Follower.prototype.canCreateMapFog = function() {
return false
};
//=============================================================================
// ** Spriteset_Map
//-----------------------------------------------------------------------------
// The set of sprites on the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
$.Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
$.Spriteset_Map_update = Spriteset_Map.prototype.update;
//=============================================================================
// * Create Screen Sprites
//=============================================================================
Spriteset_Map.prototype.createLowerLayer = function() {
// Run Original Function
$.Spriteset_Map_createLowerLayer.call(this);
// Create MapFog Layer
this.createMapFogLayer();
};
//=============================================================================
// * Frame Update
//=============================================================================
Spriteset_Map.prototype.update = function() {
// Set MapFog Layer
this._MapFogContainer.origin.x = $gameMap.displayX() * $gameMap.tileWidth();
this._MapFogContainer.origin.y = $gameMap.displayY() * $gameMap.tileHeight();
// Run Original Function
$.Spriteset_Map_update.call(this);
};
//=============================================================================
// * Create MapFog Layer
//=============================================================================
Spriteset_Map.prototype.createMapFogLayer = function() {
// Create MapFog Layer
this._MapFogContainer = new Sprite_MapFogContainer();
this._MapFogContainer.z = 3;
this._tilemap.addChild(this._MapFogContainer);
};
*/

View file

@ -0,0 +1,163 @@
//=============================================================================
// TDS Parallax Pictures
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_ParallaxPictures = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.ParallaxPictures = _TDS_.ParallaxPictures || {};
//=============================================================================
/*:
* @plugindesc
* Adds the ability to set parallax effects to pictures
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Set Picture as Parallax
//=============================================================================
Game_Interpreter.prototype.changeParallaxPictureSpeed = function(pictureId, xSpeed, ySpeed) {
// Get Picture
var picture = $gameScreen.picture(pictureId);
// If Picture Exists
if (picture) {
// Set Picture X & Y Speeds
picture._parallaxRect.x = xSpeed == undefined ? picture._parallaxRect.x : xSpeed;
picture._parallaxRect.y = ySpeed == undefined ? picture._parallaxRect.y : ySpeed;
};
};
//=============================================================================
// * Set Picture as Parallax
//=============================================================================
Game_Interpreter.prototype.setPictureAsParallax = function(width, height, xSpeed = 0, ySpeed = 0) {
// If Next Event Code is 231
if (this.nextEventCode() === 231) {
// Increase Index
this._index++;
// Get Command
var command = this.currentCommand();
// Set Parameters and Indentation
this._params = command.parameters;
this._indent = command.indent;
// Run Show Picture Command
this.command231();
// Get Picture
var picture = $gameScreen.picture(this._params[0])
// Setup Parallax
picture.setupParallax(xSpeed, ySpeed, width, height);
};
};
//=============================================================================
// ** Game_Picture
//-----------------------------------------------------------------------------
// The game object class for a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ParallaxPictures.Game_Picture_initBasic = Game_Picture.prototype.initBasic;
//=============================================================================
// * Initialize Basic Values
//=============================================================================
Game_Picture.prototype.initBasic = function() {
// Run Original Function
_TDS_.ParallaxPictures.Game_Picture_initBasic.call(this);
// Clear Parallax
this.clearParallax();
};
//=============================================================================
// * If Picture is Parallax
//=============================================================================
Game_Picture.prototype.isParallax = function() { return this._useParallax; };
//=============================================================================
// * Set Parallax
//=============================================================================
Game_Picture.prototype.setupParallax = function(x, y, width, height) {
// Set Parallax flag to true
this._useParallax = true;
// Set Parallax X & Y Speeds
this._parallaxRect.x = x; this._parallaxRect.y = y;
// Set Width & Height
this._parallaxRect.width = width; this._parallaxRect.height = height;
};
//=============================================================================
// * Set Picture as Parallax
//=============================================================================
Game_Picture.prototype.clearParallax = function() {
// Set Use Parallax Flag to false
this._useParallax = false;
// Set Parallax Speeds
this._parallaxRect = new Rectangle(0, 0, 0, 0)
};
//=============================================================================
// ** Sprite_Picture
//-----------------------------------------------------------------------------
// The sprite for displaying a picture.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.ParallaxPictures.Sprite_Picture_refresh = Sprite_Picture.prototype._refresh
_TDS_.ParallaxPictures.Sprite_Picture_updateOther = Sprite_Picture.prototype.updateOther;
//=============================================================================
// * Refresh
//=============================================================================
Sprite_Picture.prototype._refresh = function() {
// Get Picture
var picture = this.picture();
// If Picture exists
if (picture) {
// If Picture is Parallax
if (picture.isParallax()) {
// If Parallax Sprite does not Exists
if (!this._parallaxSprite) {
// Create Parallax Sprite
this._parallaxSprite = new TilingSprite();
this.addChild(this._parallaxSprite);
};
// Set Parallax Sprite Bitmap
this._parallaxSprite.bitmap = this.bitmap;
// Get Parallax Rectangle
var rect = picture._parallaxRect;
// Move Parallax Sprite
this._parallaxSprite.move(this.x, this.y, rect.width, rect.height)
// Remove Bitmap
this.bitmap = null;
} else {
// If Parallax Sprite Exists
if (this._parallaxSprite) { this.removeChild(this._parallaxSprite); };
};
};
// Run Original Function
_TDS_.ParallaxPictures.Sprite_Picture_refresh.call(this);
};
//=============================================================================
// * Update Other
//=============================================================================
Sprite_Picture.prototype.updateOther = function() {
// Run Original Function
_TDS_.ParallaxPictures.Sprite_Picture_updateOther.call(this);
// If There is a Parallax Sprite
if (this._parallaxSprite) {
// Get Picture
var picture = this.picture();
var rect = picture._parallaxRect;
this._parallaxSprite.origin.x += rect.x;
this._parallaxSprite.origin.y += rect.y;
};
};

View file

@ -0,0 +1,330 @@
//=============================================================================
// TDS Particles
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_Particles = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.Particles = _TDS_.Particles || {};
//=============================================================================
/*:
* @plugindesc
* Particle system.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Sprite_Particle
//-----------------------------------------------------------------------------
// This sprite class is used to draw and process particle sprites.
//=============================================================================
function Sprite_Particle() { this.initialize.apply(this, arguments); };
Sprite_Particle.prototype = Object.create(Sprite.prototype);
Sprite_Particle.prototype.constructor = Sprite_Particle;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_Particle.prototype.initialize = function(bitmap) {
// Super Call
Sprite.prototype.initialize.call(this, bitmap);
// Phase Index
this._phaseIndex = 0;
// Phases
this._phases = []
};
//=============================================================================
// * Setup
//=============================================================================
Sprite_Particle.prototype.setup = function(phases) {
// Clone Phases
this._phases = phases.clone();
};
//=============================================================================
// * Determine if Finished
//=============================================================================
Sprite_Particle.prototype.isFinished = function() { return this._phaseIndex >= this._phases.length; };
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_Particle.prototype.update = function() {
// Super Call
Sprite.prototype.update.call(this);
// Get Current Phase
var phase = this._phases[this._phaseIndex];
// If Phase Exists
if (phase) {
// Update Phase
this.updatePhase(phase);
// If Phase is Finished
if (phase.duration <= 0) {
// Increase Phase Index
this._phaseIndex++
};
};
};
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_Particle.prototype.updatePhase = function(phase) {
// Decrease Phase Duration
phase.duration--
// If Phase as a Function
if (phase.functStart) { phase.functStart.call(this, phase); };
this.x += phase.x;
this.y += phase.y;
this.rotation += phase.rotation * (Math.PI / 360);
this.opacity += phase.opacity;
this.scale.x += phase.scaleX;
this.scale.y += phase.scaleY;
// If Phase as a Function
if (phase.functEnd) { phase.functEnd.call(this, phase); };
};
//=============================================================================
// ** Sprite_BattleFaceStatusEmitter
//-----------------------------------------------------------------------------
// This sprite is used to display battle face status particles.
//=============================================================================
function Sprite_BattleFaceStatusEmitter() { this.initialize.apply(this, arguments); };
Sprite_BattleFaceStatusEmitter.prototype = Object.create(Sprite.prototype);
Sprite_BattleFaceStatusEmitter.prototype.constructor = Sprite_BattleFaceStatusEmitter;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Clear Values
this.clear();
// Deactivate
this.deactivate();
// this.setupGenerator('suns')
// this.activate();
};
//=============================================================================
// * Activate & Deactivate
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.activate = function() { this._active = true;};
Sprite_BattleFaceStatusEmitter.prototype.deactivate = function() { this._active = false;};
//=============================================================================
// * Clear
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.clear = function() {
// Set Intensity (How many sprites to spawn each time)
this._intensity = 1;
this._intensityVariance = 0;
// Set Generation Type
this._generateFunct = null;
// Set Spawn Timer
this._spawnTimer = 0;
this._spawnTimerVariance = 0;
this._spawnTimerCount = this._spawnTimer;
// Set Child Limit
this._childLimit = 0;
};
//=============================================================================
// * Setup generator
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.setupGenerator = function(type, settings = {}) {
// Clear
this.clear();
// Switch Type Case
switch (type.toLowerCase()) {
case 'angrytest':
this._intensity = 1;
this._intensityVariance = 0;
// Set Generation Type
this._generateFunct = this.generateAngry;
// Set Spawn Timer
this._spawnTimer = 10;
this._spawnTimerVariance = 0;
this._spawnTimerCount = this._spawnTimer;
// Set Child Limit
this._childLimit = 20;
break;
}
};
//=============================================================================
// * Generate Angry
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.generateAngry = function() {
// Get Bitmap
var bitmap = ImageManager.loadPicture('StatusParticles');
// Create Sprite
var sprite = new Sprite_Particle(bitmap);
sprite.anchor.set(0.5, 0.5)
sprite.x = (Math.round(Math.random()) * 2 - 1) * Math.randomInt(45)
sprite.y = 0
sprite.setFrame(30, 30, 30, 31)
sprite.opacity = 0;
sprite.scale.set(0, 0);
this.addChild(sprite);
// Set Unique Sprite Values
sprite._baseX = sprite.x;
sprite._angryOffset = Math.randomInt(5)
sprite._angrySpeed = 1.5 + (Math.randomInt(100) / 100);
// Create Shake Function
var shakeFunct = function() {
// Shake Sprite X value
this.x = sprite._baseX + (Math.sin((Graphics.frameCount + sprite._angryOffset) * sprite._angrySpeed) * 3);
};
// Initialize Phase
var phases = [];
// Set Phase Values
var xSpeed = 0;
var ySpeed = -(1 + Math.randomInt(1));
var rotation = 0
// Appear Phase
var phase = {duration: 10, x: xSpeed, y: ySpeed, rotation: rotation, opacity: 26, scaleX: 0.1, scaleY: 0.1}
phase.functEnd = shakeFunct;
phases.push(phase);
// Main Phase (Move up)
var phase = {duration: 30, x: xSpeed, y: ySpeed * 2, rotation: rotation, opacity: 0, scaleX: 0, scaleY: 0}
phase.functEnd = shakeFunct;
phases.push(phase);
// Disappear Phase (Explode rotating)
var phase = {duration: 10, x: xSpeed, y: ySpeed, rotation: 30, opacity: -26, scaleX: 0.1, scaleY: 0.1}
phase.functEnd = shakeFunct;
phases.push(phase);
// Setup Particle Phases
sprite.setup(phases)
};
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.update = function() {
// Super Call
Sprite.prototype.update.call(this);
// If Children Exists
if (this.children.length > 0) {
// Go Through Children
this.children.forEach(function(particle) {
// Remove Child if Finished
if (particle.isFinished()) { this.removeChild(particle); };
}, this);
};
// If Active
if (this._active) {
// If Children Length exceeds child limit
if (this.children.length >= this._childLimit) { return; }
// If Spawn Timer is not null
if (this._spawnTimerCount !== null) {
// Reduce Spawn Timer Count
this._spawnTimerCount--;
// If Timer is 0 or less
if (this._spawnTimerCount <= 0) {
// Set Spawn Timer Count
this._spawnTimerCount = this._spawnTimer + Math.randomInt(this._spawnTimerVariance);
} else {
return;
};
}
// Call Generation Function
if (this._generateFunct) {
// Generate Amount of Sprites
for (var i = 0; i < this._intensity + Math.randomInt(this._intensityVariance); i++) {
// Run Generation Function
this._generateFunct();
};
};
};
};
//=============================================================================
// * Generate
//=============================================================================
Sprite_BattleFaceStatusEmitter.prototype.generate = function() {
var bitmap = ImageManager.loadPicture('StatusParticles');
var sprite = new Sprite_Particle(bitmap);
sprite.anchor.set(0.5, 0.5)
sprite.x = (Math.round(Math.random()) * 2 - 1) * Math.randomInt(50)
sprite.y = Math.randomInt(5);
sprite.setFrame(30, 30, 30, 31)
sprite.opacity = 0;
sprite.scale.set(0, 0);
this.addChild(sprite);
// sprite.opacity = 0;
// sprite.scale.x = sprite.scale.y = 0;
// sprite.blendMode = Math.random() > 0.5 ? Graphics.BLEND_ADD : 0;
// sprite.setBlendColor([219, 10, 91, 100]);
var phases = [];
sprite._sadSpeed = Math.randomInt(10) / 100
var shakeFunct = function() {
this.x = sprite._baseX + (Math.sin(Graphics.frameCount * sprite._sadSpeed) * 3);
// this.x = this._baseX + (Math.round(Math.random()) * 2 - 1) * Math.randomInt(3)
}
var xSpeed = 0;
var ySpeed = 0//- (1 + Math.randomInt(1))
sprite.x = (Math.round(Math.random()) * 2 - 1) * Math.randomInt(30)
sprite.y = -80;
sprite.y += Math.randomInt(10)
sprite.setFrame(90, 30, 30, 31)
sprite._baseX = sprite.x;
// Appear Phase
var phase = {duration: 10, x: xSpeed, y: ySpeed, rotation: 0, opacity: 26, scaleX: 0.1, scaleY: 0.1}
phase.functEnd = shakeFunct;
phases.push(phase);
var phase = {duration: 60, x: xSpeed, y: ySpeed, rotation: 0, opacity: 0, scaleX: 0, scaleY: 0}
phase.functEnd = shakeFunct;
phases.push(phase);
var phase = {duration: 10, x: xSpeed, y: ySpeed, rotation: 10 + Math.randomInt(10), opacity: -26, scaleX: -0.1, scaleY: -0.1}
phase.functEnd = shakeFunct;
phases.push(phase);
// Setup Particle Phases
sprite.setup(phases)
};

View file

@ -0,0 +1,715 @@
//=============================================================================
// TDS Text Effects
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_TextEffects = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.TextEffects = _TDS_.TextEffects || {};
//=============================================================================
/*:
* @plugindesc
* Text Effects.
*
* @author TDS
*
* @param Effects
*
* @param SINV
* @text Vertical Sinusoidal
* @parent Effects
* @type struct<SINVEffect>[]
* @default []
* @desc Vertical Sinusoidal wave effect. (Moves up and down in a wave)
*
* @param SINH
* @text Horizontal Sinusoidal
* @parent Effects
* @type struct<SINHEffect>[]
* @default []
* @desc Horizontal Sinusoidal wave effect. (Moves left and right in a wave)
*
* @param SHAKE
* @text Shake
* @parent Effects
* @type struct<SHAKEEffect>[]
* @default []
* @desc Makes the text shake based on power set.
*
* @param RAINBOW
* @text Rainbow
* @parent Effects
* @type struct<RAINBOWEffect>[]
* @default []
* @desc Cycles through colors to create a rainbow effect on the text.
*/
//=============================================================================
// * Parameter Structures
//=============================================================================
/*~struct~SINVEffect:
* @param spacing
* @text Spacing
* @type number
* @default 1
* @desc Separation value of the wave.
*
* @param speed
* @text Speed
* @type number
* @decimals 2
* @default 0.50
* @desc Movement speed of the wave.
*
* @param amplitude
* @type Amplitude
* @type number
* @decimals 2
* @default 0.15
* @desc Amount of space to move vertically up and down.
*
*/
/*~struct~SINHEffect:
* @param spacing
* @text Spacing
* @type number
* @default 1
* @desc Separation value of the wave.
*
* @param speed
* @text Speed
* @type number
* @decimals 2
* @default 0.50
* @desc Movement speed of the wave.
*
* @param amplitude
* @type Amplitude
* @type number
* @decimals 2
* @default 0.15
* @desc Amount of space to move vertically up and down.
*
* @param anchor
* @type Anchor
* @type boolean
* @default false
* @desc Use anchor point instead of X coordinate.
*
*/
/*~struct~SHAKEEffect:
* @param powerX
* @text Power X
* @type number
* @default 3
* @desc X-Axis shaking power.
*
* @param powerY
* @text Power Y
* @type number
* @default 3
* @desc Y-Axis shaking power.
*
* @param timing
* @text Timing
* @type number
* @default 1
* @desc Amount of time to wait in frames between each movement.
*
*/
/*~struct~RAINBOWEffect:
* @param speed
* @type Speed
* @type number
* @decimals 2
* @default 0.30
* @desc Cycle speed for the rainbow
*
* @param amplitude
* @text Amplitude
* @type number
* @default 128
* @desc Amount of opacity to apply to rainbow cycles.
*
* @param center
* @text Center
* @type number
* @default 128
* @desc Opacity color from which amplitude will move to and from.
*
* @param redPhase
* @text Red Phase
* @type number
* @default 2
* @desc Red color phase. Used for color application in the cycle.
*
* @param greenPhase
* @text Green Phase
* @type number
* @default 4
* @desc Green color phase. Used for color application in the cycle.
*
* @param bluePhase
* @text Blue Phase
* @type number
* @default 6
* @desc Blue color phase. Used for color application in the cycle.
*
* @param opacity
* @text Opacity
* @type number
* @default 255
* @desc Base opacity of the rainbow color.
*
* @param useWaveOpacity
* @text Use Wave Opacity
* @type boolean
* @default false
* @desc If true it applies a wave effect to the opacity of the rainbow.
*/
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("TDS Text Effects");
// Initialize After Battle Commmon Event Parameters
_TDS_.TextEffects.params = {};
_TDS_.TextEffects.letterEffects = {}
// List of Letter Effects
var letterEffects = ['SINV', 'SINH', 'SHAKE', 'RAINBOW']
// Go through letter effects
for (var i = 0; i < letterEffects.length; i++) {
// Get Letter Effect Name
var name = letterEffects[i];
// Get Data List
var dataList = JSON.parse(parameters[name]);
// Initialize Letter Effects List
var list = _TDS_.TextEffects.letterEffects[name] = [];
// Go Through Data list
for (var i2 = 0; i2 < dataList.length; i2++) {
// Get Data
var data = JSON.parse(dataList[i2])
// Parse data
Object.keys(data).map(function(key, index) { data[key] = JSON.parse(data[key])});
// Set Data name
data.name = name
// Add data to list
list.push(data);
};
};
//=============================================================================
// ** Bitmap
//-----------------------------------------------------------------------------
// The basic object that represents an image.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextEffects.Bitmap_initialize = Bitmap.prototype.initialize;
_TDS_.TextEffects.Bitmap_drawText = Bitmap.prototype.drawText;
//=============================================================================
// * Object Initialization
//=============================================================================
Bitmap.prototype.initialize = function(width, height) {
// Text Drawing Block flag
this._blockTextDrawing = false;
// Run Original Function
_TDS_.TextEffects.Bitmap_initialize.call(this, width, height);
};
//=============================================================================
// * Block or Unblock text drawing
//=============================================================================
Bitmap.prototype.blockTextDrawing = function() { this._blockTextDrawing = true; }
Bitmap.prototype.unblockTextDrawing = function() { this._blockTextDrawing = false; }
//=============================================================================
// * Draw Text
//=============================================================================
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
// If Block Text Drawing
if (this._blockTextDrawing) { return; }
// Run Original Function
_TDS_.TextEffects.Bitmap_drawText.call(this, text, x, y, maxWidth, lineHeight, align);
};
//=============================================================================
// ** Window_Base
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextEffects.Window_Base__createAllParts = Window_Base.prototype._createAllParts;
_TDS_.TextEffects.Window_Base_initialize = Window_Base.prototype.initialize;
_TDS_.TextEffects.Window_Base_update = Window_Base.prototype.update
_TDS_.TextEffects.Window_Base_processEscapeCharacter = Window_Base.prototype.processEscapeCharacter
_TDS_.TextEffects.Window_Base_processNormalCharacter = Window_Base.prototype.processNormalCharacter;
//=============================================================================
// * Object Initialize
//=============================================================================
Window_Base.prototype.initialize = function(x, y, width, height) {
// Initialize Letter Effects
this.initLetterEffects();
// Super Call
_TDS_.TextEffects.Window_Base_initialize.call(this, x, y, width, height);
};
//=============================================================================
// * Create All Parts
//=============================================================================
Window_Base.prototype._createAllParts = function() {
// Super Call
_TDS_.TextEffects.Window_Base__createAllParts.call(this);
// Create Letter container
this.createLetterEffectContainer();
};
//=============================================================================
// * Process Normal Character
//=============================================================================
Window_Base.prototype.processNormalCharacter = function(textState) {
// If Character is not empty
if (this.canCreateLetterEffectSprite()) {
// Create Letter Effect Sprite
this.createLetterEffectSprite(textState);
// Block Text Drawing
this.contents.blockTextDrawing();
};
// // Block Text Drawing
// this.contents.unblockTextDrawing();
// Super Call
_TDS_.TextEffects.Window_Base_processNormalCharacter.call(this, textState);
};
//=============================================================================
// * Process Escape Character
//=============================================================================
Window_Base.prototype.processEscapeCharacter = function(code, textState) {
// If Not ignoring letter effec escape codes
if (!this.isIgnoringLetterEffectEscapeCodes()) {
switch (code) {
case 'LETAG': // Tag effects
// Set Letter Effect Tag
this._letterEffectTag = this.obtainEscapeParam(textState);
break
case 'LESTP': // Stop all tagged
// Get Tag
var tag = this.obtainEscapeParam(textState);
// Go Through Letter Effects
for (var i = 0; i < this._letterEffects.length; i++) {
// Get Letter Effect
var effect = this._letterEffects[i];
// If the effect has a matching tag
if (effect.tag === tag) {
// Deactivate Effect
effect.active = false
};
};
break
case 'LESYNCH':
// Set Letter Effect Synch index
this._letterEffectSynchIndex = this.obtainEscapeParam(textState);
break
case 'LETMR': // Set Timer
// Get Time
var time = this.obtainEscapeParam(textState);
// If Time is 0
if (time === 0) {
// Set timer to null
this._letterEffectTimer = null;
} else {
// Set Letter Effect timer time
this._letterEffectTimer = time;
};
break
case 'LECLEAR': // Clear All Letter Effects
// Go Through Letter Effects
for (var i = 0; i < this._letterEffects.length; i++) {
// Get Letter Effect
var effect = this._letterEffects[i];
// If the effect has no end index
if (effect.endIndex === Infinity) {
// Set Letter Effect End Index
effect.endIndex = textState.index;
};
};
// Increase Text State Index (Accounts for needed space)
textState.index++
break;
case 'SINV':
// Setup Letter Effect
this.setupLetterEffect(code, this.obtainEscapeParam(textState), textState);
break;
case 'SINH':
// Setup Letter Effect
this.setupLetterEffect(code, this.obtainEscapeParam(textState), textState);
break;
case 'QUAKE':
// Setup Letter Effect
this.setupLetterEffect('SHAKE', this.obtainEscapeParam(textState), textState);
break;
case 'RAINBOW':
// Setup Letter Effect
this.setupLetterEffect(code, this.obtainEscapeParam(textState), textState);
break;
};
};
// Run Original Function
_TDS_.TextEffects.Window_Base_processEscapeCharacter.call(this, code, textState);
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_Base.prototype.update = function() {
// Run Original Function
_TDS_.TextEffects.Window_Base_update.call(this);
// Update Letter Effects
this.updateLetterEffects();
};
//=============================================================================
// * Initialize Letter Effects
//=============================================================================
Window_Base.prototype.initLetterEffects = function() {
// Clear Letter Effect Sprites
this.clearLetterEffectSprites();
// Initialize Letter Efffect Sprites
this._letterEffectSprites = [];
// Array of Letter Effects
this._letterEffects = []
// Array of Finished Letter Effects
this._finishedLetterEffects = [];
// Letter Effects Active flag
this._letterEffectsActive = false;
// Set Letter Effect Tag
this._letterEffectTag = 0;
// Set Letter Effect Timer to null
this._letterEffectTimer = null;
// Synch Next Letter Effect Sprite
this._synchNextLetterEffectSprite = false;
// Letter Effect Synch Index
this._letterEffectSynchIndex = null;
};
//=============================================================================
// * Create Letter Container
//=============================================================================
Window_Base.prototype.createLetterEffectContainer = function() {
// Create Letter container sprite
this._letterEffectContainerSprite = new Sprite();
this.addChild(this._letterEffectContainerSprite);
};
//=============================================================================
// * Determine if Letter Effect Sprite can be created
//=============================================================================
Window_Base.prototype.canCreateLetterEffectSprite = function() {
if (this._checkWordWrapMode) { return false; }
if (this._letterEffectsActive) { return true; }
return false
};
//=============================================================================
// * Determine if Letter Effect Effect Escape Codes should be ignored
//=============================================================================
Window_Base.prototype.isIgnoringLetterEffectEscapeCodes = function() {
if (this._checkWordWrapMode) { return true; }
return false
};
//=============================================================================
// * Clear Letter Effect Sprites
//=============================================================================
Window_Base.prototype.clearLetterEffectSprites = function() {
// If Letter Effect Sprites Exist
if (this._letterEffectSprites) {
// Go through Letter Effect Sprites
for (var i = 0; i < this._letterEffectSprites.length; i++) {
// Remove Child From container
this._letterEffectContainerSprite.removeChild(this._letterEffectSprites[i]);
};
};
};
//=============================================================================
// * Setup Letter Effect
//=============================================================================
Window_Base.prototype.setupLetterEffect = function(code, index, textState) {
// If Index is 0 (Stop)
if (index === 0) {
// Set Letter Effect End Index
this.setLetterEffectEndIndex(code, textState);
} else {
// Add Letter Effect
this.addLetterEffect(this.getLetterEffectBase(code, index-1, textState));
};
// If there are Letter Effects
if (this._letterEffects.length > 0) {
// Check Effect Active State
var active = this._letterEffects.some(function(effect) {
return textState.index < effect.endIndex;
}, this);
// Set Letter Effects Active Flag
this._letterEffectsActive = active;
// Bock or Unlock Text drawing
active ? this.contents.blockTextDrawing() : this.contents.unblockTextDrawing()
};
};
//=============================================================================
// * Add Letter Effect
//=============================================================================
Window_Base.prototype.getLetterEffectBase = function(name, index, textState) {
// Create Effect
var effect = Object.assign({active: true, tag: this._letterEffectTag, startIndex: textState.index, endIndex: Infinity}, _TDS_.TextEffects.letterEffects[name][index])
// Set Timer
if (this._letterEffectTimer !== null) { effect.timer = 60; };
// Return Effect
return effect
};
//=============================================================================
// * Add Letter Effect
//=============================================================================
Window_Base.prototype.addLetterEffect = function(effect) {
// Add Letter Effec to Array
this._letterEffects.push(effect);
// Return effect
return effect;
};
//=============================================================================
// * Set Letter Effect End Index
//=============================================================================
Window_Base.prototype.setLetterEffectEndIndex = function(name, textState) {
// Go Through Letter Effects
for (var i = 0; i < this._letterEffects.length; i++) {
// Get Letter Effect
var lEffect = this._letterEffects[i];
// If It's a
if (lEffect.name === name && lEffect.endIndex === Infinity) {
// Set Letter Effect End Index
lEffect.endIndex = textState.index;
};
};
};
//=============================================================================
// * Create Letter Effect Sprite
//=============================================================================
Window_Base.prototype.createLetterEffectSprite = function(textState) {
// Get Character
var c = textState.text[textState.index];
// Get Character width
var w = Math.round(this.textWidth(c));
// If Character Is empty
if (c === ' ') { return; }
// Create Bitmap
var bitmap = new Bitmap(w, textState.height + 10);
// Copy Bitmap Settings
bitmap.fontFace = this.contents.fontFace;
bitmap.fontSize = this.contents.fontSize;
bitmap.textColor = this.contents.textColor;
// bitmap.fillAll('rgba(255, 0, 0, 0.5)')
// Draw Character
bitmap.drawText(c, 0, 0, bitmap.width, bitmap.height, 'center');
// Create Sprite
var sprite = new Sprite(bitmap)
var padding = this.standardPadding();
sprite.x = textState.x + padding;
sprite.y = textState.y + padding - 5;
// sprite.x = Math.floor(textState.x + padding + (w / 2));
// sprite.y = textState.y + padding + (textState.height / 2) + 5;
// sprite.x += 250;
// sprite.y += 30
// sprite.anchor.set(0.5, 0.5)
// sprite.pivot.set(sprite.width / 2, (sprite.height / 2) + 5 )
// sprite.scale.x += 0.1
// sprite.pivot.set(0, 0);
// sprite.anchor.set(0.5, 0.5)
// sprite.scale.y += 0.1
// sprite.rotation = 0 + (Math.sin((Graphics.frameCount + (index * 1)) * 0.1) * 1)
// Set Effect Data
sprite._effectData = {origin: new Point(sprite.x, sprite.y), offset: new Point(), index: textState.index, position: this._letterEffectSprites.length, tag: this._letterEffectTag }
// Add Sprite to Letter Sprites Array
this._letterEffectSprites.push(sprite);
// Add Sprite as Child to container
this._letterEffectContainerSprite.addChild(sprite)
// If Letter Effect Synch index is not null
if (this._letterEffectSynchIndex !== null) {
// Go Through Letter Effects
for (var i = 0; i < this._letterEffects.length; i++) {
// Get Letter Effect
var effect = this._letterEffects[i];
// If the effect has a matching tag
if (effect.tag === this._letterEffectSynchIndex) {
// Set Effect Synch Sprite
effect.synchSprite = sprite;
};
};
// Set Letter Effect synch index to null
this._letterEffectSynchIndex = null;
}
};
//=============================================================================
// * Update Letter Effects
//=============================================================================
Window_Base.prototype.updateLetterEffects = function() {
// Set Letter Effects Container Sprite Visibility
this._letterEffectContainerSprite.visible = this.isOpen();
// Get Letter Sprites
var letterSprites = this._letterEffectSprites;
// If Letter Effects Exist
if (letterSprites.length > 0) {
// Go through Letter Effects
for (var i = 0; i < this._letterEffects.length; i++) {
// Get Effect
var effect = this._letterEffects[i];
// Get Synch Sprite
var synchSprite = effect.synchSprite;
// Go through Letter Sprites
for (var i2 = 0; i2 < this._letterEffectSprites.length; i2++) {
// Get Sprite
var sprite = this._letterEffectSprites[i2];
// If Synch Sprite Exists
if (synchSprite) {
// If Sprite matches synch sprite
if (sprite === synchSprite) {
// Apply Letter Effect to Sprite
this.applyLetterEffectToSprite(effect, sprite);
} else {
// Get Effect Data
var synchEffectData = synchSprite._effectData;
var effectData = sprite._effectData;
// If Effect Data Matches Effect Tag
if (effectData.tag === effect.tag) {
// Set Sprite Anchor
sprite.anchor.set(synchSprite.anchor.x, synchSprite.anchor.y)
// Set Sprite Position
sprite.x = effectData.origin.x + synchEffectData.offset.x
sprite.y = effectData.origin.y + synchEffectData.offset.y
sprite.rotation = synchSprite.rotation;
sprite.setBlendColor(synchSprite._blendColor)
}
}
} else {
// Apply Letter Effect to Sprite
this.applyLetterEffectToSprite(effect, sprite);
};
};
// If Effect has a timer
if (effect.timer && effect.endIndex !== Infinity) {
// Decrease Effect Timer
effect.timer--;
// If Effect timer is 0 or less
if (effect.timer <= 0) { effect.active = false; };
};
// Add Effect to Finished Letter Effects array if not active
if (!effect.active) { this._finishedLetterEffects.push(effect) }
};
// If Finished Letter Effects has members
if (this._finishedLetterEffects.length > 0) {
// Get removed Indexes
var removedIndexes = []
// Go through finished effects
for (var i = 0; i < this._finishedLetterEffects.length; i++) {
// Get Effect
var effect = this._finishedLetterEffects[i];
// Get Index of Effect
var index = this._letterEffects.indexOf(effect);
// Remove Effect
if (index >= 0) { this._letterEffects.splice(index, 1); }
// Add indexes to removed indexes array
removedIndexes.push([effect.startIndex, effect.endIndex])
};
// Go through Letter Sprites
for (var i = 0; i < this._letterEffectSprites.length; i++) {
// Get Sprite
var sprite = this._letterEffectSprites[i]
// Get Sprite Effect Data
var effectData = sprite._effectData;
// Reset Sprite Position
sprite.x = effectData.origin.x
sprite.y = effectData.origin.y
sprite.setBlendColor([0, 0, 0, 0])
};
// Clear Finished Letter Effects Array
this._finishedLetterEffects = []
};
};
};
//=============================================================================
// * Apply Letter Effect to Sprite
//=============================================================================
Window_Base.prototype.applyLetterEffectToSprite = function(effect, sprite) {
// Get Sprite Effect Data
var effectData = sprite._effectData;
// Get Index
var index = effectData.index;
// Check if Effect should run
if (!effect.active) { return }
if (index < effect.startIndex || index >= effect.endIndex) { return; }
// Switch Case Effect name
switch (effect.name) {
case 'test':
break;
case 'SINH':
// Set Effect Anchor
if (effect.anchor) {
// Set Anchor Position
sprite.anchor.y = 0 + (Math.sin((Graphics.frameCount + (index * effect.spacing)) * effect.speed) * effect.amplitude)
} else {
effectData.offset.x = Math.round((Math.sin((Graphics.frameCount + (index * effect.spacing)) * effect.speed) * effect.amplitude))
sprite.x = effectData.origin.x + effectData.offset.x;
}
break;
case 'SINV':
sprite.anchor.y = 0 + (Math.sin((Graphics.frameCount + (index * effect.spacing)) * effect.speed) * effect.amplitude)
break
case 'SHAKE':
// If Frame Count matches timing
if (Graphics.frameCount % effect.timing === 0) {
// Set X & Y Offsets
if (effect.powerX > 0) { effectData.offset.x = (Math.max(Math.randomInt(effect.powerX), 1) * (Math.randomInt(100) > 50 ? -1 : 1)) };
if (effect.powerY > 0) { effectData.offset.y = (Math.max(Math.randomInt(effect.powerY), 1) * (Math.randomInt(100) > 50 ? -1 : 1)) };
// Set Sprite Position
sprite.x = effectData.origin.x + effectData.offset.x;
sprite.y = effectData.origin.y + effectData.offset.y;
};
break
case 'RAINBOW':
var frame = Graphics.frameCount + index;
var red = Math.sin(effect.speed * frame + effect.redPhase) * effect.amplitude + effect.center
var green = Math.sin(effect.speed * frame + effect.greenPhase) * effect.amplitude + effect.center
var blue = Math.sin(effect.speed * frame + effect.bluePhase) * effect.amplitude + effect.center
var alpha = effect.useWaveOpacity ? Math.sin(effect.speed * frame) * effect.amplitude + effect.center : effect.opacity;
// Set Sprite Color
sprite.setBlendColor([red, green, blue, alpha])
break;
}
};
//=============================================================================
// ** Window_Message
//-----------------------------------------------------------------------------
// The window for displaying text messages.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextEffects.Window_Message_startMessage = Window_Message.prototype.startMessage;
//=============================================================================
// * Start Message
//=============================================================================
Window_Message.prototype.startMessage = function() {
// Initialize Letter Effects
this.initLetterEffects();
// Run Original Function
_TDS_.TextEffects.Window_Message_startMessage.call(this);
};

View file

@ -0,0 +1,22 @@
(function ($) {
const Alias_getTextData = $.getTextData;
$.getTextData = function (file, name, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
if (!this._data[language].text[file][name])
return data = {
faceset: "",
faceindex: 0,
background: 0,
position: 2,
text: "This message doesn't exist " + file + ' ' + name + ' ' + language
};
// Return Text Data
return Alias_getTextData.call(this, file, name, language);
};
})(LanguageManager);

View file

@ -0,0 +1,595 @@
//=============================================================================
// TDS Language Processor
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {}; Imported.TDS_TextLanguageProcessor = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {}; _TDS_.TextLanguageProcessor = _TDS_.TextLanguageProcessor || {};
//=============================================================================
/*:
* @plugindesc
* This plugin allows you to use YAML files for multiple language purposes.
*
* @author TDS
*
*
* @param Default Language
* @desc Default language of the game.
* @default en
*
* @help
* ============================================================================
* * Script calls
* ============================================================================
*
* To manually set the current language use the following in a
* script call:
*
* LanguageManager.setLanguage(LANGUAGE, SAVE);
*
* LANGUAGE
* ^ Language name string.
*
* SAVE
* ^ true/false. If true it will save the language in the config
* file so it remembers it when the game is closed and reopened.
* (Optional. Defaults to True)
*
* Examples:
*
* LanguageManager.setLanguage('jp', false);
*
* LanguageManager.setLanguage('en');
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Text_Language_Processor");
// Initialize Parameters
_TDS_.TextLanguageProcessor.params = {};
_TDS_.TextLanguageProcessor.params.defaultLanguage = String(parameters['Default Language'] || 'en');
//=============================================================================
// ** LanguageManager
//-----------------------------------------------------------------------------
// Static class used for handling Language Text Processing.
//=============================================================================
function LanguageManager() { throw new Error('This is a static class'); };
//=============================================================================
// * Object Initialization
//=============================================================================
LanguageManager.initialize = function () {
// Current Language
this._language = this.defaultLanguage();
// Language Data Object
this._data = {};
// Load All Language Files
this.loadAllLanguageFiles();
};
//=============================================================================
// * Get Default Language
//=============================================================================
LanguageManager.defaultLanguage = function () { return _TDS_.TextLanguageProcessor.params.defaultLanguage; };
//=============================================================================
// * Get System Text
//=============================================================================
LanguageManager.setLanguage = function (language, save) {
// Set Default save State
if (save === undefined) { save = true; };
// Set Language
LanguageManager._language = language;
// If Save Flag
if (save) { ConfigManager.save(); };
};
//=============================================================================
// * Get Language Data
//=============================================================================
LanguageManager.languageData = function (language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Return Language Data
return this._data[language];
};
//=============================================================================
// * Get System Text
//=============================================================================
LanguageManager.getSystemText = function (type, name, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Data
var data = this._data[language].text.System;
// If Data Exists
if (data) { return data.terms[type][name]; };
// Return Error
return "- ERROR -";
};
//=============================================================================
// * Get Plugin Text
//=============================================================================
LanguageManager.getPluginText = function (type, name, language = this._language) {
// Get Data
var data = this._data[language].text.System
// If Data Exists
if (data) { return data.plugins[type][name]; };
// Return Error
return " - ERROR -";
};
//=============================================================================
// * Get Input Keys Table
//=============================================================================
LanguageManager.getInputKeysTable = function () {
// Get Data
var data = this.languageData().text.System;
// Return Input Keys Table
return data.inputKeysTable ? data.inputKeysTable : [];
};
//=============================================================================
// * Get Input Keys Table
//=============================================================================
LanguageManager.getInputName = function (type, input, language = this._language) {
// Get Data
var data = this.languageData().text.System;
// If Data Exists
if (data) { return data.InputNames[type][input]; };
// Return Error
return " - ERROR -";
};
//=============================================================================
// * Get Text Data
//=============================================================================
LanguageManager.getTextData = function (file, name, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Return Text Data
return this._data[language].text[file][name];
};
//=============================================================================
// * Get Message Data
//=============================================================================
LanguageManager.getMessageData = function (code, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Commands
var cmd = code.split('.');
// Get Data
var data = this.getTextData(cmd[0], cmd[1], language);
// Return Data
return data;
};
LanguageManager.getDatabaseText = function (code, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Data
var data = this._data[language].text.Database;
// If Data Exists
if (data) { return data[code]; };
// Return Error
return "- ERROR -";
};
//=============================================================================
// * Load Language Files
//=============================================================================
LanguageManager.loadLanguageFiles = function (language) {
var path = require('path');
var fs = require('fs');
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/Languages/' + language + '/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// Initialize Language Data
this._data[language] = { text: {} };
// Go Through Directory
for (var i = 0; i < dirList.length; i++) {
// Get Directory
var directory = dirList[i];
// Get Format
var format = path.extname(dirList[i]);
// Get Filename
var filename = path.basename(directory, format);
// If Format is yaml
if (format === '.yaml') {
// Get Language File Data
var data = jsyaml.load(fs.readFileSync(filePath + '/' + filename + format, 'utf8'));
// Set Language Text Data
this._data[language].text[filename] = data;
continue;
};
};
};
//=============================================================================
// * Load All Language Files
//=============================================================================
LanguageManager.loadAllLanguageFiles = function () {
var path = require('path');
var fs = require('fs');
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/Languages/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// Go Through Directory
for (var i = 0; i < dirList.length; i++) {
// Get Directory
var directory = dirList[i];
// Get Format
var format = path.extname(dirList[i]);
// Get Filename
var filename = path.basename(directory, format);
// Get Stat
var stat = fs.statSync(filePath + filename)
//If it's a directory
if (stat.isDirectory()) {
// Load Language Files
console.log(this.loadLanguageFiles);
console.log(this.loadLanguageFiles(directory));
};
};
};
// Initialize Language Manager
//LanguageManager.initialize();
//=============================================================================
// ** ConfigManager
//-----------------------------------------------------------------------------
// The static class that manages the configuration data.
//=============================================================================
// Alias Listing
//=============================================================================
//_TDS_.TextLanguageProcessor.ConfigManager_makeData = ConfigManager.makeData;
//_TDS_.TextLanguageProcessor.ConfigManager_applyData = ConfigManager.applyData;
//=============================================================================
// * Make Data
//=============================================================================
/*ConfigManager.makeData = function() {
// Get Original Config Object
var config = _TDS_.TextLanguageProcessor.ConfigManager_makeData.call(this);
// Set Language
config.language = LanguageManager._language;
// Return config object
return config;
};
//=============================================================================
// * Apply Data
//=============================================================================
ConfigManager.applyData = function(config) {
// Run Original Function
_TDS_.TextLanguageProcessor.ConfigManager_applyData.call(this, config);
// Set Language
this.language = LanguageManager._language = config.language || LanguageManager.defaultLanguage();
};*/
//=============================================================================
// ** TextManager
//-----------------------------------------------------------------------------
// The static class that handles terms and messages.
//=============================================================================
// * Get System Text
//=============================================================================
TextManager.basic = function (basicId) { return LanguageManager.getSystemText('basic', basicId); };
TextManager.param = function (paramId) { return LanguageManager.getSystemText('param', paramId); };
TextManager.command = function (commandId) { return LanguageManager.getSystemText('command', commandId); };
TextManager.message = function (messageId) { return LanguageManager.getSystemText('message', messageId); };
TextManager.database = function (databaseId) { return LanguageManager.getDatabaseText(databaseId); };
//=============================================================================
// * Get Scene Text
//=============================================================================
TextManager.basic = function (basicId) { return LanguageManager.getSystemText('basic', basicId); };
//=============================================================================
// ** Game_Message
//-----------------------------------------------------------------------------
// The game object class for the state of the message window that displays text
// or selections, etc.
//=============================================================================
// * Show Language Message
//=============================================================================
Game_Message.prototype.showLanguageMessage = function (code) {
// Get Message Data
var data = LanguageManager.getMessageData(code);
var faceset = data.faceset || "";
var faceindex = data.faceindex || 0;
var background = data.background || 0;
var positionType = data.position === undefined ? 2 : data.position;
// Get Extra Faces
var extraFaces = data.extraFaces;
// If Data has Extra Faces
if (extraFaces) {
// Go Through Extra Fraces
for (var i = 0; i < extraFaces.length; i++) {
// Get Face Data
var face = extraFaces[i];
// Set Extra Face
this.setExtraFace(i, face.faceset, face.faceindex, this.makeFaceBackgroundColor(face.faceBackgroundColor, face.faceset, face.faceindex));
};
};
// Set Message Properties
this.setFaceImage(faceset, faceindex);
this.setBackground(background);
this.setPositionType(positionType);
this._faceBackgroundColor = this.makeFaceBackgroundColor(data.faceBackgroundColor, faceset, faceindex);
if (Imported && Imported.YEP_MessageCore) {
this.addText(data.text);
} else {
this.add(data.text);
};
};
//=============================================================================
// * Make Face Background Color
//=============================================================================
Game_Message.prototype.makeFaceBackgroundColor = function (color, name, index) {
// If Color Exists
if (color) {
if (color.match(/^rgba/)) { return color; }
if (color.match(/^#/)) { return color; }
};
// If Color Is for FaceName or Color is undefined
if (name && color === 'FaceName' || color === undefined) {
// Switch Case Name
switch (name) {
case '04_HERO_OW':
return '#52b9fc';
break;
};
};
// Return null (Clear Background)
return null;
};
Game_Message.prototype.setLanguageLabels = function (labels) {
if (!this._choiceLabels) this._choiceLabels = [];
this._choiceLabels = labels;
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextLanguageProcessor.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
//=============================================================================
// * Plugin Command
//=============================================================================
Game_Interpreter.prototype.pluginCommand = function (command, args) {
// Command Switch Case
switch (command) {
case 'ShowMessage':
// Show Language Message
this.commandShowLanguageMessage(args[0]);
break;
case 'ChangeLanguage':
// Set Language
LanguageManager._language = args[0];
break;
case 'AddChoice':
this.addLanguageChoice(args[0], args[1]);
break;
case 'ShowChoices':
this.commandShowLanguageChoices(args[0]);
break;
};
// Return Original Function
return _TDS_.TextLanguageProcessor.Game_Interpreter_pluginCommand.call(this, command, args);
};
//=============================================================================
// * Show Language Message
//=============================================================================
Game_Interpreter.prototype.commandShowLanguageMessage = function (code) {
if (!$gameMessage.isBusy()) {
// Show Language Message
$gameMessage.showLanguageMessage(code);
// Next Event Code Switch Case
switch (this.nextEventCode()) {
case 102:
// Show Choices
this._index++;
this.setupChoices(this.currentCommand().parameters);
break;
case 103:
// Input Number
this._index++;
this.setupNumInput(this.currentCommand().parameters);
break;
case 104:
// Select Item
this._index++;
this.setupItemChoice(this.currentCommand().parameters);
break;
case 356:
var nextCommand = this._list[this._index + 1];
var parameters = nextCommand.parameters;
var pluginCommand = parameters[0].split(' ')[0];
var cancelType = parameters[0].split(' ')[1];
if (pluginCommand && pluginCommand === "ShowChoices") {
this._index++;
this.setupLanguageChoices(cancelType);
}
break;
};
// this._index++;
this.setWaitMode('message');
}
return false;
};
//=============================================================================
// * Show Choice
//=============================================================================
Game_Interpreter.prototype.addLanguageChoice = function (code, label) {
if (!this._choices) this._choices = [];
if (!this._choiceLabels) this._choiceLabels = [];
var data = LanguageManager.getMessageData(code);
this._choices.push(data.text);
this._choiceLabels.push(label);
};
Game_Interpreter.prototype.commandShowLanguageChoices = function (cancelType) {
if (!$gameMessage.isBusy()) {
this.setupLanguageChoices(parseInt(cancelType));
this._index++;
this.setWaitMode('message');
}
return false;
};
Game_Interpreter.prototype.commandLanguageJumpTo = function (label) {
for (var i = 0; i < this._list.length; i++) {
var command = this._list[i];
if (command.code === 118 && command.parameters[0] === label) {
this.jumpTo(i);
return;
}
}
return true;
};
Game_Interpreter.prototype.setupLanguageChoices = function (cancel) {
var choices = this._choices.clone();
var cancelType = cancel;
var defaultType = 0;
var positionType = 2;
var background = 0;
if (cancelType >= choices.length) {
cancelType = -2;
}
$gameMessage.setChoices(choices, defaultType, cancelType);
$gameMessage.setChoiceBackground(background);
$gameMessage.setChoicePositionType(positionType);
$gameMessage.setLanguageLabels(this._choiceLabels.clone());
$gameMessage.setChoiceCallback(function (n) {
if (n >= 0) {
this.commandLanguageJumpTo($gameMessage._choiceLabels[n]);
} else {
this._branch[this._indent] = n;
}
}.bind(this));
this._choices = [];
this._choiceLabels = [];
};
_TDS_.TextLanguageProcessor.Window_Base_drawTextEx = Window_Base.prototype.drawTextEx;
Window_Base.prototype.drawTextEx = function (text, x, y) {
if (!text) _TDS_.TextLanguageProcessor.Window_Base_drawTextEx.call(this, text, x, y);
var regex = /\{(.*?)\}/;
var result;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
return _TDS_.TextLanguageProcessor.Window_Base_drawTextEx.call(this, text, x, y);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorName = Window_Base.prototype.drawActorName;
Window_Base.prototype.drawActorName = function (actor, x, y, width) {
if (!actor || !actor.name()) return _TDS_.TextLanguageProcessor.Window_Base_drawActorName.call(this, actor, x, y, width);
width = width || 168;
this.changeTextColor(this.hpColor(actor));
var regex = /\{(.*?)\}/;
var result;
var text = actor.name();
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass;
Window_Base.prototype.drawActorClass = function (actor, x, y, width) {
if (!actor || !actor.currentClass().name) return _TDS_.TextLanguageProcessor.Window_Base_drawActorClass.call(this, actor, x, y, width);
width = width || 168;
this.resetTextColor();
var regex = /\{(.*?)\}/;
var result;
var text = actor.currentClass().name;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorNickname = Window_Base.prototype.drawActorNickname;
Window_Base.prototype.drawActorNickname = function (actor, x, y, width) {
if (!actor || !actor.nickname()) return _TDS_.Window_Base_drawActorNickname.call(this, actor, x, y, width);
width = width || 270;
this.resetTextColor();
var regex = /\{(.*?)\}/;
var result;
var text = actor.nickname();
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawItemName = Window_Base.prototype.drawItemName;
Window_Base.prototype.drawItemName = function (item, x, y, width) {
if (!item || !item.name) return _TDS_.TextLanguageProcessor.Window_Base_drawItemName.call(this, item, x, y, width);
width = width || 312;
if (item) {
var iconBoxWidth = Window_Base._iconWidth + 4;
this.resetTextColor();
this.drawIcon(item.iconIndex, x + 2, y + 2);
var regex = /\{(.*?)\}/;
var result;
var text = item.name;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x + iconBoxWidth, y, width - iconBoxWidth);
}
};
_TDS_.TextLanguageProcessor.Game_Interpreter_requestImages = Game_Interpreter.prototype.requestImages;
Game_Interpreter.prototype.requestImages = function (list, commonList) {
if (!list) return;
list.forEach(function (command) {
var params = command.parameters;
switch (command.code) {
case 231:
var image = params[1].replace("_" + LanguageManager.defaultLanguage(), "_" + LanguageManager._language);
ImageManager.requestPicture(image);
break;
}
});
_TDS_.TextLanguageProcessor.Game_Interpreter_requestImages.call(this, list, commonList);
};
_TDS_.TextLanguageProcessor.Game_Interpreter_command231 = Game_Interpreter.prototype.command231;
Game_Interpreter.prototype.command231 = function () {
var x, y;
if (this._params[3] === 0) { // Direct designation
x = this._params[4];
y = this._params[5];
} else { // Designation with variables
x = $gameVariables.value(this._params[4]);
y = $gameVariables.value(this._params[5]);
}
var image = this._params[1].replace("_" + LanguageManager.defaultLanguage(), "_" + LanguageManager._language);
$gameScreen.showPicture(this._params[0], image, this._params[2],
x, y, this._params[6], this._params[7], this._params[8], this._params[9]);
return true;
};

View file

@ -0,0 +1,138 @@
//========================================
// WaitFPS.js
// by Tsukimi
// Last Updated: 2018.10.22
// update history:
// 2018.11.09 v0.2 add max Wait Time
// 2018.10.22 v0.1 finished
//========================================
/*:en
* @plugindesc WaitFPS
* @author Tsukimi
*
* @param momentFPSThreshold
* @text 瞬間FPS閾値
* @type Number
* @default 57
*
* @param meanFPSFrames
* @text 平均FPS計測フレーム数
* @type Number
* @default 3
*
* @param meanFPSThreshold
* @text 平均FPS閾値
* @type Number
* @default 50
*
* @param maxWaitTime
* @text 最大待ち時間
* @type Number
* @default 60
*
* @help
*
* WaitFPS
* 作者ツキミ
*
* FPSが安定するまで待つプラグインです
* 主に場所移動後と重い処理後に使用されるかと思います
*
* ***************************************************
* プラグインコマンド
* イベントコマンドプラグインコマンドから実行
* パラメータの間は半角スペースで区切る
*
*  WaitFPS
*   FPSが閾値を超えない限り次のコマンドを実行しません
*
*/
(function() {
'use strict';
//===========================
// plugin parameter
//===========================
var pluginName = 'WaitFPS';
var getParamString = function(paramNames) {
if (!Array.isArray(paramNames)) paramNames = [paramNames];
for (var i = 0; i < paramNames.length; i++) {
var name = PluginManager.parameters(pluginName)[paramNames[i]];
if (name) return name;
}
return null;
};
var getParamNumber = function(paramNames) {
return Number(getParamString(paramNames)) || 0;
};
var momentFPSThreshold = getParamNumber("momentFPSThreshold");
var meanFPSThreshold = getParamNumber("meanFPSThreshold");
var meanFPSFrames = getParamNumber("meanFPSFrames");
var maxWaitTime = getParamNumber("maxWaitTime");
//===========================
// Game_Interpreter
// Plugin Command setting.
//===========================
var _Game_Interpreter_clear = Game_Interpreter.prototype.clear;
Game_Interpreter.prototype.clear = function() {
_Game_Interpreter_clear.apply(this, arguments);
this._MFPSwait = maxWaitTime;
};
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.apply(this, arguments);
if((command || '').toUpperCase() !== "WAITFPS") return;
this._waitCount = 1;
this.setWaitMode("fps");
};
var _Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
Game_Interpreter.prototype.updateWaitMode = function() {
var waiting = false;
if(this._waitMode == "fps") {
this._MFPSwait--;
waiting = !SceneManager.meetFPSCondition();
if (!waiting || this._MFPSwait <= 0) {
this._waitMode = '';
this._MFPSwait = maxWaitTime;
}
}
else waiting = _Game_Interpreter_updateWaitMode.apply(this, arguments);
return waiting;
};
//===========================
// SceneManager
//===========================
SceneManager._momentFPS = 0;
SceneManager._meanFPSArr = [];
SceneManager.meetFPSCondition = function() {
var meanFPS = 0;
for(var i = 0; i < this._meanFPSArr.length; i++) {
meanFPS += this._meanFPSArr[i];
}
meanFPS /= this._meanFPSArr.length;
return (this._momentFPS > momentFPSThreshold && meanFPS > meanFPSThreshold);
};
var _SceneManager_updateMain = SceneManager.updateMain;
SceneManager.updateMain = function() {
var newTime = this._getTimeInMsWithoutMobileSafari();
var fTime = (newTime - this._currentTime) / 1000;
this._momentFPS = 1/fTime;
this._meanFPSArr.push(this._momentFPS);
if(this._meanFPSArr.length > meanFPSFrames) this._meanFPSArr.shift();
_SceneManager_updateMain.apply(this, arguments);
};
})();

View file

@ -0,0 +1,992 @@
/*:
* Yami Engine Delta - Sideview Battler Enhancement
*
* @plugindesc v1.1.0 This plugin allows user to use any kind of sideview battler.
* @author Yami Engine Delta [Dr.Yami]
*
* @param [Default Setting]
* @default
*
* @param Default Frames
* @desc Default frames number for each pose.
* @default 3
*
* @param Default Speed
* @desc Default speed for each pose. The higher number, the slower motion is.
* @default 12
*
* @param Default Frame Width
* @desc Default frame width.
* @default 96
*
* @param Default Frame Height
* @desc Default frame height.
* @default 96
*
* @param Enable Weapon
* @desc Showing weapon for battler.
* @default false
*
* @help
* There is no Plugin Command for this plugin.
*
* ============================================================================
* Actors & Enemies Notetags
*
* <Sideview Battler: FILENAME>
* Enable custom sideview battler for actor/enemy with battler set FILENAME.
*
* <Sideview Battler Default>
* Make this battler use default kind of battler (MV's SV Battlers).
*
* <Sideview Battler Frames: X>
* Change default number of frames per pose for current battler.
*
* <Sideview Battler Speed: X>
* Change default speed per pose for current battler. The higher number, the
* slower motion is.
*
* <Sideview Battler Size: WIDTH, HEIGHT>
* Change the frame sizes.
*
* <Sideview Battler Weapon: FLAG>
* Set weapon showing enable for battler. FLAG can be true or false.
*
* <Sideview Battler Motion: NAME, INDEX>
* Add new motion (pose) for current battler, index is row number (start from
* zero).
*
* <Sideview Battler Motion>
* Name: NAME
* Index: INDEX
* Loop
* Frames: X
* Speed: Y
* </Sideview Battler Motion>
* Add new motion (pose) for current battler.
* Loop is for looping motion.
* Frames and Speed is for custom frames and speed from the default ones.
* Loop, Frames and Speed can be omitted.
* ============================================================================
* Notes
*
* 1. Frame will be started from 0 (first frame of the pose).
* 2. All default motions to be setup:
* walk wait chant guard damage
* evade thrust swing missile skill
* spell item escape victory dying
* abnormal sleep dead
* 3. All battlers should have the motion "walk". If any of default motions is
* not setup, the "other" motion will be used, "walk" will be used instead
* if "other" hasn't been setup.
* 4. Current version only support animated enemies with Yanfly's Animated
* Sideview Enemies. This will be standalone on next version.
* 5. When using with Yanfly's Animated Sideview Enemies, the sprite width and
* height should be set manually instead of 'auto'.
* ============================================================================
* Compatible
*
* The plugin should be placed under any of other Core script, such as YEP -
* Core Engine.
*
* The plugin should be placed under YEP - Battle Engine Core and YEP -
* Animated Sideview Enemies if used.
* ============================================================================
* Action Sequences - Action List (For YEP - Battle Engine Core)
*
* CUSTOM MOTION type: target, (no weapon)
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Forces the target to perform a custom motion defined by this plugin. Anything
* besides above listed default motions should be called with this action instead.
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Usage Example: attack animation: target
*
* ============================================================================
*/
/**
* @namespace SideviewBattler
* @memberof YED
*/
var YED = YED || {};
// init SideviewBattler module
YED.SideviewBattler = {};
// Imported
var Imported = Imported || {};
Imported.YED_SideviewBattler = true;
/* globals YED: false */
(function($SideviewBattler) {
/**
* Enum for RegExp, used to notetags
*
* @readonly
* @enum {RegExp}
* @memberof YED.SideviewBattler
*/
var Regexp = {
/**
* Filename for battler
*/
FILENAME: /<Sideview Battler:[ ]*(.*)>/i,
/**
* Default type of set for battler
*/
DEFAULT_TYPE: /<Sideview Battler Default>/i,
/**
* Default frames
*/
FRAMES: /<Sideview Battler Frames:[ ]*(\d+)>/i,
/**
* Default frames
*/
SPEED: /<Sideview Battler Speed:[ ]*(\d+)>/i,
/**
* Frame sizes
*/
SIZES: /<Sideview Battler Size:[ ]*(\d+),[ ]*(\d+)>/i,
/**
* Enable Weapon
*/
WEAPON_ENABLE: /<Sideview Battler Weapon:[ ]*(true|false)>/i,
/**
* Motions setup
*/
MOTION_QUICK: /<Sideview Battler Motion:[ ]*(.*),[ ]*(\d+)>/i,
/**
* Motions setup
*/
MOTION_BEGIN: /<Sideview Battler Motion>/i,
/**
* Motions setup
*/
MOTION_END: /<\/Sideview Battler Motion>/i,
/**
* Motions setup
*/
MOTION_NAME: /Name:[ ]*(.*)/i,
/**
* Motions setup
*/
MOTION_INDEX: /Index:[ ]*(\d+)/i,
/**
* Motions setup
*/
MOTION_LOOP: /Loop/i,
/**
* Motions setup
*/
MOTION_FRAMES: /Frames:[ ]*(\d+)/i,
/**
* Motions setup
*/
MOTION_SPEED: /Speed:[ ]*(\d+)/i,
};
$SideviewBattler.Regexp = Regexp;
}(YED.SideviewBattler));
/* globals YED: false */
(function($SideviewBattler) {
/**
* Shorten Dependencies
*/
var Regexp = $SideviewBattler.Regexp;
/**
* Contains utility tools for module.
*
* @namespace Utils
* @memberof YED.SideviewBattler
*/
var Utils = {};
/**
* Contains module parsed parameters.
*
* @type {Object}
* @memberOf YED.SideviewBattler.Utils
*/
Utils.parameters = {};
/**
* Process parameters function.
* Should be called with DataManager as current object.
*
* @function processParameters
* @memberof YED.SideviewBattler.Utils
*/
Utils.processParameters = function() {
var parameters = PluginManager.parameters('YED_SideviewBattler'),
result = Utils.parameters;
result['Default Frames'] =
Number(parameters['Default Frames'] || 0);
result['Default Speed'] =
Number(parameters['Default Speed'] || 0);
result['Default Frame Width'] =
Number(parameters['Default Frame Width'] || 0);
result['Default Frame Height'] =
Number(parameters['Default Frame Height'] || 0);
result['Enable Weapon'] =
eval(parameters['Enable Weapon'].toLowerCase());
};
/**
* Process notetag function.
* Should be called with DataManager as current object.
*
* @function processNotetag
* @memberof YED.SideviewBattler.Utils
*/
Utils.processNotetags = function() {
var groups = [$dataActors, $dataEnemies],
group, obj,
notedata, line,
helpers = {}; // multiline notetag
for (var j = 0; j < groups.length; j++) {
group = groups[j];
for (var i = 1; i < group.length; i++) {
obj = group[i];
notedata = obj.note.split(/[\r\n]+/);
Utils._processProperties.call(this, obj);
Utils._processMethods.call(this, obj);
for (var n = 0; n < notedata.length; n++) {
line = notedata[n];
Utils._processNotetag.call(this, obj, line, helpers);
}
}
}
};
/**
* Add new properties into object.
*
* @function _processProperties
* @memberof YED.SideviewBattler.Utils
* @param {Object} obj Data object
* @private
*/
Utils._processProperties = function(obj) {
obj._sideviewBattler = {
filename: "",
default : false,
frames : Utils.parameters['Default Frames'],
speed : Utils.parameters['Default Speed'],
weapon : Utils.parameters['Enable Weapon'],
sizes : [
Utils.parameters['Default Frame Width'],
Utils.parameters['Default Frame Height']
],
motions : {}
};
};
/**
* Add new methods into object.
*
* @function _processMethods
* @memberof YED.SideviewBattler.Utils
* @param {Object} obj Data object
* @private
*/
Utils._processMethods = function(obj) {
obj.getSideviewBattler = Utils.getSideviewBattler;
obj.isSideviewBattler = Utils.isSideviewBattler;
};
/**
* Process notetag for object.
*
* @function _processNotetag
* @memberof YED.SideviewBattler.Utils
* @param {Object} obj Data object
* @param {String} notetag Notetag
* @private
*/
Utils._processNotetag = function(obj, notetag, helpers) {
var sideviewBattler = obj._sideviewBattler,
match,
motion;
match = notetag.match(Regexp.FILENAME);
if (match) {
sideviewBattler.filename = String(match[1]);
}
match = notetag.match(Regexp.DEFAULT_TYPE);
if (match) {
sideviewBattler.default = true;
}
match = notetag.match(Regexp.FRAMES);
if (match) {
sideviewBattler.frames = Number(match[1]);
}
match = notetag.match(Regexp.SPEED);
if (match) {
sideviewBattler.speed = Number(match[1]);
}
match = notetag.match(Regexp.SIZES);
if (match) {
sideviewBattler.sizes[0] = Number(match[1]);
sideviewBattler.sizes[1] = Number(match[2]);
}
match = notetag.match(Regexp.WEAPON_ENABLE);
if (match) {
sideviewBattler.weapon = eval(match[1].toLowerCase());
}
match = notetag.match(Regexp.MOTION_QUICK);
if (match) {
motion = {};
motion.name = match[1].toLowerCase();
motion.index = Number(match[2]);
sideviewBattler.motions[motion.name] = motion;
}
match = notetag.match(Regexp.MOTION_BEGIN);
if (match) {
helpers.motionFlag = true;
helpers.motion = {};
return;
}
match = notetag.match(Regexp.MOTION_END);
if (match) {
motion = helpers.motion;
helpers.motionFlag = false;
sideviewBattler.motions[motion.name] = motion;
return;
}
if (helpers.motionFlag) {
motion = helpers.motion;
match = notetag.match(Regexp.MOTION_NAME);
if (match) {
motion.name = match[1].toLowerCase();
}
match = notetag.match(Regexp.MOTION_INDEX);
if (match) {
motion.index = Number(match[1]);
}
match = notetag.match(Regexp.MOTION_LOOP);
if (match) {
motion.loop = true;
}
match = notetag.match(Regexp.MOTION_FRAMES);
if (match) {
motion.frames = Number(match[1]);
}
match = notetag.match(Regexp.MOTION_SPEED);
if (match) {
motion.speed = Number(match[1]);
}
}
};
/**
* Get sideview battler infos.
* Should be attached to actor/enemy object.
*
* @function getSideviewBattler
* @memberof YED.SideviewBattler.Utils
* @return {Object}
*/
Utils.getSideviewBattler = function() {
return this._sideviewBattler;
};
/**
* Check if is sideview battler.
* Should be attached to actor/enemy object.
*
* @function getSideviewBattler
* @memberof YED.SideviewBattler.Utils
* @return {Object}
*/
Utils.isSideviewBattler = function() {
return this._sideviewBattler.filename !== ""
&& !this._sideviewBattler.default;
};
$SideviewBattler.Utils = Utils;
}(YED.SideviewBattler));
/* globals YED: false */
/**
* Pre-processes and notetag parsing
*/
(function($SideviewBattler) {
/**
* Shorten Dependencies
*/
var Utils = $SideviewBattler.Utils;
/**
* Aliasing methods
*/
var _DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
/**
* Extending: DataManager.isDatabaseLoaded
*
* Add notetags and parameters processing for module.
*/
DataManager.isDatabaseLoaded = function() {
var loaded = _DataManager_isDatabaseLoaded.call(this);
if (!loaded) {
return false;
}
Utils.processParameters.call(DataManager);
Utils.processNotetags.call(DataManager);
return true;
};
}(YED.SideviewBattler));
(function () {
if (!Imported.YEP_BattleEngineCore) {
return;
}
var _BattleManager_processActionSequence = BattleManager.processActionSequence;
BattleManager.processActionSequence = function (actionName, actionArgs) {
if (actionName.match(/CUSTOM MOTION[ ](.*)/i)) {
return this.actionCustomMotionTarget(String(RegExp.$1), actionArgs);
}
return _BattleManager_processActionSequence.call(this,
actionName, actionArgs);
};
BattleManager.actionCustomMotionTarget = function (name, actionArgs) {
var movers = this.makeActionTargets(actionArgs[0]);
if (movers.length < 1) return true;
if (actionArgs[1] && actionArgs[1].toUpperCase() === 'NO WEAPON') {
var showWeapon = false;
} else {
var showWeapon = true;
}
movers.forEach(function (mover) {
mover.forceMotion(name.toLowerCase());
});
return false;
};
} ());
(function() {
Game_Battler.prototype.getBattler = function() {
var battler;
if (this.isActor()) {
battler = this.actor();
}
if (this.isEnemy()) {
battler = this.enemy();
}
return !!battler ? battler : null;
};
Game_Battler.prototype.getSideviewBattler = function() {
var battler = this.getBattler();
return !!battler ? battler.getSideviewBattler() : null;
};
Game_Battler.prototype.isSideviewBattler = function() {
var battler = this.getBattler();
return !!battler ? battler.isSideviewBattler() : false;
};
Game_Battler.prototype.isUseWeapon = function() {
var sideviewBattler = this.getSideviewBattler();
if (!this.isSideviewBattler()) {
return true;
}
return sideviewBattler.weapon;
};
Game_Battler.prototype.getSideviewFilename = function() {
var sideviewBattler = this.getSideviewBattler();
if (!this.isSideviewBattler()) {
return null;
}
return sideviewBattler.filename;
};
Game_Battler.prototype.getSideviewSizes = function() {
var sideviewBattler = this.getSideviewBattler();
if (!this.isSideviewBattler()) {
return null;
}
return sideviewBattler.sizes;
};
Game_Battler.prototype.getSideviewMotions = function() {
var sideviewBattler = this.getSideviewBattler();
if (!this.isSideviewBattler()) {
return null;
}
return sideviewBattler.motions;
};
Game_Battler.prototype.getFallbackMotion = function() {
var motions = this.getSideviewMotions();
if (!this.isSideviewBattler()) {
return null;
}
if (!!motions.other) {
return motions.other;
}
return motions.walk;
};
Game_Battler.prototype.getSideviewMotion = function(motionName) {
var motions = this.getSideviewMotions();
if (!motionName) {
return null;
}
if (!this.isSideviewBattler()) {
return null;
}
if (!motions[motionName]) {
return this.getFallbackMotion();
}
return motions[motionName];
};
Game_Battler.prototype.getSideviewFrames = function(motionName) {
var sideviewBattler = this.getSideviewBattler(),
motion = this.getSideviewMotion(motionName);
if (!this.isSideviewBattler()) {
return null;
}
if (!!motion && !!motion.frames) {
return motion.frames;
}
return sideviewBattler.frames;
};
Game_Battler.prototype.getSideviewSpeed = function(motionName) {
var sideviewBattler = this.getSideviewBattler(),
motion = this.getSideviewMotion(motionName);
if (!this.isSideviewBattler()) {
return null;
}
if (!!motion && !!motion.speed) {
return motion.speed;
}
return sideviewBattler.speed;
};
}());
(function() {
/**
* Aliasing methods
*/
var _Game_Actor_battlerName
= Game_Actor.prototype.battlerName;
Game_Actor.prototype.battlerName = function() {
if (this.isSideviewBattler()) {
return this.getSideviewFilename();
}
return _Game_Actor_battlerName.call(this);
};
}());
(function() {
/**
* Aliasing methods
*/
var _Game_Enemy_battlerName
= Game_Enemy.prototype.battlerName;
Game_Enemy.prototype.battlerName = function() {
if (this.isSideviewBattler()) {
return this.getSideviewFilename();
}
return _Game_Enemy_battlerName.call(this);
};
}());
(function() {
/**
* Aliasing methods
*/
var _Sprite_Actor_initMembers
= Sprite_Actor.prototype.initMembers;
var _Sprite_Actor_setupWeaponAnimation
= Sprite_Actor.prototype.setupWeaponAnimation;
var _Sprite_Actor_startMotion
= Sprite_Actor.prototype.startMotion;
var _Sprite_Actor_forceMotion
= Sprite_Actor.prototype.forceMotion;
var _Sprite_Actor_motionSpeed
= Sprite_Actor.prototype.motionSpeed;
var _Sprite_Actor_updateFrame
= Sprite_Actor.prototype.updateFrame;
var _Sprite_Actor_updateMotionCount
= Sprite_Actor.prototype.updateMotionCount;
Sprite_Actor.prototype.initMembers = function() {
_Sprite_Actor_initMembers.call(this);
this._motionName = "";
};
Sprite_Actor.prototype.setupWeaponAnimation = function() {
if (this._actor.isUseWeapon()) {
_Sprite_Actor_setupWeaponAnimation.call(this);
return;
}
this._actor.clearWeaponAnimation();
};
Sprite_Actor.prototype.startMotion = function(motionType) {
if (this._actor.isSideviewBattler()) {
this.startSideviewMotion(motionType);
return;
}
_Sprite_Actor_startMotion.call(this, motionType);
};
Sprite_Actor.prototype.forceMotion = function(motionType) {
if (this._actor.isSideviewBattler()) {
this.forceSideviewMotion(motionType);
return;
}
_Sprite_Actor_forceMotion.call(this, motionType);
};
Sprite_Actor.prototype.startSideviewMotion = function(motionType) {
if (this._motionName !== motionType) {
this._motionName = motionType;
this._motionCount = 0;
this._pattern = 0;
}
};
Sprite_Actor.prototype.forceSideviewMotion = function(motionType) {
this._motionName = motionType;
this._motionCount = 0;
this._pattern = 0;
};
Sprite_Actor.prototype.getCurrentMotion = function() {
return this._actor.getSideviewMotion(this._motionName);
};
Sprite_Actor.prototype.frameSizes = function() {
return this._actor.getSideviewSizes();
};
Sprite_Actor.prototype.motionFrames = function() {
var motionName = this._motionName;
if (this._actor.isSideviewBattler()) {
return this._actor.getSideviewFrames(motionName);
}
return 3;
};
Sprite_Actor.prototype.motionSpeed = function() {
var motionName = this._motionName;
if (this._actor.isSideviewBattler()) {
return this._actor.getSideviewSpeed(motionName);
}
return _Sprite_Actor_motionSpeed.call(this);
};
Sprite_Actor.prototype.updateFrame = function() {
if (this._actor.isSideviewBattler()) {
this.updateSideviewFrame();
return;
}
_Sprite_Actor_updateFrame.call(this);
};
Sprite_Actor.prototype.updateSideviewFrame = function() {
var bitmap = this._mainSprite.bitmap,
motion = this.getCurrentMotion(),
frameSizes = this.frameSizes();
Sprite_Battler.prototype.updateFrame.call(this);
if (bitmap) {
var motionIndex = motion.index;
var pattern = this._pattern;
var cw = frameSizes[0];
var ch = frameSizes[1];
var cx = pattern;
var cy = motionIndex;
this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch);
}
};
Sprite_Actor.prototype.updateMotionCount = function() {
if (this._actor.isSideviewBattler()) {
this.updateSideviewMotionCount();
return;
}
_Sprite_Actor_updateMotionCount.call(this);
};
Sprite_Actor.prototype.updateSideviewMotionCount = function() {
var motion = this.getCurrentMotion(),
speed = this.motionSpeed(),
frames = this.motionFrames();
if (!!motion && ++this._motionCount >= speed) {
if (!!motion.loop) {
this._pattern = (this._pattern + 1) % frames;
} else if (this._pattern < frames - 1) {
this._pattern++;
} else {
this.refreshMotion();
}
this._motionCount = 0;
}
};
}());
(function() {
if (!Imported.YEP_X_AnimatedSVEnemies) {
return;
}
/**
* Aliasing methods
*/
var _Sprite_Enemy_initMembers
= Sprite_Enemy.prototype.initMembers;
var _Sprite_Enemy_setupWeaponAnimation
= Sprite_Enemy.prototype.setupWeaponAnimation;
var _Sprite_Enemy_startMotion
= Sprite_Enemy.prototype.startMotion;
var _Sprite_Enemy_forceMotion
= Sprite_Enemy.prototype.forceMotion;
var _Sprite_Enemy_updateFrame
= Sprite_Enemy.prototype.updateFrame;
var _Sprite_Enemy_updateMotionCount
= Sprite_Enemy.prototype.updateMotionCount;
Sprite_Enemy.prototype.initMembers = function() {
_Sprite_Enemy_initMembers.call(this);
this._motionName = "";
};
Sprite_Enemy.prototype.setupWeaponAnimation = function() {
if (this._enemy.isUseWeapon()) {
_Sprite_Enemy_setupWeaponAnimation.call(this);
return;
}
this._enemy.clearWeaponAnimation();
};
Sprite_Enemy.prototype.startMotion = function(motionType) {
if (this._enemy.isSideviewBattler()) {
this.startSideviewMotion(motionType);
return;
}
_Sprite_Enemy_startMotion.call(this, motionType);
};
Sprite_Enemy.prototype.forceMotion = function(motionType) {
if (this._enemy.isSideviewBattler()) {
this.forceSideviewMotion(motionType);
return;
}
_Sprite_Enemy_forceMotion.call(this, motionType);
};
Sprite_Enemy.prototype.startSideviewMotion = function(motionType) {
if (this._motionName !== motionType) {
this._motionName = motionType;
this._motionCount = 0;
this._pattern = 0;
}
};
Sprite_Enemy.prototype.forceSideviewMotion = function(motionType) {
this._motionName = motionType;
this._motionCount = 0;
this._pattern = 0;
};
Sprite_Enemy.prototype.getCurrentMotion = function() {
return this._enemy.getSideviewMotion(this._motionName);
};
Sprite_Enemy.prototype.frameSizes = function() {
return this._enemy.getSideviewSizes();
};
Sprite_Enemy.prototype.motionFrames = function() {
var motionName = this._motionName;
if (this._enemy.isSideviewBattler()) {
return this._enemy.getSideviewFrames(motionName);
}
return 3;
};
Sprite_Enemy.prototype.motionSpeed = function() {
var motionName = this._motionName;
if (this._enemy.isSideviewBattler()) {
return this._enemy.getSideviewSpeed(motionName);
}
return 12;
};
Sprite_Enemy.prototype.updateMotionCount = function() {
if (this._enemy.isSideviewBattler()) {
this.updateSideviewMotionCount();
return;
}
_Sprite_Enemy_updateMotionCount.call(this);
};
Sprite_Enemy.prototype.updateSideviewMotionCount = function() {
var motion = this.getCurrentMotion(),
speed = this.motionSpeed(),
frames = this.motionFrames();
if (!!motion && ++this._motionCount >= speed) {
if (!!motion.loop) {
this._pattern = (this._pattern + 1) % frames;
} else if (this._pattern < frames - 1) {
this._pattern++;
} else {
this.refreshMotion();
}
this._motionCount = 0;
}
};
Sprite_Enemy.prototype.updateFrame = function() {
if (this._enemy.isSideviewBattler()) {
if (Imported.YEP_X_AnimatedSVEnemies) {
this.updateSideviewFrame();
return;
}
this.updateSideviewFrame();
return;
}
_Sprite_Enemy_updateFrame.call(this);
};
// compatible with YEP - Animated Sideview Enemies
Sprite_Enemy.prototype.updateSideviewFrame = function() {
var bitmap = this._mainSprite.bitmap,
motion = this.getCurrentMotion(),
frameSizes = this.frameSizes();
Sprite_Battler.prototype.updateFrame.call(this);
if (bitmap.width <= 0) {
return;
}
this._effectTarget = this._mainSprite;
var motionIndex = motion.index;
var pattern = this._pattern;
var cw = frameSizes[0];
var ch = frameSizes[1];
var cx = pattern;
var cy = motionIndex;
var cdh = 0;
if (this._effectType === 'bossCollapse') {
cdh = ch - this._effectDuration;
}
this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch - cdh);
this.adjustMainBitmapSettings(bitmap);
this.adjustSVShadowSettings();
};
}());

View file

@ -0,0 +1,46 @@
/*:
* Yami Engine Delta - Sideview Battler Enhancement Add-On
*
* @plugindesc v1.0.0 This plugin allows user to use any kind of sideview battler.
* @author Yami Engine Delta [Dr.Yami]
* @help
* There is no Plugin Command for this plugin.
*
* ============================================================================
* Actors & Enemies Notetags
*
* <sprite mirrored>
* The sprite will be mirrored.
*
*/
/**
* @namespace SideviewBattler
* @memberof YED
*/
(function() {
var _processSVENotetags1 = DataManager.processSVENotetags1;
DataManager.processSVENotetags1 = function(group) {
_processSVENotetags1.call(this, group);
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.spriteMirrored = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:SPRITE MIRRORED)>/i)) {
obj.spriteMirrored = true;
}
}
}
};
Game_Enemy.prototype.spriteScaleX = function() {
if (this.enemy().spriteMirrored) return this.enemy().spriteScaleX * -1;
return this.enemy().spriteScaleX;
};
})();

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,670 @@
//=============================================================================
// Yanfly Engine Plugins - Auto Passive States
// YEP_AutoPassiveStates.js
//=============================================================================
var Imported = Imported || {};
Imported.YEP_AutoPassiveStates = true;
var Yanfly = Yanfly || {};
Yanfly.APS = Yanfly.APS || {};
Yanfly.APS.version = 1.15;
//=============================================================================
/*:
* @plugindesc v1.15 This plugin allows for some states to function as
* passives for actors, enemies, skills, and equips.
* @author Yanfly Engine Plugins
*
* @param ---Basic---
* @default
*
* @param Actor Passives
* @parent ---Basic---
* @desc These states will always appear on actors as passives.
* Place a space in between each state ID.
* @default 0
*
* @param Enemy Passives
* @parent ---Basic---
* @desc These states will always appear on enemies as passives.
* Place a space in between each state ID.
* @default 0
*
* @param Global Passives
* @parent ---Basic---
* @desc These states will always appear on all battlers as passives.
* Place a space in between each state ID.
* @default 0
*
* @param ---List---
* @default ...Requires RPG Maker MV 1.5.0+...
*
* @param Actor Passives List
* @parent ---List---
* @type state[]
* @desc These states will always appear on actors as passives.
* Use with RPG Maker MV 1.5.0+.
* @default []
*
* @param Enemy Passives List
* @parent ---List---
* @type state[]
* @desc These states will always appear on enemies as passives.
* Use with RPG Maker MV 1.5.0+.
* @default []
*
* @param Global Passives List
* @parent ---List---
* @type state[]
* @desc These states will always appear on all battlers as passives.
* Use with RPG Maker MV 1.5.0+.
* @default []
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* Passive states are states that are automatically active. You can think of
* them as an extension of traits but with more flexibility. They will always
* be there as long as the actor or enemy has auto passive state notetags.
*
* ============================================================================
* Notetags
* ============================================================================
*
* For those who would like to allocate passive states to your battlers, use
* the notetags below:
*
* Actor, Class, Skills, Weapon, Armor, Enemy Notetags:
* <Passive State: x>
* <Passive State: x, x, x>
* This will allow the actor or enemy to have state x as a passive state.
* If placed inside a weapon or armor notebox, the user will have that
* passive state.
*
* <Passive State: x to y>
* This will add the states x through y (in a sequence) for the actor or
* enemy to have as a passive state. If placed inside a weapon or armor
* notebox, the user will have that passive state.
*
* For those who don't want their passive states to always be on, you can use
* the following notetags to introduce conditions for your passive states. All
* conditions must be fulfilled in order for the passive state to appear.
*
* State Notetags:
* <Passive Condition: HP Above x%>
* <Passive Condition: HP Below x%>
* <Passive Condition: MP Above x%>
* <Passive Condition: MP Below x%>
* If the user's HP or MP is above/below x% of the MaxHP or MaxMP, this
* condition will be met for the passive state to appear.
*
* <Passive Condition: Stat Above x>
* <Passive Condition: Stat Below x>
* Replace 'stat' with 'HP', 'MP', 'TP', 'MAXHP', 'MAXMP', 'ATK', 'DEF',
* 'MAT', 'MDF', 'AGI', 'LUK'. If the above stat is above/below x, then the
* condition is met for the passive state to appear.
*
* <Passive Condition: Switch x ON>
* <Passive Condition: Switch x OFF>
* If switch x is either ON/OFF, then the condition is met for the passive
* state to appear.
*
* <Passive Condition: Variable x Above y>
* <Passive Condition: Variable x Below y>
* Replace x with the variable you wish to check to see if it's above/below
* y, then the condition is met for the passive state to appear.
*
* ============================================================================
* Lunatic Mode - Conditional Passives
* ============================================================================
*
* For those who understand a bit of JavaScript and would like for their
* passive states to appear under specific conditions, you can use this notetag
* to accomplish conditional factors.
*
* State Notetags:
* <Custom Passive Condition>
* if (user.hp / user.mhp <= 0.25) {
* condition = true;
* } else {
* condition = false;
* }
* </Custom Passive Condition>
* This enables you to input conditions to be met in order for the passive
* state to appear. If the 'condition' variable returns true, the passive
* state will appear. If the 'condition' returns false, it won't appear. If
* condition is not defined, it will return true and the passive state will
* appear on the battler.
* * Note: All non-custom passive conditions must be met before this one can
* be fulfilled and allow the custom condition to appear.
* * Note: If you decide to use a condition that requires the actor to have a
* particular state, it cannot be a passive state to prevent infinite loops.
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.15:
* - Bug fixed that made global passives not apply to actors.
*
* Version 1.14:
* - Updated for RPG Maker MV version 1.5.0.
* - Added parameters: Actor Passives List, Enemy Passives List, and
* Global Passives List
*
* Version 1.13:
* - Lunatic Mode fail safes added.
*
* Version 1.12:
* - Implemented <Custom Passive Condition> to now affect passive state ID's
* added by Equip Battle Skills.
*
* Version 1.11:
* - Added 'Global Passives' that encompass both actors and enemies.
*
* Version 1.10:
* - Added compatibility functionality for Equip Battle Skills to add the
* equipped passive states during battle test.
*
* Version 1.09:
* - Added 'Actor Passives' and 'Enemy Passives' plugin parameters. This will
* cause all actors and enemies respectively to be affected by the listed
* states as passives.
*
* Version 1.08:
* - Fixed conditional checks to make sure all states are being checked
* properly without conflict with other conditional states.
*
* Version 1.07:
* - Updated for RPG Maker MV version 1.1.0.
*
* Version 1.06:
* - Added a mass member refresh whenever $gamePlayer is refreshed.
*
* Version 1.05a:
* - Added Lunatic Mode - <Custom Passive Condition> notetag for states.
* - Fixed a bug that would cause infinite loops.
*
* Version 1.04:
* - Added a lot of passive condition notetags for states.
* --- <Passive Condition: HP/MP Above/Below x%>
* --- <Passive Condition: Stat Above/Below x>
* --- <Passive Condition: Switch x ON/OFF>
* --- <Passive Condition: Variable x Above/Below y>
*
* Version 1.03:
* - Added refreshing whenever a new skill is learned to update passives.
*
* Version 1.02:
* - Optimized passive state calculations to reduce lag.
*
* Version 1.01:
* - Fixed a bug with having multiple passive states of the same ID.
*
* Version 1.00:
* - Finished plugin!
*/
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.SetupParameters = function () {
Yanfly.Parameters = PluginManager.parameters('YEP_AutoPassiveStates');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.APSActorPas = String(Yanfly.Parameters['Actor Passives']);
Yanfly.Param.APSActorPas = Yanfly.Param.APSActorPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSActorPas.length; ++i) {
Yanfly.Param.APSActorPas[i] = parseInt(Yanfly.Param.APSActorPas[i]);
Yanfly.Param.APSActorPas[i] = Yanfly.Param.APSActorPas[i] || 0;
}
var data = JSON.parse(Yanfly.Parameters['Actor Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSActorPas.contains(stateId)) continue;
Yanfly.Param.APSActorPas.push(stateId);
}
Yanfly.Param.APSEnemyPas = String(Yanfly.Parameters['Enemy Passives']);
Yanfly.Param.APSEnemyPas = Yanfly.Param.APSEnemyPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSEnemyPas.length; ++i) {
Yanfly.Param.APSEnemyPas[i] = parseInt(Yanfly.Param.APSEnemyPas[i]);
Yanfly.Param.APSEnemyPas[i] = Yanfly.Param.APSEnemyPas[i] || 0;
}
var data = JSON.parse(Yanfly.Parameters['Enemy Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSEnemyPas.contains(stateId)) continue;
Yanfly.Param.APSEnemyPas.push(stateId);
}
Yanfly.Param.APSGlobalPas = String(Yanfly.Parameters['Global Passives']);
Yanfly.Param.APSGlobalPas = Yanfly.Param.APSGlobalPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSGlobalPas.length; ++i) {
id = parseInt(Yanfly.Param.APSGlobalPas[i]);
Yanfly.Param.APSActorPas.push(id);
Yanfly.Param.APSEnemyPas.push(id);
}
var data = JSON.parse(Yanfly.Parameters['Global Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (!Yanfly.Param.APSActorPas.contains(stateId)) {
Yanfly.Param.APSActorPas.push(stateId);
}
if (!Yanfly.Param.APSEnemyPas.contains(stateId)) {
Yanfly.Param.APSEnemyPas.push(stateId);
}
}
};
Yanfly.SetupParameters();
//=============================================================================
// DataManager
//=============================================================================
Yanfly.APS.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.APS.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_AutoPassiveStates) {
this.processAPSNotetags1($dataActors, Yanfly.Param.APSActorPas);
this.processAPSNotetags1($dataClasses);
this.processAPSNotetags1($dataEnemies, Yanfly.Param.APSEnemyPas);
this.processAPSNotetags1($dataSkills);
this.processAPSNotetags1($dataWeapons);
this.processAPSNotetags1($dataArmors);
this.processAPSNotetags2($dataStates);
Yanfly._loaded_YEP_AutoPassiveStates = true;
}
return true;
};
DataManager.processAPSNotetags1 = function (group, inheritArray) {
var note1 = /<(?:PASSIVE STATE):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note2 = /<(?:PASSIVE STATE):[ ](\d+)[ ](?:THROUGH|to)[ ](\d+)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.passiveStates = [];
if (inheritArray) {
obj.passiveStates = obj.passiveStates.concat(inheritArray);
}
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
obj.passiveStates = obj.passiveStates.concat(array);
} else if (line.match(note2)) {
var range = Yanfly.Util.getRange(parseInt(RegExp.$1),
parseInt(RegExp.$2));
obj.passiveStates = obj.passiveStates.concat(range);
}
}
}
};
DataManager.processAPSNotetags2 = function (group) {
var note1a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)([%])>/i;
var note1b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)([%])>/i;
var note2a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)>/i;
var note2b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)>/i;
var note3a = /<(?:PASSIVE CONDITION):[ ]SWITCH[ ](\d+)[ ](.*)>/i;
var notez1 = /<(?:CUSTOM PASSIVE CONDITION)>/i;
var notez2 = /<\/(?:CUSTOM PASSIVE CONDITION)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.passiveCondition = '';
obj.passiveConditionEval = '';
var evalMode = 'none';
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1a)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = 'if (' + param + ' <= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note1b)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = 'if (' + param + ' >= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note2a)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = 'if (' + param + ' <= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note2b)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = 'if (' + param + ' >= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note3a)) {
var id = parseInt(RegExp.$1);
var value = String(RegExp.$2).toUpperCase();
var pass = ''
if (['ON', 'TRUE', 'ENABLE', 'ENABLED'].contains(value)) {
pass = 'if (!$gameSwitches.value(' + id + ')) condition = false;'
}
if (['OFF', 'FALSE', 'DISABLE', 'DISABLED'].contains(value)) {
pass = 'if ($gameSwitches.value(' + id + ')) condition = false;'
}
if (pass === '') continue;
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(notez1)) {
evalMode = 'custom passive condition';
} else if (line.match(notez2)) {
evalMode = 'none';
} else if (evalMode === 'custom passive condition') {
obj.passiveConditionEval = obj.passiveConditionEval + line + '\n';
}
}
}
};
DataManager.getPassiveConditionParam = function (string) {
string = string.toUpperCase();
var text = 'user.';
if (['HP'].contains(string)) text += 'hp';
if (['MP', 'SP'].contains(string)) text += 'mp';
if (['TP'].contains(string)) text += 'tp';
if (['ATK'].contains(string)) text += 'param(2)';
if (['DEF'].contains(string)) text += 'param(3)';
if (['MAT', 'INT'].contains(string)) text += 'param(4)';
if (['MDF', 'RES'].contains(string)) text += 'param(5)';
if (['AGI'].contains(string)) text += 'param(6)';
if (['LUK'].contains(string)) text += 'param(7)';
if (['MAX HP', 'MAXHP'].contains(string)) text += 'mhp';
if (['MAX MP', 'MAX SP', 'MAXMP', 'MAXSP'].contains(string)) text += 'mmp';
if (string.match(/VARIABLE[ ](\d+)/i)) {
text = '$gameVariables.value(' + parseInt(RegExp.$1) + ')';
}
return text;
};
DataManager.getPassiveConditionParamRate = function (string) {
string = string.toUpperCase();
var text = '0';
if (['HP'].contains(string)) return 'user.hpRate()';
if (['MP'].contains(string)) return 'user.mpRate()';
return text;
};
//=============================================================================
// Game_BattlerBase
//=============================================================================
Yanfly.APS.Game_BattlerBase_refresh = Game_BattlerBase.prototype.refresh;
Game_BattlerBase.prototype.refresh = function () {
this._passiveStatesRaw = undefined;
Yanfly.APS.Game_BattlerBase_refresh.call(this);
};
Yanfly.APS.Game_BattlerBase_states = Game_BattlerBase.prototype.states;
Game_BattlerBase.prototype.states = function () {
var array = Yanfly.APS.Game_BattlerBase_states.call(this);
array = array.concat(this.passiveStates());
this.sortPassiveStates(array);
return array;
};
Yanfly.APS.Game_BattlerBase_isStateAffected =
Game_BattlerBase.prototype.isStateAffected;
Game_BattlerBase.prototype.isStateAffected = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return true;
return Yanfly.APS.Game_BattlerBase_isStateAffected.call(this, stateId);
};
Game_BattlerBase.prototype.passiveStates = function () {
var array = [];
var raw = this.passiveStatesRaw();
for (var i = 0; i < raw.length; ++i) {
var state = $dataStates[raw[i]];
if (state && array.contains(state)) continue;
array.push(state);
}
return array;
};
Game_BattlerBase.prototype.passiveStatesRaw = function () {
var array = [];
return array.filter(Yanfly.Util.onlyUnique);
};
Game_BattlerBase.prototype.getPassiveStateData = function (obj) {
if (!obj) return [];
if (!obj.passiveStates) return [];
var array = [];
for (var i = 0; i < obj.passiveStates.length; ++i) {
var stateId = obj.passiveStates[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
}
var added = this.addEquipBattleTestSkillPassives(obj);
if (added.length > 0) {
for (var i = 0; i < added.length; ++i) {
var stateId = added[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
}
}
return array;
};
Game_BattlerBase.prototype.addEquipBattleTestSkillPassives = function (obj) {
if (!Imported.YEP_EquipBattleSkills) return [];
if (!DataManager.isBattleTest()) return [];
if (!DataManager.isSkill(obj)) return [];
return obj.equipStates;
};
Game_BattlerBase.prototype.meetPassiveStateCondition = function (stateId) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
if (this._checkPassiveStateCondition.contains(stateId)) return false;
var state = $dataStates[stateId];
if (!state) return false;
if (state.passiveCondition !== '') {
if (!this.passiveStateConditions(state)) return false;
}
if (state.passiveConditionEval === '') return true;
return this.passiveStateConditionEval(state);
};
Game_BattlerBase.prototype.passiveStateConditions = function (state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveCondition;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, 'PASSIVE STATE CUSTOM CONDITION ERROR');
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
};
Game_BattlerBase.prototype.passiveStateConditionEval = function (state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveConditionEval;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, 'PASSIVE STATE CUSTOM CONDITION ERROR');
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
};
Game_BattlerBase.prototype.sortPassiveStates = function (array) {
array.sort(function (a, b) {
var p1 = a.priority;
var p2 = b.priority;
if (p1 !== p2) return p2 - p1;
return a - b;
});
};
Game_BattlerBase.prototype.isPassiveStateAffected = function (stateId) {
return this.passiveStatesRaw().contains(stateId);
};
//=============================================================================
// Game_Battler
//=============================================================================
Yanfly.APS.Game_Battler_isStateAddable = Game_Battler.prototype.isStateAddable;
Game_Battler.prototype.isStateAddable = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return false;
return Yanfly.APS.Game_Battler_isStateAddable.call(this, stateId);
};
Yanfly.APS.Game_Battler_removeState = Game_Battler.prototype.removeState;
Game_Battler.prototype.removeState = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return;
Yanfly.APS.Game_Battler_removeState.call(this, stateId);
};
//=============================================================================
// Game_Actor
//=============================================================================
Game_Actor.prototype.passiveStatesRaw = function () {
if (this._passiveStatesRaw !== undefined) return this._passiveStatesRaw;
var array = Game_BattlerBase.prototype.passiveStatesRaw.call(this);
array = array.concat(this.getPassiveStateData(this.actor()));
array = array.concat(this.getPassiveStateData(this.currentClass()));
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
array = array.concat(this.getPassiveStateData(equip));
}
for (var i = 0; i < this._skills.length; ++i) {
var skill = $dataSkills[this._skills[i]];
array = array.concat(this.getPassiveStateData(skill));
}
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique)
return this._passiveStatesRaw;
};
Yanfly.APS.Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
Game_Actor.prototype.learnSkill = function (skillId) {
Yanfly.APS.Game_Actor_learnSkill.call(this, skillId);
this._passiveStatesRaw = undefined;
};
Yanfly.APS.Game_Actor_forgetSkill = Game_Actor.prototype.forgetSkill;
Game_Actor.prototype.forgetSkill = function (skillId) {
Yanfly.APS.Game_Actor_forgetSkill.call(this, skillId);
this._passiveStatesRaw = undefined;
};
//=============================================================================
// Game_Enemy
//=============================================================================
Game_Enemy.prototype.passiveStatesRaw = function () {
if (this._passiveStatesRaw !== undefined) return this._passiveStatesRaw;
var array = Game_BattlerBase.prototype.passiveStatesRaw.call(this);
array = array.concat(this.getPassiveStateData(this.enemy()));
for (var i = 0; i < this.skills().length; ++i) {
var skill = this.skills()[i];
array = array.concat(this.getPassiveStateData(skill));
}
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique)
return this._passiveStatesRaw;
};
if (!Game_Enemy.prototype.skills) {
Game_Enemy.prototype.skills = function () {
var skills = []
for (var i = 0; i < this.enemy().actions.length; ++i) {
var skill = $dataSkills[this.enemy().actions[i].skillId];
if (skill) skills.push(skill);
}
return skills;
}
};
//=============================================================================
// Game_Unit
//=============================================================================
Game_Unit.prototype.refreshMembers = function () {
var group = this.allMembers();
var length = group.length;
for (var i = 0; i < length; ++i) {
var member = group[i];
if (member) member.refresh();
}
};
Game_Unit.prototype.allMembers = function () {
return this.members();
};
//=============================================================================
// Game_Player
//=============================================================================
Yanfly.APS.Game_Player_refresh = Game_Player.prototype.refresh;
Game_Player.prototype.refresh = function () {
$gameParty.refreshMembers();
Yanfly.APS.Game_Player_refresh.call(this);
};
//=============================================================================
// Utilities
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function (e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').window.isDevToolsOpen()) {
require('nw.gui').window.showDevTools();
}
}
};
Yanfly.Util.getRange = function (n, m) {
var result = [];
for (var i = n; i <= m; ++i) result.push(i);
return result;
};
Yanfly.Util.onlyUnique = function (value, index, self) {
return self.indexOf(value) === index;
};
//=============================================================================
// End of File
//=============================================================================

View file

@ -0,0 +1,93 @@
//=============================================================================
// Yanfly Engine Plugins - Base Troop Events
// YEP_BaseTroopEvents.js
//=============================================================================
var Imported = Imported || {};
Imported.YEP_BaseTroopEvents = true;
var Yanfly = Yanfly || {};
Yanfly.BTE = Yanfly.BTE || {};
Yanfly.BTE.version = 1.01
//=============================================================================
/*:
* @plugindesc v1.01 Enabling this plugin will cause all troops to have
* events occur in every fight.
* @author Yanfly Engine Plugins
*
* @param Base Troop ID
* @type troop
* @desc Change this value to the Troop ID you want all of the recurring
* troop events to draw from.
* @default 1
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* For all the eventers out there who love to customize their battles through
* custom event pages, you can now save yourself some time by drawing all the
* event pages from a base troop event to occur in every fight. All of the
* events will be present in every single battle.
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.01:
* - Updated for RPG Maker MV version 1.5.0.
*
* Version 1.00:
* - Finished Plugin!
*/
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_BaseTroopEvents');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.BaseTroopID = Number(Yanfly.Parameters['Base Troop ID']);
//=============================================================================
// DataManager
//=============================================================================
Yanfly.BTE.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.BTE.DataManager_isDatabaseLoaded.call(this)) return false;
this.processBTEPages();
return true;
};
DataManager.processBTEPages = function() {
for (var n = 1; n < $dataTroops.length; n++) {
var base_troop = $dataTroops[Yanfly.Param.BaseTroopID];
var troop = $dataTroops[n];
if (n !== Yanfly.Param.BaseTroopID && Yanfly.Param.BaseTroopID > 0) {
if (troop._baseTroopEventsMade) continue;
Yanfly.Util.extend(troop.pages, base_troop.pages);
troop._baseTroopEventsMade = true;
}
}
};
//=============================================================================
// New Function
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.extend = function (mainArray, otherArray) {
otherArray.forEach(function(i) {
mainArray.push(i)
}, this);
}
//=============================================================================
// End of File
//=============================================================================

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more