RPGMZ 清爽战斗界面
个人记录保存
//================================================================================================= // Fun_Battle.js //================================================================================================= /*: * @target MZ * @plugindesc 战斗系统改造。 * @author 希夷先生 * * @help * 插件功能:战斗系统改造 */ (() => { //=============================战斗开始============================= const _Scene_Battle_prototype_start = Scene_Battle.prototype.start; Scene_Battle.prototype.start = function() { _Scene_Battle_prototype_start.call(this); //PluginManager.callCommand($gameMap._interpreter, "Fun_Mess_Auto", "开启自动跳过", "开启自动跳过"); }; //=============================战斗结束============================= const _Scene_Battle_prototype_stop = Scene_Battle.prototype.stop; Scene_Battle.prototype.stop = function(){ _Scene_Battle_prototype_stop.call(this); //PluginManager.callCommand($gameMap._interpreter, "Fun_Mess_Auto", "关闭自动跳过", "关闭自动跳过"); }; const _Scene_Map_prototype_updateEncounterEffect = Scene_Map.prototype.updateEncounterEffect; Scene_Map.prototype.updateEncounterEffect = function() { if (this._encounterEffectDuration > 0) { this._encounterEffectDuration--; const speed = this.encounterEffectSpeed(); const n = speed - this._encounterEffectDuration; const p = n / speed; const q = ((p - 1) * 20 * p + 5) * p + 1; const zoomX = $gamePlayer.screenX(); const zoomY = $gamePlayer.screenY() - 24; if (n === 2) { $gameScreen.setZoom(zoomX, zoomY, 1); this.snapForBattleBackground(); //this.startFlashForEncounter(speed / 2); } //$gameScreen.setZoom(zoomX, zoomY, q); if (n === Math.floor(speed / 6)) { //this.startFlashForEncounter(speed / 2); } if (n === Math.floor(speed / 2)) { BattleManager.playBattleBgm(); this.startFadeOut(this.fadeSpeed()); } } }; //战斗结束处理 BattleManager.updateBattleEnd = function() { if (this.isBattleTest()) { AudioManager.stopBgm(); SceneManager.exit(); } else if (!this._escaped && $gameParty.isAllDead()) { //战斗失败回到上一个界面 不结束游戏 $gameParty.reviveBattleMembers(); SceneManager.pop(); } else { SceneManager.pop(); } this._phase = ""; }; //修改为10帧 瞬间渐变进入战斗 Scene_Map.prototype.encounterEffectSpeed = function() { return 10; }; //战斗失败 文本关闭 const _BattleManager_displayDefeatMessage = BattleManager.displayDefeatMessage; BattleManager.displayDefeatMessage = function() { //$gameMessage.add(TextManager.defeat.format($gameParty.name())); }; //敌人出现文本消息 //=================== 保存原始的 BattleManager.displayStartMessages 方法========================== const _BattleManager_displayStartMessages = BattleManager.displayStartMessages; BattleManager.displayStartMessages = function() { // 移除敌人出现消息的循环 // 移除先手/偷袭状态提示 //战斗开始 //if (this._preemptive) { // $gameMessage.add(TextManager.preemptive.format($gameParty.name())); //} else if (this._surprise) { // $gameMessage.add(TextManager.surprise.format($gameParty.name())); //} }; //战斗结算文本消息 //=================== 保存原始的 BattleManager.displayVictoryMessage 方法========================== const _BattleManager_displayVictoryMessage = BattleManager.displayVictoryMessage; BattleManager.displayVictoryMessage = function() { //$gameMessage.add(TextManager.victory.format($gameParty.name())); }; //战斗胜利 显示经验 BattleManager.displayExp = function() { const exp = this._rewards.exp; if (exp > 0) { const text = TextManager.obtainExp.format(exp, TextManager.exp); console.log("战斗胜利:" + text); $gameMessage.add("\\." + text); } }; //去掉升级信息 Game_Actor.prototype.shouldDisplayLevelUp = function() { return false; }; //去掉掉落物品信息 BattleManager.displayDropItems = function() { }; //去掉AB显示 Game_Enemy.prototype.setPlural = function(plural) { this._plural = false; }; Scene_Battle.prototype.statusWindowRect = function() { const extra = 10; const ww = Graphics.boxWidth - 192; const wh = this.windowAreaHeight() - 30; const wx = 1000; const wy = 1000; return new Rectangle(wx, wy, ww, wh); }; Window_BattleEnemy.prototype.initialize = function(rect) { this._enemies = []; Window_Selectable.prototype.initialize.call(this, rect); this.refresh(); this.hide(); // 1. 窗口整体透明 this.opacity = 0; // 2. 背景透明 this.backOpacity = 0; // 3. 边框隐藏 this.frameVisible = false; // 4. 黑色遮罩隐藏 this.hideBackgroundDimmer(); // 5. 关键:不绘制任何内容(文字、头像、图标全都不画) this.contentsOpacity = 0; }; // --- 关键:去掉选中项背景阴影 --- Window_BattleEnemy.prototype.drawItemBackground = function(index) { // 空函数:不画任何背景 }; // --- 关键:不画光标/选择框阴影 --- Window_BattleEnemy.prototype.drawCursor = function(x, y, width, height) { // 空函数:不画光标 }; Scene_Battle.prototype.partyCommandWindowRect = function() { const ww = 192; const wh = this.windowAreaHeight(); const wx = Graphics.boxWidth / 2 - ww / 2 const wy = Graphics.boxHeight / 2 - wh / 2; return new Rectangle(wx, wy, ww, wh); }; Scene_Battle.prototype.actorCommandWindowRect = function() { const ww = 192; const wh = this.windowAreaHeight(); const wx = Graphics.boxWidth / 2 - ww / 2 const wy = Graphics.boxHeight / 2 - wh / 2; return new Rectangle(wx, wy, ww, wh); }; Scene_Battle.prototype.createActorCommandWindow = function() { const rect = this.actorCommandWindowRect(); const commandWindow = new Window_ActorCommand(rect); //commandWindow.y = Graphics.boxHeight - commandWindow.height; commandWindow.setHandler("attack", this.commandAttack.bind(this)); commandWindow.setHandler("skill", this.commandSkill.bind(this)); commandWindow.setHandler("guard", this.commandGuard.bind(this)); commandWindow.setHandler("item", this.commandItem.bind(this)); commandWindow.setHandler("cancel", this.commandCancel.bind(this)); this.addWindow(commandWindow); this._actorCommandWindow = commandWindow; }; Window_PartyCommand.prototype.initialize = function(rect) { Window_Command.prototype.initialize.call(this, rect); this.openness = 0; this.deactivate(); this.backOpacity = 0; // 3. 边框隐藏 this.frameVisible = false; }; Window_ActorCommand.prototype.initialize = function(rect) { Window_Command.prototype.initialize.call(this, rect); this.openness = 0; this.deactivate(); this._actor = null; this.backOpacity = 0; // 3. 边框隐藏 this.frameVisible = false; }; Window_BattleSkill.prototype.initialize = function(rect) { Window_SkillList.prototype.initialize.call(this, rect); this.hide(); this.backOpacity = 0; // 3. 边框隐藏 this.frameVisible = false; }; Window_BattleItem.prototype.initialize = function(rect) { Window_ItemList.prototype.initialize.call(this, rect); this.hide(); this.backOpacity = 0; // 3. 边框隐藏 this.frameVisible = false; }; Window_Help.prototype.initialize = function(rect) { Window_Base.prototype.initialize.call(this, rect); this._text = ""; if (SceneManager._scene instanceof Scene_Battle) { // 3. 边框隐藏 this.frameVisible = false; } }; Window_Message.prototype.initialize = function(rect) { Window_Base.prototype.initialize.call(this, rect); this.openness = 0; this.initMembers(); if (SceneManager._scene instanceof Scene_Battle) { // 3. 边框隐藏 this.frameVisible = false; } }; Window.prototype._updatePauseSign = function() { //取消暂停标记 }; Window_Scrollable.prototype.updateArrows = function() { this.downArrowVisible = false; this.upArrowVisible = false; }; })();非常的清爽
结尾总结
Project1论坛 小圈子 人才 离开
