|
|
|
|
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| 'use strict';
|
| {
|
|
|
| const script = document.currentScript;
|
| const pluginName = script.src.replace(/^.*\/(.*).js$/, function() {return arguments[1];});
|
|
|
| function hasPluginCommonBase(){
|
| for(const i in $plugins) {
|
| if($plugins[i].name === "PluginCommonBase" && $plugins[i].status) return true;
|
| }
|
| return false;
|
| };
|
|
|
|
|
| if(hasPluginCommonBase() && Utils.RPGMAKER_NAME === "MZ"){
|
| PluginManagerEx.registerCommand(document.currentScript, "EasySpin", function (args) {
|
| this.character(args.eventId).easySpin(false);
|
| if(args.wait) this.wait(24);
|
| });
|
| PluginManagerEx.registerCommand(document.currentScript, "EasyShake", function (args) {
|
| this.character(args.eventId).easyShake(false);
|
| if(args.wait) this.wait(24);
|
| });
|
| PluginManagerEx.registerCommand(document.currentScript, "EasyJump", function (args) {
|
| const character = this.character(args.eventId);
|
| character.easyJump(false);
|
| if(args.wait) this.wait(character._jumpCount);
|
| });
|
| PluginManagerEx.registerCommand(document.currentScript, "EasyBackoff", function (args) {
|
| const character = this.character(args.eventId);
|
| character.easyBackoff();
|
| if(args.wait) this.wait(1/character.distancePerFrame());
|
| });
|
| PluginManagerEx.registerCommand(document.currentScript, "EasyBackstep", function (args) {
|
| const character = this.character(args.eventId);
|
| character.easyBackstep();
|
| if(args.wait) this.wait(character._jumpCount);
|
| });
|
| }
|
| else if(Utils.RPGMAKER_NAME === "MZ"){
|
| PluginManager.registerCommand(pluginName, "EasySpin", function (args) {
|
| const wait = args.wait==="true";
|
| this.character(+args.eventId).easySpin();
|
| if(wait) this.wait(24);
|
| });
|
| PluginManager.registerCommand(pluginName, "EasyShake", function (args) {
|
| const wait = args.wait==="true";
|
| this.character(+args.eventId).easyShake(false);
|
| if(wait) this.wait(24);
|
| });
|
| PluginManager.registerCommand(pluginName, "EasyJump", function (args) {
|
| const character = this.character(+args.eventId);
|
| const wait = args.wait==="true";
|
| character.easyJump(false);
|
| if(wait) this.wait(character._jumpCount);
|
| });
|
| PluginManager.registerCommand(pluginName, "EasyBackoff", function (args) {
|
| const character = this.character(+args.eventId);
|
| const wait = args.wait==="true";
|
| character.easyBackoff();
|
| if(wait) this.wait(1/character.distancePerFrame());
|
| });
|
| PluginManager.registerCommand(pluginName, "EasyBackstep", function (args) {
|
| const character = this.character(+args.eventId);
|
| const wait = args.wait==="true";
|
| character.easyBackstep();
|
| if(wait) this.wait(character._jumpCount);
|
| });
|
| }
|
|
|
| const commandSet = new Set(['easySpin', 'easyShake', 'easyJump', 'easyBackoff', 'easyBackstep']);
|
|
|
| const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
| Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
| _Game_Interpreter_pluginCommand.apply(this, arguments);
|
|
|
| if (commandSet.has(command)) {
|
| const character = this.character(+args[0]);
|
| const wait = args[1]==="true" || args[1]===undefined;
|
| character[command](false);
|
|
|
| if (wait) {
|
| switch (command) {
|
| case 'easySpin':
|
| case 'easyShake':
|
| this.wait(24);
|
| break;
|
|
|
| case 'easyJump':
|
| case 'easyBackstep':
|
| this.wait(character._jumpCount);
|
| break;
|
|
|
| case 'easyBackoff':
|
| this.wait(1/character.distancePerFrame());
|
| break;
|
| }
|
| }
|
| }
|
|
|
| };
|
|
|
|
|
| const _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
|
| Game_CharacterBase.prototype.initMembers = function() {
|
| _Game_CharacterBase_initMembers.call(this);
|
| this._easySpin = false;
|
| this._easySpinCount = 0;
|
| this._easyShake = false;
|
| this._easyShakeCount = 0;
|
| this._easyActionX = 0;
|
| this._easyActionAngle = 0;
|
| this._easyActionJumping = false;
|
| };
|
|
|
|
|
| const _Game_CharacterBase_update = Game_CharacterBase.prototype.update;
|
| Game_CharacterBase.prototype.update = function() {
|
| _Game_CharacterBase_update.call(this);
|
| this.updateEasySpin();
|
| this.updateEasyShake();
|
| };
|
|
|
|
|
| Game_CharacterBase.prototype.updateEasySpin = function() {
|
| if (this._easySpin) {
|
| this._easySpinCount++;
|
| this.easySpinSetAngle();
|
| } else if (this._easySpinCount) {
|
| this._easySpinCount = 0;
|
| }
|
| };
|
|
|
|
|
| Game_CharacterBase.prototype.updateEasyShake = function() {
|
| if (this._easyShake) {
|
| this._easyShakeCount++;
|
| this.easyShakeSetOffsets();
|
| }
|
| };
|
|
|
| Game_CharacterBase.prototype.easySpinSetAngle = function() {
|
| let angle = 15 * this._easySpinCount;
|
| if(angle >= 360){
|
| angle = 0
|
| this._easySpin = false;
|
| }
|
| this._easyActionAngle = angle;
|
| };
|
|
|
| Game_CharacterBase.prototype.easyShakeSetOffsets = function() {
|
| const angle = 37.5 * this._easyShakeCount;
|
| const rad = angle*Math.PI/180
|
| let offset = 4 * Math.sin(rad);
|
| if(angle >= 900){
|
| this._easyShake = false;
|
| this._easyShakeCount = 0;
|
| offset = 0;
|
| }
|
| this._easyActionX = offset;
|
| };
|
|
|
| Game_CharacterBase.prototype.easySpin = function (bool = true){
|
| this._easySpin = true;
|
| this._easySpinCount = 0;
|
| if(bool) this._waitCount = 24;
|
| };
|
|
|
| Game_CharacterBase.prototype.easyShake = function (bool = true){
|
| this._easyShake = true;
|
| this._easyShakeCount = 0;
|
| if(bool) this._waitCount = 24;
|
| };
|
|
|
| Game_CharacterBase.prototype.easyBackoff = function (){
|
| this.moveBackward();
|
| };
|
|
|
| Game_CharacterBase.prototype.easyJump = function (){
|
| this._easyActionJumping = true;
|
| this.jump(0,0);
|
| };
|
|
|
| Game_CharacterBase.prototype.easyBackstep = function (){
|
| this._easyActionJumping = true;
|
| this.backstep();
|
| };
|
|
|
| Game_CharacterBase.prototype.backstep = function (){
|
| const dir = this.direction();
|
| const x = dir===6?-1:dir===4?1:0;
|
| const y = dir===2?-1:dir===8?1:0;
|
| const lastDirectionFix = this.isDirectionFixed();
|
| this.setDirectionFix(true);
|
| this.jump(x,y);
|
| this.setDirectionFix(lastDirectionFix);
|
| };
|
|
|
| const _Sprite_Character_update = Sprite_Character.prototype.update;
|
| Sprite_Character.prototype.update = function() {
|
| _Sprite_Character_update.call(this);
|
| this.updateAngle();
|
| };
|
|
|
|
|
| const _Sprite_Character_updateAngle = Sprite_Character.prototype.updateAngle;
|
| if (_Sprite_Character_updateAngle) {
|
| Sprite_Character.prototype.updateAngle = function() {
|
| _Sprite_Character_updateAngle.call(this);
|
| if (this._character._easySpin) {
|
| this.anchor.y = 0.5;
|
| this.rotation += this._character._easyActionAngle * Math.PI / 180;
|
| }
|
| };
|
|
|
| } else {
|
| Sprite_Character.prototype.updateAngle = function() {
|
| this.rotation = 0;
|
| if (this._character._easySpin) {
|
| this.anchor.y = 0.5;
|
| this.rotation += this._character._easyActionAngle * Math.PI / 180;
|
| } else {
|
| this.anchor.y = 1;
|
| }
|
| };
|
| }
|
|
|
| const _Sprite_Character_updatePosition = Sprite_Character.prototype.updatePosition;
|
| Sprite_Character.prototype.updatePosition = function() {
|
| _Sprite_Character_updatePosition.call(this);
|
| if (this._character._easyActionX) {
|
| this.x += this._character._easyActionX;
|
| }
|
| if (this._character._easySpin) {
|
| this.y -= this.height/2;
|
| }
|
| };
|
|
|
| const _Game_CharacterBase_updateJump = Game_CharacterBase.prototype.updateJump;
|
| Game_CharacterBase.prototype.updateJump = function() {
|
| _Game_CharacterBase_updateJump.call(this);
|
| if (this._jumpCount === 0) {
|
| this._easyActionJumping = false;
|
| }
|
| };
|
|
|
| const _Game_Followers_jumpAll = Game_Followers.prototype.jumpAll;
|
| Game_Followers.prototype.jumpAll = function() {
|
| if (!$gamePlayer._easyActionJumping) {
|
| _Game_Followers_jumpAll.call(this);
|
| }
|
| };
|
|
|
| Tilemap.prototype._compareChildOrder = function(a, b) {
|
| if (a.z !== b.z) {
|
| return a.z - b.z;
|
| } else {
|
| const c = a._character && a._character._easySpinCount? -a.height/2 : 0;
|
| const d = b._character && b._character._easySpinCount? -b.height/2 : 0;
|
| if (a.y - c !== b.y - d) {
|
| return a.y - c - b.y + d;
|
| } else {
|
| return a.spriteId - b.spriteId;
|
| }
|
| }
|
| };
|
|
|
| } |