Last active
July 30, 2018 08:41
-
-
Save DICE2000/c010a6f92768e2ac732a083e17dd196e to your computer and use it in GitHub Desktop.
YanflyEnginePluginのバグや仕様をああだこうだする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================= | |
// dice2000_YEPFanPatch.js | |
//============================================================================= | |
// | |
// YanflyEnginePluginのバグや仕様をああだこうだする | |
// | |
// ★YEP_CoreEngine.js(Ver.1.28)とMBS_FPLEを共存させます。 | |
// | |
// ★YEP_MessageCore.js(Ver.1.19)にword-breakを追加します。 | |
// その実態はYED_WordWrapの引き写しです。 | |
// | |
// ★YEP_BattleEngineCore(Ver.1.46)でSelect Help Windowをtrueにした際に | |
// 選択肢のロック処理ができていないのを修正。 | |
// 味方全体(戦闘不能)単体のスキル/アイテムを生存者に使おうとする時に | |
// エラー音が返るように修正。 | |
// 味方単体のスキルを戦闘不能者に使おうとする時にもエラー音が返る仕様に。 | |
// Todo:味方全体(戦闘不能)全体スキルで、全員が点滅してしまう | |
// | |
// ★YEP_BuffsStatesCore(Ver.1.15)のバフ割合表示をバフ回数表示にします。 | |
// | |
// ★YEP_X_InBattleStatus(Ver.1.01)で、キャラ選択を上下キーでもできるように修正。 | |
// | |
// ★YEP_PartySystem(Ver.1.13)を導入した状態で隊列ショートカットキーを有効にします。 | |
// | |
// ★dice2000modeをオンにすると制作中のゲームの仕様に切り替わります。 | |
// すべて自分用です。 | |
// ・EquipCoreで表示される項目の変更 | |
// ・STBで行動選択時に変数にいくつかのパラメータを代入 | |
// | |
// 2018/7/30 dice2000modeの追加・修正。 | |
// 2018/7/28 YEPのバージョンアップに対応。 | |
// dice2000modeの追加。 | |
// 2018/3/15 YEP_X_InBattleStatusのキー入力追加。 | |
// YEP_PartySystemにショートカットキー追加。 | |
// 2018/3/7 YEP_BattleEngineCoreに関するメソッドを追加。 | |
// 2018/3/2 初版。 | |
// | |
// ---------------------------------------------------------------------------- | |
// NAK a.k.a. 22番目の素数 | |
// [Blog] : http://dice2000.tumblr.com/ | |
// [GitHub] : https://github.com/DICE2000 | |
// ---------------------------------------------------------------------------- | |
/*: | |
* @plugindesc YEPのバグや仕様をああだこうだするためのプラグイン | |
* @author 22番目の素数(NAK) | |
* | |
* @param MessageCore Break Word | |
* @text 強制改行 | |
* @desc MessageCore:スペースで区切られていない単語も強制的に改行します。 | |
* @default false | |
* @type boolean | |
* | |
* @param YEP BSC Rate Counters | |
* @text バフ回数表示 | |
* @desc Buffs and States:バフ/デバフを回数で表示します。 | |
* @default false | |
* @type boolean | |
* | |
* @param YEP BSC Percentage of Rate | |
* @text バフ/デバフ割合 | |
* @desc Buffs and States:指定した1回あたりの上昇/下降率を%で入力します。 | |
* @defalut 25 | |
* @type number | |
* @min 1 | |
* | |
* @param changeLeaderSE | |
* @desc 隊列の変更が行われた際に鳴る効果音です。指定しないとカーソル移動の音が鳴ります。 | |
* @require 1 | |
* @dir audio/se/ | |
* @type file | |
* | |
* @param dice2000mode | |
* @text 自分用の仕様変更(β版) | |
* @desc 自分用の仕様がONになります。 | |
* @default false | |
* @type boolean | |
* | |
* @help このスクリプトはYEPシリーズの下に置いてください。 | |
* | |
* ★YEP_CoreEngine.js(Ver.1.28)とMBS_FPLEを共存させます。 | |
* | |
* ★YEP_MessageCoreのWord WrappingがONの状態でBreak WordをONにすると | |
* 日本語文章の折り返しができるようになります。 | |
* 任意の位置を指定して改行したい場合は<BR>を入れてください。 | |
* (YEP_MessageCoreのWord Wrappingの仕様) | |
* | |
* ★YEP_BattleEngineCoreでSelect Help Windowを有効にした際に | |
* カーソル選択がおかしくなるのを修正します。 | |
* dtbのことしか考えていませんので、ご了承ください。 | |
* | |
* ★YEP_BuffsStatesCoreでバフの割合を百分率表示ではなく | |
* 回数表示に変更します。 | |
* この変更にともなってBSC本体のCounter SettingsのAlignmentが | |
* 有効になります。(1.14時点では強制センタリングされ無効) | |
* | |
* ★YEP_X_InBattleStatusでキャラ選択を上下キーでも行います。 | |
* | |
* ★YEP_PartySystemを導入した状態でQ/Wキーによる隊列入替を実行します。 | |
* | |
* ★あとは自分用 | |
* | |
*/ | |
//グローバルに定義されている変数の存在チェック | |
var Imported = Imported || {}; | |
var Yanfly = Yanfly || {}; | |
//オプションは外で見る方がいいんですかね | |
var paramWordBreak = (PluginManager.parameters('dice2000_YEPFanPatch')['MessageCore Break Word'] === 'true'); | |
var paramBSCRateCounter = (PluginManager.parameters('dice2000_YEPFanPatch')['YEP BSC Rate Counters'] === 'true'); | |
var paramBSCRatePercentage = Number((PluginManager.parameters('dice2000_YEPFanPatch')['YEP BSC Percentage of Rate'])); | |
var ParamchangeLeaderSE = PluginManager.parameters('dice2000_YEPFanPatch')['changeLeaderSE']; | |
var paramDice2000mode = PluginManager.parameters('dice2000_YEPFanPatch')['dice2000mode']; | |
if(Imported['MBS - FPLE'] === 1.40) { | |
if (Imported.YEP_CoreEngine) { | |
if (Yanfly.Core.version && Yanfly.Core.version === 1.28) { | |
var dice2000_YEPCE_Scene_Map_snapForBattleBackground = Scene_Map.prototype.snapForBattleBackground; | |
Scene_Map.prototype.snapForBattleBackground = function() { | |
if(this.useFPLE()){ | |
Yanfly.Core.Scene_Map_snapForBattleBackground.call(this); | |
}else{ | |
dice2000_YEPCE_Scene_Map_snapForBattleBackground.call(this); | |
} | |
}; | |
} // Yanfly.Core.version | |
}; // YEP_CoreEngine | |
} | |
/* | |
if (Imported.YEP_CoreEngine) { | |
if (Yanfly.Core.version && Yanfly.Core.version === 1.28) { | |
} // Yanfly.Core.version | |
}; // YEP_CoreEngine | |
*/ | |
if (Imported.YEP_MessageCore) { | |
if (Yanfly.Message.version && Yanfly.Message.version === 1.19) { | |
var dice2000_YEPMC_wordbreak_Window_Base_checkWordWrap = Window_Base.prototype.checkWordWrap; | |
Window_Base.prototype.checkWordWrap = function(textState) { | |
var flagcheck = paramWordBreak && this._wordWrap && !!textState; | |
if(flagcheck){ | |
//YED_WordWrap.jsの引き写しです!! | |
var word = textState.text[textState.index]; | |
var size = this.textWidthExCheck(word); | |
var result = (size + textState.x > this.wordwrapWidth()); | |
if(result) textState.index--; | |
return result; | |
}else{ | |
dice2000_YEPMC_wordbreak_Window_Base_checkWordWrap.apply(this, arguments); | |
} | |
}; | |
} // Yanfly.Message.version | |
}; // YEP_MessageCore | |
if (Imported.YEP_BattleEngineCore) { | |
if (Yanfly.BEC.version && Yanfly.BEC.version === 1.46) { | |
Window_BattleActor.prototype.autoSelect = function() { | |
var action = BattleManager.inputtingAction(); | |
if (!action) return; | |
this._inputLock = false; | |
this._selectDead = false; | |
this._selectAll = false; | |
if (action.isForUser()) { | |
this.select(BattleManager.actor().index()); | |
this._inputLock = true; | |
} else if (action.isForAll()) { | |
this._inputLock = true; | |
this._selectAll = true; | |
this.updateCursor(); | |
} else if (action.isForDeadFriend()) { | |
this._selectDead = true; | |
this.autoSelectFirstDeadActor(); | |
} | |
}; | |
Window_BattleActor.prototype.updateCursor = function() { | |
if (this._cursorAll || this._selectAll) { | |
var allRowsHeight = this.maxRows() * this.itemHeight(); | |
this.setCursorRect(0, 0, this.contents.width, allRowsHeight); | |
this.setTopRow(0); | |
} else if (this.isCursorVisible()) { | |
var rect = this.itemRect(this.index()); | |
this.setCursorRect(rect.x, rect.y, rect.width, rect.height); | |
} else { | |
this.setCursorRect(0, 0, 0, 0); | |
} | |
}; | |
var dice2000_Window_BattleActor_processOk = Window_BattleActor.prototype.processOk; | |
Window_BattleActor.prototype.processOk = function() { | |
if(this._selectDead && !this.actor().isDead()){ | |
this.playBuzzerSound(); | |
}else if(!this._selectDead && this.actor().isDead()){ | |
this.playBuzzerSound(); | |
}else{ | |
dice2000_Window_BattleActor_processOk.call(this); | |
} | |
}; | |
Window_BattleActor.prototype.isOkEnabled = function() { | |
return Window_Selectable.prototype.isOkEnabled.call(this); | |
}; | |
} // Yanfly.BEC.version | |
}; // YEP_BattleEngineCore | |
if (Imported.YEP_X_BattleSysSTB && paramDice2000mode) { | |
if (Yanfly.STB.version && Yanfly.STB.version === 1.03) { | |
BattleManager.startAction = function() { | |
if (Imported.YEP_InstantCast) this.detectStbInstantCast(); | |
Yanfly.STB.BattleManager_startAction.call(this); | |
//ここから追加 | |
//行動したアクター/エネミーのIDを代入 | |
if(this._subject){ | |
if(this._subject.isActor()){ | |
$gameVariables._data[1] = this._subject.actorId(); | |
$gameSwitches._data[1] = true; | |
} | |
if(this._subject.isEnemy()){ | |
$gameVariables._data[1] = this._subject.enemyId(); | |
$gameSwitches._data[1] = false; | |
} | |
} | |
if(this._action && this._action.item()){ | |
//変数2番に使用スキル | |
$gameVariables._data[2] = this._action.item()['id']; | |
//スイッチ2番にスキル判定 | |
$gameSwitches._data[2] = this._action.isSkill(); | |
//変数3番に使用スキル属性ID | |
$gameVariables._data[3] = this._action.item().damage['elementId']; | |
} | |
//変数4番にターゲットの数 | |
if(this._action) $gameVariables._data[4] = this._action.makeTargets().length; | |
//ここまで追加 | |
}; | |
BattleManager.processTurn = function() { | |
var subject = this._subject; | |
SceneManager._scene.refreshSTBTurnOrderWindow(); | |
//行動開始時にリジェネの判定 | |
if (this.isSTB() && subject) subject.regenerateAll(); | |
if (this.isSTB() && subject.isActor()) { | |
this.startSTBInput(); | |
} else { | |
Yanfly.STB.BattleManager_processTurn.call(this); | |
} | |
}; | |
BattleManager.endAction = function() { | |
if (this.isSTB()) { | |
//行動終了時に現在の状態をメッセージで表示する | |
if (this._subject) this._logWindow.displayCurrentState(this._subject); | |
this.endSTBAction(); | |
} else { | |
Yanfly.STB.BattleManager_endAction.call(this); | |
} | |
}; | |
} // Yanfly.BEC.version | |
}; // YEP_X_BattleSysSTB | |
if (Imported.YEP_X_InBattleStatus) { | |
if (Yanfly.IBS.version && Yanfly.IBS.version === 1.01) { | |
Window_InBattleStateList.prototype.updateLeftRight = function() { | |
var index = $gameParty.battleMembers().indexOf(this._battler); | |
var current = index; | |
if (Input.isRepeated('left') || Input.isRepeated('up')) { | |
index -= 1; | |
} else if (Input.isRepeated('right') || Input.isRepeated('down')) { | |
index += 1; | |
} | |
index = index.clamp(0, $gameParty.battleMembers().length - 1); | |
if (current !== index) { | |
var battler = $gameParty.battleMembers()[index]; | |
this.setBattler(battler); | |
SoundManager.playCursor(); | |
} | |
}; | |
} // Yanfly.IBS.version | |
}; // YEP_X_InBattleStatus | |
/* | |
if (Imported.YEP_X_TurnOrderDisplay) { | |
if (Yanfly.TOD.version && Yanfly.TOD.version === 1.03) { | |
//画面下に配置した際に消失するバグの修正 | |
//このメソッドは上に配置された時にしか必要でない | |
Window_TurnOrderIcon.prototype.destinationY = function() { | |
var value = Yanfly.Param.TODPositionY; | |
return value; | |
}; | |
} // Yanfly.TOD.version | |
}; // YEP_X_TurnOrderDisplay | |
*/ | |
if (Imported.YEP_BuffsStatesCore) { | |
if (Yanfly.BSC.version && Yanfly.BSC.version === 1.15) { | |
Sprite_StateIcon.prototype.drawBuffRate = function(paramId) { | |
if (!Yanfly.Param.BSCShowTurns) return; | |
var value = this._battler.paramBuffRate(paramId); | |
var text = Math.floor(value * 100) + '%'; | |
if(paramBSCRateCounter){ | |
value = Math.floor(((value * 100) - 100) / paramBSCRatePercentage); | |
text = String(Math.abs(value)); | |
} | |
var wx = Yanfly.Param.BSCCounterBufferX || 0; | |
var wy = (Yanfly.Param.BSCCounterBufferY || 8) - 2; | |
var ww = Window_Base._iconWidth; | |
var wh = Window_Base.prototype.lineHeight.call(this); | |
var align = Yanfly.Param.BSCCounterAlign; | |
var contents = this._turnCounterSprite.bitmap; | |
contents.fontSize = Yanfly.Param.BSCFontSize * 0.75; | |
contents.textColor = this.textColor(0); | |
contents.drawText(text, wx, wy, ww, wh, align); | |
}; | |
Window_Base.prototype.drawBuffRate = function(actor, paramId, wx, wy) { | |
var value = actor.paramBuffRate(paramId); | |
if (value === undefined) return; | |
if(paramBSCRateCounter){ | |
value = Math.floor(((value * 100) - 100) / paramBSCRatePercentage); | |
value = String(Math.abs(value)); | |
}else{ | |
value = Math.floor(value * 100) + '%'; | |
} | |
this.contents.fontSize = (Yanfly.Param.BSCCounterSize || 16) * 0.75; | |
wx += Yanfly.Param.BSCCounterBufferX || 0; | |
wy += Yanfly.Param.BSCCounterBufferY || 8; | |
var align = Yanfly.Param.BSCCounterAlign; | |
this.changePaintOpacity(true); | |
this.drawText(value, wx, wy, Window_Base._iconWidth, align); | |
this.resetFontSettings(); | |
this.resetTextColor(); | |
}; | |
} // Yanfly.BSC.version | |
}; // YEP_BuffsStatesCore | |
if (Imported.YEP_EquipCore && paramDice2000mode) { | |
if (Yanfly.Equip.version && Yanfly.Equip.version === 1.17) { | |
Window_StatCompare.prototype.refresh = function() { | |
this.contents.clear(); | |
if (!this._actor) return; | |
for (var i = 0; i < 8; ++i) { | |
this.drawItem(0, this.lineHeight() * i, i + 2); | |
} | |
}; | |
var dice2000_YEPEC_Window_StatCompare_drawItem = Window_StatCompare.prototype.drawItem; | |
Window_StatCompare.prototype.drawItem = function(x, y, paramId) { | |
if(paramId >= 7){ | |
this.drawDarkRect(x, y, this.contents.width, this.lineHeight()); | |
this.drawParamName(y, paramId + 1); | |
this.drawCurrentParam(y, paramId + 1); | |
this.drawRightArrow(y); | |
if (!this._tempActor) return; | |
this.drawNewParam(y, paramId + 1); | |
this.drawParamDifference(y, paramId + 1); | |
}else{ | |
dice2000_YEPEC_Window_StatCompare_drawItem.apply(this, arguments); | |
} | |
}; | |
Window_StatCompare.prototype.drawCurrentParam = function(y, paramId) { | |
var x = this.contents.width - this.textPadding(); | |
x -= this._paramValueWidth * 2 + this._arrowWidth + this._bonusValueWidth; | |
this.resetTextColor(); | |
var actorparam = 0; | |
var str_percent = ''; | |
if(paramId >= 8){ | |
str_percent = '%'; | |
var value = this._actor.xparam(paramId - 8) * 100; | |
actorparam = Yanfly.Util.toGroup(value); | |
}else{ | |
actorparam = Yanfly.Util.toGroup(this._actor.param(paramId)); | |
} | |
this.drawText(actorparam + str_percent, x, y, this._paramValueWidth, 'right'); | |
}; | |
Window_StatCompare.prototype.drawNewParam = function(y, paramId) { | |
var x = this.contents.width - this.textPadding(); | |
x -= this._paramValueWidth + this._bonusValueWidth; | |
var newValue = 0; | |
var diffvalue = 0; | |
var str_percent = ''; | |
if(paramId >= 8){ | |
str_percent = '%'; | |
newValue = this._tempActor.xparam(paramId - 8) * 100; | |
diffvalue = newValue - this._actor.xparam(paramId - 8) * 100; | |
}else{ | |
newValue = this._tempActor.param(paramId); | |
diffvalue = newValue - this._actor.param(paramId); | |
} | |
var actorparam = Yanfly.Util.toGroup(newValue); | |
this.changeTextColor(this.paramchangeTextColor(diffvalue)); | |
this.drawText(actorparam + str_percent, x, y, this._paramValueWidth, 'right'); | |
}; | |
Window_StatCompare.prototype.drawParamDifference = function(y, paramId) { | |
var x = this.contents.width - this.textPadding(); | |
x -= this._bonusValueWidth; | |
var newValue = 0; | |
var diffvalue = 0; | |
var str_percent = ''; | |
if(paramId >= 8){ | |
newValue = this._tempActor.xparam(paramId - 8) * 100; | |
diffvalue = newValue - this._actor.xparam(paramId - 8) * 100; | |
}else{ | |
newValue = this._tempActor.param(paramId); | |
diffvalue = newValue - this._actor.param(paramId); | |
} | |
if (diffvalue === 0) return; | |
var actorparam = Yanfly.Util.toGroup(newValue); | |
this.changeTextColor(this.paramchangeTextColor(diffvalue)); | |
var text = Yanfly.Util.toGroup(diffvalue); | |
if (diffvalue > 0) { | |
text = ' (+' + text + ')'; | |
} else { | |
text = ' (' + text + ')'; | |
} | |
this.drawText(text, x, y, this._bonusValueWidth, 'left'); | |
}; | |
} // Yanfly.Equip.version | |
}; // YEP_EquipCore | |
if (Imported.YEP_PartySystem) { | |
if (Yanfly.Party.version && Yanfly.Party.version === 1.13) { | |
Game_Party.prototype.updateOnSceneMap = function(sceneActive){ | |
if(sceneActive && $gameParty.size() >= 2 && $gameSystem.isFormationEnabled()){ | |
var input = 0; | |
if (Input.isTriggered('pagedown')) input = 1; | |
if (Input.isTriggered('pageup')) input = -1; | |
if (input !== 0) $gameParty.YEP_changeLeader(input); | |
} | |
}; | |
var dice2000_Scene_Map_updatemain = Scene_Map.prototype.updateMain; | |
Scene_Map.prototype.updateMain = function() { | |
dice2000_Scene_Map_updatemain.apply(this, arguments); | |
if(!$gameMap.isEventRunning()) $gameParty.updateOnSceneMap(this.isActive()); | |
}; | |
Game_Party.prototype.swapOrderAllMembers = function(index1, index2) { | |
var bm = this._battleMembers; | |
if (bm.length > index1 && bm.length > index2) { | |
var actorId1 = this._battleMembers[index1]; | |
var actorId2 = this._battleMembers[index2]; | |
} else if (bm.length > index1) { | |
var actorId1 = this._battleMembers[index1]; | |
var actorId2 = this._actors[index2]; | |
} else if (bm.length > index2) { | |
var actorId1 = this._actors[index1]; | |
var actorId2 = this._battleMembers[index2]; | |
} else { | |
var actorId1 = this._actors[index1]; | |
var actorId2 = this._actors[index2]; | |
} | |
if (bm.length <= index1 || bm.length <= index2){ | |
this._actors[index1] = actorId2; | |
this._actors[index2] = actorId1; | |
} | |
if (bm.length > index1) this._battleMembers[index1] = actorId2; | |
if (bm.length > index2) this._battleMembers[index2] = actorId1; | |
}; | |
Game_Party.prototype.rearrangeActorsAll = function() { | |
if (this._battleMembers === null) this.initializeBattleMembers(); | |
var battleArray = []; | |
for (var i = 0; i < this._battleMembers.length; ++i) { | |
var actorId = this._battleMembers[i]; | |
if (actorId === null) continue; | |
if ($gameActors.actor(actorId)) battleArray.push(actorId); | |
} | |
var reserveArray = []; | |
for (var i = 0; i < this._actors.length; ++i) { | |
var actorId = this._actors[i]; | |
if (battleArray.contains(actorId)) continue; | |
if ($gameActors.actor(actorId) === null) continue; | |
reserveArray.push(actorId); | |
} | |
//↓犯人↓(強制的に並び替えてしまう) | |
//reserveArray = this.sortReserveParty(reserveArray); | |
this._actors = battleArray.concat(reserveArray); | |
}; | |
//隊列を変更する関数の追加 | |
Game_Party.prototype.YEP_changeLeader = function(direction) { | |
if(ParamchangeLeaderSE === ''){ | |
SoundManager.playCursor(); | |
}else{ | |
var se = {name:ParamchangeLeaderSE, pan:0, pitch:100, volume:90}; | |
AudioManager.playStaticSe(se); | |
} | |
//ずらす方向 | |
// +1か-1かを入れる | |
// -1 …後ろが前にくる | |
// +1 …前が後ろに行く | |
var length = this.size(); | |
if(direction === 1){ | |
for (var i = 0; i < length - 1; i++){ | |
this.swapOrderAllMembers(i, i + 1); | |
this.rearrangeActorsAll(); | |
} | |
}else{ | |
for (var i = length - 1; i > 0; i--){ | |
this.swapOrderAllMembers(i - 1, i); | |
this.rearrangeActorsAll(); | |
} | |
} | |
$gamePlayer.refresh(); | |
}; | |
} // Yanfly.Party.version | |
}; // YEP_PartySystem | |
//============================================================================= | |
// FILE NO OWARI | |
//============================================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment