dead-bunny/js/plugins/Nore_Man.js
2025-01-12 01:21:39 -06:00

408 lines
11 KiB
JavaScript

/*:ja
* @target MZ
* @author ル
*
* @command add
* @text 男優追加
* @des 男優追加
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command reload
* @text 男優リロード
* @des 男優リロード
*
* @command setNameToVar
* @text 変数60に男優の名前を設定
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command newManEvent
* @text 新規男優のイベント(実行時sw 20がONになる)
*
* @command runManEvent
* @text 男優会話のイベント
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*/
var Nore;
(function (Nore) {
var pluginName = "Nore_Man";
PluginManager.registerCommand(pluginName, "add", function (args) {
var actorId = parseInt(args.actorId);
if (!$slg.manInfo().contains(actorId)) {
$slg.manInfo().addMan(actorId);
}
});
PluginManager.registerCommand(pluginName, "reload", function (args) {
var soupKichen = $slg.facilityInfo().findFacility(FacilityId.soupKichen);
if (!soupKichen) {
return;
}
$slg.manInfo().soupKichen().reload();
});
PluginManager.registerCommand(pluginName, "setNameToVar", function (args) {
var actorId = parseInt(args.actorId);
var name = $gameActors.actor(actorId).name();
$gameVariables.setValue(60, name);
});
PluginManager.registerCommand(pluginName, "newManEvent", function (args) {
var manId = $slg.manInfo().nextHireManId();
if (manId <= 0) {
return;
}
var manName = $gameActors.actor(manId).nameJp();
$gameVariables.setValue(52, manName);
$gameVariables.setValue(55, manId);
var manScenario = $slg.manInfo().manScenario(manId, 1);
if (this.runDouseiScenario(manScenario)) {
$slg.manInfo().onManSwitch(manId);
$gameSwitches.setValue(20, true);
}
});
PluginManager.registerCommand(pluginName, "runManEvent", function (args) {
var manId = parseInt(args.actorId);
var manScenario = $slg.manInfo().manScenario(manId, 2);
var manName = $gameActors.actor(manId).name();
$gameVariables.setValue(52, manName);
$gameVariables.setValue(55, manId);
if (this.runDouseiScenario(manScenario)) {
}
});
})(Nore || (Nore = {}));
var ManInfo = /** @class */ (function () {
function ManInfo() {
this._manIdList = [];
this.addMan(18);
this.addMan(20);
}
ManInfo.prototype.nextHireManId = function () {
this._finishedEventMap = this._finishedEventMap || [];
for (var _i = 0, _a = this._manIdList; _i < _a.length; _i++) {
var manId = _a[_i];
if (this._finishedEventMap[manId]) {
continue;
}
if (this.hasManEvent(manId)) {
this._finishedEventMap[manId] = true;
return manId;
}
}
return -1;
};
ManInfo.prototype.onManSwitch = function (manId) {
var sw = this.manSwitch(manId);
if (sw > 0) {
$gameSwitches.setValue(sw, true);
} else {
console.error(manId + "のスイッチが見つかりません");
}
};
ManInfo.prototype.manSwitch = function (manId) {
switch (manId) {
case 50:
return 501; // ヌマオ
case 51:
return 502; // シゲさん
case 52:
return 503; // むなし
case 53:
return 504; // ノッブ
case 54:
return 505; // 鈴木 ゴンゾウ
case 55:
return 506; // アナルのヤシチ
case 56:
return 507; // ゴンザレス
case 57:
return 508; // アンドレ
case 61:
return 509; // 鉄橋下の帝王
case 22:
return 510; // デブオ
case 48:
return 511; // クズオ
case 49:
return 512; // ガリオ
case 2:
return 513; // タクオ
case 1:
return 514; // シンジ
case 24:
return 515; // 田吾作
}
return -1;
};
ManInfo.prototype.hasManEvent = function (manId) {
return this.manScenario(manId, 1) != null;
};
ManInfo.prototype.manScenario = function (manId, index) {
var actor = $gameActors.actor(manId);
var name = actor.nameJp().replace(" ", "_");
var scenarioBase = "男優_%1_0" + index;
var scenarioName = scenarioBase.format(name);
if ($dataScenario && $dataScenario[scenarioName]) {
return scenarioName;
}
};
ManInfo.prototype.manList = function () {
var result = [];
for (var _i = 0, _a = this._manIdList; _i < _a.length; _i++) {
var actorId = _a[_i];
result.push($gameActors.actor(actorId));
}
return result;
};
ManInfo.prototype.addMan = function (actorId) {
if (this._manIdList.contains(actorId)) {
console.error("既に" + actorId + "は加わっています");
return;
}
this._manIdList.push(actorId);
};
ManInfo.prototype.soupKichen = function () {
this._soupKichen = this._soupKichen || new SoupKichen();
return this._soupKichen;
};
ManInfo.prototype.hire = function (man) {
p("hire:" + man.id());
this._hireCount = this._hireCount || 0;
this._hireCount++;
this._manIdList.push(man.id());
this._soupKichen.hire(man.id());
$gameActors.actor(man.id()).setupEroParams();
if (man.id() == 1) {
$gameSwitches.setValue(284, true);
}
};
ManInfo.prototype.contains = function (id) {
return this._manIdList.contains(id);
};
ManInfo.prototype.hireCount = function () {
this._hireCount = this._hireCount || 0;
return this._hireCount;
};
return ManInfo;
})();
var TUTO_MAN_ID = 50;
var YANG_MAN_ID = 60;
var DEBUO_MAN_ID = 22;
var KUZUO_MAN_ID = 48;
var GARIO_MAN_ID = 49;
var SoupKichen = /** @class */ (function () {
function SoupKichen() {
this.reload();
}
SoupKichen.prototype.level = function () {
if (!$slg.facilityInfo().isFacilityExists(FacilityId.soupKichen)) {
return 0;
}
return $slg.facilityInfo().findMaxFacilityLevel(FacilityType.soupKitchen);
};
SoupKichen.prototype.reload = function () {
this._manIdList = [];
var candidates = this.candidates();
candidates = Nore.shuffle(candidates);
for (var i = 0; i < this.maxCandidaets(); i++) {
if (candidates.length == 0) {
break;
}
this._manIdList.push(candidates.shift());
}
this.addTutorialMan(this._manIdList);
//this.addYang(this._manIdList);
this.addDebuo(this._manIdList);
this.addKuzuo(this._manIdList);
this.addGario(this._manIdList);
$slg.removeTimeGaugeEventType(TimeGaugeEventType.soupKichen);
if (!this.isEmptyOrFixed()) {
var time = $slg.facilityInfo().calcSoupKichenReloadTime();
$slg.addTimeGaugeEvent(new SoupKichenTimeGaugeEvent(time));
}
};
SoupKichen.prototype.maxCandidaets = function () {
switch (this.level()) {
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
default:
return 5;
}
};
SoupKichen.prototype.candidates = function () {
var result = [];
var level = this.level();
for (var key in MAN_PARAMS) {
var man = MAN_PARAMS[key];
if (man.level == 0) {
continue;
}
if (man.level > level) {
continue;
}
if ($slg.manInfo().contains(parseInt(key))) {
continue;
}
result.push(parseInt(key));
}
return result;
};
SoupKichen.prototype.addYang = function (list) {
if (!$gameSwitches.value(253)) {
return;
}
if ($slg.manInfo().contains(YANG_MAN_ID)) {
return;
}
if (list.contains(YANG_MAN_ID)) {
return;
}
list.push(YANG_MAN_ID);
};
SoupKichen.prototype.addTutorialMan = function (list) {
if ($slg.manInfo().contains(TUTO_MAN_ID)) {
return;
}
if (list.contains(TUTO_MAN_ID)) {
return;
}
list.push(TUTO_MAN_ID);
};
SoupKichen.prototype.addDebuo = function (list) {
if (!$gameSwitches.value(269)) {
return;
}
if ($slg.manInfo().contains(DEBUO_MAN_ID)) {
return;
}
if (list.contains(DEBUO_MAN_ID)) {
return;
}
list.push(DEBUO_MAN_ID);
};
SoupKichen.prototype.addKuzuo = function (list) {
if (!$gameSwitches.value(267)) {
return;
}
if ($slg.manInfo().contains(KUZUO_MAN_ID)) {
return;
}
if (list.contains(KUZUO_MAN_ID)) {
return;
}
list.push(KUZUO_MAN_ID);
};
SoupKichen.prototype.addGario = function (list) {
if (!$gameSwitches.value(270)) {
return;
}
if ($slg.manInfo().contains(GARIO_MAN_ID)) {
return;
}
if (list.contains(GARIO_MAN_ID)) {
return;
}
list.push(GARIO_MAN_ID);
};
SoupKichen.prototype.manList = function () {
var result = [];
if (!this.isEnabled()) {
return result;
}
for (var _i = 0, _a = this._manIdList; _i < _a.length; _i++) {
var id = _a[_i];
result.push(new Man(parseInt(id)));
}
return result;
};
SoupKichen.prototype.isEmpty = function () {
return this.manList().length == 0;
};
SoupKichen.prototype.hire = function (id) {
var index = this._manIdList.indexOf(id);
this._manIdList.splice(index, 1);
if (id == YANG_MAN_ID) {
$gameParty.addCommonEvent(268, -1);
}
};
SoupKichen.prototype.isEmptyOrFixed = function () {
var candidates = this.candidates();
this.addTutorialMan(candidates);
this.addDebuo(candidates);
this.addKuzuo(candidates);
this.addGario(candidates);
return candidates.length == this._manIdList.length;
};
SoupKichen.prototype.isEnabled = function () {
return $slg.manInfo().soupKichen().level() >= 1;
};
SoupKichen.prototype.isEmptyOrDisabled = function () {
return this.isEmpty() || !this.isEnabled();
};
return SoupKichen;
})();
var Man = /** @class */ (function () {
function Man(id) {
this._id = id;
}
Man.prototype.price = function () {
if (!this.param()) {
return -1;
}
return this.param().price;
};
Man.prototype.param = function () {
return MAN_PARAMS[this._id];
};
Man.prototype.name = function () {
var actor = this.actor();
if (actor) {
return actor.name();
} else {
console.error("IDが" + this._id + "の男優が見つかりません");
return "";
}
};
Man.prototype.job = function () {
if (!this.param()) {
return "";
}
if (ConfigManager.language == "en") {
return this.param().jobEn;
}
return this.param().job;
};
Man.prototype.iconIndex = function () {
return this.actor().iconIndex();
};
Man.prototype.actor = function () {
return $gameActors.actor(this._id);
};
Man.prototype.id = function () {
return this._id;
};
Man.prototype.bonusNinshinRate = function () {
var param = this.param();
var skills = [param.skill1, param.skill2, param.skill3];
for (var _i = 0, skills_1 = skills; _i < skills_1.length; _i++) {
var skill = skills_1[_i];
if (skill == "精液多め") {
return 0.5;
}
}
return 0;
};
Man.prototype.isOsusume = function () {
return this._id == TUTO_MAN_ID || this._id == YANG_MAN_ID;
};
return Man;
})();