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

651 lines
19 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 showResult
* @text AVリザルト
* @des AVリザルト
*
* @command setAvJacketName
* @text AVジャケット名を変数 81 82 83 に設定
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command setAvJacketNameByItem
* @text 指定のitemIDのAVジャケット名を変数 81 82 83 に設定
* @arg itemId
* @type number
* @text itemId
* @desc itemId
*/
var Nore;
(function (Nore) {
var AV_TITLE_VAR_1 = 81;
var AV_TITLE_VAR_2 = 82;
var TANEOYA_VAR_1 = 83;
var SALES_VAR_1 = 84;
var pluginName = "Nore_AvResultBar";
PluginManager.registerCommand(pluginName, "showResult", function (args) {
$gameTemp.av = $slg.avInfo().nextResultAv();
if (!$gameTemp.av) {
console.error("AVが見つかりません");
return;
}
$slg.plusFan($gameTemp.av.plusFan());
SceneManager.push(Scene_AvResultBar);
});
PluginManager.registerCommand(pluginName, "setAvJacketName", function (args) {
var actorId = parseInt(args.actorId);
var lastAv = $slg.avInfo().actorLastShowResultAv(actorId);
if (lastAv) {
$gameVariables.setValue(AV_TITLE_VAR_1, lastAv.jacketTitle());
$gameVariables.setValue(AV_TITLE_VAR_2, lastAv.jacketSubTitle());
$gameVariables.setValue(SALES_VAR_1, lastAv.realSales());
if (lastAv.isSyusan()) {
var actor = $gameActors.actor(actorId);
var name_1 = actor.lastBaby().taneoyaName();
$gameVariables.setValue(TANEOYA_VAR_1, name_1);
}
}
});
PluginManager.registerCommand(
pluginName,
"setAvJacketNameByItem",
function (args) {
var itemId = parseInt(args.itemId);
var lastAv = $slg.avInfo().findAvByItemId(itemId);
if (lastAv) {
$gameVariables.setValue(AV_TITLE_VAR_1, lastAv.jacketTitle());
$gameVariables.setValue(AV_TITLE_VAR_2, lastAv.jacketSubTitle());
$gameVariables.setValue(SALES_VAR_1, lastAv.realSales());
if (lastAv.isSyusan()) {
var actor = $gameActors.actor(actorId);
var name_2 = actor.lastBaby().taneoyaName();
$gameVariables.setValue(TANEOYA_VAR_1, name_2);
}
}
}
);
})(Nore || (Nore = {}));
var AV_SALES_RATE = 10;
var AvReviewType;
(function (AvReviewType) {
AvReviewType["popularity"] = "popularity";
AvReviewType["mania"] = "mania";
AvReviewType["okaidoku"] = "okaidoku";
AvReviewType["chijoku"] = "chijoku";
AvReviewType["nuki"] = "nuki";
AvReviewType["eros"] = "eros";
AvReviewType["sm"] = "sm";
})(AvReviewType || (AvReviewType = {}));
var AvReview = /** @class */ (function () {
function AvReview() {
this._reviewList = [];
}
AvReview.prototype.makeReview = function (av) {
var list = av.avParamList();
var actor = $gameActors.actor(av.actorId());
this.addReview(AvReviewType.eros, this.calcEros(actor, list));
if (av.containsType(AvRequired.sm)) {
this.addReview(AvReviewType.sm, this.calcSm(actor, list));
}
this.addReview(AvReviewType.nuki, this.calcNuki(actor, list));
};
AvReview.prototype.calcEros = function (actor, list) {
var n =
(actor.eroParam(AvRequired.kiss) +
actor.eroParam(AvRequired.chichi) * 2) /
30;
return Math.ceil(n / 10) * 10 + Math.randomInt(10);
};
AvReview.prototype.calcSm = function (actor, list) {
var n = 0;
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var param = list_1[_i];
if (param.requiredType() == AvRequired.sm) {
n += param.total() * 3;
} else {
n += param.total();
}
}
n /= list.length + 2;
return Math.ceil(n / 10) * 10 + Math.randomInt(10);
};
AvReview.prototype.calcNuki = function (actor, list) {
var n = 0;
for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
var param = list_2[_i];
n += param.total();
}
n /= list.length;
return Math.ceil(n / 10) * 10 + Math.randomInt(10);
};
AvReview.prototype.calcPopularity = function (actor, list) {
return actor.eroAbility(Ability.popularity);
};
AvReview.prototype.addReview = function (type, value) {
this._reviewList.push(new AvReviewOne(type, value));
};
AvReview.prototype.choiseType = function () {
var typeList = [];
typeList.push(AvReviewType.mania);
return typeList;
};
AvReview.prototype.reviewList = function () {
return this._reviewList;
};
return AvReview;
})();
var AvReviewOne = /** @class */ (function () {
function AvReviewOne(type, value) {
this.type = type;
this.value = value;
}
return AvReviewOne;
})();
var Scene_AvResultBar = /** @class */ (function (_super) {
__extends(Scene_AvResultBar, _super);
function Scene_AvResultBar() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Scene_AvResultBar.prototype.create = function () {
this.loadAvImage();
_super.prototype.create.call(this);
this.createDark();
this.createResultWindow();
this.saveAvTitleVar();
};
Scene_AvResultBar.prototype.start = function () {
_super.prototype.start.call(this);
this._avWindow.refresh();
};
Scene_AvResultBar.prototype.isReady = function () {
if (!this._spriteSheetLoaded) {
return false;
}
return _super.prototype.isReady.call(this);
};
Scene_AvResultBar.prototype.saveAvTitleVar = function () {
var sw = this.actorAvTalkSw();
if (sw > 0) {
$gameSwitches.setValue(sw, true);
}
};
Scene_AvResultBar.prototype.actorAvTalkSw = function () {
switch ($gameTemp.av.actorId()) {
case 9:
return 190;
case 4:
return 191;
case 13:
return 192;
case 17:
return 193;
}
return -1;
};
Scene_AvResultBar.prototype.loadAvImage = function () {};
Scene_AvResultBar.prototype.createDark = function () {
var dark = new PIXI.Graphics();
dark.beginFill(0, 0.8);
dark.drawRect(0, 0, Graphics.boxWidth + 10, Graphics.boxHeight + 10);
dark.endFill();
this.addChild(dark);
};
Scene_AvResultBar.prototype.createResultWindow = function () {
this._avWindow = new Window_AvResultBar(this.onLoad.bind(this));
this.addChild(this._avWindow);
this._avWindow.setHandler("ok", this.onOk.bind(this));
this._avWindow.setHandler("cancel", this.onOk.bind(this));
this._avWindow.activate();
};
Scene_AvResultBar.prototype.onLoad = function () {
//p('onLoad')
this._spriteSheetLoaded = true;
};
Scene_AvResultBar.prototype.update = function () {
_super.prototype.update.call(this);
if (TouchInput.isTriggered()) {
this.onOk();
}
};
Scene_AvResultBar.prototype.onOk = function () {
if (!this._avWindow.isFinished()) {
this._avWindow.activate();
return;
}
var av = $gameTemp.av;
av.showResult();
this.popScene();
};
return Scene_AvResultBar;
})(Scene_MenuBase);
var Window_AvResultBar = /** @class */ (function (_super) {
__extends(Window_AvResultBar, _super);
function Window_AvResultBar(callback) {
var _this = this;
var r = new Rectangle(90, 48, 1100, 704);
_this = _super.call(this, r) || this;
_this.createJacket(callback);
_this.createSalesSprite();
ImageManager.loadSystem("result");
return _this;
}
Window_AvResultBar.prototype.createJacket = function (callback) {
var av = $gameTemp.av;
this._jacketSprite = new Nore.Sprite_AvJacketBig(
av.avJacket(),
JacketScale.scale3,
callback
);
this._jacketSprite.x = 15;
this._jacketSprite.y = 15;
this.addChild(this._jacketSprite);
this._jacketSprite.refresh();
};
Window_AvResultBar.prototype.refresh = function () {
this._contentsBackSprite.removeChildren();
_super.prototype.refresh.call(this);
this.drawSpriteBack();
this.drawTitle();
this.drawParameter(550, 360);
this.drawManParameter(830, 360);
};
Window_AvResultBar.prototype.drawSpriteBack = function () {
var offsetYSales = ConfigManager.language == "jp" ? 0 : 40;
{
var s = this.getSprite(0, 0, 492, 146);
s.x = 546;
s.y = 20;
this._contentsBackSprite.addChild(s);
}
{
var s2 = this.getSprite(0, 150, 500, 126);
s2.x = 546 - 6;
s2.y = 182;
this._contentsBackSprite.addChild(s2);
var s3 = this.getSprite(0, 276 + offsetYSales, 500, 40);
s3.x = 546 - 6;
s3.y = 182 + 14;
this._contentsBackSprite.addChild(s3);
}
var offsetY = ConfigManager.language == "jp" ? 0 : 30;
{
var s4 = this.getSprite(0, 370, 216, 344);
s4.x = 546 - 7;
s4.y = 320;
this._contentsBackSprite.addChild(s4);
var s5 = this.getSprite(0, 714 + offsetY, 216, 30);
s5.x = 546 - 7;
s5.y = 350;
this._contentsBackSprite.addChild(s5);
}
{
var s6 = this.getSprite(218, 370, 270, 344);
s6.x = 546 - 7 + 230;
s6.y = 320;
this._contentsBackSprite.addChild(s6);
var s7 = this.getSprite(218, 714 + offsetY, 226, 30);
s7.x = 546 - 7 + 250;
s7.y = 350;
this._contentsBackSprite.addChild(s7);
}
};
Window_AvResultBar.prototype.update = function () {
_super.prototype.update.call(this);
};
Window_AvResultBar.prototype.drawTitle = function () {
var xx = 566;
var ww = 460;
var av = $gameTemp.av;
var actor = av.actor();
this.contents.fontSize = 18;
this.contents.outlineWidth = 2;
this.contents.outlineColor = "#43005c";
this.drawText(
TextManager.avResult1.format(actor.name(), av.avCountTotal()),
xx,
21,
ww,
"center"
);
this.contents.outlineColor = "#000000";
this.contents.outlineWidth = 5;
this.contents.fontSize = 32;
this.drawText(av.jacketTitle(), xx, 58, ww, "center");
this.contents.fontSize = 20;
this.drawText(av.jacketSubTitle(), xx, 96, ww, "center");
this.contents.fontSize = 18;
this.contents.outlineWidth = 2;
this.contents.outlineColor = "#43005c";
this.drawText(TextManager.avResult2, xx, 126, ww, "center");
};
Window_AvResultBar.prototype.getSprite = function (x, y, w, h) {
var baseTexture = Nore.getSystemBaseTexture("result");
var r = new Rectangle(x, y, w, h);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
return s;
};
Window_AvResultBar.prototype.createSalesSprite = function () {
var av = $gameTemp.av;
this._salesSprite = new Sprite_AvSales(
av.realSales(),
av.reward(),
av.plusFan()
);
this._salesSprite.x = 550;
this._salesSprite.y = 220;
this.addChild(this._salesSprite);
};
Window_AvResultBar.prototype.createBarSprite = function () {
var yy = 300;
var xx = 600;
var interval = 100;
var av = $gameTemp.av;
var list = av.reviewList();
var reviewOne1 = list[0];
this._bar1 = new Sprite_AvGauge(reviewOne1.type, reviewOne1.value);
this._bar1.x = xx;
this._bar1.y = yy;
this.addChild(this._bar1);
var reviewOne2 = list[1];
this._bar2 = new Sprite_AvGauge(reviewOne2.type, reviewOne2.value);
this._bar2.x = xx + interval;
this._bar2.y = yy;
this.addChild(this._bar2);
var reviewOne3 = list[2];
if (!reviewOne3) {
return;
}
this._bar3 = new Sprite_AvGauge(reviewOne3.type, reviewOne3.value);
this._bar3.x = xx + interval * 2;
this._bar3.y = yy;
this.addChild(this._bar3);
};
Window_AvResultBar.prototype.isFinished = function () {
return this._salesSprite.isFinished();
};
Window_AvResultBar.prototype.drawParameter = function (x, y) {
var av = $gameTemp.av;
var upEroInfo = av.upEroInfo();
if (!upEroInfo) {
return;
}
var list = Nore.$avParamManager.list();
var actor = av.actor();
this.contents.fontSize = 20;
this.changeTextColor(ColorManager.normalColor());
this.drawText(av.actor().name(), x - 0, y + 20, 200, "center");
var after = upEroInfo.afterActorParam();
var diff = upEroInfo.diffActorParam();
for (var i = 0; i < list.length; i++) {
this.drawStatusOne(after, diff, x + 23, y + 70, i, list[i], false);
}
};
Window_AvResultBar.prototype.drawStatusOne = function (
afterEroInfo,
diff,
x,
y,
index,
info,
isMan
) {
var yy = y + index * 37;
var xx = x;
//this.drawIcon(info.iconIndex(), xx, yy);
this.changeTextColor(ColorManager.normalColor());
if (isMan) {
this.drawText(afterEroInfo.value(info.type()), xx + 40, yy, 42, "right");
} else {
this.drawText(
this.commaValue(afterEroInfo.value(info.type())),
xx + 40,
yy,
42,
"right"
);
}
this.changeTextColor(ColorManager.crisisColor());
var up = diff.value(info.type());
if (up > 0) {
var offset = false ? 0 : 65;
if (isMan) {
this.drawText("+" + up, xx + offset, yy, 80, "right");
} else {
this.drawText("+" + this.commaValue(up), xx + offset, yy, 80, "right");
}
}
};
Window_AvResultBar.prototype.drawManParameter = function (x, y) {
var av = $gameTemp.av;
var upEroInfo = av.upEroInfo();
if (!upEroInfo) {
return;
}
var list = Nore.$avParamManager.list();
var actor = av.actor();
this.changeTextColor(ColorManager.normalColor());
this.drawText(av.mainMan().name(), x - 10, y + 20, 180, "center");
var after = upEroInfo.afterManParam();
var diff = upEroInfo.mainManUpEro();
for (var i = 0; i < list.length; i++) {
this.drawStatusOne(after, diff, x, y + 70, i, list[i], true);
}
};
Window_AvResultBar.prototype.commaValue = function (value) {
var value1 = Math.floor(value / 10);
var value2 = value % 10;
return value1 + "." + value2;
};
return Window_AvResultBar;
})(Window_Selectable);
var Sprite_AvSales = /** @class */ (function (_super) {
__extends(Sprite_AvSales, _super);
function Sprite_AvSales(sales, reward, fan) {
var _this = _super.call(this) || this;
_this._time = 0;
_this._finished = false;
_this.createBitmap();
_this._sales = sales;
_this._reward = reward;
_this._plusFan = fan;
return _this;
}
Sprite_AvSales.prototype.createBitmap = function () {
this.bitmap = new Bitmap(840, 210);
};
Sprite_AvSales.prototype.update = function () {
_super.prototype.update.call(this);
if (!this._sales) {
return;
}
if (this._finished) {
return;
}
this.nextStep();
this.refresh();
};
Sprite_AvSales.prototype.maxStep = function () {
return 60;
};
Sprite_AvSales.prototype.nextStep = function () {
this._time++;
this._current =
Math.round((this._sales / this.maxStep()) * this._time) +
Math.randomInt(4) -
2;
this._currentReward = Math.round(
(this._current / this._sales) * this._reward
);
this._currentFan = Math.round(
(this._plusFan / this.maxStep()) * this._time
);
if (this._time == this.maxStep()) {
this._finished = true;
this._current = this._sales;
this._currentReward = this._reward;
this._currentFan = this._plusFan;
}
};
Sprite_AvSales.prototype.refresh = function () {
this.bitmap.clear();
this.drawSales(15);
this.drawReward(130);
this.drawFan(330);
};
Sprite_AvSales.prototype.drawSales = function (x) {
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.fontSize = 40;
this.bitmap.drawText(this._current + "", x, 35, 120, 40, "right");
};
Sprite_AvSales.prototype.drawReward = function (x) {
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.fontSize = 40;
this.bitmap.drawText(
this._currentReward + "",
x - 24,
35,
148,
40,
"right"
);
this.bitmap.fontSize = 26;
this.bitmap.drawText("", x, 40, 148, 40, "right");
};
Sprite_AvSales.prototype.drawFan = function (x) {
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.fontSize = 40;
this.bitmap.drawText(
this._currentFan * FAN_UNIT + "",
x - 24,
35,
148,
40,
"right"
);
this.bitmap.fontSize = 26;
this.bitmap.drawText("人", x, 40, 148, 40, "right");
};
Sprite_AvSales.prototype.isFinished = function () {
return this._finished;
};
Sprite_AvSales.prototype.drawIcon = function (iconIndex, x, y) {
var bitmap = ImageManager.loadSystem("IconSet");
var pw = ImageManager.iconWidth;
var ph = ImageManager.iconHeight;
var sx = (iconIndex % 16) * pw;
var sy = Math.floor(iconIndex / 16) * ph;
this.bitmap.blt(bitmap, sx, sy, pw, ph, x, y);
};
return Sprite_AvSales;
})(Sprite);
var Sprite_AvGauge = /** @class */ (function (_super) {
__extends(Sprite_AvGauge, _super);
function Sprite_AvGauge(title, value) {
var _this = _super.call(this) || this;
_this._time = 0;
_this._finished = false;
_this._title = title;
_this._value = value;
_this.createBitmap();
return _this;
}
Sprite_AvGauge.prototype.createBitmap = function () {
this.bitmap = new Bitmap(150, 300);
};
Sprite_AvGauge.prototype.update = function () {
_super.prototype.update.call(this);
if (!this._value) {
return;
}
if (this._finished) {
return;
}
this.nextStep();
this.refresh();
};
Sprite_AvGauge.prototype.maxStep = function () {
return 100;
};
Sprite_AvGauge.prototype.nextStep = function () {
this._time++;
this._current = this._time;
if (this._time == this._value) {
this._finished = true;
this._current = this._value;
}
};
Sprite_AvGauge.prototype.refresh = function () {
this.bitmap.clear();
this.drawGauge(5);
this.drawValue(5);
};
Sprite_AvGauge.prototype.drawGauge = function (y) {
var hh = 100;
this.bitmap.fillRect(
20,
hh - this._current,
20,
this._current,
ColorManager.salesColor()
);
};
Sprite_AvGauge.prototype.drawValue = function (y) {
this.bitmap.textColor = ColorManager.salesColor();
this.bitmap.drawText(this._current + "", -10, 93, 51, 40, "right");
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.fontSize = 20;
this.bitmap.drawText(this.getTitle(), 0, 120, 100, 40, "left");
};
Sprite_AvGauge.prototype.getTitle = function () {
switch (this._title) {
case AvReviewType.nuki:
return "ヌキ度";
case AvReviewType.sm:
return "鬼畜度";
case AvReviewType.eros:
return "エロ度";
case AvReviewType.mania:
return "マニア度";
case AvReviewType.chijoku:
return "恥辱度";
}
return "";
};
return Sprite_AvGauge;
})(Sprite);