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

1454 lines
41 KiB
JavaScript

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 reserveCommonEvent
* @text コモンイベント実行
* @des コモンイベント実行
* @arg commonEventId
* @type number
* @text commonEventId
* @desc commonEventId
* @arg time
* @type number
* @text time
* @desc time
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg text
* @type string
* @text text
* @desc text
* @arg itemId
* @type number
* @text itemId
* @desc itemId
*
* @command removeCommonEvent
* @text コモンイベント削除
* @des コモンイベント削除
* @arg commonEventId
* @type number
* @text commonEventId
* @desc commonEventId
*
* @command reserveScenario
* @text シナリオ実行
* @des シナリオ実行
* @arg scenarioId
* @type string
* @text scenarioId
* @desc scenarioId
* @arg time
* @type number
* @text time
* @desc time
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg text
* @type string
* @text text
* @desc text
* @arg itemId
* @type number
* @text itemId
* @desc itemId
*
* @command hpRecover
* @text HP回復イベント
* @des HP回復イベント
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg scenarioId
* @type string
* @text scenarioId
* @desc scenarioId
*
* @command battle
* @text バトルイベント
* @des バトルイベント
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command ninshin
* @text 妊娠
* @des 妊娠
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg scenarioId
* @type string
* @text scenarioId
* @desc scenarioId
*
* @command bote
* @text ボテ腹
* @des ボテ腹
* @arg actorId
* @type number
* @text actorId
* @desc actorId
* @arg scenarioId
* @type string
* @text scenarioId
* @desc scenarioId
*
* @command douseiSyusan
* @text 同棲出産
* @des 同棲出産
* @arg actorId
* @type number
* @text actorId
* @desc actorId
*
* @command removeCommonTImeGaugeEvent
* @text コモンタイムゲージイベントを削除
* @des コモンタイムゲージイベントを削除
* @arg commonId
* @type number
* @text commonId
* @desc commonId
*/
var Nore;
(function (Nore) {
var pluginName = "Nore_TimeEvent";
PluginManager.registerCommand(
pluginName,
"reserveCommonEvent",
function (args) {
var commonEventId = parseInt(args.commonEventId);
var time = parseInt(args.time);
var actorId = parseInt(args.actorId);
var itemId = parseInt(args.itemId);
var text = args.text;
var e = new CommonEventTimeGaugeEvent(
commonEventId,
time,
actorId,
text,
itemId
);
$slg.addTimeGaugeEvent(e);
}
);
PluginManager.registerCommand(
pluginName,
"removeCommonEvent",
function (args) {
var commonEventId = parseInt(args.commonEventId);
$slg.removeCommonTimeGaugeEvent(commonEventId);
}
);
PluginManager.registerCommand(pluginName, "reserveScenario", function (args) {
var scenarioId = args.scenarioId;
var time = parseInt(args.time);
var actorId = parseInt(args.actorId);
var itemId = parseInt(args.itemId);
var text = args.text;
var e = new ScenarioTimeGaugeEvent(scenarioId, time, actorId, text, itemId);
$slg.addTimeGaugeEvent(e);
});
PluginManager.registerCommand(pluginName, "hpRecover", function (args) {
var actorId = parseInt(args.actorId);
var scenarioId = args.scenarioId;
//let time = 6000;
//$gameActors.actor(actorId).setHp(1);
var e = new HpTimeGaugeEvent(-1, actorId, scenarioId);
$slg.addTimeGaugeEvent(e);
});
PluginManager.registerCommand(pluginName, "bote", function (args) {
var actorId = parseInt(args.actorId);
var scenarioId = args.scenarioId;
var time = 700;
if ($slg.facilityInfo().hasFacility(57)) {
time = Math.floor(time / 3);
}
var e = new BoteTimeGaugeEvent(actorId, time, scenarioId);
$slg.addTimeGaugeEvent(e);
});
PluginManager.registerCommand(pluginName, "douseiSyusan", function (args) {
var actorId = parseInt(args.actorId);
var time = 1200;
var e = new DouseiSyusanTimeGaugeEvent(time, actorId);
$slg.addTimeGaugeEvent(e);
});
PluginManager.registerCommand(
pluginName,
"removeCommonTImeGaugeEvent",
function (args) {
var commonId = parseInt(args.commonId);
$slg.removeCommonTimeGaugeEvent(commonId);
}
);
})(Nore || (Nore = {}));
var NO_ALARM_SOUND_SW = 49;
var TimeGaugeEventType;
(function (TimeGaugeEventType) {
TimeGaugeEventType["av"] = "av";
TimeGaugeEventType["sale"] = "sale";
TimeGaugeEventType["commonEvent"] = "commonEvent";
TimeGaugeEventType["facility"] = "facility";
TimeGaugeEventType["scenario"] = "scenario";
TimeGaugeEventType["battle"] = "battle";
TimeGaugeEventType["ninshin"] = "ninshin";
TimeGaugeEventType["dousei"] = "dousei";
TimeGaugeEventType["douseiSyusan"] = "douseiSyusan";
TimeGaugeEventType["bote"] = "bote";
TimeGaugeEventType["soupKichen"] = "soupKichen";
TimeGaugeEventType["training"] = "training";
})(TimeGaugeEventType || (TimeGaugeEventType = {}));
var TimeGaugeEvent = /** @class */ (function () {
function TimeGaugeEvent(type, time) {
this._fadeoutFrame = 0;
this._waitFireEvent = 0;
this._type = type;
this._time = time;
this._remain = time;
this._id = $slg.nextTimeEventId();
}
TimeGaugeEvent.prototype.maxFadeFrame = function () {
return 60;
//return 20;
};
TimeGaugeEvent.prototype.fadeout = function () {
this._fadeoutFrame = this.maxFadeFrame();
};
TimeGaugeEvent.prototype.id = function () {
return this._id;
};
TimeGaugeEvent.prototype.timePer = function () {
return Math.round(this.timeRate() * 100);
};
TimeGaugeEvent.prototype.timeRate = function () {
return this._remain / this._time;
};
TimeGaugeEvent.prototype.fadeoutFrame = function () {
return this._fadeoutFrame;
};
TimeGaugeEvent.prototype.updateFade = function () {
if (this._fadeoutFrame > 0) {
this.updateFadeout();
return;
}
};
TimeGaugeEvent.prototype.speedUp = function () {
this._speedUp = true;
};
TimeGaugeEvent.prototype.update = function () {
if (this._waitClick) {
return;
}
if (this._waitFireEvent > 0) {
this._waitFireEvent--;
if (this._waitFireEvent == 0) {
$gameSwitches.setValue(NO_ALARM_SOUND_SW, true);
this.fireEvent();
}
return;
}
if (this._fadeoutFrame > 0) {
return;
}
if (this._remain <= 0) {
return;
}
this._remain--;
if (this._speedUp) {
this._remain -= 4;
this._speedUp = false;
this._lastSpeedUp = true;
}
if (this._remain <= 0) {
this._remain = 0;
if (this.isNeedClick()) {
this._waitClick = true;
this._remain = 1;
SoundManager.playMiss();
return;
}
this.fireEvent();
}
};
TimeGaugeEvent.prototype.updateFadeout = function () {
this._fadeoutFrame--;
if (this._fadeoutFrame <= 0) {
$slg.removeTimeGaugeEvent(this._id);
}
};
TimeGaugeEvent.prototype.finish = function () {
this._finished = true;
this._dirty = true;
};
TimeGaugeEvent.prototype.fireEvent = function () {
this.finish();
};
TimeGaugeEvent.prototype.isDirty = function () {
return this._dirty;
};
TimeGaugeEvent.prototype.clearDirty = function () {
this._dirty = false;
};
TimeGaugeEvent.prototype.isFinished = function () {
return this._finished;
};
TimeGaugeEvent.prototype.iconId = function () {
return -1;
};
TimeGaugeEvent.prototype.extraIconId = function () {
return -1;
};
TimeGaugeEvent.prototype.iconByActor = function (actorId) {
var actor = $gameActors.actor(actorId);
return actor.iconIndex();
};
TimeGaugeEvent.prototype.getTexts = function () {
return [""];
};
TimeGaugeEvent.prototype.type = function () {
return this._type;
};
TimeGaugeEvent.prototype.actorId = function () {
return -1;
};
TimeGaugeEvent.prototype.sprite = function () {
return null;
};
TimeGaugeEvent.prototype.isVisible = function () {
if (this._remain <= 0) {
return false;
}
return true;
};
TimeGaugeEvent.prototype.clearLastSpeedUp = function () {
this._lastSpeedUp = false;
};
TimeGaugeEvent.prototype.isLastSpeedUp = function () {
return this._lastSpeedUp;
};
TimeGaugeEvent.prototype.isWaitClick = function () {
return this._waitClick;
};
TimeGaugeEvent.prototype.isNeedClick = function () {
if (ConfigManager.autoTimeEvent) {
return false;
}
return true;
};
TimeGaugeEvent.prototype.onClick = function () {
if (!this.canClick()) {
return;
}
this._waitClick = false;
this._waitFireEvent = 20;
//this.fireEvent();
SoundManager.playEvasion();
};
TimeGaugeEvent.prototype.canClick = function () {
if ($gameMap._interpreter.isRunning()) {
return false;
}
if ($gameTemp.isCommonEventReserved()) {
return false;
}
if ($gameParty.hasCommonEvent()) {
return false;
}
if ($slg.hasWaitFireTimeEvent()) {
return false;
}
return true;
};
TimeGaugeEvent.prototype.isWaitFire = function () {
return this._waitFireEvent > 0;
};
return TimeGaugeEvent;
})();
var CommonEventTimeGaugeEvent = /** @class */ (function (_super) {
__extends(CommonEventTimeGaugeEvent, _super);
function CommonEventTimeGaugeEvent(
commonEventId,
time,
actorId,
text,
itemId
) {
if (itemId === void 0) {
itemId = -1;
}
var _this = _super.call(this, TimeGaugeEventType.commonEvent, time) || this;
_this._commonEventId = commonEventId;
_this._actorId = actorId;
_this._text = text;
_this._itemId = itemId;
return _this;
}
CommonEventTimeGaugeEvent.prototype.fireEvent = function () {
$gameParty.addCommonEvent(this._commonEventId, this._id);
// $commonEvent.reserveCommonEvent(this._commonEventId, this._id);
};
CommonEventTimeGaugeEvent.prototype.getTexts = function () {
var itemText = this.itemText();
if (itemText) {
return [itemText];
}
return [this._text];
};
CommonEventTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
CommonEventTimeGaugeEvent.prototype.actorId = function () {
return this._actorId;
};
CommonEventTimeGaugeEvent.prototype.itemText = function () {
if (this._itemId > 0) {
var item = $dataItems[this._itemId];
switch (ConfigManager.language) {
case "en":
if (item.meta["nameEn"]) {
return item.meta["nameEn"];
}
break;
case "ch":
case "jp":
break;
}
return item.name;
} else {
switch (ConfigManager.language) {
case "en":
return "Event";
}
return null;
}
};
return CommonEventTimeGaugeEvent;
})(TimeGaugeEvent);
var ScenarioTimeGaugeEvent = /** @class */ (function (_super) {
__extends(ScenarioTimeGaugeEvent, _super);
function ScenarioTimeGaugeEvent(scenarioId, time, actorId, text, itemId) {
var _this = _super.call(this, TimeGaugeEventType.scenario, time) || this;
_this._scenarioId = scenarioId;
_this._actorId = actorId;
_this._text = text;
_this._itemId = itemId;
return _this;
}
ScenarioTimeGaugeEvent.prototype.fireEvent = function () {
$gameParty.addScenario(this._scenarioId, this._id);
};
ScenarioTimeGaugeEvent.prototype.getTexts = function () {
if (this._itemId > 0) {
var item = $dataItems[this._itemId];
switch (ConfigManager.language) {
case "en":
if (item.meta["nameEn"]) {
return [item.meta["nameEn"]];
}
break;
case "ch":
case "jp":
break;
}
return [item.name];
} else {
switch (ConfigManager.language) {
case "en":
return ["Event"];
}
return [this._text];
}
};
ScenarioTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
return ScenarioTimeGaugeEvent;
})(TimeGaugeEvent);
var HpTimeGaugeEvent = /** @class */ (function (_super) {
__extends(HpTimeGaugeEvent, _super);
function HpTimeGaugeEvent(time, actorId, scenarioId) {
var _this = _super.call(this, TimeGaugeEventType.commonEvent, time) || this;
_this._actorId = actorId;
_this._scenarioId = scenarioId;
return _this;
}
HpTimeGaugeEvent.prototype.update = function () {
if (this._fadeoutFrame > 0) {
return;
}
if (this._remain == 0) {
return;
}
if (this.actor().hp >= this.actor().mhp) {
this._remain = 0;
this.fireEvent();
}
_super.prototype.update.call(this);
};
HpTimeGaugeEvent.prototype.timeRate = function () {
return 1 - this.actor().hpRate();
};
HpTimeGaugeEvent.prototype.fireEvent = function () {
this.actor().recoverAll();
$gameSwitches.setValue(62, false);
if (this._scenarioId) {
$gameParty.addScenario(this._scenarioId, this._id);
} else if (this._actorId == 9 && $gameActors.actor(9).countSyusan() == 0) {
//$gameParty.addScenario('出産しよう_01', this._id);
} else {
this.finish();
}
};
HpTimeGaugeEvent.prototype.actor = function () {
return $gameActors.actor(this._actorId);
};
HpTimeGaugeEvent.prototype.getTexts = function () {
return ["体力回復中"];
};
HpTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
HpTimeGaugeEvent.prototype.isVisible = function () {
return false;
};
return HpTimeGaugeEvent;
})(TimeGaugeEvent);
var NinshinTimeGaugeEvent = /** @class */ (function (_super) {
__extends(NinshinTimeGaugeEvent, _super);
function NinshinTimeGaugeEvent(actorId, time, taneoyaId) {
var _this = _super.call(this, TimeGaugeEventType.ninshin, time) || this;
_this._actorId = actorId;
_this._taneoyaId = taneoyaId;
return _this;
}
NinshinTimeGaugeEvent.prototype.fireEvent = function () {
$gameParty.addScenario(this.scenarioId(), this._id);
};
NinshinTimeGaugeEvent.prototype.getTexts = function () {
return [this.text().format(this.actorName())];
};
NinshinTimeGaugeEvent.prototype.text = function () {
return TextManager.jusei;
};
NinshinTimeGaugeEvent.prototype.actorName = function () {
return $gameActors.actor(this._actorId).name();
};
NinshinTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
NinshinTimeGaugeEvent.prototype.actorId = function () {
return this._actorId;
};
NinshinTimeGaugeEvent.prototype.scenarioId = function () {
switch (this._actorId) {
case 4:
return getMarinaNinshinScenarioId(this.actor());
case 8:
return getSenriNinshinScenarioId(this.actor());
case 9:
return getNonokaNinshinScenarioId(this.actor());
case 10:
return getKanamiNinshinScenarioId(this.actor());
case 11:
return getMiyuNinshinScenarioId(this.actor());
case 13:
return getSakiNinshinScenarioId(this.actor());
case 17:
return getKokonaNinshinScenarioId(this.actor());
}
return null;
};
NinshinTimeGaugeEvent.prototype.actor = function () {
return $gameActors.actor(this._actorId);
};
NinshinTimeGaugeEvent.prototype.isNeedClick = function () {
return false;
};
return NinshinTimeGaugeEvent;
})(TimeGaugeEvent);
var BoteTimeGaugeEvent = /** @class */ (function (_super) {
__extends(BoteTimeGaugeEvent, _super);
function BoteTimeGaugeEvent(actorId, time, scenarioId) {
var _this = _super.call(this, TimeGaugeEventType.bote, time) || this;
_this._actorId = actorId;
_this._scenarioId = scenarioId;
return _this;
}
BoteTimeGaugeEvent.prototype.fireEvent = function () {
var actor = $gameActors.actor(this._actorId);
actor.lastBaby().setBote();
actor.setBote(1);
if (actor.dousei().isSkipBoteEvent()) {
$slg.fadeoutTimeGaugeEvent(this._id);
return;
}
$gameParty.addScenario(this._scenarioId, this._id);
};
BoteTimeGaugeEvent.prototype.getTexts = function () {
return [TextManager.toNinshin.format(this.actorName())];
};
BoteTimeGaugeEvent.prototype.actorName = function () {
return $gameActors.actor(this._actorId).name();
};
BoteTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
BoteTimeGaugeEvent.prototype.actorId = function () {
return this._actorId;
};
BoteTimeGaugeEvent.prototype.isNeedClick = function () {
return false;
};
return BoteTimeGaugeEvent;
})(TimeGaugeEvent);
var FacilityTimeGaugeEvent = /** @class */ (function (_super) {
__extends(FacilityTimeGaugeEvent, _super);
function FacilityTimeGaugeEvent(time, facilityId, level) {
var _this = _super.call(this, TimeGaugeEventType.facility, time) || this;
_this._facilityId = facilityId;
_this._level = level;
return _this;
}
FacilityTimeGaugeEvent.prototype.fireEvent = function () {
$slg.facilityInfo().levelUp(this._facilityId, this._id);
};
FacilityTimeGaugeEvent.prototype.getTexts = function () {
return [
TextManager.underConstruction.format(this.facility().nameWithoutLevel()),
];
};
FacilityTimeGaugeEvent.prototype.facility = function () {
return new Facility(this._facilityId, this._level);
};
FacilityTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(8);
};
FacilityTimeGaugeEvent.prototype.facilityId = function () {
return this._facilityId;
};
FacilityTimeGaugeEvent.prototype.isNeedClick = function () {
if (ConfigManager.autoTimeEvent) {
return false;
}
var facility = new Facility(this._facilityId, this._level);
return $slg.facilityInfo().checkFacilityEvent(facility) != null;
};
return FacilityTimeGaugeEvent;
})(TimeGaugeEvent);
var DouseiSyusanTimeGaugeEvent = /** @class */ (function (_super) {
__extends(DouseiSyusanTimeGaugeEvent, _super);
function DouseiSyusanTimeGaugeEvent(time, actorId) {
var _this =
_super.call(this, TimeGaugeEventType.douseiSyusan, time) || this;
_this._actorId = actorId;
return _this;
}
DouseiSyusanTimeGaugeEvent.prototype.fireEvent = function () {
$slg.fadeoutTimeGaugeEvent(this._id);
var commonId = this.commonEventId();
if (commonId > 0) {
$gameParty.addCommonEvent(commonId, -1);
}
};
DouseiSyusanTimeGaugeEvent.prototype.commonEventId = function () {
switch (this._actorId) {
case 4:
return 566;
case 8:
return 656;
case 9:
return 536;
case 10:
return 506;
case 11:
return 476;
case 13:
return 596;
case 17:
return 626;
default:
console.error("DouseiSyusanTimeGaugeEventのactorId が不正です");
return -1;
}
};
DouseiSyusanTimeGaugeEvent.prototype.getTexts = function () {
return [this.actor().name() + "同棲出産中"];
};
DouseiSyusanTimeGaugeEvent.prototype.actor = function () {
return $gameActors.actor(this._actorId);
};
DouseiSyusanTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
DouseiSyusanTimeGaugeEvent.prototype.actorId = function () {
return this._actorId;
};
return DouseiSyusanTimeGaugeEvent;
})(TimeGaugeEvent);
var KaijinTrainingTimeGaugeEvent = /** @class */ (function (_super) {
__extends(KaijinTrainingTimeGaugeEvent, _super);
function KaijinTrainingTimeGaugeEvent(trainingId, remain) {
var _this = _super.call(this, TimeGaugeEventType.training, remain) || this;
_this._trainingId = trainingId;
return _this;
}
KaijinTrainingTimeGaugeEvent.prototype.getTexts = function () {
var info = $slg.formation().trainingInfo();
return [info.actorName() + "LV" + info.level() + TextManager.inTraining2];
};
KaijinTrainingTimeGaugeEvent.prototype.iconId = function () {
var info = $slg.formation().trainingInfo();
var iconId = this.iconByMonster(info.actor().actorId());
if (iconId > 0) {
return iconId;
}
return this.iconByActor(10);
};
KaijinTrainingTimeGaugeEvent.prototype.iconByMonster = function (actorId) {
switch (actorId) {
case 101:
return 337;
case 102:
return 343;
case 103:
return 341;
case 104:
return 342;
case 105:
return 344;
case 106:
return 345; //かぐや
case 107:
return 348;
case 108:
return 349;
case 109:
return 336;
case 110:
return 339;
case 111:
return 333; // 凄腕の暗殺者
case 112:
return 326;
case 113:
return 353; // ディーナ
case 114:
return 328;
case 115:
return 329;
case 116:
return 330;
case 117:
return 331; // ヒュプノス
case 118:
return 332;
case 119:
return 335;
case 120:
return 354; // ターニャ
case 121:
return 340; // デビルクイーン
case 122:
return 350; // テオ
case 123:
return 351;
case 124:
return 324; // カレン
case 125:
return 334;
case 126:
return 321;
case 127:
return 347;
case 128:
return 346;
case 129:
return 323;
case 130:
return 352;
case 131:
return 320;
case 132:
return 322;
case 133:
return 325;
}
return -1;
};
KaijinTrainingTimeGaugeEvent.prototype.fireEvent = function () {
/*if ($slg.clickerStage().enemyId() > 0) {
// バトル中はレベルアップなし
this._remain++;
return;
}*/
var info = $slg.formation().trainingInfo();
var actor = info.actor();
info.levelUp();
$slg.formation().calcPassiveSkill();
SoundManager.playRecovery();
//if ($slg.facilityInfo().hasFacility(29)) {
// 怪人訓練 Lv2
if (!actor.isMaxLevel()) {
$slg.removeTimeGaugeEventType(TimeGaugeEventType.training);
info.setup(actor);
}
//}
};
KaijinTrainingTimeGaugeEvent.prototype.reduceRemain = function (num) {
this._remain -= num * 60;
if (this._remain <= 0) {
this._remain = 1;
}
};
KaijinTrainingTimeGaugeEvent.prototype.isNeedClick = function () {
return false;
};
return KaijinTrainingTimeGaugeEvent;
})(TimeGaugeEvent);
var AvTimeGaugeEvent = /** @class */ (function (_super) {
__extends(AvTimeGaugeEvent, _super);
function AvTimeGaugeEvent(type, time, av) {
var _this = _super.call(this, type, time) || this;
_this._totalReward = 0;
_this._avId = av.id();
_this._stepList = [0, 25, 50, 75];
return _this;
}
AvTimeGaugeEvent.prototype.update = function () {
if (this._fadeoutFrame > 0) {
return;
}
if (this._remain <= 0) {
return;
}
var before = this.currentStep();
var count = 1;
if (this._speedUp) {
count = 5;
if ($slg.facilityInfo().hasFacility(23)) {
count = 10;
}
this._speedUp = false;
this._lastSpeedUp = true;
}
for (var i = 0; i <= count; i++) {
this._remain--;
var after = this.currentStep();
if (before != after) {
this.gainReward(after == 0);
before = after;
}
if (this._remain <= 0) {
this.fireEvent();
break;
}
}
};
AvTimeGaugeEvent.prototype.fireEvent = function () {
this.av().finishSale();
if (this.av().isAuto()) {
// スキップしたものはセール情報もなし
this.av().showResult();
$slg.plusFan(this.av().plusFan());
this.finish();
AudioManager.playSe({
name: "FCPC1_SE14_Select14",
volume: 90,
pitch: 120,
pan: 0,
});
return;
}
$slg.avInfo().pushResultAv(this._avId, this._id);
};
AvTimeGaugeEvent.prototype.gainReward = function (isLast) {
var r = this.av().reward();
if (isLast) {
$gameParty.gainGold(r - this._totalReward);
this._totalReward = r;
} else {
var gainReward = Math.round(r / this._stepList.length);
$gameParty.gainGold(gainReward);
this._totalReward += gainReward;
}
};
AvTimeGaugeEvent.prototype.av = function () {
return $slg.avInfo().findAv(this._avId);
};
AvTimeGaugeEvent.prototype.currentStep = function () {
var per = this.timePer();
var n = 0;
for (var _i = 0, _a = this._stepList; _i < _a.length; _i++) {
var step = _a[_i];
if (per <= step) {
return n;
}
n++;
}
return n;
};
AvTimeGaugeEvent.prototype.iconId = function () {
return 2273;
};
AvTimeGaugeEvent.prototype.getTexts = function () {
return [TextManager.saleAv];
};
AvTimeGaugeEvent.prototype.getAvSaleText = function () {
var av = this.av();
return av.name();
};
AvTimeGaugeEvent.prototype.sprite = function () {
var av = this.av();
var jacket = av.avJacket();
if (!jacket) {
return null;
}
return new Sprite_AvScreenShot(jacket.screenShot(), false);
};
return AvTimeGaugeEvent;
})(TimeGaugeEvent);
var DouseiTimeGaugeEvent = /** @class */ (function (_super) {
__extends(DouseiTimeGaugeEvent, _super);
function DouseiTimeGaugeEvent(type, time, actorId) {
var _this = _super.call(this, type, time) || this;
_this._actorId = actorId;
_this._stepList = [12, 25, 37, 50, 63, 75, 88];
var dousei = _this.dousei();
_this._itemList = dousei.makeItemList();
_this.play(true);
return _this;
}
DouseiTimeGaugeEvent.prototype.dousei = function () {
var actor = $gameActors.actor(this._actorId);
return actor.dousei();
};
DouseiTimeGaugeEvent.prototype.update = function () {
if (this._fadeoutFrame > 0) {
return;
}
if (this._remain <= 0) {
return;
}
var before = this.currentStep();
this._remain--;
var after = this.currentStep();
if (before != after) {
this.play(false);
}
if (this._remain <= 0) {
this.play(false);
this.fireEvent();
}
};
DouseiTimeGaugeEvent.prototype.fireEvent = function () {
$slg.removeTimeGaugeEvent(this._id);
var type = TimeGaugeEventType.dousei;
var event = new DouseiTimeGaugeEvent(type, this._time, this._actorId);
$slg.addTimeGaugeEvent(event);
};
DouseiTimeGaugeEvent.prototype.play = function (isInitial) {
var step = this.currentStep();
var playId = this._itemList[step];
this._currentPlay = playId;
if (!isInitial) {
this.dousei().upCurrentPlay();
}
this.dousei().setCurrentPlay(playId);
};
DouseiTimeGaugeEvent.prototype.currentPlay = function () {
return this._currentPlay;
};
DouseiTimeGaugeEvent.prototype.currentStep = function () {
var per = this.timePer();
var n = 0;
for (var _i = 0, _a = this._stepList; _i < _a.length; _i++) {
var step = _a[_i];
if (per <= step) {
return n;
}
n++;
}
return n;
};
DouseiTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(this._actorId);
};
DouseiTimeGaugeEvent.prototype.extraIconId = function () {
var item = this.dousei().currentPlayItem();
if (item) {
return item.iconIndex();
}
return -1;
};
DouseiTimeGaugeEvent.prototype.getTexts = function () {
var playName = this.playName();
if (!playName) {
return [this.manName() + "と同棲中"];
} else {
return [this.manName() + "と同棲", playName + "中"];
}
};
DouseiTimeGaugeEvent.prototype.actorName = function () {
return $gameActors.actor(this._actorId).name();
};
DouseiTimeGaugeEvent.prototype.playName = function () {
if (this.currentPlay() >= 1) {
return $dataItems[this.currentPlay()].name;
} else {
return null;
}
};
DouseiTimeGaugeEvent.prototype.manName = function () {
var manId = this.dousei().manId();
return $gameActors.actor(manId).name();
};
DouseiTimeGaugeEvent.prototype.actorId = function () {
return this._actorId;
};
return DouseiTimeGaugeEvent;
})(TimeGaugeEvent);
var SoupKichenTimeGaugeEvent = /** @class */ (function (_super) {
__extends(SoupKichenTimeGaugeEvent, _super);
function SoupKichenTimeGaugeEvent(time) {
return _super.call(this, TimeGaugeEventType.soupKichen, time) || this;
}
SoupKichenTimeGaugeEvent.prototype.calcTime = function (level) {};
SoupKichenTimeGaugeEvent.prototype.fireEvent = function () {
$slg.manInfo().soupKichen().reload();
};
SoupKichenTimeGaugeEvent.prototype.getTexts = function () {
return [TextManager.changeActor];
};
SoupKichenTimeGaugeEvent.prototype.iconId = function () {
return this.iconByActor(8);
};
SoupKichenTimeGaugeEvent.prototype.isNeedClick = function () {
return false;
};
return SoupKichenTimeGaugeEvent;
})(TimeGaugeEvent);
var Sprite_TimeGaugeEventSet = /** @class */ (function (_super) {
__extends(Sprite_TimeGaugeEventSet, _super);
function Sprite_TimeGaugeEventSet() {
var _this = _super.call(this) || this;
_this.refresh();
return _this;
}
Sprite_TimeGaugeEventSet.prototype.update = function () {
_super.prototype.update.call(this);
this.updatePosition();
if (!this._eventList || this._eventList.length == 0) {
$gameTemp.timeSpeedUp = false;
}
if ($slg.isTimeGaugeChanged()) {
this.refresh();
$slg.clearTimeGaugeChanged();
}
};
Sprite_TimeGaugeEventSet.prototype.updatePosition = function () {
var s = SceneManager._scene._spriteset;
if (s) {
if (s._clickerWindow) {
if (s._clickerWindow.visible) {
this.x = 772 + 8;
return;
}
}
}
this.x = 1072 + 8;
};
Sprite_TimeGaugeEventSet.prototype.refresh = function () {
this.removeChildren();
this._eventList = [];
var list = $slg.timeGaugeEventList();
var index = 0;
for (var i = 0; i < list.length; i++) {
var e = list[i];
if (e.isVisible()) {
this.addEvent(e, index);
index++;
}
}
};
Sprite_TimeGaugeEventSet.prototype.addEvent = function (e, index) {
var sprite = new Sprite_TimeGaugeEvent(e);
sprite.y = index * this.itemHeight();
this.addChild(sprite);
this._eventList.push(sprite);
};
Sprite_TimeGaugeEventSet.prototype.itemHeight = function () {
return 46;
};
return Sprite_TimeGaugeEventSet;
})(Sprite);
var Sprite_TimeGaugeEvent = /** @class */ (function (_super) {
__extends(Sprite_TimeGaugeEvent, _super);
function Sprite_TimeGaugeEvent(event) {
var _this = _super.call(this) || this;
_this._lastFadeFrame = 0;
_this._event = event;
_this.bitmap = new Bitmap(_this.timeWidth(), 50);
_this._gaugeSprite = new PIXI.Sprite();
_this.addChild(_this._gaugeSprite);
_this.createFlashSprite();
_this.createOverFrameSprite();
_this.refresh();
return _this;
}
Sprite_TimeGaugeEvent.prototype.createFlashSprite = function () {
var g = new PIXI.Graphics();
g.beginFill(0x9999ff, 0.8);
g.drawRect(0, 0, this.timeWidth() - 10, 44);
g.endFill();
g.x = 1;
g.y = 2;
g.visible = false;
this._flashSprite = g;
this.addChild(g);
};
Sprite_TimeGaugeEvent.prototype.createOverFrameSprite = function () {
var g = new PIXI.Graphics();
var ww = this.timeWidth() - 10;
var hh = 44;
g.beginFill(0x9999ff, 0.3);
g.drawRect(0, 0, ww, hh);
g.endFill();
g.lineStyle(1, 0xbbbbff, 0.8);
g.moveTo(0, 0).lineTo(ww, 0).lineTo(ww, hh).lineTo(0, hh).lineTo(0, 0);
g.x = 1;
g.y = 2;
g.visible = false;
this._overFrameSprite = g;
this.addChild(g);
};
Sprite_TimeGaugeEvent.prototype.destroy = function (options) {
if (this._imageSprite) {
this.removeChild(this._imageSprite);
this._imageSprite = null;
}
_super.prototype.destroy.call(this, options);
};
Sprite_TimeGaugeEvent.prototype.timeWidth = function () {
return 210;
};
Sprite_TimeGaugeEvent.prototype.update = function () {
_super.prototype.update.call(this);
this.updateTouch();
if (this.isChange()) {
this.refreshGauge();
}
if (this._lastFadeFrame > 0) {
this.updateFade();
}
if (this._event.isWaitClick()) {
this.drawBalloon();
}
this.updateFlash();
};
Sprite_TimeGaugeEvent.prototype.updateTouch = function () {
if (this._event.isWaitClick()) {
this.updateOver();
} else {
this._overFrameSprite.visible = false;
}
if (!TouchInput.isPressed()) {
$gameTemp.timeSpeedUp = false;
return;
}
var touchPos = new Point(TouchInput.x, TouchInput.y);
var localPos = this.worldTransform.applyInverse(touchPos);
var leftMargin = 25;
var frame2 = new Rectangle(
this._frame.x - leftMargin,
this._frame.y + 2,
this._frame.width + leftMargin,
this._frame.height - 4
);
if (frame2.contains(localPos.x, localPos.y)) {
if (this._event.isWaitClick()) {
this._event.onClick();
return;
}
this._event.speedUp();
$gameTemp.timeSpeedUp = true;
}
};
Sprite_TimeGaugeEvent.prototype.updateOver = function () {
if (!this._event.canClick()) {
return;
}
var touchPos = new Point(TouchInput.x, TouchInput.y);
var localPos = this.worldTransform.applyInverse(touchPos);
var leftMargin = 25;
var frame2 = new Rectangle(
this._frame.x - leftMargin,
this._frame.y + 2,
this._frame.width + leftMargin,
this._frame.height - 4
);
if (frame2.contains(localPos.x, localPos.y)) {
this._overFrameSprite.visible = true;
} else {
this._overFrameSprite.visible = false;
}
};
Sprite_TimeGaugeEvent.prototype.updateFade = function () {
if (this._event.maxFadeFrame() - this._lastFadeFrame < 2) {
return;
}
this.opacity -= 5;
};
Sprite_TimeGaugeEvent.prototype.updateFlash = function () {
if (!this._event.isWaitFire()) {
return;
}
this._flashSprite.visible = true;
this._flashSprite.alpha -= 0.07;
};
Sprite_TimeGaugeEvent.prototype.isChange = function () {
if (this._lastFadeFrame != this._event.fadeoutFrame()) {
return true;
}
if (this._lastWaitClick != this._event.isWaitClick()) {
return true;
}
return this._lastGaugeRate != this._event.timeRate();
};
Sprite_TimeGaugeEvent.prototype.refresh = function () {
this.bitmap.clear();
this.drawBackground();
this.drawSprite();
this.drawText();
this.drawGauge();
this.drawCharImage();
this.drawExtraIcon();
if (this._event.isWaitClick()) {
this.drawBalloon();
}
};
Sprite_TimeGaugeEvent.prototype.drawBackground = function () {
var bitmap = ImageManager.loadSystem("main");
this.bitmap.blt(bitmap, 0, 100, 211, 46, 0, 0);
};
Sprite_TimeGaugeEvent.prototype.drawSprite = function () {
var sprite = this._event.sprite();
if (!sprite) {
return;
}
this._imageSprite = sprite;
this._imageSprite.scale.x = 0.35;
this._imageSprite.scale.y = 0.35;
this._imageSprite.x = 4;
this._imageSprite.y = 11;
this.addChild(this._imageSprite);
};
Sprite_TimeGaugeEvent.prototype.drawCharImage = function () {
var iconId = this._event.iconId();
if (iconId <= 0) {
return;
}
this.drawIcon(iconId, 13, 10);
};
Sprite_TimeGaugeEvent.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);
};
Sprite_TimeGaugeEvent.prototype.drawExtraIcon = function () {
var extraIcon = this._event.extraIconId();
if (extraIcon <= 0) {
return;
}
this.drawIcon(extraIcon, 152, 6);
};
Sprite_TimeGaugeEvent.prototype.refreshGauge = function () {
this._gaugeSprite.removeChildren();
this.drawGauge();
};
Sprite_TimeGaugeEvent.prototype.drawText = function () {
var texts = this._event.getTexts();
this.bitmap.fontSize = 15;
var xx = 59;
var yy = 2;
for (var _i = 0, texts_1 = texts; _i < texts_1.length; _i++) {
var text = texts_1[_i];
this.bitmap.drawText(text, xx, yy, 134, 26);
yy += 23;
}
};
Sprite_TimeGaugeEvent.prototype.drawGauge = function () {
this._lastFadeFrame = this._event.fadeoutFrame();
this._lastGaugeRate = this._event.timeRate();
this._lastWaitClick = this._event.isWaitClick();
if (
this._lastFadeFrame > 0 ||
this._event.isWaitClick() ||
this._event.isWaitFire()
) {
var gaugeSprite = this.getGaugeSprite(1, 1);
this._gaugeSprite.addChild(gaugeSprite);
} else {
var gaugeSprite = void 0;
if (this._event.isLastSpeedUp()) {
this._event.clearLastSpeedUp();
gaugeSprite = this.getGaugeSprite(2, 1 - this._lastGaugeRate);
} else {
gaugeSprite = this.getGaugeSprite(0, 1 - this._lastGaugeRate);
}
this._gaugeSprite.addChild(gaugeSprite);
}
};
Sprite_TimeGaugeEvent.prototype.getGaugeSprite = function (index, rate) {
var baseTexture = Nore.getSystemBaseTexture("main");
var r = new Rectangle(0, 320 + index * 28, Math.floor(128 * rate), 20);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
s.x = 61;
s.y = 27;
return s;
};
Sprite_TimeGaugeEvent.prototype.drawBalloon = function () {
if (this._balloonSprite) {
return;
}
var s = this.getBalloonSprite();
s.x = -25;
s.y = -4;
this.addChild(s);
this._balloonSprite = s;
};
Sprite_TimeGaugeEvent.prototype.getBalloonSprite = function () {
var baseTexture = Nore.getSystemBaseTexture("main");
var r = new Rectangle(32 * 10, 32 * 12, 32 * 3, 32);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
return s;
};
return Sprite_TimeGaugeEvent;
})(Sprite);
var Sprite_MiniTimeGaugeEvent = /** @class */ (function (_super) {
__extends(Sprite_MiniTimeGaugeEvent, _super);
function Sprite_MiniTimeGaugeEvent(event, h, erase, title) {
if (h === void 0) {
h = 5;
}
if (erase === void 0) {
erase = false;
}
if (title === void 0) {
title = null;
}
var _this = _super.call(this) || this;
_this._gaugeHeight = h;
_this._event = event;
_this._erase = erase;
_this._title = title;
_this.bitmap = new Bitmap(_this.timeWidth(), 30);
_this.refresh();
return _this;
}
Sprite_MiniTimeGaugeEvent.prototype.timeWidth = function () {
if (this._title) {
return 100 + 60;
}
return 100;
};
Sprite_MiniTimeGaugeEvent.prototype.update = function () {
_super.prototype.update.call(this);
if (this.isChange()) {
this.refreshGauge();
}
};
Sprite_MiniTimeGaugeEvent.prototype.isChange = function () {
return this._lastGaugeRate != this._event.timeRate();
};
Sprite_MiniTimeGaugeEvent.prototype.refreshGauge = function () {
this.refresh();
};
Sprite_MiniTimeGaugeEvent.prototype.refresh = function () {
this.bitmap.clear();
this.drawTitle();
this.drawGauge();
this.checkErase();
};
Sprite_MiniTimeGaugeEvent.prototype.checkErase = function () {
if (!this._erase) {
return;
}
if (this._event.timeRate() <= 0) {
if (this.parent) {
this.parent.removeChild(this);
}
}
};
Sprite_MiniTimeGaugeEvent.prototype.drawTitle = function () {
if (!this._title) {
return;
}
this.bitmap.fontSize = 11;
this.bitmap.drawText(this._title, 10, -9, 84, 30);
};
Sprite_MiniTimeGaugeEvent.prototype.drawGauge = function () {
this._lastGaugeRate = this._event.timeRate();
var xx = 1;
if (this._title) {
xx += 48;
}
var yy = 3;
var ww = 83;
var hh = this._gaugeHeight;
this._bitmap.fillRect(xx, yy, ww + 2, hh + 2, "#000000");
var www = Math.round((1 - this._lastGaugeRate) * ww);
this._bitmap.gradientFillRect(
xx + 1,
yy + 1,
www,
hh,
ColorManager.tpGaugeColor1(),
ColorManager.tpGaugeColor2()
);
};
return Sprite_MiniTimeGaugeEvent;
})(Sprite);