menacephere-of-inverted-dreams/js/plugins/YSAK_function.js
2024-11-29 14:36:36 -06:00

883 lines
26 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// RPG Maker MZ -
//=============================================================================
/*:
* @target MZ
* @plugindesc
* @author 西ヤスアキ
*
* @help
*
*
*
*
*
*/
/*:ja
* @target MZ
* @plugindesc 便利な関数を用意する。
* @author 西ヤスアキ
*
* @help
* イベントスクリプトで使用するかもしれないメソッドをまとめています。
* 初期の方に作ったので使いにくい、今は使われていないものが多数あります。
*
*
*
*/
(() => {
("use strict");
//=============================================================================
// プラグインパラメータの取得
//=============================================================================
const pluginName = "YSAK_function";
const parameters = PluginManager.parameters("YSAK_function");
/////////////////////////////////////////////////////////////////////////////////
//スクリプトから現在のパーティメンバーをthis.partyMemberCheak()で判定できるようにします。
//this.partyMembersIdに配列として入るのでうまいことやってください。
////////////////////////////////////////////////////////////////////////////////////
Game_Interpreter.prototype.partyMemberCheak = function () {
this.partyMembersId = [];
let pMemId = this.partyMembersId; //[1,2,3,4]
//メアいます
if ($gameParty._actors.contains(1)) {
pMemId.push(1);
}
//リリリいます
if ($gameParty._actors.contains(2)) {
pMemId.push(2);
}
//デイいます
if ($gameParty._actors.contains(3)) {
pMemId.push(3);
}
//ルーシィいます
if ($gameParty._actors.contains(4)) {
pMemId.push(4);
}
};
//現在のパーティメンバーの画像Idを配列に加えます。
Game_Interpreter.prototype.partyMemberPictureId = function () {
this.partyMemberCheak();
let pMemId = this.partyMembersId; //[1,2,3,4]
this.pictureId = []; //[91,92,93,94]
let pictureId = this.pictureId;
let selectPicNum = 91;
//メアいます
if (pMemId.includes(1)) {
pictureId.push(selectPicNum);
}
//リリリいます
if (pMemId.includes(2)) {
pictureId.push(selectPicNum + 1);
}
//デイいます
if (pMemId.includes(3)) {
pictureId.push(selectPicNum + 2);
}
//ルーシィいます
if (pMemId.includes(4)) {
pictureId.push(selectPicNum + 3);
}
};
////////////////////////////////////////////////////////////
//現在のパーティメンバーに合わせて立ち絵を表示します。
//実装がカスすぎて直したい
//たぶんだけど$gameScreen.showPictureがイベントスクリプトのあとに実行されるせいでpictureXの値を動的に変更できないので変数にぶちこんだ。
//Game_Interpreterじゃなくて自前のものにしたら動くと思う。
/////////////////////////////////////////////////////////////////
Game_Interpreter.prototype.showPartyMemberPicture = function () {
this.partyMemberPictureId(); //[91,92,93,94]
let pictureId = this.pictureId;
let pictureX = 260;
let pictureY = 200;
let basePicNum = 81;
let selectPicNum = 91;
let zoomRatio = 42;
let opacity = 255;
let zoomRatio2 = 44;
let hideOpacity = 0;
//画像の表示位置の指定
let pictureX1 = pictureX;
let pictureX2 = pictureX + 160;
let pictureX3 = pictureX + 320;
let pictureX4 = pictureX + 480;
//console.log(pictureId);
//非選択時の画像 配列には91,92,93,94が順不同で含まれるのでそれを検索して指定位置に表示する
for (let i = 0; i < pictureId.length; i++) {
//メアいます
if (pictureId.includes(selectPicNum)) {
if (pictureId.indexOf(selectPicNum) == 0) {
$gameScreen.showPicture(
basePicNum,
"m0-1-dark",
0,
pictureX1,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum) == 1) {
$gameScreen.showPicture(
basePicNum,
"m0-1-dark",
0,
pictureX2,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum) == 2) {
$gameScreen.showPicture(
basePicNum,
"m0-1-dark",
0,
pictureX3,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum) == 3) {
$gameScreen.showPicture(
basePicNum,
"m0-1-dark",
0,
pictureX4,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
}
//リリリいます
if (pictureId.includes(selectPicNum + 1)) {
if (pictureId.indexOf(selectPicNum + 1) == 0) {
$gameScreen.showPicture(
basePicNum + 1,
"rrrA1-dark",
0,
pictureX1,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 1) {
$gameScreen.showPicture(
basePicNum + 1,
"rrrA1-dark",
0,
pictureX2,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 2) {
$gameScreen.showPicture(
basePicNum + 1,
"rrrA1-dark",
0,
pictureX3,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 3) {
$gameScreen.showPicture(
basePicNum + 1,
"rrrA1-dark",
0,
pictureX4,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
}
//デイいます
if (pictureId.includes(selectPicNum + 2)) {
if (pictureId.indexOf(selectPicNum + 2) == 0) {
$gameScreen.showPicture(
basePicNum + 2,
"d1-1-1-dark",
0,
pictureX1,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 1) {
$gameScreen.showPicture(
basePicNum + 2,
"d1-1-1-dark",
0,
pictureX2,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 2) {
$gameScreen.showPicture(
basePicNum + 2,
"d1-1-1-dark",
0,
pictureX3,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 3) {
$gameScreen.showPicture(
basePicNum + 2,
"d1-1-1-dark",
0,
pictureX4,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
}
//ルーシィいます
if (pictureId.includes(selectPicNum + 3)) {
if (pictureId.indexOf(selectPicNum + 3) == 0) {
$gameScreen.showPicture(
basePicNum + 3,
"la1-dark",
0,
pictureX1,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 1) {
$gameScreen.showPicture(
basePicNum + 3,
"la1-dark",
0,
pictureX2,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 2) {
$gameScreen.showPicture(
basePicNum + 3,
"la1-dark",
0,
pictureX3,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 3) {
$gameScreen.showPicture(
basePicNum + 3,
"la1-dark",
0,
pictureX4,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
}
}
}
//選択時の画像
for (let i = 0; i < pictureId.length; i++) {
//メアいます
if (pictureId.includes(selectPicNum)) {
if (pictureId.indexOf(selectPicNum) == 0) {
$gameScreen.showPicture(
selectPicNum,
"m0-1",
0,
pictureX1,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
console.log("mea 1");
}
if (pictureId.indexOf(selectPicNum) == 1) {
$gameScreen.showPicture(
selectPicNum,
"m0-1",
0,
pictureX2,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
console.log("mea 2");
}
if (pictureId.indexOf(selectPicNum) == 2) {
$gameScreen.showPicture(
selectPicNum,
"m0-1",
0,
pictureX3,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
console.log("mea 3");
}
if (pictureId.indexOf(selectPicNum) == 3) {
$gameScreen.showPicture(
selectPicNum,
"m0-1",
0,
pictureX4,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
console.log("mea 4");
}
}
//リリリいます
if (pictureId.includes(selectPicNum + 1)) {
if (pictureId.indexOf(selectPicNum + 1) == 0) {
$gameScreen.showPicture(
selectPicNum + 1,
"rrrA1",
0,
pictureX1,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 1) {
$gameScreen.showPicture(
selectPicNum + 1,
"rrrA1",
0,
pictureX2,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 2) {
$gameScreen.showPicture(
selectPicNum + 1,
"rrrA1",
0,
pictureX3,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 1) == 3) {
$gameScreen.showPicture(
selectPicNum + 1,
"rrrA1",
0,
pictureX4,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
}
//デイいます
if (pictureId.includes(selectPicNum + 2)) {
if (pictureId.indexOf(selectPicNum + 2) == 0) {
$gameScreen.showPicture(
selectPicNum + 2,
"d1-1-1",
0,
pictureX1,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 1) {
$gameScreen.showPicture(
selectPicNum + 2,
"d1-1-1",
0,
pictureX2,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 2) {
$gameScreen.showPicture(
selectPicNum + 2,
"d1-1-1",
0,
pictureX3,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 2) == 3) {
$gameScreen.showPicture(
selectPicNum + 2,
"d1-1-1",
0,
pictureX4,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
}
//ルーシィいます
if (pictureId.includes(selectPicNum + 3)) {
if (pictureId.indexOf(selectPicNum + 3) == 0) {
$gameScreen.showPicture(
selectPicNum + 3,
"la1",
0,
pictureX1,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 1) {
$gameScreen.showPicture(
selectPicNum + 3,
"la1",
0,
pictureX2,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 2) {
$gameScreen.showPicture(
selectPicNum + 3,
"la1",
0,
pictureX3,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
if (pictureId.indexOf(selectPicNum + 3) == 3) {
$gameScreen.showPicture(
selectPicNum + 3,
"la1",
0,
pictureX4,
pictureY,
zoomRatio2,
zoomRatio2,
hideOpacity,
0
);
}
}
}
};
////////////////////////////////////////////////////////////////////////////////
//自作メニュー用関数
//メニュー上部の画像の表示位置を決めるために変数にX,Yを代入します。 Variablesに20個くらい
/////////////////////////////////////////////////////////////////////////////////////
Game_Interpreter.prototype.menuTopListPosition = function (x, y, hensuu) {
const topMenuRefPointX = x;
const topMenuRefPointY = y;
const hensuuStart = hensuu; //2001
const hensuuStop = hensuuStart + 18;
let j = 0;
for (let i = hensuuStart; i <= hensuuStop; i = i + 2) {
let pointX = topMenuRefPointX + j * 140;
let pointY = topMenuRefPointY;
$gameVariables.setValue(i, pointX);
$gameVariables.setValue(i + 1, pointY);
//console.log(j + " 変数X = " + i + ", " + pointX + " " + pointY);
j += 1;
}
};
Game_Interpreter.prototype.menuMainPicture = function (index, select) {
const buttonIndex = index; //メインボタン選択の番号
const selectNum = select; //画像が選択中がどうか 選択中:1 選択してない0
const buttonPicNum = buttonIndex + 70; //71,72,73,74
const partyMember = $gameParty._actors;
const pictureX = 100;
const pictureY = 140 + (buttonIndex - 1) * 105; //140,280,420,560
const zoomRatio = 100;
const opacity = 255;
if (selectNum == 0) {
//パーティメンバーにメアがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(1) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_01mea_base",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(1, pictureX, pictureY);
}
//パーティメンバーにリリリがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(2) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_02ririri_base",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(2, pictureX, pictureY);
}
//パーティメンバーにデイがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(3) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_03dei_base",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(3, pictureX, pictureY);
}
//パーティメンバーにルーシィがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(4) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_04rucy_base",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(4, pictureX, pictureY);
}
}
//選択中
if (selectNum == 1) {
//パーティメンバーにメアがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(1) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_01mea_select",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(1, pictureX, pictureY);
}
//パーティメンバーにリリリがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(2) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_02ririri_select",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(2, pictureX, pictureY);
}
//パーティメンバーにデイがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(3) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_03dei_select",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(3, pictureX, pictureY);
}
//パーティメンバーにルーシィがいて、それがbuttonindex番目なら画像を表示
if (partyMember.indexOf(4) == buttonIndex - 1) {
$gameScreen.showPicture(
buttonPicNum,
"menu/main/button/01_status/01sta_04rucy_select",
0,
pictureX,
pictureY,
zoomRatio,
zoomRatio,
opacity,
0
);
this.createHPMPbar(4, pictureX, pictureY);
}
}
};
Game_Interpreter.prototype.createHPMPbar = function (actorId, x, y) {
const actor = $gameActors.actor(actorId);
const pictureX = x + 105;
const pictureY = y + 46;
const YSAKmenuHP = new Sprite(
ImageManager.loadPicture("menu/main/button/01sta_HPbar")
);
YSAKmenuHP.move(pictureX, pictureY);
YSAKmenuHP.opacity = 255;
YSAKmenuHP.setFrame(0, 0, (55 * actor.hp) / actor.param(0), 32);
SceneManager._scene.addChild(YSAKmenuHP);
const YSAKmenuMP = new Sprite(
ImageManager.loadPicture("menu/main/button/01sta_MPbar")
);
YSAKmenuMP.move(pictureX, pictureY + 16);
YSAKmenuMP.opacity = 255;
YSAKmenuMP.setFrame(0, 0, (55 * actor.mp) / actor.param(1), 32);
SceneManager._scene.addChild(YSAKmenuMP);
};
// Game_Interpreter.prototype.menuMainStatus = function (index) {
// const buttonIndex = index; //メインボタン選択の番号
// const partyMember = $gameParty._actors;
// //console.log($gameParty._actors);
// //パーティメンバーにメアがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(1) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMemuStatus);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(1);
// };
// }
// //パーティメンバーにリリリがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(2) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMemuStatus);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(2);
// };
// }
// //パーティメンバーにデイがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(3) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMemuStatus);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(3);
// };
// }
// //パーティメンバーにルーシィがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(4) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMemuStatus);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(4);
// };
// }
// };
// Game_Interpreter.prototype.menuMainEquip = function (index) {
// const buttonIndex = index; //メインボタン選択の番号
// const partyMember = $gameParty._actors;
// //console.log($gameParty._actors);
// //パーティメンバーにメアがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(1) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuEquip);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(1);
// };
// }
// //パーティメンバーにリリリがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(2) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuEquip);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(2);
// };
// }
// //パーティメンバーにデイがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(3) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuEquip);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(3);
// };
// }
// //パーティメンバーにルーシィがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(4) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuEquip);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(4);
// };
// }
// };
// Game_Interpreter.prototype.menuMainSkill = function (index) {
// const buttonIndex = index; //メインボタン選択の番号
// const partyMember = $gameParty._actors;
// //console.log($gameParty._actors);
// //パーティメンバーにメアがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(1) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuSkill);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(1);
// };
// }
// //パーティメンバーにリリリがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(2) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuSkill);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(2);
// };
// }
// //パーティメンバーにデイがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(3) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuSkill);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(3);
// };
// }
// //パーティメンバーにルーシィがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(4) == buttonIndex - 1) {
// SceneManager.push(Scene_YSAKMenuSkill);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(4);
// };
// }
// };
// Game_Interpreter.prototype.menuMainSkillTree = function (index) {
// const buttonIndex = index; //メインボタン選択の番号
// const partyMember = $gameParty._actors;
// //console.log($gameParty._actors);
// //パーティメンバーにメアがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(1) == buttonIndex - 1) {
// SceneManager.push(SkillTreeClassAlias.Scene_SkillTree);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(1);
// };
// }
// //パーティメンバーにリリリがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(2) == buttonIndex - 1) {
// SceneManager.push(SkillTreeClassAlias.Scene_SkillTree);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(2);
// };
// }
// //パーティメンバーにデイがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(3) == buttonIndex - 1) {
// SceneManager.push(SkillTreeClassAlias.Scene_SkillTree);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(3);
// };
// }
// //パーティメンバーにルーシィがいて、それがbuttonindex番目ならステータスを表示
// if (partyMember.indexOf(4) == buttonIndex - 1) {
// SceneManager.push(SkillTreeClassAlias.Scene_SkillTree);
// SceneManager._nextScene.updateActor = function () {
// this._actor = $gameActors.actor(4);
// };
// }
// };
})();