From 33081835516b22238c4b065bc3bd31c7f1a1ff42 Mon Sep 17 00:00:00 2001 From: aaixy <54528229+aaixy@users.noreply.github.com> Date: Thu, 26 Dec 2019 12:22:31 +0800 Subject: [PATCH] Add files via upload --- AXY_Actor.js | 455 ++++++++++++++++++++++++++++++++++++++++++++ AXY_Enemy.js | 23 ++- AXY_MiniGame_FC.js | 319 +++++++++++++++++++++++++++++++ AXY_Save.js | 150 ++++++++++----- AXY_Skill.js | 93 ++++++++- AXY_TitleVersion.js | 10 +- 6 files changed, 989 insertions(+), 61 deletions(-) create mode 100644 AXY_Actor.js create mode 100644 AXY_MiniGame_FC.js diff --git a/AXY_Actor.js b/AXY_Actor.js new file mode 100644 index 0000000..e1ee03c --- /dev/null +++ b/AXY_Actor.js @@ -0,0 +1,455 @@ +//============================================================================= +// A XueYu Plugins - Actor +// AXY_Actor.js +// Version: 1.02 +// License: MIT +//============================================================================= +/*: + * @plugindesc v1.02 Allows to change Actor's staff. + * @author A XueYu Plugins + * + * @help + * Introduction + * This plugin allows to change Actor's staff. + * Github: https://github.com/aaixy/rmmv-plugins + * + * Usage: + * Write + * + * + * + * + * + * + * + * + * + * + * + * + * + * //this will overwrite above four exp params and make level up linner. + * if you want to set general then Write + * + * + * + * + * + * + * + * + * to Actor or Class meta note box, Class has higher priority; + * + * Example: + * not yet + * + * changelog + * 1.02 2019.12.25 + * add: exp support; + * 1.01 2019.12.22 + * add: face hue support; + * add: character hue support; + * 1.00 2019.12.12 + * first release; + * + * @param mhp + * @text Max HP + * @desc Max HP, default: 9999 + * @type number + * @min 1 + * @default 9999 + * + * @param mmp + * @text Max MP + * @desc Max MP, default: 9999 + * @type number + * @min 0 + * @default 9999 + * + * @param matk + * @text Max ATK + * @desc Max ATK, default: 999 + * @type number + * @min 0 + * @default 999 + * + * @param mdef + * @text Max DEF + * @desc Max DEF, default: 999 + * @type number + * @min 0 + * @default 999 + * + * @param mmat + * @text Max MAT + * @desc Max MAT, default: 999 + * @type number + * @min 0 + * @default 999 + * + * @param mmdf + * @text Max MDF + * @desc Max MDF, default: 999 + * @type number + * @min 0 + * @default 999 + * + * @param magi + * @text Max AGI + * @desc Max AGI, default: 999 + * @type number + * @min 0 + * @default 999 + * + * @param mluk + * @text Max LUK + * @desc Max LUK, default: 999 + * @type number + * @min 0 + * @default 999 + * + */ + +// Imported +var Imported = Imported || {}; +Imported.AXY_Actor = true; + +// Parameter Variables +var AXY = AXY || {}; +AXY.Actor = AXY.Actor || {}; + +AXY.Actor.Parameters = PluginManager.parameters('AXY_Actor'); +AXY.Actor.Param = AXY.Actor.Param || {}; +AXY.Actor.Alias = AXY.Actor.Alias || {}; +AXY.Actor.Variables = AXY.Actor.Variables || {}; + +//============================================================================= +// Utils +//============================================================================= +// Create a utility function to parse complex parameters. +//============================================================================= +Utils.recursiveParse = function (param) { + try { + if (typeof JSON.parse(param) == "object") { + return JSON.parse(param, function (key, value) { + try { + return this.recursiveParse(value); + } catch (e) { + return value; + } + }.bind(this)); + } else { + return JSON.parse(param, function (key, value) { + return value; + }.bind(this)); + } + } catch (e) { + return param; + } +}; + +//============================================================================= +// Parameters +//============================================================================= +// Read and parse parameters into a locally scoped Parameters object. +//============================================================================= +Object.keys(AXY.Actor.Parameters).forEach(function (key) { + return AXY.Actor.Param[key] = Utils.recursiveParse(AXY.Actor.Parameters[key]); +}); + +// Main +Game_Actor.prototype.expForLevel = function (level) { + var _metaClass = this.currentClass().meta; + var _metaActor = this.actor().meta; + var _tmp = parseInt(_metaClass.axy_actor_exp) || parseInt(_metaActor.axy_actor_exp) || 0; + if (_tmp) { + return Math.round(_tmp * level); + } else { + var c = this.currentClass(); + var basis = parseInt(_metaClass.axy_actor_exp_basis) || parseInt(_metaActor.axy_actor_exp_basis) || c.expParams[0]; + var extra = parseInt(_metaClass.axy_actor_exp_extra) || parseInt(_metaActor.axy_actor_exp_extra) || c.expParams[1]; + var acc_a = parseInt(_metaClass.axy_actor_exp_acc_a) || parseInt(_metaActor.axy_actor_exp_acc_a) || c.expParams[2]; + var acc_b = parseInt(_metaClass.axy_actor_exp_acc_b) || parseInt(_metaActor.axy_actor_exp_acc_b) || c.expParams[3]; + return Math.round(basis * (Math.pow(level - 1, 0.9 + acc_a / 250)) * level * + (level + 1) / (6 + Math.pow(level, 2) / 50 / acc_b) + (level - 1) * extra); + } +}; + +Window_Base.prototype.drawActorFace = function (actor, x, y, width, height) { + var _metaClass = actor.currentClass().meta; + var _metaActor = actor.actor().meta; + var _hue = parseInt(_metaClass.axy_actor_hue) || parseInt(_metaActor.axy_actor_hue) || 0; + this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height, _hue); +}; + +Window_Base.prototype.drawFace = function (faceName, faceIndex, x, y, width, height, hue) { + width = width || Window_Base._faceWidth; + height = height || Window_Base._faceHeight; + var bitmap = ImageManager.loadFace(faceName, hue); + var pw = Window_Base._faceWidth; + var ph = Window_Base._faceHeight; + var sw = Math.min(width, pw); + var sh = Math.min(height, ph); + var dx = Math.floor(x + Math.max(width - pw, 0) / 2); + var dy = Math.floor(y + Math.max(height - ph, 0) / 2); + var sx = faceIndex % 4 * pw + (pw - sw) / 2; + var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2; + this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy); +}; +if (Imported.YEP_BattleStatusWindow) { + Window_BattleStatus.prototype.drawFace = function (fn, fi, x, y, width, height, hue) { + width = width || Window_Base._faceWidth; + height = height || Window_Base._faceHeight; + var bitmap = ImageManager.loadFace(fn, hue); + var pw = Window_Base._faceWidth; + var ph = Window_Base._faceHeight; + var sw = Math.min(width, pw); + var sh = Math.min(height, ph); + var dx = Math.floor(x + Math.max(width - pw, 0) / 2); + var dy = Math.floor(y + Math.max(height - ph, 0) / 2); + var sx = fi % 4 * pw + (pw - sw) / 2; + var sy = Math.floor(fi / 4) * ph + (ph - sh) / 2; + this._faceContents.bitmap.blt(bitmap, sx, sy, sw, sh, dx, dy); + }; +} + +Sprite_Character.prototype.setCharacterBitmap = function () { + this.bitmap = ImageManager.loadCharacter(this._characterName, this._character._characterHue); + this._isBigCharacter = ImageManager.isBigCharacter(this._characterName); +}; +/* +Spriteset_Map.prototype.createCharacters = function () { + this._characterSprites = []; + $gameMap.events().forEach(function (event) { + this._characterSprites.push(new Sprite_Character(event)); + }, this); + $gameMap.vehicles().forEach(function (vehicle) { + this._characterSprites.push(new Sprite_Character(vehicle)); + }, this); + $gamePlayer.followers().reverseEach(function (follower) { + + this._characterSprites.push(new Sprite_Character(follower)); + }, this); + this._characterSprites.push(new Sprite_Character($gamePlayer)); + for (var i = 0; i < this._characterSprites.length; i++) { + this._tilemap.addChild(this._characterSprites[i]); + } +}; +Game_Actor.prototype.initImages = function () { + var actor = this.actor(); + this._characterName = actor.characterName; + this._characterIndex = actor.characterIndex; + this._faceName = actor.faceName; + this._faceIndex = actor.faceIndex; + this._battlerName = actor.battlerName; + + var _metaClass = this.currentClass().meta; + var _metaActor = this.actor().meta; + var _hue = parseInt(_metaClass.axy_actor_hue) || parseInt(_metaActor.axy_actor_hue) || 0; + this._hue = _hue; + console.log(_hue); + console.log(this._hue); +}; +Game_Actor.prototype.characterHue = function () { + return this._hue; +};*/ + +Game_CharacterBase.prototype.characterHue = function () { + return this._characterHue; +}; + +Game_CharacterBase.prototype.setImage = function (characterName, characterIndex, characterHue) { + this._tileId = 0; + this._characterName = characterName; + this._characterIndex = characterIndex; + this._isObjectCharacter = ImageManager.isObjectCharacter(characterName); + this._characterHue = characterHue; +}; + +Game_Player.prototype.refresh = function () { + var actor = $gameParty.leader(); + var characterName = actor ? actor.characterName() : ''; + var characterIndex = actor ? actor.characterIndex() : 0; + var _metaClass = actor.currentClass().meta; + var _metaActor = actor.actor().meta; + var _hue = parseInt(_metaClass.axy_actor_hue) || parseInt(_metaActor.axy_actor_hue) || 0; + var characterHue = actor ? _hue : 0; + this.setImage(characterName, characterIndex, characterHue); + this._followers.refresh(); +}; + +Game_Follower.prototype.refresh = function () { + var characterName = this.isVisible() ? this.actor().characterName() : ''; + var characterIndex = this.isVisible() ? this.actor().characterIndex() : 0; + var _metaClass = this.isVisible() ? this.actor().currentClass().meta : 0; + var _metaActor = this.isVisible() ? this.actor().actor().meta : 0; + var _hue = parseInt(_metaClass.axy_actor_hue) || parseInt(_metaActor.axy_actor_hue) || 0; + var characterHue = this.isVisible() ? _hue : 0; + this.setImage(characterName, characterIndex, characterHue); +}; + +//rmmv miss actor info, so these blow can not use hue except modify rmmv whoel core lower logic. +/* +Window_Base.prototype.drawActorCharacter = function (actor, x, y) { + console.log(actor); + var _metaClass = actor.currentClass().meta; + var _metaActor = actor.actor().meta; + var _hue = parseInt(_metaClass.axy_actor_hue) || parseInt(_metaActor.axy_actor_hue) || 0; + this.drawCharacter(actor.characterName(), actor.characterIndex(), x, y, _hue); +}; + +Window_Base.prototype.drawCharacter = function (characterName, characterIndex, x, y, hue) { + console.log(hue); + var bitmap = ImageManager.loadCharacter(characterName, hue); + var big = ImageManager.isBigCharacter(characterName); + var pw = bitmap.width / (big ? 3 : 12); + var ph = bitmap.height / (big ? 4 : 8); + var n = characterIndex; + var sx = (n % 4 * 3 + 1) * pw; + var sy = (Math.floor(n / 4) * 4) * ph; + this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph); +}; + +Window_SavefileList.prototype.drawPartyCharacters = function (info, x, y) { + console.log(info); + if (info.characters) { + for (var i = 0; i < info.characters.length; i++) { + var data = info.characters[i]; + this.drawCharacter(data[0], data[1], x + i * 48, y, 100); + } + } +};*/ + +Game_Party.prototype.charactersForSavefile = function () { + return this.battleMembers().map(function (actor) { + return [actor.characterName(), actor.characterIndex()]; + }); +}; + +Game_Actor.prototype.paramMax = function (paramId) { + var _metaClass = this.currentClass().meta; + var _metaActor = this.actor().meta; + switch (paramId) { + case 0: // MHP + var _tmp = parseInt(_metaClass.axy_actor_mhp) || parseInt(_metaActor.axy_actor_mhp) || AXY.Actor.Param.mhp; + return _tmp; + case 1: // MMP + var _tmp = parseInt(_metaClass.axy_actor_mmp) || parseInt(_metaActor.axy_actor_mmp) || AXY.Actor.Param.mmp; + return _tmp; + case 2: //ATK + var _tmp = parseInt(_metaClass.axy_actor_matk) || parseInt(_metaActor.axy_actor_matk) || AXY.Actor.Param.matk; + return _tmp; + case 3: //DEF + var _tmp = parseInt(_metaClass.axy_actor_mdef) || parseInt(_metaActor.axy_actor_mdef) || AXY.Actor.Param.mdef; + return _tmp; + case 4: //MAT + var _tmp = parseInt(_metaClass.axy_actor_mmat) || parseInt(_metaActor.axy_actor_mmat) || AXY.Actor.Param.mmat; + return _tmp; + case 5: //MDF + var _tmp = parseInt(_metaClass.axy_actor_mmdf) || parseInt(_metaActor.axy_actor_mmdf) || AXY.Actor.Param.mmdf; + return _tmp; + case 6: //AGI + var _tmp = parseInt(_metaClass.axy_actor_magi) || parseInt(_metaActor.axy_actor_magi) || AXY.Actor.Param.magi; + return _tmp; + case 7: //LUK + var _tmp = parseInt(_metaClass.axy_actor_mluk) || parseInt(_metaActor.axy_actor_mluk) || AXY.Actor.Param.mluk; + return _tmp; + } + return Game_Battler.prototype.paramMax.call(this, paramId); +}; + +Game_Actor.prototype.paramBase = function (paramId) { + var _metaClass = this.currentClass().meta; + var _metaActor = this.actor().meta; + switch (paramId) { + case 0: // MHP + var _mtmp = parseInt(_metaClass.axy_actor_mhp) || parseInt(_metaActor.axy_actor_mhp); + var _tmp = parseInt(_metaClass.axy_actor_hp) || parseInt(_metaActor.axy_actor_hp); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 1: // MMP + var _mtmp = parseInt(_metaClass.axy_actor_mmp) || parseInt(_metaActor.axy_actor_mmp); + var _tmp = parseInt(_metaClass.axy_actor_mp) || parseInt(_metaActor.axy_actor_mp); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 2: //ATK + var _mtmp = parseInt(_metaClass.axy_actor_matk) || parseInt(_metaActor.axy_actor_matk); + var _tmp = parseInt(_metaClass.axy_actor_atk) || parseInt(_metaActor.axy_actor_atk); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 3: //DEF + var _mtmp = parseInt(_metaClass.axy_actor_mdef) || parseInt(_metaActor.axy_actor_mdef); + var _tmp = parseInt(_metaClass.axy_actor_def) || parseInt(_metaActor.axy_actor_def); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 4: //MAT + var _mtmp = parseInt(_metaClass.axy_actor_mmat) || parseInt(_metaActor.axy_actor_mmat); + var _tmp = parseInt(_metaClass.axy_actor_mat) || parseInt(_metaActor.axy_actor_mat); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 5: //MDF + var _mtmp = parseInt(_metaClass.axy_actor_mmdf) || parseInt(_metaActor.axy_actor_mmdf); + var _tmp = parseInt(_metaClass.axy_actor_mdf) || parseInt(_metaActor.axy_actor_mdf); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 6: //AGI + var _mtmp = parseInt(_metaClass.axy_actor_magi) || parseInt(_metaActor.axy_actor_magi); + var _tmp = parseInt(_metaClass.axy_actor_agi) || parseInt(_metaActor.axy_actor_agi); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + case 7: //LUK + var _mtmp = parseInt(_metaClass.axy_actor_mluk) || parseInt(_metaActor.axy_actor_mluk); + var _tmp = parseInt(_metaClass.axy_actor_luk) || parseInt(_metaActor.axy_actor_luk); + if (_tmp) { + var _t = _tmp; + } else if (_mtmp) { + var _t = (this._level + 1) * _mtmp / 100; + } else { + var _t = this.currentClass().params[paramId][this._level]; + } + return _t; + } + return this.currentClass().params[paramId][this._level]; +}; \ No newline at end of file diff --git a/AXY_Enemy.js b/AXY_Enemy.js index 75ead1d..a0baebe 100644 --- a/AXY_Enemy.js +++ b/AXY_Enemy.js @@ -1,11 +1,11 @@ //============================================================================= // A XueYu Plugins - Enemy // AXY_Enemy.js -// Version: 1.05 +// Version: 1.06 // License: MIT //============================================================================= /*: - * @plugindesc v1.05 Allows add Enemy in battle and enemy's staff. + * @plugindesc v1.06 Allows add Enemy in battle and enemy's staff. * @author A XueYu Plugins * * @help @@ -16,6 +16,7 @@ * Usage: * Write * + * * to enemy meta note box; * * Example: @@ -27,6 +28,9 @@ * AXY.Enemy.bulkAdd(10,[1,10],[100,200],[300,400]); * * changelog + * 1.06 2019.12.22 + * add: global variables for hp and mhp; + * add: for max hp; * 1.05 2019.11.28 * add: meta: for break out hp=999999; * 1.04 2019.11.25 @@ -48,6 +52,12 @@ * @type struct * @default * + * @param GlobalHpMhpTimesVariableID + * @text Global HP/MHP Times Variable ID + * @desc Global HP/MHP times Variable ID. default: 1 + * @type variable + * @default 1 + * * */ @@ -150,16 +160,15 @@ Object.keys(AXY.Enemy.Parameters).forEach(function (key) { Game_BattlerBase.prototype.param = function (paramId) { if (paramId === 0) { var value = this.enemy().meta.axy_enemy_hp || this.paramBase(paramId) + this.paramPlus(paramId); - var maxValue = parseInt(this.enemy().meta.axy_enemy_hp) || this.paramMax(paramId); + var maxValue = parseInt(this.enemy().meta.axy_enemy_mhp) || parseInt(this.enemy().meta.axy_enemy_hp) || this.paramMax(paramId); + + value *= $gameVariables.value(AXY.Enemy.Param.GlobalHpMhpTimesVariableID) || 1; + maxValue *= $gameVariables.value(AXY.Enemy.Param.GlobalHpMhpTimesVariableID) || 1; } else { var value = this.paramBase(paramId) + this.paramPlus(paramId); var maxValue = this.paramMax(paramId); } value *= this.paramRate(paramId) * this.paramBuffRate(paramId); - //console.log(value); - //AAAAAA = this; - //AAAAAAV = value; - //AAAAAAM = maxValue; var minValue = this.paramMin(paramId); return Math.round(value.clamp(minValue, maxValue)); diff --git a/AXY_MiniGame_FC.js b/AXY_MiniGame_FC.js new file mode 100644 index 0000000..cd7cd6b --- /dev/null +++ b/AXY_MiniGame_FC.js @@ -0,0 +1,319 @@ +//============================================================================= +// A XueYu Plugins - Mini Game FC +// AXY_MiniGame_FC.js +// Version: 1.0 +// License: MIT +//============================================================================= +/*: + * @plugindesc v1.0 This plugin show mini game FC. + * @author A XueYu Plugins + * + * @param Anchor + * @desc The MiniGame_FC Anchor point. topleft/center + * @default center + * + * @param X + * @desc The x position of MiniGame_FC. this is a eval param, so you can use Variables. + * @default window.innerWidth/2 + * + * @param Y + * @desc The y position of MiniGame_FC. this is a eval param, so you can use Variables. + * @default window.innerHeight/2 + * + * @param Width + * @desc The MiniGame_FC box width with auto, % percent or px. + * @default auto + * + * @param Height + * @desc The MiniGame_FC box height with auto, % percent or px. + * @default auto + * + * @param opacity + * @desc The css opacity. 0-1 + * @default 1 + * + * @param zIndex + * @desc The css zIndex. + * @default 10000 + * + * @param delay + * @desc The MiniGame_FC life time. set to 0 to disable. unit is microseconds. + * @default 1000 + * + * @param MiniGame_FCalign + * @desc The MiniGame_FC align. left/center/right + * @default center + * + * @param backgroundcolor + * @desc #000000-#FFFFFF or RGBA(R,G,B,A) or red blue green yellow etc. + * @default rgba(0,0,0,0) + * + * @param color + * @desc #000000-#FFFFFF or RGBA(R,G,B,A) or red blue green yellow etc. + * @default white + * + * @param padding + * @desc The css padding. + * @default 0 + * + * @param fontfamily + * @desc The MiniGame_FC font family. this is a eval param, so you can use Variables. + * @default $gameSystem ? Window_Base.prototype.standardFontFace : 'GameFont' + * + * @param fontsize + * @desc The MiniGame_FC font size. + * @default 20 + * + * @param MiniGame_FCShadowColor + * @desc #000000-#FFFFFF or RGBA(R,G,B,A) or red blue green yellow etc. + * @default rgba(0,0,0,1) + * + * @param MiniGame_FCShadowWidth + * @desc MiniGame_FC Shadow Width. + * @default 1 + * + * @help + * Introduction + * This plugin support rmmv show mini game MiniGame_FC. + * Easy to use and powerful. + * + * Example: + * AXY_MiniGame_FC.show(); + * AXY_MiniGame_FC.show('zzjb'); + * AXY_MiniGame_FC.remove(); + * AXY_MiniGame_FC.removeall(); + * + * + * changelog + * 1.0 2019.12.18 + * first release; + */ + +// Imported +var Imported = Imported || {}; +Imported.AXY_MiniGame_FC = true; + +// Parameter Variables +var AXY = AXY || {}; +AXY.MiniGame_FC = AXY.MiniGame_FC || {}; + +AXY.MiniGame_FC.Parameters = PluginManager.parameters('AXY_MiniGame_FC'); +AXY.MiniGame_FC.Param = AXY.MiniGame_FC.Param || {}; + +// +AXY.MiniGame_FC.Param.Anchor = String(AXY.MiniGame_FC.Parameters['Anchor']); +AXY.MiniGame_FC.Param.X = String(AXY.MiniGame_FC.Parameters['X']); +AXY.MiniGame_FC.Param.Y = String(AXY.MiniGame_FC.Parameters['Y']); +AXY.MiniGame_FC.Param.Width = String(AXY.MiniGame_FC.Parameters['Width']); +AXY.MiniGame_FC.Param.Height = String(AXY.MiniGame_FC.Parameters['Height']); +AXY.MiniGame_FC.Param.opacity = parseFloat(AXY.MiniGame_FC.Parameters['opacity']); +AXY.MiniGame_FC.Param.zIndex = parseInt(AXY.MiniGame_FC.Parameters['zIndex']); +AXY.MiniGame_FC.Param.delay = parseInt(AXY.MiniGame_FC.Parameters['delay']); +AXY.MiniGame_FC.Param.path = String(AXY.MiniGame_FC.Parameters['path']); + +//main +//MiniGame_FC +AXY_MiniGame_FC = { + show: function (rom) { + $gameSystem.setTouchMoveEnabled(false); + //$gameMap._interpreter.setWaitMode('video'); + //$gameMap._interpreter.setWaitMode('message'); + $gameMessage.add('Playing game... Please do not disturb me!') + $gameSystem.saveBgm(); + AudioManager.stopBgm(); + //console.log(arguments); + var AXYMiniGame_FCArgs = arguments[1] ? arguments[1] : {}; + var msg = AXYMiniGame_FCArgs['msg'] ? eval(String(AXYMiniGame_FCArgs['msg'])) : ""; + var delay = AXYMiniGame_FCArgs['delay'] ? AXYMiniGame_FCArgs['delay'] : AXY.MiniGame_FC.Param.delay; + var id = AXYMiniGame_FCArgs['id'] ? AXYMiniGame_FCArgs['id'] : 1; + var x = AXYMiniGame_FCArgs['x'] != undefined ? eval(AXYMiniGame_FCArgs['x']) : eval(AXY.MiniGame_FC.Param.X); + var y = AXYMiniGame_FCArgs['y'] != undefined ? eval(AXYMiniGame_FCArgs['y']) : eval(AXY.MiniGame_FC.Param.Y); + var width = AXYMiniGame_FCArgs['width'] ? AXYMiniGame_FCArgs['width'] : AXY.MiniGame_FC.Param.Width; + var height = AXYMiniGame_FCArgs['height'] ? AXYMiniGame_FCArgs['height'] : AXY.MiniGame_FC.Param.Height; + var opacity = AXYMiniGame_FCArgs['opacity'] ? AXYMiniGame_FCArgs['opacity'] : AXY.MiniGame_FC.Param.opacity; + var align = AXYMiniGame_FCArgs['align'] ? AXYMiniGame_FCArgs['align'] : AXY.MiniGame_FC.Param.Anchor; + var MiniGame_FCalign = AXYMiniGame_FCArgs['MiniGame_FCalign'] ? AXYMiniGame_FCArgs['MiniGame_FCalign'] : String(AXY.MiniGame_FC.Parameters['MiniGame_FCalign']); + var backgroundcolor = AXYMiniGame_FCArgs['backgroundcolor'] ? AXYMiniGame_FCArgs['backgroundcolor'] : String(AXY.MiniGame_FC.Parameters['backgroundcolor']); + var color = AXYMiniGame_FCArgs['color'] ? AXYMiniGame_FCArgs['color'] : String(AXY.MiniGame_FC.Parameters['color']); + var padding = AXYMiniGame_FCArgs['padding'] ? AXYMiniGame_FCArgs['padding'] : String(AXY.MiniGame_FC.Parameters['padding']);; + var fontfamily = AXYMiniGame_FCArgs['fontfamily'] ? eval(AXYMiniGame_FCArgs['fontfamily']) : eval(String(AXY.MiniGame_FC.Parameters['fontfamily'])); + var fontsize = AXYMiniGame_FCArgs['fontsize'] ? AXYMiniGame_FCArgs['fontsize'] : String(AXY.MiniGame_FC.Parameters['fontsize']); + var MiniGame_FCshadowcolor = AXYMiniGame_FCArgs['MiniGame_FCshadowcolor'] ? AXYMiniGame_FCArgs['MiniGame_FCshadowcolor'] : String(AXY.MiniGame_FC.Parameters['MiniGame_FCShadowColor']); + var MiniGame_FCshadowwidth = AXYMiniGame_FCArgs['MiniGame_FCshadowwidth'] ? AXYMiniGame_FCArgs['MiniGame_FCshadowwidth'] : String(AXY.MiniGame_FC.Parameters['MiniGame_FCShadowWidth']); + + var AXYMiniGame_FCTemplate = ''; + + $('body').append(AXYMiniGame_FCTemplate); + /*$("#AXYMiniGame_FC"+id).load( "minigame/carrace/car.html", function( response, status, xhr ) { + $("#AXYMiniGame_FC"+id).html(response); + });*/ + $('.AXYAjaxButtonImg_FCController').unbind('click touchend').bind('click touchend', function () { + AXY_MiniGame_FC.remove(); + //AudioManager.playSe(obj.soundEffect); + }); + + $.ajax({ + url: "minigame/fc/index.html", + type: 'post', + dataType: 'html', + data: "", + success: function (data) { + $("#AXYMiniGame_FC" + id).find('[role="canvas"]').html(data); + //console.log(data); + //console.log($("#AXYMiniGame_FC"+id+"")); + //console.log($("#AXYMiniGame_FC" + id + "")[0].clientHeight); + //console.log($("#AXYMiniGame_FC" + id + "")[0].clientWidth); + if (align == 'center') { + //$("#AXYMiniGame_FC"+id+"")[0].onload = function(){ + + if (width.indexOf("px") != -1) { + var widthpx = width; + var widthint = parseFloat(width); + } else if (width == 'auto') { + var widthint = $("#AXYMiniGame_FC" + id + "")[0].clientWidth; + var widthpx = ''; + } else { + var widthint = $("#AXYMiniGame_FC" + id + "")[0].clientWidth * parseFloat(width) / 100; + var widthpx = widthint + 'px'; + } + if (height.indexOf("px") != -1) { + var heightpx = height; + var heightint = parseFloat(height); + } else if (height == 'auto') { + var heightint = $("#AXYMiniGame_FC" + id + "")[0].clientHeight; + var heightpx = ''; + } else { + var heightint = $("#AXYMiniGame_FC" + id + "")[0].clientHeight * parseFloat(height) / 100; + var heightpx = heightint + 'px'; + } + + var imgx = widthint / 2; + var imgy = heightint / 2; + var divx = x - imgx; //*parseFloat(width)/100; + var divy = y - imgy; //*parseFloat(height)/100; + + //console.log('img center point: imgx='+imgx+', imgy='+imgy); + //console.log('screens left top: divx='+divx+', divy='+divy); + //console.log('x='+parseFloat(width)/100+', y='+parseFloat(height)/100+', naturalWidth='+ $("#AXYMiniGame_FC"+id+" img")[0].naturalWidth); + //console.log('x='+x+', y='+y); + //console.log('widthpx='+widthpx+', heightpx='+heightpx); + //console.log('Graphics.width='+Graphics.width+', Graphics.height='+Graphics.height); + //console.log(window); + //var imgCenter = + + $("#AXYMiniGame_FC" + id + "").css({ + 'width': widthpx, + 'height': heightpx, + 'line-height': heightpx + }); + $("#AXYMiniGame_FC" + id).css({ + left: divx + 'px', + top: divy + 'px', + visibility: 'visible' + }); + + + //} + } else { + $("#AXYMiniGame_FC" + id).css({ + left: x + 'px', + top: y + 'px', + visibility: 'visible' + }); + } + + $("#AXYMiniGame_FC" + id).css('font-family', fontfamily); + $("#AXYMiniGame_FC" + id).css('MiniGame_FC-shadow', MiniGame_FCshadowcolor + ' ' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 ' + MiniGame_FCshadowwidth + 'px 0,' + MiniGame_FCshadowcolor + ' -' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 -' + MiniGame_FCshadowwidth + 'px 0'); + $("#AXYMiniGame_FC" + id).css('-webkit-MiniGame_FC-shadow', MiniGame_FCshadowcolor + ' ' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 ' + MiniGame_FCshadowwidth + 'px 0,' + MiniGame_FCshadowcolor + ' -' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 -' + MiniGame_FCshadowwidth + 'px 0'); + $("#AXYMiniGame_FC" + id).css('-moz-MiniGame_FC-shadow', MiniGame_FCshadowcolor + ' ' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 ' + MiniGame_FCshadowwidth + 'px 0,' + MiniGame_FCshadowcolor + ' -' + MiniGame_FCshadowwidth + 'px 0 0,' + MiniGame_FCshadowcolor + ' 0 -' + MiniGame_FCshadowwidth + 'px 0'); + $("#AXYMiniGame_FC" + id).css('*filter', 'Glow(color=' + MiniGame_FCshadowcolor + ', strength=' + MiniGame_FCshadowwidth + ')'); + + if (rom) { + nes.ui.loadROM('minigame/fc/roms/' + rom + '.nes'); + } else { + nes.ui.loadROM('minigame/fc/roms/Contra (U) [!].nes'); + } + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + //console.log(XMLHttpRequest); + //console.log(textStatus); + //console.log(errorThrown); + $.toaster({ + title: 'ERROR: ', + message: textStatus + ' ' + errorThrown, + color: 'red' + }); + }, + complete: function (XMLHttpRequest, textStatus) { + //console.log(XMLHttpRequest); + //console.log(textStatus); + //$.toaster({ title: 'COMPLETE: ', message : textStatus, color:'white'}); + } + }); + + /*console.log($("#AXYMiniGame_FC"+id+"")); + console.log($("#AXYMiniGame_FC"+id+"")[0].clientHeight); + console.log($("#AXYMiniGame_FC"+id+"")[0].clientWidth); + console.log(window); + + console.log(width); + console.log(height);*/ + //console.log(fontfamily); + + + + //console.log(css); + //console.log($gameParty); + //console.log($gameSystem); + //console.log(MiniGame_FCManager.currencyUnit); + + //$('#AXYMiniGame_FC'+id+' img').stop().show().animate({"width": "100%","height": "100%"}, "normal"); + }, + remove: function () { + $gameSystem.setTouchMoveEnabled(true); + $gameMap._interpreter.setWaitMode(''); + $gameSystem.replayBgm(); + nes.stop(); + var id = arguments[0] ? arguments[0] : 1; + var score = arguments[1] ? arguments[1] : 1; + //console.log(id); + //console.log('#AXYMiniGame_FC'+id); + + setTimeout(function () { + $('#AXYMiniGame_FC' + id).stop().animate({ + "width": "0", + "height": "0" + }, "normal", function () { + //$(this).empty(); + $(this).remove(); + //$(this) = null; + }); + //$('#AXYMiniGame_FC'+id) = null; + console.log($('#AXYMiniGame_FC' + id)); + $('#sence').empty(); + $('#sence').remove(); + console.log($('#sence')); + console.log(window); + $gameParty.gainGold(score); + }, AXY.MiniGame_FC.Param.delay); + }, + removeall: function () { + $('.AXYMiniGame_FC').stop().animate({ + "width": "0", + "height": "0" + }, "normal", function () { + $(this).remove(); + }); + } +}; \ No newline at end of file diff --git a/AXY_Save.js b/AXY_Save.js index 2ee7a8d..4a5fc14 100644 --- a/AXY_Save.js +++ b/AXY_Save.js @@ -1,11 +1,11 @@ //============================================================================= // A XueYu Plugins - Save // AXY_Save.js -// Version: 1.01 +// Version: 1.02 // License: MIT //============================================================================= - /*: - * @plugindesc v1.01 Allows to Change save's staff. +/*: + * @plugindesc v1.02 Allows to Change save's staff. * @author A XueYu Plugins * * @param MaxSaveFile @@ -16,22 +16,37 @@ * @desc If you do not define The SaveFile id, then the DefaultSaveFileId will be uses. Default: 21 * @default 21 * - * @param ReadOnlySaveFileId - * @desc If you do not allows player to overwrite SaveFileId, then the ReadOnlySaveFileId will be uses. Default: 21,22 - * @default 21,22 - * - * @param OverWriteNotice - * @desc If you do not allows player to overwrite SaveFileId, then notice the player. Default: You can not overwrite this save file. This is readonly. - * @default You can not overwrite this save file. This is readonly. - * - * @param SaveFileTitle - * @desc The SaveFileTitle could show others text. Format and default: 21:AutoSave,22:NotOverWrite - * @default 21:AutoSave,22:NotOverWrite - * * @param SaveFolder * @desc Specify the save folder. This is relative to the directory where the current Game/Game_boxed.exe is located. Default: save * @default save - * + * + * @param ReadOnlySaveFile + * @text ReadOnly SaveFile Settings + * @type struct[] + * @desc If you do not allows player to overwrite SaveFile, then the ReadOnlySaveFile will be uses. + * + */ + +/*~struct~ReadOnlySaveFileStruct: + * @param id + * @text ID + * @desc SaveFile Id. + * @type number + * + * @param title + * @text Title + * @desc The SaveFile Title. + * @type text + * + * @param notice + * @text Notice + * @desc Notice the player when they overwrite the SaveFile. Default: You can not overwrite this save file. This is readonly. + * @type text + * @default You can not overwrite this save file. This is readonly. + * + */ + +/* * @help * Introduction * This plugin allows to Change save's staff. @@ -40,6 +55,8 @@ * 2.You can use script command such as: AXY_Save.save(); which use default savefileid you define or AXY_Save.save(21); which use you direct define. * * changelog + * 1.02 2019.12.24 + * modify: param struct; * 1.01 2019.9.25 * Upgrade DataManager.saveGame to rmmv1.6.1 origin method; * Add feature: Make save folder customizable; @@ -70,57 +87,99 @@ AXY.Save.Variable.arr = []; AXY.Save.Variable.filenamearr = []; AXY.Save.Variable.ReadOnlySaveFileIdarr = []; +//============================================================================= +// Utils +//============================================================================= +// Create a utility function to parse complex parameters. +//============================================================================= +Utils.recursiveParse = function (param) { + try { + if (typeof JSON.parse(param) == "object") { + return JSON.parse(param, function (key, value) { + try { + return this.recursiveParse(value); + } catch (e) { + return value; + } + }.bind(this)); + } else { + return JSON.parse(param, function (key, value) { + return value; + }.bind(this)); + } + } catch (e) { + return param; + } +}; + +//============================================================================= +// Parameters +//============================================================================= +// Read and parse parameters into a locally scoped Parameters object. +//============================================================================= +Object.keys(AXY.Save.Parameters).forEach(function (key) { + return AXY.Save.Param[key] = Utils.recursiveParse(AXY.Save.Parameters[key]); +}); + // Main AXY_Save = { save: function () { //console.log(arguments[0]); - var fileid = arguments[0] ? arguments[0] : AXY.Save.Param.DefaultSaveFileId; + var fileid = arguments[0] ? arguments[0] : AXY.Save.Param.DefaultSaveFileId; $gameSystem.onBeforeSave(); DataManager.saveGameWithoutRescue(fileid); } }; //AXY.Save.DataManager_maxSavefiles = DataManager.maxSavefiles; -DataManager.maxSavefiles = function() { - //AXY.Save.DataManager_maxSavefiles.call(this); +DataManager.maxSavefiles = function () { + //AXY.Save.DataManager_maxSavefiles.call(this); return AXY.Save.Param.MaxSaveFile; }; AXY.Save.Variable.arr = AXY.Save.Param.SaveFileTitle.split(','); AXY.Save.Window_SavefileList_drawFileId = Window_SavefileList.prototype.drawFileId; -Window_SavefileList.prototype.drawFileId = function(id, x, y) { - AXY.Save.Window_SavefileList_drawFileId.call(this); - +Window_SavefileList.prototype.drawFileId = function (id, x, y) { + AXY.Save.Window_SavefileList_drawFileId.call(this); + AXY.Save.Variable.filenamearr[id] = TextManager.file; - for(var i = 0; i < AXY.Save.Variable.arr.length; i++) { + /*for (var i = 0; i < AXY.Save.Variable.arr.length; i++) { var arrTitle = AXY.Save.Variable.arr[i].split(':'); - if(id == arrTitle[0]){ + if (id == arrTitle[0]) { AXY.Save.Variable.filenamearr[id] = arrTitle[1]; } - }; + };*/ + for (var i in AXY.Save.Param.ReadOnlySaveFile) { + if (id == AXY.Save.Param.ReadOnlySaveFile[i].id) { + AXY.Save.Variable.filenamearr[id] = AXY.Save.Param.ReadOnlySaveFile[i].title; + } + } + this.drawText(AXY.Save.Variable.filenamearr[id] + ' ' + id, x, y, 180); }; AXY.Save.Variable.ReadOnlySaveFileIdarr = AXY.Save.Param.ReadOnlySaveFileId.split(','); //AXY.Save.DataManager_saveGame = DataManager.saveGame; -DataManager.saveGame = function(savefileId) { - //AXY.Save.DataManager_saveGame.call(this); +DataManager.saveGame = function (savefileId) { + //AXY.Save.DataManager_saveGame.call(this); - function inArray(search,array){ - for(var i in array){ - if(array[i]==search){ - return true; + function inArray(search, array) { + for (var i in array) { + if (array[i].id == search) { + return i; } } return false; } - if(inArray(savefileId+"", AXY.Save.Variable.ReadOnlySaveFileIdarr)){ + var index = inArray(savefileId + "", AXY.Save.Param.ReadOnlySaveFile); + if (index !== false) { //SoundManager.playBuzzer(); - $.toaster({ message : ""+AXY.Save.Param.OverWriteNotice+""}); + $.toaster({ + message: "" + AXY.Save.Param.ReadOnlySaveFile[index].notice + "" + }); return false; - } - else{ + } else { $gameSystem.onBeforeSave(); try { StorageManager.backup(savefileId); @@ -130,24 +189,19 @@ DataManager.saveGame = function(savefileId) { try { StorageManager.remove(savefileId); StorageManager.restoreBackup(savefileId); - } catch (e2) { - } + } catch (e2) {} return false; } } - + }; -StorageManager.localFileDirectoryPath = function() { - var path = require('path'); - var base = path.dirname(process.mainModule.filename); - if(base.indexOf("www") != -1){ +StorageManager.localFileDirectoryPath = function () { + var path = require('path'); + var base = path.dirname(process.mainModule.filename); + if (base.indexOf("www") != -1) { return path.join(base, '..', AXY.Save.Param.SaveFolder, '/'); - } - else{ + } else { return path.join(base, AXY.Save.Param.SaveFolder, '/'); } -}; - - - +}; \ No newline at end of file diff --git a/AXY_Skill.js b/AXY_Skill.js index dcb50cb..03841ec 100644 --- a/AXY_Skill.js +++ b/AXY_Skill.js @@ -1,11 +1,11 @@ //============================================================================= // A XueYu Plugins - Skill // AXY_Skill.js -// Version: 1.00 +// Version: 1.01 // License: MIT //============================================================================= /*: - * @plugindesc v1.00 Set param about skill. + * @plugindesc v1.01 Set param about skill. * @author A XueYu Plugins * * @help @@ -16,9 +16,15 @@ * Usage: * Write * + * //one by one, totals = repeats*targets + * //one by one, totals = repeats + * //round by round, totals = repeats*targets + * //round by round, totals = repeats * to skill meta note box; * * changelog + * 1.01 2019.12.25 + * add: abcd four repeat mode; * 1.00 2019.11.28 * first release. * @@ -94,4 +100,87 @@ Object.keys(AXY.Skill.Parameters).forEach(function (key) { } return Math.floor(repeats); }; + + Game_Action.prototype.repeatTargets = function (targets) { + var repeatedTargets = []; + var repeats = this.numRepeats(); + + //console.log(this.item().meta.axy_skill_mode); + var _tmp = this.item().meta.axy_skill_mode; + switch (_tmp == undefined ? '' : _tmp.toLowerCase()) { + case 'a': //one by one, totals = repeats*targets + for (var j = 0; j < repeats; j++) { + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + if (target) { + repeatedTargets.push(target); + //console.log('a'); + } + } + } + break; + case 'b': //one by one, totals = repeats + for (var j = 0; j < repeats;) { + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + if (target) { + repeatedTargets.push(target); + j++; + //console.log('b'); + } + } + } + break; + case 'c': //round by round, totals = repeats*targets + for (var j = 0; j < repeats; j++) { + targets = []; + if (!this._forcing && this.subject().isConfused()) { + targets = [this.confusionTarget()]; + } else if (this.isForOpponent()) { + targets = this.targetsForOpponents(); + } else if (this.isForFriend()) { + targets = this.targetsForFriends(); + } + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + if (target) { + repeatedTargets.push(target); + //console.log('c'); + } + } + } + break; + case 'd': //round by round, totals = repeats + for (var j = 0; j < repeats;) { + targets = []; + if (!this._forcing && this.subject().isConfused()) { + targets = [this.confusionTarget()]; + } else if (this.isForOpponent()) { + targets = this.targetsForOpponents(); + } else if (this.isForFriend()) { + targets = this.targetsForFriends(); + } + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + if (target) { + repeatedTargets.push(target); + j++; + //console.log('d'); + } + } + } + break; + default: + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + if (target) { + for (var j = 0; j < repeats; j++) { + repeatedTargets.push(target); + } + } + } + break; + } + return repeatedTargets; + }; })(); \ No newline at end of file diff --git a/AXY_TitleVersion.js b/AXY_TitleVersion.js index 974c4e8..4aa0fab 100644 --- a/AXY_TitleVersion.js +++ b/AXY_TitleVersion.js @@ -1,11 +1,11 @@ //============================================================================= // A XueYu Plugins - Title Version // AXY_TitleVersion.js -// Version: 1.01 +// Version: 1.02 // License: MIT //============================================================================= /*: - * @plugindesc v1.01 Display Version or Multiple lines of text in Title Screen. + * @plugindesc v1.02 Display Version or Multiple lines of text in Title Screen. * @author A XueYu Plugins * * @param DisplayVersion1 @@ -174,6 +174,8 @@ * to your home page at the title screen. * * changelog + * 1.02 2019.12.15 + * fix: eval incompatiable with |; * 1.01 2019.9.26 * add eval on text, so formulas are allowed. * change xy to axy; @@ -302,9 +304,9 @@ Scene_Title.prototype.createForeground = function () { var y = AXY.TitleVersion.Param.Y4; - var versionText = AXY.TitleVersion.Param.TextContent4.split("|"); + var versionText = eval(AXY.TitleVersion.Param.TextContent4).split("|"); versionText.forEach(function (vt) { - this._titleVersionSprite.bitmap.drawText(eval(vt), AXY.TitleVersion.Param.X4, y, Graphics.width, AXY.TitleVersion.Param.FontSize4, AXY.TitleVersion.Param.Align4); + this._titleVersionSprite.bitmap.drawText(vt, AXY.TitleVersion.Param.X4, y, Graphics.width, AXY.TitleVersion.Param.FontSize4, AXY.TitleVersion.Param.Align4); // from top to bottom different from bottom to top, must display before change y. y += AXY.TitleVersion.Param.FontSize4 + AXY.TitleVersion.Param.LineSpacing4; }, this);