sakura-gozen/js/plugins/iii/iiiKANIUpgrade.js
2025-01-14 14:06:54 -06:00

685 lines
24 KiB
JavaScript
Raw 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.

//=============================================================================
// iiiKANIUpgrade.js
// ----------------------------------------------------------------------------
// (C) 2020 III
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
/*:ja
* @target MZ
* @plugindesc 桜御前アップグレード用プラグイン。ソースにて数値等直接記載。
* @author III
*
* @command UpgradeJudge
* @text 強化判定
* @desc 強化の判定に使用する項目の情報を事前に入力します。
*
* @command UpgradeExec
* @text 強化判定後半
* @desc 強化の判定に使用する項目の情報を事前に入力します。
*/
var Imported = Imported || {};
Imported["iiiKANIUpgrade"] = 1.0;
(function () {
"use strict";
/**
* PluginCommand
*/
const script = document.currentScript;
const parameters = PluginManagerEx.createParameter(script);
PluginManagerEx.registerCommand(script, "UpgradeJudge", function (args) {
var upj = new UPJ(this);
upj.Task();
});
PluginManagerEx.registerCommand(script, "UpgradeExec", function (args) {
var upj = new UPJ(this);
upj.Task2();
});
var tbl = {
0: { pid: 0, val: 500, uptype: 128, msg: `【現在の体力Lv】` },
1: { pid: 0, val: 500, uptype: 128, msg: `【現在の体力Lv】` },
2: { pid: 0, val: 500, uptype: 128, msg: `【現在の体力Lv】` },
3: { pid: 0, val: 500, uptype: 128, msg: `【現在の体力Lv】` },
4: { pid: 0, val: 500, uptype: 128, msg: `【現在の体力Lv】` },
//"5" : { pid: -1, val: -1, uptype: -1, msg: `---` },
6: { pid: 0, val: 500, uptype: 128, msg: `---` },
7: { pid: 0, val: 500, uptype: 128, msg: `---` },
8: { pid: 1, val: 1, uptype: 129, msg: `【現在の技Lv】` },
9: { pid: 1, val: 1, uptype: 129, msg: `【現在の技Lv】` },
10: { pid: 1, val: 1, uptype: 129, msg: `【現在の技Lv】` },
11: { pid: 1, val: 1, uptype: 129, msg: `【現在の技Lv】` },
12: { pid: 1, val: 1, uptype: 129, msg: `【現在の技Lv】` },
//"13" : { pid: -1, val: -1, uptype: -1, msg: `---` },
14: { pid: 1, val: 1, uptype: 129, msg: `---` },
15: { pid: 1, val: 1, uptype: 129, msg: `---` },
//力のみレベルから計算するのでiiiFormulaWeapon.jsに影響
16: { pid: 134, val: 20, uptype: 130, msg: `【現在の力Lv】` },
17: { pid: 134, val: 20, uptype: 130, msg: `【現在の力Lv】` },
18: { pid: 134, val: 20, uptype: 130, msg: `【現在の力Lv】` },
19: { pid: 134, val: 20, uptype: 130, msg: `【現在の力Lv】` },
20: { pid: 134, val: 20, uptype: 130, msg: `【現在の力Lv】` },
//"21" : { pid: -1, val: -1, uptype: -1, msg: `---` },
22: { pid: 134, val: 20, uptype: 130, msg: `---` },
23: { pid: 134, val: 20, uptype: 130, msg: `---` },
24: { pid: 3, val: 10, uptype: 131, msg: `【現在の耐Lv】` },
25: { pid: 3, val: 10, uptype: 131, msg: `【現在の耐Lv】` },
26: { pid: 3, val: 10, uptype: 131, msg: `【現在の耐Lv】` },
27: { pid: 3, val: 10, uptype: 131, msg: `【現在の耐Lv】` },
28: { pid: 3, val: 10, uptype: 131, msg: `【現在の耐Lv】` },
//"29" : { pid: -1, val: -1, uptype: -1, msg: `---` },
30: { pid: 3, val: 10, uptype: 131, msg: `---` },
31: { pid: 3, val: 10, uptype: 131, msg: `---` },
32: { pid: 4, val: 1, uptype: 132, msg: `【現在の闘志(技力回復)Lv】` },
33: { pid: 4, val: 1, uptype: 132, msg: `【現在の闘志(技力回復)Lv】` },
34: { pid: 4, val: 1, uptype: 132, msg: `【現在の闘志(技力回復)Lv】` },
35: { pid: 4, val: 1, uptype: 132, msg: `【現在の闘志(技力回復)Lv】` },
36: { pid: 4, val: 1, uptype: 132, msg: `【現在の闘志(技力回復)Lv】` },
//"37" : { pid: -1, val: -1, uptype: -1, msg: `---` },
38: { pid: 4, val: 1, uptype: 132, msg: `---` },
39: { pid: 4, val: 1, uptype: 132, msg: `---` },
40: { pid: 6, val: 10, uptype: 133, msg: `【現在の敏Lv】` },
41: { pid: 6, val: 10, uptype: 133, msg: `【現在の敏Lv】` },
42: { pid: 6, val: 10, uptype: 133, msg: `【現在の敏Lv】` },
43: { pid: 6, val: 10, uptype: 133, msg: `【現在の敏Lv】` },
44: { pid: 6, val: 10, uptype: 133, msg: `【現在の敏Lv】` },
//"45" : { pid: -1, val: -1, uptype: -1, msg: `---` },
46: { pid: 6, val: 10, uptype: 133, msg: `---` },
47: { pid: 6, val: 10, uptype: 133, msg: `---` },
//各武器アクション拡張機能
48: { pid: 135, val: 50, uptype: -1, msg: `【脇差アクション範囲拡張】` },
49: { pid: 136, val: 50, uptype: -1, msg: `【長槍アクション範囲拡張】` },
50: { pid: 137, val: 50, uptype: -1, msg: `【弓アクション範囲拡張】:` },
51: { pid: 138, val: 50, uptype: -1, msg: `【鎖物アクション範囲拡張】:` },
52: { pid: 139, val: 50, uptype: -1, msg: `【太刀アクション範囲拡張】:` },
//"53" : { pid: -1, val: -1, uptype: -1, msg: `---` },
54: { pid: -1, val: -1, uptype: -1, msg: `---` },
55: { pid: -1, val: -1, uptype: -1, msg: `---` },
//アクションタイミング調整
56: {
pid: 140,
val: 0.25,
uptype: -1,
msg: `【アクションタイミング補助機能】:`,
},
//"57" : { pid: -1, val: -1, uptype: -1, msg: `---` },
//"58" : { pid: -1, val: -1, uptype: -1, msg: `---` },
//"59" : { pid: -1, val: -1, uptype: -1, msg: `---` },
//"60" : { pid: -1, val: -1, uptype: -1, msg: `---` },
//"61" : { pid: -1, val: -1, uptype: -1, msg: `---` },
62: { pid: -1, val: -1, uptype: -1, msg: `---` },
63: { pid: -1, val: -1, uptype: -1, msg: `---` },
//消費道具入手関連
64: {
pid: 15,
val: 2,
uptype: -1,
msg: `【崩玉】:相手を「崩し」状態にする道具`,
},
65: {
pid: 16,
val: 2,
uptype: -1,
msg: `【武士秘薬】:全回復+各ステータス一時上昇、状態異常耐性`,
},
66: {
pid: 87,
val: 2,
uptype: -1,
msg: `【黄金ビン】:ガラス瓶の中に注がれた黄金。とある人物が金一封と交換してくれる。`,
},
67: {
pid: 61,
val: 50,
uptype: -1,
msg: `【淫蝶粉(口)】口Exp + 3 を 50個`,
},
68: {
pid: 62,
val: 50,
uptype: -1,
msg: `【淫蝶粉(乳)】乳Exp + 3 を 50個`,
},
69: {
pid: 63,
val: 50,
uptype: -1,
msg: `【淫蝶粉(膣)】膣Exp + 3 を 50個`,
},
70: {
pid: 64,
val: 50,
uptype: -1,
msg: `【淫蝶粉(尻)】尻Exp + 3 を 50個`,
},
//"71" : { pid: -1, val: -1, uptype: -1, msg: `---` },
//大事道具入手関連
72: {
pid: 49,
val: -1,
uptype: -1,
msg: `【淫力開放】淫力の上限Lvを最大まで開放する`,
},
73: {
pid: 49,
val: -1,
uptype: -1,
msg: `【時空商店】:道具からショップを呼び出せるようにする`,
},
};
class UPJ {
lv = 0;
cost = 0;
constructor(inter, upgradeType) {
this.inter = inter;
this.selectedIndex = $gameVariables.value(126);
this.tblObj = tbl[this.selectedIndex];
this.lv = 0;
if (this.tblObj) this.lv = $gameVariables.value(this.tblObj.uptype);
}
MSet() {
$gameMessage.setBackground(1);
$gameMessage.setPositionType(1);
$gameMessage.newPage();
}
Task() {
var select = this.selectedIndex;
//判定無しスイッチ
$gameSwitches.setValue(50, false);
if (!this.tblObj) {
$gameSwitches.setValue(50, true);
return;
}
//select index cursor
//ON OFF選択肢
const param = $gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
if (select == 6 || select == 7) {
//体力
if (select == 6) {
$gameSwitches.setValue(181, true);
$gameActors.actor(1).addParam(this.tblObj.pid, param);
}
if (select == 7) {
$gameSwitches.setValue(181, false);
$gameActors.actor(1).addParam(this.tblObj.pid, -param);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 14 || select == 15) {
//技力
if (select == 14) {
$gameSwitches.setValue(182, true);
$gameActors.actor(1).addParam(this.tblObj.pid, param);
}
if (select == 15) {
$gameSwitches.setValue(182, false);
$gameActors.actor(1).addParam(this.tblObj.pid, -param);
}
$gameSwitches.setValue(50, true);
$gameActors.actor(1).gainMp(100);
return;
}
if (select == 22 || select == 23) {
//腕力
if (select == 22) {
$gameSwitches.setValue(183, true);
$gameVariables.setValue(
this.tblObj.pid,
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val
);
}
if (select == 23) {
$gameSwitches.setValue(183, false);
$gameVariables.setValue(this.tblObj.pid, 0);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 30 || select == 31) {
//耐久
if (select == 30) {
$gameSwitches.setValue(184, true);
$gameActors.actor(1).addParam(this.tblObj.pid, param);
}
if (select == 31) {
$gameSwitches.setValue(184, false);
$gameActors.actor(1).addParam(this.tblObj.pid, -param);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 38 || select == 39) {
//闘志
if (select == 38) {
$gameSwitches.setValue(185, true);
$gameActors.actor(1).addParam(this.tblObj.pid, param);
}
if (select == 39) {
$gameSwitches.setValue(185, false);
$gameActors.actor(1).addParam(this.tblObj.pid, -param);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 46 || select == 47) {
//敏捷
if (select == 46) {
$gameSwitches.setValue(186, true);
$gameActors.actor(1).addParam(this.tblObj.pid, param);
}
if (select == 47) {
$gameSwitches.setValue(186, false);
$gameActors.actor(1).addParam(this.tblObj.pid, -param);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 54 || select == 55) {
//範囲拡張
if (select == 54) {
$gameSwitches.setValue(187, true);
}
if (select == 55) {
$gameSwitches.setValue(187, false);
}
$gameSwitches.setValue(50, true);
return;
}
if (select == 62 || select == 63) {
//タイミング拡張
if (select == 62) {
$gameSwitches.setValue(188, true);
}
if (select == 63) {
$gameSwitches.setValue(188, false);
}
$gameSwitches.setValue(50, true);
return;
}
//通常能力関連
if (this.selectedIndex < 48) {
var lv = this.lv;
if (lv <= 4) {
//レベルからコスト値設定
var Costtbl = [2, 3, 4, 5, 6];
var cost = Costtbl[lv];
//index(126)から見た文章の設定
this.MSet();
$gameMessage.add(this.tblObj.msg + `\\c[2]${lv}\\c[0]`);
$gameMessage.add("強化ポイントを使用して能力を強化しますか?");
$gameMessage.add(" ");
$gameMessage.add(
"[所持強化ポイント]\\c[24]\\V[127]\\c[0] / 消費ポイント:\\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
} else {
this.MSet();
$gameMessage.add("強化レベルは最大です。これ以上強化できません。");
this.inter.setWaitMode("message");
this.inter._index = this.inter._list.length;
}
}
//範囲拡張関連
if (this.selectedIndex > 47 && this.selectedIndex < 56) {
cost = 10;
this.MSet();
$gameMessage.add(this.tblObj.msg);
$gameMessage.add("強化ポイントを使用して判定範囲を拡張しますか?");
$gameMessage.add(" ");
$gameMessage.add(
"[所持強化ポイント]\\c[24]\\V[127]\\c[0] / 消費ポイント:\\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
}
//アクションタイミング関連
if (this.selectedIndex > 55 && this.selectedIndex < 64) {
cost = 20;
this.MSet();
$gameMessage.add(this.tblObj.msg);
$gameMessage.add(
"強化ポイントをアクションタイミングの補助機能を解放しますか?"
);
$gameMessage.add(" ");
$gameMessage.add(
"[所持強化ポイント]\\c[24]\\V[127]\\c[0] / 消費ポイント:\\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
}
//消費道具の場合
if (this.selectedIndex > 63 && this.selectedIndex < 72) {
cost = 2;
this.MSet();
$gameMessage.add(this.tblObj.msg);
$gameMessage.add("強化ポイントを使用して道具を獲得しますか?");
$gameMessage.add(" ");
$gameMessage.add(
"[所持強化ポイント]\\c[24]\\V[127]\\c[0] / 消費ポイント:\\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
}
if (this.selectedIndex > 71) {
cost = 2;
this.MSet();
$gameMessage.add(this.tblObj.msg);
$gameMessage.add("強化ポイントを使用して道具を獲得しますか?");
$gameMessage.add(" ");
$gameMessage.add(
"[所持強化ポイント]\\c[24]\\V[127]\\c[0] / 消費ポイント:\\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
}
}
Task2() {
var lv = this.lv;
var cost = 0;
var havepoint = $gameVariables.value(127);
var select = this.selectedIndex;
//通常能力
if (select < 48) {
if (lv <= 4) {
//レベルからコスト値設定
var Costtbl = [2, 3, 4, 5, 6];
cost = Costtbl[lv];
}
if (cost <= havepoint) {
//index(126)から見て、何のパラメータを上昇させるかの設定
//+++各種能力値
//スイッチをONにしてパラメータを元に戻す
switch (
this.tblObj.pid //スイッチON処理
) {
case 0:
if (
!$gameSwitches.value(181) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
const mhpR =
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
$gameActors.actor(1).addParam(this.tblObj.pid, mhpR);
}
$gameSwitches.setValue(181, true);
break;
case 1:
if (
!$gameSwitches.value(182) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
const mmpR =
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
$gameActors.actor(1).addParam(this.tblObj.pid, mmpR);
}
$gameSwitches.setValue(182, true);
$gameActors.actor(1).gainMp(100);
break;
case 134:
if (
!$gameSwitches.value(183) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
$gameVariables.setValue(
this.tblObj.pid,
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val
);
}
$gameSwitches.setValue(183, true);
break;
case 3:
if (
!$gameSwitches.value(184) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
const defR =
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
$gameActors.actor(1).addParam(this.tblObj.pid, defR);
}
$gameSwitches.setValue(184, true);
break;
case 4:
if (
!$gameSwitches.value(185) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
const mgkR =
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
$gameActors.actor(1).addParam(this.tblObj.pid, mgkR);
}
$gameSwitches.setValue(185, true);
break;
case 6:
if (
!$gameSwitches.value(186) &&
$gameVariables.value(this.tblObj.uptype) != 0
) {
const agiR =
$gameVariables.value(this.tblObj.uptype) * this.tblObj.val;
$gameActors.actor(1).addParam(this.tblObj.pid, agiR);
}
$gameSwitches.setValue(186, true);
break;
}
if (select >= 16 && select <= 23) {
//++攻撃パラメータのみ変数に格納( v134 変数に実際の数値を格納 )
$gameVariables.setValue(
this.tblObj.pid,
$gameVariables.value(this.tblObj.pid) + this.tblObj.val
);
} else {
$gameActors.actor(1).addParam(this.tblObj.pid, this.tblObj.val);
}
$gameActors.actor(1).gainHp(9999);
$gameActors.actor(1).gainMp(100);
$gameVariables.setValue(
this.tblObj.uptype,
$gameVariables.value(this.tblObj.uptype) + 1
);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
// 強化ポイント減衰処理
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
} else {
this.MSet();
$gameMessage.add("強化ポイントが不足しています。");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
}
}
//拡張選択肢
if (select > 47 && select < 56) {
cost = 10;
if (havepoint >= cost) {
//変数に固定値を代入するだけでOK
$gameVariables.setValue(this.tblObj.pid, this.tblObj.val);
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
//機能ON・OFFスイッチ
$gameSwitches.setValue(187, true);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
} else {
this.MSet();
$gameMessage.add("強化ポイントが不足しています。");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
}
}
//タイミング調整機能
if (select > 55 && select < 64) {
cost = 20;
if (havepoint >= cost) {
//変数に固定値を代入するだけでOK
$gameVariables.setValue(this.tblObj.pid, this.tblObj.val);
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
//機能ON・OFFスイッチ
$gameSwitches.setValue(188, true);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
} else {
this.MSet();
$gameMessage.add("強化ポイントが不足しています。");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
}
}
//+++アイテム付与関連(lv に依存せず、コスト固定)
if (select > 63 && select < 72) {
cost = 2;
if (havepoint >= cost) {
$gameParty.gainItem($dataItems[this.tblObj.pid], this.tblObj.val);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
} else {
this.MSet();
$gameMessage.add("強化ポイントが不足しています。");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
}
}
//大事なモノ付与関連
if (select > 71) {
cost = 2;
if (select == 72) {
if ($gameParty.hasItem($dataItems[12])) {
this.MSet();
$gameMessage.add("この道具は1度のみ獲得可能です!");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
} else if (havepoint >= cost) {
$gameParty.gainItem($dataItems[12], 1);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
}
}
if (select == 73) {
if ($gameParty.hasItem($dataItems[11])) {
this.MSet();
$gameMessage.add("この道具は1度のみ獲得可能です!");
this.inter.setWaitMode("message");
AudioManager.playSe({
name: "Buzzer1",
volume: 90,
pitch: 100,
pan: 0,
});
} else if (havepoint >= cost) {
$gameParty.gainItem($dataItems[11], 1);
AudioManager.playSe({
name: "Reflection",
volume: 90,
pitch: 100,
pan: 0,
});
$gameVariables.setValue(127, $gameVariables.value(127) - cost);
}
}
}
}
}
})();