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

2255 lines
65 KiB
JavaScript
Raw Permalink 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.

var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError(
"Class extends value " + String(b) + " is not a constructor or null"
);
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype =
b === null
? Object.create(b)
: ((__.prototype = b.prototype), new __());
};
})();
/*:ja
* @target MZ
* @author ル
*
* @command dousei
* @text 同棲選択
* @des 同棲選択
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command douseiSet
* @text 同棲相手設定
* @des 同棲相手設定
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg manId
* @type number
* @text manId
* @desc manId
*
* @command douseiPlay
* @text 同棲アニメ再生
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command douseiSexPlay
* @text 同棲SEXアニメ再生
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command nekoUpdate
* @text 猫操作かを更新
*
* @command douseiNameSet
* @text 同棲相手の名前を変数56番に設定し、55番にIDを設定
* @des 同棲相手の名前を変数56番に設定
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command startDouseiMsg
* @text 55番のIDの男との汎用同棲会話を作成
* @arg actorId
* @type number
*
* @command startDouseiNinshinMsg
* @text 55番のIDの男との妊娠会話を作成
* @arg actorId
* @type number
*
* @command startDouseiSyusanMsg
* @text 55番のIDの男との出産会話を作成
* @arg actorId
* @type number
*
* @command startDouseiMaxMsg
* @text 同棲相手との友好度MAX会話を実行
* @arg actorId
* @type number
*
* @command upDouseiMaxBonusAndRunScenario
* @text 同棲相手との友好度MAXボーナスを獲得してシナリオ実行
* @arg actorId
* @type number
*
* @command upDouseiSyusanFriendship
* @text 同棲出産で友好度アップ
* @arg actorId
* @type number
*
* @command useCondom
* @text コンドーム使用設定
* @arg actorId
* @type number
* @arg b
* @type boolean
*
* @command startDouseiSexMsg
* @text 同棲相手との覗き見イベントを実行
* @arg actorId
* @type number
*/
var Nore;
(function (Nore) {
var DOUSEI_TOP_Y = 45;
var pluginName = "Nore_Dousei";
PluginManager.registerCommand(pluginName, "dousei", function (args) {
var actorId = parseInt(args.actorId);
if (actorId > 0) {
$gameParty.setMenuActorId(actorId);
}
SceneManager.push(Scene_Dousei);
});
PluginManager.registerCommand(pluginName, "douseiSet", function (args) {
var actorId = parseInt(args.actorId);
var manId = parseInt(args.manId);
var dousei = $gameActors.actor(actorId).dousei();
dousei.setMan(manId);
});
PluginManager.registerCommand(pluginName, "douseiPlay", function (args) {
var actorId = parseInt(args.actorId);
$gameActors.actor(actorId).dousei().run();
});
PluginManager.registerCommand(pluginName, "douseiSexPlay", function (args) {
var actorId = parseInt(args.actorId);
var dousei = $gameActors.actor(actorId).dousei();
dousei.run();
//$gameVariables.setValue(dousei.actorDouseiVar(), Nore.DOUSEI_CHAR_VAR.gyaku);
});
PluginManager.registerCommand(pluginName, "nekoUpdate", function (args) {
if ($gameVariables.value(72) != 1) {
$gameSystem.endNeko();
return;
}
if ($gameSwitches.value(Nore.SENRI_DOUSEI_SW)) {
$gameSystem.playNeko();
} else {
$gameSystem.endNeko();
}
});
PluginManager.registerCommand(pluginName, "douseiNameSet", function (args) {
var actorId = parseInt(args.actorId);
var manId = $gameActors.actor(actorId).dousei().manId();
$gameVariables.setValue(55, manId);
$gameVariables.setValue(56, $gameActors.actor(manId).name());
});
PluginManager.registerCommand(pluginName, "startDouseiMsg", function (args) {
var actorId = parseInt(args.actorId);
var manId = $gameVariables.value(55);
var manParam = MAN_PARAMS[manId];
var actorName = $gameActors.actor(actorId).nameJp();
var text = "%1_同棲開始_%2_01".format(actorName, manParam.type);
p(text);
var list = $dataScenario[text];
if (!list) {
console.error("id:" + text + " のデータが見つかりません");
return;
}
console.log("Scenario \u30B3\u30DE\u30F3\u30C9\u5B9F\u884C: ".concat(text));
this.setupChild(list, this._eventId);
});
PluginManager.registerCommand(
pluginName,
"startDouseiNinshinMsg",
function (args) {
$gameSwitches.setValue(20, false);
var actorId = parseInt(args.actorId);
var manId = $gameVariables.value(55);
var man = $gameActors.actor(manId);
var manParam = MAN_PARAMS[manId];
var actor = $gameActors.actor(actorId);
var actorName = actor.nameJp();
if (actor.friendship(manId) >= 100) {
var text1 = "%1_同棲_妊娠_%2_02".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1)) {
return;
}
var text2 = "%1_同棲_妊娠_%2_02".format(actorName, manParam.type);
if (this.runDouseiScenario(text2)) {
return;
}
}
var text1_1 = "%1_同棲_妊娠_%2_01".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1_1)) {
return;
}
var text1_2 = "%1_同棲_妊娠_%2_01".format(actorName, manParam.type);
if (this.runDouseiScenario(text1_2)) {
return;
}
}
);
Game_Interpreter.prototype.runDouseiScenario = function (file) {
var list = $dataScenario[file];
if (list) {
$gameSwitches.setValue(20, true);
console.log(
"Scenario \u30B3\u30DE\u30F3\u30C9\u5B9F\u884C: ".concat(file)
);
this.setupChild(list, this._eventId);
return true;
}
return false;
};
PluginManager.registerCommand(
pluginName,
"startDouseiSyusanMsg",
function (args) {
$gameSwitches.setValue(20, false);
var actorId = parseInt(args.actorId);
var manId = $gameVariables.value(55);
var manParam = MAN_PARAMS[manId];
var man = $gameActors.actor(manId);
var actorName = $gameActors.actor(actorId).nameJp();
var actor = $gameActors.actor(actorId);
if (actor.friendship(manId) >= 100) {
var text1 = "%1_同棲_出産_%2_02".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1)) {
$gameSwitches.setValue(20, true);
return;
}
var text2 = "%1_同棲_出産_%2_02".format(actorName, manParam.type);
if (this.runDouseiScenario(text2)) {
$gameSwitches.setValue(20, true);
return;
}
}
var text3 = "%1_同棲_出産_%2_01".format(actorName, man.nameJp());
if (this.runDouseiScenario(text3)) {
$gameSwitches.setValue(20, true);
return;
}
var text4 = "%1_同棲_出産_%2_01".format(actorName, manParam.type);
if (this.runDouseiScenario(text4)) {
$gameSwitches.setValue(20, true);
return;
}
}
);
PluginManager.registerCommand(
pluginName,
"startDouseiMaxMsg",
function (args) {
var actorId = parseInt(args.actorId);
var actor = $gameActors.actor(actorId);
var actorName = actor.nameJp();
var manId = actor.dousei().manId();
var man = $gameActors.actor(manId);
if (!man) {
console.error(actorId + "の同棲相手がみつかりません");
return;
}
var text1 = "%1_同棲マックス会話_%2_01".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1)) {
return;
}
var manParam = MAN_PARAMS[manId];
var text2 = "%1_同棲マックス会話_%2_01".format(actorName, manParam.type);
if (this.runDouseiScenario(text2)) {
return;
}
console.error(
""
.concat(actorName, "\u3068")
.concat(
man.nameJp(),
"\u306E\u53CB\u597D\u5EA6\u30DE\u30C3\u30AF\u30B9\u30A4\u30D9\u30F3\u30C8\u304C\u5B58\u5728\u3057\u307E\u305B\u3093"
)
);
}
);
PluginManager.registerCommand(
pluginName,
"upDouseiMaxBonusAndRunScenario",
function (args) {
var actorId = parseInt(args.actorId);
var actor = $gameActors.actor(actorId);
var bonusType = actor.dousei().calcFriendshipMaxBonusType();
$gameParty.upFriendshipBonus(bonusType, 1);
$gameVariables.setValue(40, friendshipBonusName(bonusType));
$gameVariables.setValue(39, $gameParty.friendshipBonusRate(bonusType));
var text1 = "同棲友好度MAXボーナス_01";
if (this.runDouseiScenario(text1)) {
return;
}
}
);
PluginManager.registerCommand(
pluginName,
"upDouseiSyusanFriendship",
function (args) {
var actorId = parseInt(args.actorId);
var actor = $gameActors.actor(actorId);
var manId = actor.dousei().manId();
actor.addFriendship(manId, 15, false);
}
);
PluginManager.registerCommand(pluginName, "useCondom", function (args) {
var actorId = parseInt(args.actorId);
var actor = $gameActors.actor(actorId);
var b = args.b == true;
actor.dousei().setUseCondom(b);
if (!b) {
actor.dousei().setSexOnly();
}
});
PluginManager.registerCommand(
pluginName,
"startDouseiSexMsg",
function (args) {
$gameSwitches.setValue(20, false);
$gameSwitches.setValue(52, false);
var actorId = parseInt(args.actorId);
var actor = $gameActors.actor(actorId);
var manId = $gameVariables.value(55);
var man = $gameActors.actor(manId);
var manParam = MAN_PARAMS[manId];
var actorName = actor.nameJp();
if (actor.friendship(manId) >= 100) {
var text1 = "%1_同棲覗き見_SEX_%2_02".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1)) {
$gameSwitches.setValue(52, true);
return;
}
var text2 = "%1_同棲覗き見_SEX_%2_02".format(actorName, manParam.type);
if (this.runDouseiScenario(text2)) {
$gameSwitches.setValue(52, true);
return;
}
}
var text1_1 = "%1_同棲覗き見_SEX_%2_01".format(actorName, man.nameJp());
if (this.runDouseiScenario(text1_1)) {
return;
}
var text1_2 = "%1_同棲覗き見_SEX_%2_01".format(actorName, manParam.type);
if (this.runDouseiScenario(text1_2)) {
return;
}
}
);
function friendshipBonusName(type) {
switch (type) {
case FriendshipBonusType.atkFlame:
return TextManager.atkFlame;
case FriendshipBonusType.atkWater:
return TextManager.atkWater;
case FriendshipBonusType.atkWood:
return TextManager.atkWood;
case FriendshipBonusType.hpFlame:
return TextManager.hpFlame;
case FriendshipBonusType.hpWater:
return TextManager.hpWater;
case FriendshipBonusType.hpWood:
return TextManager.hpWood;
default:
console.error("不正なボーナスタイプです:" + type);
return "";
}
}
var DOUSEI_CHAR_VAR;
(function (DOUSEI_CHAR_VAR) {
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["sex"] = 1)] = "sex";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["anal"] = 1)] = "anal";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["cri"] = 1)] = "cri";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["chichi"] = 2)] = "chichi";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["fela"] = 3)] = "fela";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["sm"] = 4)] = "sm";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["kijoui"] = 5)] = "kijoui";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["gyaku"] = 6)] = "gyaku";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["back"] = 7)] = "back";
DOUSEI_CHAR_VAR[(DOUSEI_CHAR_VAR["kunni"] = 8)] = "kunni";
})((DOUSEI_CHAR_VAR = Nore.DOUSEI_CHAR_VAR || (Nore.DOUSEI_CHAR_VAR = {})));
Nore.NONOKA_DOUSEI_VAR = 31;
Nore.SENRI_DOUSEI_VAR = 32;
Nore.MARINA_DOUSEI_VAR = 33;
Nore.SAKI_DOUSEI_VAR = 34;
Nore.KOKONA_DOUSEI_VAR = 35;
Nore.KANAMI_DOUSEI_VAR = 36;
Nore.MIYU_DOUSEI_VAR = 37;
Nore.NONOKA_DOUSEI_SW = 91;
Nore.SENRI_DOUSEI_SW = 92;
Nore.MARINA_DOUSEI_SW = 93;
Nore.SAKI_DOUSEI_SW = 94;
Nore.KOKONA_DOUSEI_SW = 95;
Nore.KANAMI_DOUSEI_SW = 96;
Nore.MIYU_DOUSEI_SW = 97;
var Scene_Dousei = /** @class */ (function (_super) {
__extends(Scene_Dousei, _super);
function Scene_Dousei() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Scene_Dousei.prototype.create = function () {
_super.prototype.create.call(this);
this.createDouseiWindow();
this.createMsgWindow();
this.createConfirmWindow();
};
Scene_Dousei.prototype.createDouseiWindow = function () {
var dousei = this.actor().dousei();
if (this.actor().countSyusan() == 0 && $gameSwitches.value(228)) {
dousei.useRubber();
}
this._lastMan = dousei.manId();
this._douseiWindow = new Window_Dousei(dousei.manId());
this.addChild(this._douseiWindow);
this._douseiWindow.activate();
this._douseiWindow.select(0);
this._douseiWindow.setHandler("ok", this.onOk.bind(this));
this._douseiWindow.setHandler("cancel", this.onCancel.bind(this));
this._douseiWindow.setHandler("change", this.onChange.bind(this));
this._manDescWindow = new Window_DouseiManDesc();
this.addChild(this._manDescWindow);
this._manWindow = new Window_DouseiMan(this.actor());
this.addChild(this._manWindow);
this._manWindow.select(0);
this._manWindow.setHandler("ok", this.onManOk.bind(this));
this._manWindow.setHandler("cancel", this.onManCancel.bind(this));
};
Scene_Dousei.prototype.createMsgWindow = function () {
this._msgWindow = new Nore.Window_Msg();
this._msgWindow.setTexts([TextManager.douseiNg1, TextManager.douseiNg2]);
this.addChild(this._msgWindow);
this._msgWindow.visible = false;
this._msgWindow.setHandler("ok", this.onMsgOk.bind(this));
this._msgWindow.setHandler("cancel", this.onMsgOk.bind(this));
};
Scene_Dousei.prototype.createConfirmWindow = function () {
this._confirmWindow = new Nore.Window_Confirm(700);
this.addChild(this._confirmWindow);
this._confirmWindow.setTexts([" ", " "]);
this._confirmWindow.visible = false;
this._confirmWindow.setHandler("ok", this.onConfirmOk.bind(this));
this._confirmWindow.setHandler("cancel", this.onConfirmCancel.bind(this));
};
Scene_Dousei.prototype.onMsgOk = function () {
this._msgWindow.hide();
this._douseiWindow.activate();
};
Scene_Dousei.prototype.onOk = function () {
if (this._douseiWindow.index() == 0) {
if (this.actor().dousei().isDouseiNinshin()) {
this.showMsgWindow(0);
return;
}
this._manDescWindow.show();
this._manWindow.show();
this._manWindow.activate();
return;
}
if (this._douseiWindow.index() == 10) {
this.decide();
return;
}
if (this._douseiWindow.index() <= 6) {
if (!$gameSwitches.value(228)) {
this.showMsgWindow(1);
return;
}
var play_1 = this._douseiWindow.getPlay(this._douseiWindow.index());
play_1.changeEnable();
this._douseiWindow.refresh();
this._douseiWindow.activate();
return;
}
var play = this._douseiWindow.getOption(this._douseiWindow.index());
play.changeEnable();
this._douseiWindow.refresh();
this._douseiWindow.activate();
};
Scene_Dousei.prototype.showMsgWindow = function (msgType) {
this._msgWindow.visible = true;
if (msgType == 0) {
this._msgWindow.setTexts([
TextManager.douseiNg1,
TextManager.douseiNg2,
]);
} else {
this._msgWindow.setText(TextManager.douseiNg3);
}
SoundManager.playBuzzer();
this._msgWindow.activate();
};
Scene_Dousei.prototype.onCancel = function () {
//this.popScene();
this.decide();
};
Scene_Dousei.prototype.decide = function () {
var manId = this._douseiWindow.manId();
if (manId > 0) {
var man = $gameActors.actor(manId);
var alreadyId = this._manWindow.alreadyDouseiId(man);
if (alreadyId > 0) {
var name_1 = man.name();
var name2 = $gameActors.actor(alreadyId).name();
var name3 = this.actor().name();
var text1 = TextManager.douseiAlreadyDialog1.format(name_1, name2);
var text2 = TextManager.douseiAlreadyDialog2.format(name3);
this._confirmWindow.setTexts([text1, text2]);
this._confirmWindow.show();
this._confirmWindow.select(0);
} else {
this.decideInternal();
}
} else {
this.decideInternal();
}
};
Scene_Dousei.prototype.onConfirmOk = function () {
this.decideInternal();
};
Scene_Dousei.prototype.onConfirmCancel = function () {
this._confirmWindow.hide();
this._douseiWindow.activate();
};
Scene_Dousei.prototype.decideInternal = function () {
var dousei = this.actor().dousei();
var manId = this._douseiWindow.manId();
if (manId > 0) {
var man = $gameActors.actor(manId);
var alreadyId = this._manWindow.alreadyDouseiId(man);
if (alreadyId > 0) {
$gameActors.actor(alreadyId).dousei().setMan(0);
$gameActors.actor(alreadyId).dousei().stop();
}
}
if (this._douseiWindow.isDecideEnabled()) {
dousei.setMan(manId);
this.runDouseiTimeEvent();
}
this.popScene();
$gameSystem.endNeko();
$gamePlayer.refresh();
};
Scene_Dousei.prototype.onWomanOk = function () {
this._douseiWindow.activate();
};
Scene_Dousei.prototype.onManOk = function () {
var actor = this._manWindow.selectedActor();
if (actor) {
this._douseiWindow.setMan(actor.actorId());
} else {
this._douseiWindow.setMan(0);
}
this._douseiWindow.activate();
};
Scene_Dousei.prototype.onManCancel = function () {
this._douseiWindow.activate();
};
Scene_Dousei.prototype.onChange = function () {
this._manWindow.hide();
this._manDescWindow.hide();
if (this._douseiWindow.index() == 0) {
this._manDescWindow.show();
this._manWindow.show();
this._manWindow.selectedActor();
}
};
Scene_Dousei.prototype.runDouseiTimeEvent = function () {
var actorId = this.actor().actorId();
$slg.removeDouseiTimeGaugeEvent(actorId);
var dousei = this.actor().dousei();
if (!dousei.isPlayEnabled(dousei.manId())) {
dousei.stop();
return;
}
if (this._lastMan != dousei.manId()) {
this.runDouseiStartEvent();
} else {
dousei.run();
}
};
Scene_Dousei.prototype.runDouseiStartEvent = function () {
var dousei = this.actor().dousei();
var actorId = this.actor().actorId();
switch (actorId) {
case 4:
this.runDouseiStartEvent4();
dousei.stop();
break;
case 8:
this.runDouseiStartEvent8();
dousei.stop();
break;
case 9:
this.runDouseiStartEvent9();
dousei.stop();
break;
case 10:
this.runDouseiStartEvent10();
dousei.stop();
break;
case 11:
this.runDouseiStartEvent11();
dousei.stop();
break;
case 13:
this.runDouseiStartEvent13();
dousei.stop();
break;
case 17:
this.runDouseiStartEvent17();
dousei.stop();
break;
default:
dousei.run();
break;
}
p("runDouseiStartEvent:" + actorId);
};
Scene_Dousei.prototype.runDouseiStartEvent4 = function () {
$gameParty.addCommonEvent(560, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent8 = function () {
$gameParty.addCommonEvent(650, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent9 = function () {
$gameParty.addCommonEvent(530, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent10 = function () {
$gameParty.addCommonEvent(500, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent11 = function () {
$gameParty.addCommonEvent(470, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent13 = function () {
$gameParty.addCommonEvent(590, -1);
};
Scene_Dousei.prototype.runDouseiStartEvent17 = function () {
$gameParty.addCommonEvent(620, -1);
};
Scene_Dousei.prototype.createCancelButton = function () {
this._cancelButton = new Sprite_Button2("cancel", true);
this._cancelButton.x = Graphics.boxWidth - this._cancelButton.width - 26;
this._cancelButton.y = 35;
this.addWindow(this._cancelButton);
};
return Scene_Dousei;
})(Scene_MenuBase);
Nore.Scene_Dousei = Scene_Dousei;
var Window_Dousei = /** @class */ (function (_super) {
__extends(Window_Dousei, _super);
function Window_Dousei(manId) {
var _this = this;
var r = new Rectangle(100, DOUSEI_TOP_Y, 600, 724);
_this = _super.call(this, r) || this;
_this._manId = 0;
_this._manId = manId;
_this.contents.outlineWidth = 5;
_this.refresh();
return _this;
}
Window_Dousei.prototype.maxItems = function () {
return 11;
};
Window_Dousei.prototype.itemRect = function (index) {
var r = _super.prototype.itemRect.call(this, index);
r.x += 120;
r.y += 92 + index * 6;
r.height += 1;
r.width = 200;
if (index > 0) {
r.x += 92;
r.y += 92;
r.width = 110;
}
if (index > 6) {
r.y += 54;
}
if (index == 10) {
r.y += 25;
r.width += 10;
r.height += 6;
}
return r;
};
Window_Dousei.prototype.itemHeight = function () {
return 32;
};
Window_Dousei.prototype.rowSpacing = function () {
return 0;
};
Window_Dousei.prototype.refresh = function () {
_super.prototype.refresh.call(this);
this.drawTitle();
this.drawName();
this.drawFriendship();
};
Window_Dousei.prototype.actor = function () {
return $gameParty.menuActor();
};
Window_Dousei.prototype.drawFriendship = function () {
this.contents.fontSize = 14;
var textY = 124;
this.drawText(TextManager.douseiFriendship, 32, textY, 200);
var xx = 125;
var yy = textY + 16;
var hh = 8;
if (this._manId == 0) {
return;
}
var actor = this.actor();
var friendship = actor.friendship(this._manId);
var max = actor.maxFriendship(this._manId);
var ww = max * 2; // 200
this.contents.fillRect(xx, yy, 200 + 2, hh, "#000000");
this.contents.fillRect(xx + 1, yy + 1, ww, hh - 2, "#666666");
var color;
if (friendship >= 100) {
color = ColorManager.friendshipMaxColor();
} else {
color = ColorManager.friendshipColor();
}
this.contents.fillRect(xx + 1, yy + 1, friendship * 2, hh - 2, color);
var friendshipLevel = actor.friendshipLevel(this._manId);
var text = actor.getFriendshipLevelText(friendshipLevel);
this.drawText(text, xx - 20, textY, 100);
};
Window_Dousei.prototype.getSprite = function (x, y, w, h) {
var baseTexture = Nore.getSystemBaseTexture("dousei");
var r = new Rectangle(x, y, w, h);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
return s;
};
Window_Dousei.prototype.drawTitle = function () {
this.contents.fontSize = 24;
var s = this.getSprite(0, 0, 521, 64);
s.x = 38;
s.y = 26;
this._windowContentsSprite.addChild(s);
this.drawText(
TextManager.douseiTitile.format(this.actor().name()),
120,
24,
300,
"center"
);
this.drawIcon(this.actor().iconIndex(), 82, 24);
this.contents.fontSize = 22;
var rect2 = this.itemRect(0);
var spriteOffset = ConfigManager.language == "jp" ? 0 : 192;
this.drawText(TextManager.douseiMan, 32, rect2.y - 4, 200);
{
var s_1 = this.getSprite(spriteOffset, 64, 160, 32);
s_1.x = 388;
s_1.y = 100;
this._windowContentsSprite.addChild(s_1);
}
//this.drawText('プレイジャンル', 350, rect2.y - 8, 200);
if (this._manId > 0) {
var upList = getManDouseiSkill(
this._manId,
this.actor().friendshipLevel(this._manId)
);
for (var _i = 0, upList_1 = upList; _i < upList_1.length; _i++) {
var type = upList_1[_i];
this.drawIconType(type, rect2.y + 33);
}
}
this.contents.fontSize = 20;
var rect3 = this.itemRect(1);
{
var s_2 = this.getSprite(spriteOffset, 96, 160, 32);
s_2.x = 388;
s_2.y = 198;
this._windowContentsSprite.addChild(s_2);
}
{
var s_3 = this.getSprite(spriteOffset, 128, 192, 32);
s_3.x = 48;
s_3.y = 198;
this._windowContentsSprite.addChild(s_3);
}
//this.drawText('許可するプレイ', 10, rect3.y - 38, 200);
//this.drawText('上昇パラメータ', 350, rect3.y - 38, 200);
{
var s_4 = this.getSprite(spriteOffset, 160, 192, 32);
s_4.x = 48;
s_4.y = 478;
this._windowContentsSprite.addChild(s_4);
}
//this.drawText('追加オプション', 10, rect3.y + 233, 200);
this.contents.fontSize = 20;
var dousei = this.actor().dousei();
var index = 1;
for (var _a = 0, _b = dousei.playList(); _a < _b.length; _a++) {
var d = _b[_a];
this.drawPlay(index, d);
index++;
}
for (var _c = 0, _d = dousei.optionList(); _c < _d.length; _c++) {
var d = _d[_c];
this.drawPlay(index, d);
index++;
}
};
Window_Dousei.prototype.drawIconType = function (type, y) {
var interval = 35;
var base = this.paramX();
switch (type) {
case AvRequired.kiss:
this.drawIcon(Icon.kiss, base + interval * 0, y);
break;
case AvRequired.chichi:
this.drawIcon(Icon.chichi, base + interval * 1, y);
break;
case AvRequired.cri:
this.drawIcon(Icon.cri, base + interval * 2, y);
break;
case AvRequired.manko:
this.drawIcon(Icon.manko, base + interval * 3, y);
break;
case AvRequired.anal:
this.drawIcon(Icon.anal, base + interval * 4, y);
break;
case AvRequired.sm:
this.drawIcon(Icon.sm, base + interval * 5, y);
break;
}
};
Window_Dousei.prototype.isAutoSyusanEnabled = function () {
return $gameSwitches.value(282);
};
Window_Dousei.prototype.drawPlay = function (index, play) {
var rect = this.itemRect(index);
var yy = rect.y - 2;
if (play.isOption()) {
if (play.itemId() == 11) {
if (!$gameSwitches.value(1038)) {
return;
}
}
if (play.itemId() == 12) {
if (!$slg.facilityInfo().hasFacility(57)) {
return;
}
}
if (play.itemId() == 13) {
if (!this.isAutoSyusanEnabled()) {
return;
}
}
} else if (this._manId > 0) {
if (this.isManEnabledPlay(this._manId, play)) {
this.changePaintOpacity(true);
} else {
return;
this.changePaintOpacity(false);
}
} else {
return;
}
this.contents.fontSize = 20;
var offsetX = 0;
if (play.iconIndex() > 0) {
this.drawIcon(play.iconIndex(), 25, yy);
offsetX = 12;
}
this.contents.outlineColor = "#050081";
this.drawText(play.name(), 45 + offsetX, yy, 150);
this.contents.outlineColor = "#000000";
if (play.isEnabled()) {
this.drawText("", rect.x + 60, yy, 100);
} else {
this.drawText("", rect.x + 10, yy, 100);
}
this.changePaintOpacity(play.isEnabled());
if (play.isOption()) {
this.drawDescription(yy, play);
} else {
this.drawUpParam(yy, play);
}
this.changePaintOpacity(true);
};
Window_Dousei.prototype.isManEnabledPlay = function (manId, play) {
var list = getManDouseiSkill(
manId,
this.actor().friendshipLevel(this._manId)
);
return list.contains(play.bodyType());
};
Window_Dousei.prototype.drawDescription = function (yy, play) {
if (play.itemId() == 11) {
if (Nore.isTaikenban()) {
this.contents.fontSize = 14;
this.drawText(TextManager.douseiRubber1, 350, yy - 9, 250);
this.drawText(TextManager.douseiRubberTaikenban2, 350, yy + 9, 250);
} else {
if (this.actor().countSyusan() == 0) {
this.drawText(TextManager.douseiRubber2, 350, yy, 250);
} else {
this.drawText(TextManager.douseiRubber1, 350, yy, 250);
}
}
}
if (play.itemId() == 12) {
this.contents.fontSize = 14;
this.drawText(TextManager.douseiNinshinSkip, 350, yy - 9, 250);
this.drawText(TextManager.douseiNinshinSkip2, 350, yy + 9, 250);
}
if (play.itemId() == 13) {
this.contents.fontSize = 14;
this.drawText(TextManager.douseiAutoSyusan, 350, yy - 9, 250);
this.drawText(TextManager.douseiAutoSyusan2, 350, yy + 9, 250);
}
//this.drawText(play.description(), 350, yy, 250);
};
Window_Dousei.prototype.drawUpParam = function (yy, play) {
if (this.isTaikenbanNg(play)) {
this.contents.fontSize = 17;
this.drawText(TextManager.douseiTaikenbanNg, 350, yy, 200);
return;
}
var list = [
AvRequired.kiss,
AvRequired.chichi,
AvRequired.cri,
AvRequired.manko,
AvRequired.anal,
AvRequired.sm,
];
var index = 0;
var baseX = this.paramX() + 18;
var interval = 32 - 3;
this.contents.fontSize = 15;
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var type = list_1[_i];
var upValue = play.upValue(type);
if (upValue > 0) {
var icon = getAvRequiredIcon(type);
this.drawIcon(icon, baseX + interval * index, yy);
var param = this.actor().eroParam10(type);
this.drawText(param, 300, yy + 1, 58, "right");
}
index++;
}
};
Window_Dousei.prototype.isTaikenbanNg = function (play) {
if (!Nore.isTaikenban()) {
return false;
}
if (play.bodyType() == BodyType.manko) {
return false;
}
return true;
};
Window_Dousei.prototype.paramX = function () {
return 350;
};
Window_Dousei.prototype.drawName = function () {};
Window_Dousei.prototype.drawItem = function (index) {
this.contents.fontSize = 20;
var rect = this.itemRect(index);
var yy = rect.y - 2;
if (index == 0) {
if (this._manId > 0) {
var actor = $gameActors.actor(this._manId);
this.drawIcon(actor.iconIndex(), rect.x + 2, yy + 1);
this.drawText(actor.name(), rect.x + 42, yy, rect.width);
}
}
if (index == 10) {
var enabled = this.isDecideEnabled();
this.changePaintOpacity(enabled);
this.drawText("", rect.x, yy + 4, rect.width, "center");
this.changePaintOpacity(true);
if (!enabled) {
if (this._manId > 0) {
this.drawText(
TextManager.douseiDecide,
rect.x + 130,
yy + 4,
150,
"left"
);
}
}
}
this.changePaintOpacity(true);
};
Window_Dousei.prototype.isManOk = function () {
return this._manId > 0;
};
Window_Dousei.prototype.isPlayOk = function () {
var dousei = this.actor().dousei();
return dousei.isPlayEnabled(this._manId);
};
Window_Dousei.prototype.getPlay = function (index) {
if (index < 1) {
return null;
}
var dousei = this.actor().dousei();
return dousei.playList()[index - 1];
};
Window_Dousei.prototype.getOption = function (index) {
if (index < 7) {
return null;
}
var dousei = this.actor().dousei();
return dousei.optionList()[index - 7];
};
Window_Dousei.prototype.setMan = function (actorId) {
this._manId = actorId;
this.refresh();
};
Window_Dousei.prototype.manId = function () {
return this._manId;
};
Window_Dousei.prototype.isCurrentItemEnabled = function () {
if (this.index() == 7) {
if (this.actor().countSyusan() == 0) {
return false;
}
//return this.isManOk();
}
if (this.index() == 10) {
return this.isDecideEnabled();
}
return true;
};
Window_Dousei.prototype.isDecideEnabled = function () {
if (this._manId == 0) {
return true;
}
return this.isManOk() && this.isPlayOk();
};
return Window_Dousei;
})(Window_Selectable);
var Window_DouseiManDesc = /** @class */ (function (_super) {
__extends(Window_DouseiManDesc, _super);
function Window_DouseiManDesc() {
var _this = this;
var r = new Rectangle(710, DOUSEI_TOP_Y, 460, 110);
_this = _super.call(this, r) || this;
_this.refresh();
return _this;
}
Window_DouseiManDesc.prototype.refresh = function () {
this.drawTitle();
};
Window_DouseiManDesc.prototype.drawTitle = function () {
this.changePaintOpacity(true);
this.contents.fontSize = 15;
this.drawText(TextManager.douseiManTitle1, 10, 0, 410, "center");
this.drawText(TextManager.douseiManTitle2, 10, 18, 410, "center");
var y = this.itemHeight() + 12;
this.contents.fontSize = 18;
this.drawText(TextManager.douseiName, 40, y, 200);
this.drawText(TextManager.douseiJenre, 170, y, 200);
};
return Window_DouseiManDesc;
})(Window_Base);
var Window_DouseiMan = /** @class */ (function (_super) {
__extends(Window_DouseiMan, _super);
function Window_DouseiMan(actor) {
var _this = this;
var r = new Rectangle(710, DOUSEI_TOP_Y + 110, 460, 614);
_this = _super.call(this, r) || this;
_this._actor = actor;
_this.makeData();
_this.refresh();
return _this;
}
Window_DouseiMan.prototype.refresh = function () {
_super.prototype.refresh.call(this);
};
Window_DouseiMan.prototype.makeData = function () {
this._itemList = [];
for (var _i = 0, _a = $slg.manList(); _i < _a.length; _i++) {
var man = _a[_i];
if (this.isInclude(man)) {
this._itemList.push(man);
}
}
this._itemList.push(null);
};
Window_DouseiMan.prototype.isInclude = function (man) {
if (this._actor.actorId() == 8) {
switch (man.actorId()) {
case 5:
case 18:
return true;
default:
return false;
}
}
if (this._actor.actorId() == 10) {
switch (man.actorId()) {
case 3:
case 26:
return true;
default:
return false;
}
}
if (this._actor.actorId() == 11) {
switch (man.actorId()) {
case 22:
case 48:
case 49:
return true;
default:
return false;
}
}
return true;
};
Window_DouseiMan.prototype.maxItems = function () {
if (!this._itemList) {
return 0;
}
return this._itemList.length;
};
/*itemRect(index: number): Rectangle {
const rect = super.itemRect(index);
rect.y += this.itemHeight() * 2;
return rect;
}*/
Window_DouseiMan.prototype.drawItem = function (index) {
this.contents.fontSize = 20;
var rect = this.itemRect(index);
var man = this._itemList[index];
if (!man) {
return;
}
this.changePaintOpacity(this.isEnabled(man));
this.drawIcon(man.iconIndex(), rect.x + 4, rect.y + 2);
this.drawText(man.name(), rect.x + 42, rect.y - 4, rect.width);
this.drawFriendship(man, rect);
var alreadyActorId = this.alreadyDouseiId(man);
if (alreadyActorId > 0) {
this.contents.fontSize = 16;
var actor = $gameActors.actor(alreadyActorId);
var name_2 = actor.name();
if (actor.dousei().isDouseiNinshin()) {
this.drawText(
TextManager.douseiNinshinMan.format(name_2),
rect.x + 198,
rect.y,
220
);
} else {
this.drawText(
TextManager.douseiAlready.format(name_2),
rect.x + 198,
rect.y,
220
);
}
return;
}
var upList = getManDouseiSkill(
man.actorId(),
this._actor.friendshipLevel(man.actorId())
);
for (var _i = 0, upList_2 = upList; _i < upList_2.length; _i++) {
var type = upList_2[_i];
this.drawIconType(type, rect.y + 2);
}
};
Window_DouseiMan.prototype.drawFriendship = function (man, rect) {
var xx = rect.x + 42 + 20;
var yy = rect.y + 28;
var hh = 5;
var friendship = this._actor.friendship(man.actorId());
var ww = 100;
this.contents.fillRect(xx, yy, ww + 2, hh, "#000000");
var maxFriendship = this._actor.maxFriendship(man.actorId());
this.contents.fillRect(
xx + 1,
yy + 1,
(maxFriendship * ww) / 100,
hh - 2,
"#666666"
);
var color;
if (friendship >= 100) {
color = ColorManager.friendshipMaxColor();
} else {
color = ColorManager.friendshipColor();
}
this.contents.fillRect(
xx + 1,
yy + 1,
(friendship * ww) / 100,
hh - 2,
color
);
var friendshipLevel = this._actor.friendshipLevel(man.actorId());
var text = this._actor.getFriendshipLevelText(friendshipLevel);
this.contents.fontSize = 10;
this.drawText(text, xx - 15, yy - 15, 100);
};
Window_DouseiMan.prototype.drawIconType = function (type, y) {
var interval = 35;
var base = 170;
switch (type) {
case AvRequired.kiss:
this.drawIcon(Icon.kiss, base + interval * 1, y);
break;
case AvRequired.chichi:
this.drawIcon(Icon.chichi, base + interval * 2, y);
break;
case AvRequired.cri:
this.drawIcon(Icon.cri, base + interval * 3, y);
break;
case AvRequired.manko:
this.drawIcon(Icon.manko, base + interval * 4, y);
break;
case AvRequired.anal:
this.drawIcon(Icon.anal, base + interval * 5, y);
break;
case AvRequired.sm:
this.drawIcon(Icon.sm, base + interval * 6, y);
break;
}
};
Window_DouseiMan.prototype.selectedActor = function () {
return this._itemList[this.index()];
};
Window_DouseiMan.prototype.isEnabled = function (man) {
if (!man) {
return true;
}
if (this.isNonokaFirst(man)) {
return false;
}
if (this.isMarinaFirst(man)) {
return false;
}
if (this.isDouseiSyusan(man)) {
return false;
}
return this._actor.canDousei(man.actorId());
};
Window_DouseiMan.prototype.isDouseiSyusan = function (man) {
var actorIds = $gameParty.getActorIdList();
for (var _i = 0, actorIds_1 = actorIds; _i < actorIds_1.length; _i++) {
var id = actorIds_1[_i];
var actor = $gameActors.actor(id);
if (actor.dousei().isDouseiNinshin()) {
if (actor.dousei().manId() == man.actorId()) {
return true;
}
}
}
return false;
};
Window_DouseiMan.prototype.isNonokaFirst = function (man) {
if (this._actor.actorId() != 9) {
return false;
}
if ($gameSwitches.value(303)) {
return false;
}
if (man.actorId() == 19) {
return false;
}
return true;
};
Window_DouseiMan.prototype.isMarinaFirst = function (man) {
if (this._actor.actorId() != 4) {
return false;
}
if ($gameSwitches.value(307)) {
return false;
}
if (man.actorId() == 20) {
return false;
}
return true;
};
Window_DouseiMan.prototype.alreadyDouseiId = function (man) {
if (!man) {
return 0;
}
for (var _i = 0, _a = $gameParty.getActorIdList(); _i < _a.length; _i++) {
var actorId = _a[_i];
if (actorId == this._actor.actorId()) {
continue;
}
var actor = $gameActors.actor(actorId);
if (actor.dousei().manId() == man.actorId()) {
return actor.actorId();
}
}
return 0;
};
Window_DouseiMan.prototype.isCurrentItemEnabled = function () {
return this.isEnabled(this.selectedActor());
};
Window_DouseiMan.prototype.itemHeight = function () {
return 39;
};
return Window_DouseiMan;
})(Window_Selectable);
})(Nore || (Nore = {}));
var DouseiUpResult = /** @class */ (function () {
function DouseiUpResult(
actorId,
manActorId,
t,
up,
acme,
useCondom,
useDrag
) {
this._actorId = actorId;
this._manActorId = manActorId;
this.type = t;
this.up = up;
this._acme = acme;
this._useCondom = useCondom;
this._useDrag = useDrag;
}
DouseiUpResult.prototype.iconIndex = function () {
return getAvRequiredIcon(this.type);
};
DouseiUpResult.prototype.execute = function () {
var actor = $gameActors.actor(this._actorId);
actor.upEroParam(this.type, this.up);
actor.upEro(toEroType(this.type), 1);
actor.upEro(EroType.acme, this._acme);
var n = this.calcNinshinDamage();
if (n <= 0) {
return false;
}
var canNinshin = false;
if (this.type == AvRequired.manko) {
canNinshin = true;
}
if (this._useCondom) {
canNinshin = false;
}
if (this._useDrag) {
n *= 5;
}
var isMax = actor.dousei().friendshipLevel() == FriendshipLevel.S;
var isNinshin = actor.ninshinDamage(
n,
this._manActorId,
canNinshin,
true,
isMax
);
if (isNinshin) {
actor.dousei().setDouseiNinshin(true);
this.reserveNinshinCommonEvent();
return true;
}
return false;
};
DouseiUpResult.prototype.reserveNinshinCommonEvent = function () {
switch (this._actorId) {
case 4:
$gameParty.addCommonEvent(565, -1);
break;
case 8:
$gameParty.addCommonEvent(655, -1);
break;
case 9:
$gameParty.addCommonEvent(535, -1);
break;
case 10:
$gameParty.addCommonEvent(505, -1);
break;
case 11:
$gameParty.addCommonEvent(475, -1);
break;
case 13:
$gameParty.addCommonEvent(595, -1);
break;
case 17:
$gameParty.addCommonEvent(625, -1);
break;
}
};
DouseiUpResult.prototype.calcNinshinDamage = function () {
var baseDamage = 3;
if (this.type == AvRequired.manko) {
baseDamage++;
}
baseDamage *= this.bonusNinshinRate();
return Math.round(baseDamage);
};
DouseiUpResult.prototype.bonusNinshinRate = function () {
var man = new Man(this._manActorId);
return 1 + man.bonusNinshinRate();
};
return DouseiUpResult;
})();
var DouseiPlay = /** @class */ (function () {
function DouseiPlay(itemId, option) {
if (option === void 0) {
option = false;
}
this._itemId = itemId;
this._option = option;
if (!option) {
this._enabled = true;
} else {
this._enabled = false;
}
this._bodyType = this.calcBodyType();
}
DouseiPlay.prototype.calcBodyType = function () {
var item = this.item();
if (!item) {
return;
}
if (item.meta[AvRequired.kiss]) {
return BodyType.kiss;
}
if (item.meta[AvRequired.chichi]) {
return BodyType.chichi;
}
if (item.meta[AvRequired.cri]) {
return BodyType.cri;
}
if (item.meta[AvRequired.manko]) {
return BodyType.manko;
}
if (item.meta[AvRequired.anal]) {
return BodyType.anal;
}
if (item.meta[AvRequired.sm]) {
return BodyType.sm;
}
return null;
};
DouseiPlay.prototype.bodyType = function () {
if (!this._bodyType) {
this._bodyType = this.calcBodyType();
}
return this._bodyType;
};
DouseiPlay.prototype.item = function () {
return $dataItems[this._itemId];
};
DouseiPlay.prototype.name = function () {
switch (ConfigManager.language) {
case "en":
if (this.item().meta["nameEn"]) {
return this.item().meta["nameEn"];
}
break;
case "ch":
case "jp":
break;
}
return this.item().name;
};
DouseiPlay.prototype.iconIndex = function () {
return this.item().iconIndex;
};
DouseiPlay.prototype.isEnabled = function () {
if (Nore.isTaikenban()) {
if (this._option) {
if (this._itemId == 11) {
if (!$gameSwitches.value(1038)) {
return false;
}
return true;
}
}
if (this._bodyType != BodyType.manko) {
return false;
}
}
return this._enabled;
};
DouseiPlay.prototype.enable = function () {
this._enabled = true;
};
DouseiPlay.prototype.disable = function () {
this._enabled = false;
};
DouseiPlay.prototype.changeEnable = function () {
this._enabled = !this._enabled;
};
DouseiPlay.prototype.upValue = function (type) {
if (!this.item()) {
return 0;
}
if (this.item().meta[type]) {
return parseInt(this.item().meta[type]);
} else {
return 0;
}
};
DouseiPlay.prototype.itemId = function () {
return this._itemId;
};
DouseiPlay.prototype.isOption = function () {
return this._option;
};
DouseiPlay.prototype.description = function () {
return this.item().description;
};
DouseiPlay.prototype.upStatus = function (
actorId,
manActorId,
useCondom,
useDrag
) {
var result = [];
var actor = $gameActors.actor(actorId);
var list = [
AvRequired.kiss,
AvRequired.chichi,
AvRequired.cri,
AvRequired.manko,
AvRequired.anal,
AvRequired.sm,
];
for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
var type = list_2[_i];
var up = this.upValue(type);
if (up > 0) {
var acme = this.acmeCount(type, actor);
result.push(
new DouseiUpResult(
actorId,
manActorId,
type,
up,
acme,
useCondom,
useDrag
)
);
}
}
return result;
};
DouseiPlay.prototype.acmeCount = function (type, actor) {
switch (type) {
case AvRequired.chichi:
return this.acmeCountChichi(actor);
case AvRequired.kiss:
return 0;
case AvRequired.cri:
return this.acmeCountCri(actor);
case AvRequired.manko:
return this.acmeCountManko(actor);
case AvRequired.anal:
return this.acmeCountAnal(actor);
case AvRequired.sm:
return this.acmeCountSm(actor);
}
return 0;
};
DouseiPlay.prototype.acmeCountChichi = function (actor) {
var value = actor.eroParam(AvRequired.chichi);
if (value <= 50) {
return 0;
}
if (value >= 300) {
return 2;
}
if (value >= 100) {
return 1;
}
if (Math.randomInt(2) == 0) {
return 1;
}
return 0;
};
DouseiPlay.prototype.acmeCountCri = function (actor) {
var value = actor.eroParam(AvRequired.cri);
if (value <= 50) {
return 1;
}
if (value >= 300) {
return 4;
}
if (value >= 100) {
return 3;
}
if (Math.randomInt(2) == 0) {
return 3;
}
return 2;
};
DouseiPlay.prototype.acmeCountManko = function (actor) {
var value = actor.eroParam(AvRequired.manko);
if (value <= 50) {
if (Math.randomInt(2) == 0) {
return 1;
} else {
return 0;
}
}
if (value >= 300) {
return 3;
}
if (value >= 100) {
return 2;
}
if (Math.randomInt(2) == 0) {
return 2;
}
return 1;
};
DouseiPlay.prototype.acmeCountAnal = function (actor) {
var value = actor.eroParam(AvRequired.anal);
if (value <= 100) {
return 0;
}
if (value >= 300) {
return 2;
}
if (value >= 100) {
return 1;
}
if (Math.randomInt(2) == 0) {
return 1;
}
return 0;
};
DouseiPlay.prototype.acmeCountSm = function (actor) {
var value = actor.eroParam(AvRequired.sm);
if (value <= 100) {
return 0;
}
if (value >= 300) {
return 2;
}
if (value >= 100) {
return 1;
}
if (Math.randomInt(2) == 0) {
return 1;
}
return 0;
};
DouseiPlay.prototype.douseiVar = function () {
var item = this.item();
if (!item) {
return 0;
}
if (item.meta[AvRequired.kiss]) {
return Nore.DOUSEI_CHAR_VAR.fela;
}
if (item.meta[AvRequired.anal]) {
return Nore.DOUSEI_CHAR_VAR.anal;
}
if (item.meta[AvRequired.manko]) {
return Nore.DOUSEI_CHAR_VAR.sex;
}
if (item.meta[AvRequired.chichi]) {
return Nore.DOUSEI_CHAR_VAR.chichi;
}
if (item.meta[AvRequired.cri]) {
return Nore.DOUSEI_CHAR_VAR.cri;
}
if (item.meta[AvRequired.sm]) {
return Nore.DOUSEI_CHAR_VAR.sm;
}
return 0;
};
return DouseiPlay;
})();
var DouseiPlayId;
(function (DouseiPlayId) {
DouseiPlayId[(DouseiPlayId["fela"] = 2)] = "fela";
DouseiPlayId[(DouseiPlayId["sex"] = 3)] = "sex";
DouseiPlayId[(DouseiPlayId["anal"] = 4)] = "anal";
DouseiPlayId[(DouseiPlayId["chichi"] = 5)] = "chichi";
DouseiPlayId[(DouseiPlayId["kunni"] = 6)] = "kunni";
DouseiPlayId[(DouseiPlayId["sm"] = 7)] = "sm";
DouseiPlayId[(DouseiPlayId["rubber"] = 11)] = "rubber";
DouseiPlayId[(DouseiPlayId["drag"] = 12)] = "drag";
DouseiPlayId[(DouseiPlayId["skipSyusan"] = 13)] = "skipSyusan";
DouseiPlayId[(DouseiPlayId["skipBote"] = 12)] = "skipBote";
DouseiPlayId[(DouseiPlayId["empty"] = -1)] = "empty";
})(DouseiPlayId || (DouseiPlayId = {}));
var DouseiPlayHistory = /** @class */ (function () {
function DouseiPlayHistory(manId) {
this._manId = manId;
this._playCountMap = {};
}
DouseiPlayHistory.prototype.up = function (playId) {
this._playCountMap[playId] = this._playCountMap[playId] || 0;
this._playCountMap[playId] = this._playCountMap[playId] + 1;
};
DouseiPlayHistory.prototype.count = function (playId) {
this._playCountMap[playId] = this._playCountMap[playId] || 0;
return this._playCountMap[playId];
};
return DouseiPlayHistory;
})();
var Dousei = /** @class */ (function () {
function Dousei(actorId) {
this._manList = [];
this._lastGainGold = 0;
this._nakadashi = 0;
this._douseiNishin = false;
this._actorId = actorId;
this._count = 0;
this._day = 0;
this._manId = 0;
this.createPlayList();
}
Dousei.prototype.resetNakadashi = function () {
this._nakadashi = 0;
};
Dousei.prototype.calcFriendshipMaxBonusType = function () {
if (this._actorId == 8) {
if (this._manId == 18) {
// ヨシオとセンリ
return FriendshipBonusType.atkFlame;
}
}
if (this._manId == 20) {
// タロウ
return FriendshipBonusType.atkFlame;
}
var manParam = MAN_PARAMS[this._manId];
if (!manParam) {
console.error(this._manId);
return;
}
switch (manParam.type) {
case "クズ":
return FriendshipBonusType.hpFlame;
case "丁寧":
return FriendshipBonusType.hpWater;
case "じじい":
return FriendshipBonusType.hpWood;
case "外人":
return FriendshipBonusType.atkWood;
case "子供":
return FriendshipBonusType.atkWater;
default:
console.error("不正なタイプです:" + manParam.type);
return FriendshipBonusType.hpFlame;
}
};
Dousei.prototype.isCondom = function () {
for (var _i = 0, _a = this._optionList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() == 11) {
return o.isEnabled();
}
}
return false;
};
Dousei.prototype.setUseCondom = function (b) {
for (var _i = 0, _a = this._optionList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() == 11) {
if (b) {
o.enable();
} else {
o.disable();
}
return;
}
}
};
Dousei.prototype.setSexOnly = function () {
for (var _i = 0, _a = this._playList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() == 3) {
o.enable();
} else {
o.disable();
}
}
};
Dousei.prototype.isDrag = function () {
return false;
};
Dousei.prototype.isSkipBoteEvent = function () {
for (var _i = 0, _a = this._optionList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() == 12) {
return o.isEnabled();
}
}
return false;
};
Dousei.prototype.addHistory = function (manId, playId) {
this.history(manId).up(playId);
if (playId == DouseiPlayId.sex) {
if (!this.isCondom()) {
this._nakadashi++;
}
}
};
Dousei.prototype.history = function (manId) {
this._historyMap = this._historyMap || {};
if (!this._historyMap[manId]) {
this._historyMap[manId] = new DouseiPlayHistory(manId);
}
return this._historyMap[manId];
};
Dousei.prototype.makeItemList = function () {
var candidates = [];
var skillList = getManDouseiSkill(
this._manId,
this.actor().friendshipLevel(this._manId)
);
for (var _i = 0, _a = this._playList; _i < _a.length; _i++) {
var play = _a[_i];
if (!skillList.contains(play.bodyType())) {
continue;
}
if (play.isEnabled()) {
candidates.push(play.itemId());
}
}
if (candidates.length == 0) {
return [];
}
var result = Nore.shuffle(candidates);
var remain = 8 - result.length;
var shuffle2 = Nore.shuffle(candidates);
for (var i = 0; i < remain; i++) {
if (shuffle2.length == 0) {
shuffle2 = Nore.shuffle(candidates);
}
result.push(shuffle2.shift());
}
return result;
};
Dousei.prototype.isPlayEnabled = function (manId) {
if (manId == 0) {
return false;
}
for (var _i = 0, _a = this._playList; _i < _a.length; _i++) {
var play = _a[_i];
if (this.isManEnabledPlay(manId || this._manId, play)) {
if (play.isEnabled()) {
return true;
}
}
}
return false;
};
Dousei.prototype.isManEnabledPlay = function (manId, play) {
var list = getManDouseiSkill(manId, this.actor().friendshipLevel(manId));
return list.contains(play.bodyType());
};
Dousei.prototype.isHpOk = function () {
return this.actor().hp >= 1;
};
Dousei.prototype.createPlayList = function () {
this._playList = [];
this._playList.push(new DouseiPlay(DouseiPlayId.fela));
this._playList.push(new DouseiPlay(DouseiPlayId.chichi));
this._playList.push(new DouseiPlay(DouseiPlayId.kunni));
this._playList.push(new DouseiPlay(DouseiPlayId.sex));
this._playList.push(new DouseiPlay(DouseiPlayId.anal));
this._playList.push(new DouseiPlay(DouseiPlayId.sm));
this._optionList = [];
this._optionList.push(new DouseiPlay(DouseiPlayId.rubber, true));
this._optionList.push(new DouseiPlay(DouseiPlayId.skipBote, true));
this._optionList.push(new DouseiPlay(DouseiPlayId.skipSyusan, true));
};
Dousei.prototype.useRubber = function () {
for (var _i = 0, _a = this._optionList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() === DouseiPlayId.rubber) {
o.enable();
}
}
};
Dousei.prototype.actor = function () {
return $gameActors.actor(this._actorId);
};
Dousei.prototype.actorId = function () {
return this._actorId;
};
Dousei.prototype.count = function () {
return this._count;
};
Dousei.prototype.day = function () {
return this._day;
};
Dousei.prototype.addCount = function (count) {
this._day++;
this._count += count;
};
Dousei.prototype.name = function () {
if (!this._manId) {
return "同棲可能";
}
var manName = $gameActors.actor(this._manId).name();
return manName + "と同棲";
};
Dousei.prototype.addMan = function (actorId) {
if (this._manList.contains(actorId)) {
return;
}
this._manList.push(actorId);
};
Dousei.prototype.playList = function () {
return this._playList;
};
Dousei.prototype.optionList = function () {
return this._optionList;
};
Dousei.prototype.setMan = function (manId) {
if (this._manId == manId) {
return;
}
this._manId = manId;
this.updateDouseiSwitch();
this.resetNakadashi();
};
Dousei.prototype.updateDouseiSwitch = function () {
var sw = this.douseiSwitchId();
var on = this._manId > 0;
$gameSwitches.setValue(sw, on);
$gameVariables.setValue(this.actorDouseiVar(), 0);
};
Dousei.prototype.douseiSwitchId = function () {
switch (this._actorId) {
case 10:
return Nore.KANAMI_DOUSEI_SW;
case 11:
return Nore.MIYU_DOUSEI_SW;
case 8:
return Nore.SENRI_DOUSEI_SW;
case 9:
return Nore.NONOKA_DOUSEI_SW;
case 4:
return Nore.MARINA_DOUSEI_SW;
case 13:
return Nore.SAKI_DOUSEI_SW;
case 17:
return Nore.KOKONA_DOUSEI_SW;
}
};
Dousei.prototype.manId = function () {
return this._manId;
};
Dousei.prototype.man = function () {
if (this._manId == 0) {
return null;
}
return $gameActors.actor(this._manId);
};
Dousei.prototype.manName = function () {
if (this._manId > 0) {
return $gameActors.actor(this._manId).name();
} else {
return "";
}
};
Dousei.prototype.isEmpty = function () {
return this._manId == 0;
};
Dousei.prototype.setCurrentPlay = function (itemId) {
this._nextUpInfo = [];
this._playId = itemId;
this._dirty = true;
var play = this.currentPlayItem();
this._nextUpInfo = play.upStatus(
this._actorId,
this._manId,
this.isCondom(),
this.isDrag()
);
this.setDouseiValue(play.douseiVar());
};
Dousei.prototype.setDouseiValue = function (value) {
var actorVar = this.actorDouseiVar();
if (actorVar > 0) {
$gameVariables.setValue(actorVar, value);
}
};
Dousei.prototype.currentDouseiValue = function () {
var actorVar = this.actorDouseiVar();
if (actorVar > 0) {
return $gameVariables.value(actorVar);
}
return -1;
};
Dousei.prototype.actorDouseiVar = function () {
switch (this._actorId) {
case 10:
return Nore.KANAMI_DOUSEI_VAR;
case 11:
return Nore.MIYU_DOUSEI_VAR;
case 8:
return Nore.SENRI_DOUSEI_VAR;
case 9:
return Nore.NONOKA_DOUSEI_VAR;
case 4:
return Nore.MARINA_DOUSEI_VAR;
case 13:
return Nore.SAKI_DOUSEI_VAR;
case 17:
return Nore.KOKONA_DOUSEI_VAR;
}
return -1;
};
Dousei.prototype.douseiUpFriendship = function () {
if ($slg.facilityInfo().hasFacility(61)) {
return 5;
}
if ($slg.facilityInfo().hasFacility(60)) {
return 2;
}
return 1;
};
Dousei.prototype.upCurrentPlay = function () {
if (this._nextUpInfo) {
var isMax = this.actor().addFriendship(
this._manId,
this.douseiUpFriendship(),
true
);
this.addHistory(this._manId, this._playId);
if (isMax) {
$gameParty.addCommonEvent(this.douseiMaxCommonId(), -1);
}
for (var _i = 0, _a = this._nextUpInfo; _i < _a.length; _i++) {
var result = _a[_i];
var isNinshin = result.execute();
if (isNinshin) {
this._active = false;
}
}
if ($slg.facilityInfo().findFacility(75)) {
var gold = 2;
if ($slg.facilityInfo().findFacility(76)) {
gold += 2;
}
this._lastGainGold = gold;
$gameParty.gainGold(gold);
}
}
};
Dousei.prototype.douseiMaxCommonId = function () {
switch (this._actorId) {
case 8:
return 701;
case 9:
return 703;
case 4:
return 705;
case 13:
return 707;
case 10:
return 709;
case 11:
return 711;
case 17:
return 713;
default:
console.error("友好度MAXイベントがみつかりません:" + this._actorId);
return -1;
}
};
Dousei.prototype.lastGainGold = function () {
return this._lastGainGold;
};
Dousei.prototype.clearLastGainGold = function () {
this._lastGainGold = 0;
};
Dousei.prototype.nextUpInfo = function () {
return this._nextUpInfo;
};
Dousei.prototype.isDirty = function () {
return this._dirty;
};
Dousei.prototype.clearDirty = function () {
this._dirty = false;
};
Dousei.prototype.currentPlayItem = function () {
if (this.isDouseiPeeping()) {
return new DouseiPlay(DouseiPlayId.sex);
}
if (this._playId > 0) {
for (var _i = 0, _a = this._playList; _i < _a.length; _i++) {
var play = _a[_i];
if (play.itemId() == this._playId) {
return play;
}
}
return new DouseiPlay(DouseiPlayId.empty);
} else {
return new DouseiPlay(DouseiPlayId.empty);
}
};
Dousei.prototype.isDouseiPeeping = function () {
if (this._actorId == 9 && $gameSwitches.value(361)) {
return true;
}
if (this._actorId == 4 && $gameSwitches.value(362)) {
return true;
}
if (this._actorId == 13 && $gameSwitches.value(363)) {
return true;
}
if (this._actorId == 17 && $gameSwitches.value(364)) {
return true;
}
return false;
};
Dousei.prototype.update = function () {
if (!this._active) {
return;
}
if (this._rest) {
return;
}
if (!this.isHpOk()) {
return;
}
if (this._playWait > 0) {
this._playWait--;
if (this._playWait == 0) {
this.upCurrentPlay();
this.next();
}
}
};
Dousei.prototype.next = function () {
this._playIndex++;
if (this._playIndex >= this._itemList.length) {
if (this._itemList.length > 0) {
this.run();
}
return;
}
this.playCurrentItem();
};
Dousei.prototype.playCurrentItem = function () {
var playId = this._itemList[this._playIndex];
this.setCurrentPlay(playId);
this._playWait = this.calcPlayWait();
};
Dousei.prototype.run = function () {
this._dirty = true;
this._rest = false;
if (this._manId == 0) {
this._active = false;
this._nextUpInfo = [];
this._playIndex = -1;
this._itemList = [];
var actorVar = this.actorDouseiVar();
$gameVariables.setValue(actorVar, 0);
return;
}
this._active = true;
this._playIndex = -1;
this._itemList = this.makeItemList();
this.next();
};
Dousei.prototype.stop = function () {
this._active = false;
this._nextUpInfo = null;
};
Dousei.prototype.calcPlayWait = function () {
return 360;
};
Dousei.prototype.isActive = function () {
return this._active;
};
Dousei.prototype.isEnabled = function () {
switch (this._actorId) {
// マリナ
case 4:
return $slg.facilityInfo().hasFacility(48);
// センリ
case 8:
return $gameSwitches.value(225);
// ノノカ
case 9:
return $slg.facilityInfo().hasFacility(46);
// カナミ
// ミユ
case 10:
case 11:
return true;
// サキ
case 13:
return $slg.facilityInfo().hasFacility(50);
// ココナ
case 17:
return $slg.facilityInfo().hasFacility(53);
}
return false;
};
Dousei.prototype.rest = function () {
this._rest = true;
this._nextUpInfo = null;
};
Dousei.prototype.isRest = function () {
return this._rest;
};
Dousei.prototype.resume = function () {
this._rest = false;
};
Dousei.prototype.isDouseiNinshin = function () {
return this._douseiNishin;
};
Dousei.prototype.setDouseiNinshin = function (b) {
this._douseiNishin = b;
};
Dousei.prototype.isSyusanSkip = function () {
for (var _i = 0, _a = this._optionList; _i < _a.length; _i++) {
var o = _a[_i];
if (o.itemId() === DouseiPlayId.skipSyusan) {
return o.isEnabled();
}
}
return false;
};
Dousei.prototype.isTaikenbanNg = function () {
if (!Nore.isTaikenban()) {
return false;
}
if (this._actorId == 9) {
return false;
}
return true;
};
Dousei.prototype.nakadashi = function () {
return this._nakadashi;
};
Dousei.prototype.friendshipLevel = function () {
if (this._manId <= 0) {
return FriendshipLevel.NONE;
}
return this.actor().friendshipLevel(this._manId);
};
return Dousei;
})();