sakura-gozen/js/plugins/iii/iiiKANIUpgrade.js
2025-01-16 19:07:39 -06:00

685 lines
24 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

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: `【Current Health Lv】` },
1: { pid: 0, val: 500, uptype: 128, msg: `【Current Health Lv】` },
2: { pid: 0, val: 500, uptype: 128, msg: `【Current Health Lv】` },
3: { pid: 0, val: 500, uptype: 128, msg: `【Current Health Lv】` },
4: { pid: 0, val: 500, uptype: 128, msg: `【Current Health 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: `【Current Skill Lv】` },
9: { pid: 1, val: 1, uptype: 129, msg: `【Current Skill Lv】` },
10: { pid: 1, val: 1, uptype: 129, msg: `【Current Skill Lv】` },
11: { pid: 1, val: 1, uptype: 129, msg: `【Current Skill Lv】` },
12: { pid: 1, val: 1, uptype: 129, msg: `【Current Skill 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: `---` },
// Power is calculated from level only, affects iiiFormulaWeapon.js
16: { pid: 134, val: 20, uptype: 130, msg: `【Current Power Lv】` },
17: { pid: 134, val: 20, uptype: 130, msg: `【Current Power Lv】` },
18: { pid: 134, val: 20, uptype: 130, msg: `【Current Power Lv】` },
19: { pid: 134, val: 20, uptype: 130, msg: `【Current Power Lv】` },
20: { pid: 134, val: 20, uptype: 130, msg: `【Current Power 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: `【Current Endurance Lv】` },
25: { pid: 3, val: 10, uptype: 131, msg: `【Current Endurance Lv】` },
26: { pid: 3, val: 10, uptype: 131, msg: `【Current Endurance Lv】` },
27: { pid: 3, val: 10, uptype: 131, msg: `【Current Endurance Lv】` },
28: { pid: 3, val: 10, uptype: 131, msg: `【Current Endurance 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: `【Current Fighting Spirit (Skill Recovery) Lv】` },
33: { pid: 4, val: 1, uptype: 132, msg: `【Current Fighting Spirit (Skill Recovery) Lv】` },
34: { pid: 4, val: 1, uptype: 132, msg: `【Current Fighting Spirit (Skill Recovery) Lv】` },
35: { pid: 4, val: 1, uptype: 132, msg: `【Current Fighting Spirit (Skill Recovery) Lv】` },
36: { pid: 4, val: 1, uptype: 132, msg: `【Current Fighting Spirit (Skill Recovery) 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: `【Current Agility Lv】` },
41: { pid: 6, val: 10, uptype: 133, msg: `【Current Agility Lv】` },
42: { pid: 6, val: 10, uptype: 133, msg: `【Current Agility Lv】` },
43: { pid: 6, val: 10, uptype: 133, msg: `【Current Agility Lv】` },
44: { pid: 6, val: 10, uptype: 133, msg: `【Current Agility 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: `---` },
// Each Weapon Action Extension
48: { pid: 135, val: 50, uptype: -1, msg: `【Wakizashi Action Range Expansion】` },
49: { pid: 136, val: 50, uptype: -1, msg: `【Spear Action Range Expansion】` },
50: { pid: 137, val: 50, uptype: -1, msg: `【Bow Action Range Expansion】` },
51: { pid: 138, val: 50, uptype: -1, msg: `【Chain Action Range Expansion】` },
52: { pid: 139, val: 50, uptype: -1, msg: `【Tachi Action Range Expansion】` },
//"53" : { pid: -1, val: -1, uptype: -1, msg: `---` },
54: { pid: -1, val: -1, uptype: -1, msg: `---` },
55: { pid: -1, val: -1, uptype: -1, msg: `---` },
// Action Timing Adjustment
56: {
pid: 140,
val: 0.25,
uptype: -1,
msg: `【Action Timing Assistance】`,
},
//"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: `---` },
// Related to Obtaining Consumable Items
64: {
pid: 15,
val: 2,
uptype: -1,
msg: `【Collapse Orb】Item that puts the opponent into a "Collapse" state`,
},
65: {
pid: 16,
val: 2,
uptype: -1,
msg: `【Samurai Elixir】Full recovery + temporary boost to all stats, immunity to status ailments`,
},
66: {
pid: 87,
val: 2,
uptype: -1,
msg: `【Golden Bottle】Golden liquid in a glass bottle. A certain character will trade it \nfor a small fortune.`,
},
67: {
pid: 61,
val: 50,
uptype: -1,
msg: `【Lustful Butterfly Powder (Mouth)】Mouth Exp + 3 for 50 pieces`,
},
68: {
pid: 62,
val: 50,
uptype: -1,
msg: `【Lustful Butterfly Powder (Breasts)】Breast Exp + 3 for 50 pieces`,
},
69: {
pid: 63,
val: 50,
uptype: -1,
msg: `【Lustful Butterfly Powder (Vagina)】Vagina Exp + 3 for 50 pieces`,
},
70: {
pid: 64,
val: 50,
uptype: -1,
msg: `【Lustful Butterfly Powder (Butt)】Butt Exp + 3 for 50 pieces`,
},
//"71" : { pid: -1, val: -1, uptype: -1, msg: `---` },
// Related to Obtaining Important Tools
72: {
pid: 49,
val: -1,
uptype: -1,
msg: `【Unleash Lust Power】Unlocks the maximum level cap for Lust Power`,
},
73: {
pid: 49,
val: -1,
uptype: -1,
msg: `【Space-Time Shop】Allows calling the shop from items`,
},
};
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("Would you like to use enhancement points to strengthen your abilities?");
$gameMessage.add("");
$gameMessage.add(
"[Owned Enhancement Points]: \\c[24]\\V[127]\\c[0] / Cost Points: \\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
} else {
this.MSet();
$gameMessage.add("The enhancement level is at maximum. You cannot enhance further.");
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("Would you like to use enhancement points to expand the judgment range?");
$gameMessage.add("");
$gameMessage.add(
"[Owned Enhancement Points]: \\c[24]\\V[127]\\c[0] / Cost Points: \\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(
"Do you want to unlock the support function for action timing\nusing enhancement points?"
);
$gameMessage.add("");
$gameMessage.add(
"[Owned Enhancement Points]: \\c[24]\\V[127]\\c[0] / Cost Points: \\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("Would you like to use enhancement points to acquire tools?");
$gameMessage.add("");
$gameMessage.add(
"[Owned Enhancement Points]: \\c[24]\\V[127]\\c[0] / Cost Points: \\c[17]" +
cost +
"\\c[0]"
);
this.inter.setWaitMode("message");
}
if (this.selectedIndex > 71) {
cost = 2;
this.MSet();
$gameMessage.add(this.tblObj.msg);
$gameMessage.add("Would you like to use enhancement points to acquire tools?");
$gameMessage.add("");
$gameMessage.add(
"[Owned Enhancement Points]: \\c[24]\\V[127]\\c[0] / Cost Points: \\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("You do not have enough enhancement points.");
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("You do not have enough enhancement points.");
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("You do not have enough enhancement points.");
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("You do not have enough enhancement points.");
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("This tool can only be acquired once!");
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("This tool can only be acquired once!");
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);
}
}
}
}
}
})();