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

597 lines
17 KiB
JavaScript

/*:ja
* @target MZ
* @author ル
*
* @command nextStage
* @text 次のステージへ
* @des 次のステージへ
*
*/
var Nore;
(function (Nore) {
var pluginName = "Nore_Slg";
PluginManager.registerCommand(pluginName, "nextStage", function (args) {
$slg.nextStage();
});
var DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function () {
DataManager_createGameObjects.call(this);
$gameTroop = new Game_Troop2();
$slg = new Slg();
};
var _DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function (contents) {
_DataManager_extractSaveContents.call(this, contents);
$slg = contents.slg;
};
var _DataManager_makeSaveContents = DataManager.makeSaveContents;
DataManager.makeSaveContents = function () {
var contents = _DataManager_makeSaveContents.call(this);
contents.slg = $slg;
return contents;
};
})(Nore || (Nore = {}));
var troopIdList = [0, 7, 2, 3, 5];
var STAGE_VAR = 1;
var AREA_VAR = 2;
var BATTLE_VAR = 5;
var SHOW_SIDE_BATTLE_SW = 15;
var ONE_DAY_TIME = 240;
var Icon;
(function (Icon) {
Icon[(Icon["kiss"] = 977)] = "kiss";
Icon[(Icon["chichi"] = 896)] = "chichi";
Icon[(Icon["cri"] = 898)] = "cri";
Icon[(Icon["manko"] = 900)] = "manko";
Icon[(Icon["anal"] = 901)] = "anal";
Icon[(Icon["sm"] = 987)] = "sm";
Icon[(Icon["lock"] = 802)] = "lock";
Icon[(Icon["ok"] = 410)] = "ok";
Icon[(Icon["bote"] = 947)] = "bote";
Icon[(Icon["skill1"] = 812)] = "skill1";
Icon[(Icon["skill2"] = 813)] = "skill2";
Icon[(Icon["skillEmpty"] = 811)] = "skillEmpty";
Icon[(Icon["gacha"] = 474)] = "gacha";
Icon[(Icon["gold"] = 800)] = "gold";
Icon[(Icon["gold2"] = 656)] = "gold2";
Icon[(Icon["ticket"] = 658)] = "ticket";
Icon[(Icon["fan"] = 966)] = "fan";
Icon[(Icon["kikaku"] = 2112)] = "kikaku";
Icon[(Icon["energy"] = 2115)] = "energy";
Icon[(Icon["power"] = 2116)] = "power";
Icon[(Icon["actionPoint"] = 407)] = "actionPoint";
Icon[(Icon["actionPoint2"] = 412)] = "actionPoint2";
Icon[(Icon["baby"] = 935)] = "baby";
Icon[(Icon["rankH"] = 816)] = "rankH";
Icon[(Icon["rankG"] = 817)] = "rankG";
Icon[(Icon["rankF"] = 818)] = "rankF";
Icon[(Icon["rankE"] = 819)] = "rankE";
Icon[(Icon["rankD"] = 820)] = "rankD";
Icon[(Icon["rankC"] = 821)] = "rankC";
Icon[(Icon["rankB"] = 822)] = "rankB";
Icon[(Icon["rankA"] = 823)] = "rankA";
Icon[(Icon["rankS"] = 824)] = "rankS";
Icon[(Icon["star"] = 427)] = "star";
Icon[(Icon["n"] = 489)] = "n";
Icon[(Icon["r"] = 490)] = "r";
Icon[(Icon["sr"] = 491)] = "sr";
Icon[(Icon["ssr"] = 493)] = "ssr";
})(Icon || (Icon = {}));
var Slg = /** @class */ (function () {
function Slg() {
this._interWait = 0;
this._avId = 1;
this._eventId = 1;
this._tanetsukeMap = {};
this._gameTime = 0;
this._time = 0;
this._battleInfo = new BattleInfo();
this._facilityInfo = new FacilityInfo();
this._decisiveBattleInfo = new DecisiveBattleInfo();
this._avInfo = new AvInfo();
this._formation = new Formation();
this._manInfo = new ManInfo();
this._fan = 0;
this._waitingEventList = [];
this._currentEventList = [];
this._clicker = new Clicker();
this._timeGaugeEventList = [];
}
Slg.prototype.isInterpreterRunning = function () {
if (!this._interpreter) {
return;
}
return this._interpreter.isRunning();
};
Slg.prototype.clearInterpreter = function () {
this._interpreter = null;
};
Slg.prototype.fan = function () {
return this._fan;
};
Slg.prototype.plusFan = function (n) {
this._fan += n;
};
Slg.prototype.update = function () {
/*
if (this._speed == Speed.stop) {
return;
}
*/
$slg.goldSe = false;
if (this._interpreter) {
this._interpreter.update();
}
this._gameTime++;
if (this._gameTime % this.updateTime() == 0) {
for (var i = 0; i < this.gameSpeed(); i++) {
this.updateGame();
this._time++;
}
}
};
Slg.prototype.gameSpeed = function () {
return 1;
};
Slg.prototype.updateGame = function () {
this.updateTimeGaugeEvent();
this.updateFacilities();
this.updateClicker();
this.updateActors();
this.updateTraining();
};
Slg.prototype.updateTraining = function () {
$slg.formation().trainingInfo().update();
};
Slg.prototype.updateClicker = function () {
this._clicker.update();
};
Slg.prototype.updateTimeGaugeEventFade = function () {
var removeList = [];
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
e.updateFade();
if (e.isFinished()) {
removeList.push(e);
this._timeGaugeChanged = true;
}
}
for (
var _b = 0, removeList_1 = removeList;
_b < removeList_1.length;
_b++
) {
var e = removeList_1[_b];
var index = this._timeGaugeEventList.indexOf(e);
this._timeGaugeEventList.splice(index, 1);
}
};
Slg.prototype.updateTimeGaugeEvent = function () {
var removeList = [];
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
e.update();
if (e.isFinished()) {
removeList.push(e);
this._timeGaugeChanged = true;
}
}
for (
var _b = 0, removeList_2 = removeList;
_b < removeList_2.length;
_b++
) {
var e = removeList_2[_b];
var index = this._timeGaugeEventList.indexOf(e);
this._timeGaugeEventList.splice(index, 1);
}
};
Slg.prototype.removeDouseiTimeGaugeEvent = function (actorId) {
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
if (e.type() == TimeGaugeEventType.dousei) {
var event_1 = e;
if (event_1.actorId() == actorId) {
var index = this._timeGaugeEventList.indexOf(e);
this._timeGaugeEventList.splice(index, 1);
this._timeGaugeChanged = true;
return;
}
}
}
};
Slg.prototype.isTimeGaugeChanged = function () {
return this._timeGaugeChanged;
};
Slg.prototype.clearTimeGaugeChanged = function () {
this._timeGaugeChanged = false;
};
Slg.prototype.timeGaugeEventList = function () {
return this._timeGaugeEventList;
};
Slg.prototype.fadeoutTimeGaugeEvent = function (id) {
if (id >= 0) {
var index = 0;
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
if (e.id() == id) {
e.fadeout();
return;
}
index++;
}
}
};
Slg.prototype.removeTimeGaugeEvent = function (id) {
if (id >= 0) {
var index = 0;
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
if (e.id() == id) {
this._timeGaugeEventList.splice(index, 1);
this._timeGaugeChanged = true;
return;
}
index++;
}
}
};
Slg.prototype.getTimeGaugeEvent = function (type) {
for (var _i = 0, _a = this._timeGaugeEventList; _i < _a.length; _i++) {
var e = _a[_i];
if (e.type() == type) {
return e;
}
}
return null;
};
Slg.prototype.nextAvId = function () {
var id = this._avId;
this._avId++;
return id;
};
Slg.prototype.nextTimeEventId = function () {
var id = this._eventId;
this._eventId++;
return id;
};
Slg.prototype.nextStage = function () {
$gameVariables.setValue(STAGE_VAR, this.stage() + 1);
};
Slg.prototype.nextTroopId = function () {
return troopIdList[this.area()];
};
Slg.prototype.onStart = function () {
this.facilityInfo().onStart();
$gameSwitches.setValue(40, Nore.isTaikenban());
};
Slg.prototype.stage = function () {
return $gameVariables.value(STAGE_VAR);
};
Slg.prototype.area = function () {
return $gameVariables.value(AREA_VAR);
};
Slg.prototype.makeAv = function (av) {
$gameVariables.setValue(7, $gameVariables.value(7) + 1);
p("AV撮影:" + av.itemId());
av.make(99);
this.avInfo().addAv(av);
var actor = $gameActors.actor(av.actorId());
actor.onMakeAv(av.mainMan().actorId());
actor.gainHp(-av.hpCost());
var upEroInfo = this.upEroParam(
av.actorId(),
av.itemId(),
av.mainMan(),
av.subMan1(),
av.subMan2()
);
av.setUpEroInfo(upEroInfo);
upEroInfo.up();
av.done();
$gameTemp.lastSelection = null;
var commonId = av.commonEventId();
$gameParty.insertCommonEvent(commonId, -1);
};
Slg.prototype.upEroParam = function (
actorId,
itemId,
mainMan,
subMan1,
subMan2
) {
var key = actorId + "_" + itemId;
console.log("upEroParam:" + key);
var params = ERO_PARAMS[key];
if (!params) {
console.error(key + "の ERO_PARAMS が見つかりません");
return null;
}
var result = new UpEroInfo(params, actorId);
result.addMain(mainMan);
result.addSub1(subMan1);
result.addSub2(subMan2);
var actor = $gameActors.actor(actorId);
actor.upEro(EroType.acme, params.acme);
actor.upEro(EroType.nakadashi, params.nakadashi);
actor.upEro(EroType.anal, params.anal);
actor.upEro(EroType.fela, params.fela);
return result;
};
Slg.prototype.checkTimeEvent = function () {
var removeList = [];
for (var _i = 0, _a = this._waitingEventList; _i < _a.length; _i++) {
var e = _a[_i];
e.onNextDay();
if (e.day() == 0) {
this.fireEvent(e);
removeList.push(e);
}
}
for (
var _b = 0, removeList_3 = removeList;
_b < removeList_3.length;
_b++
) {
var e = removeList_3[_b];
this._waitingEventList.splice(this._waitingEventList.indexOf(e), 1);
}
};
Slg.prototype.clearEvent = function () {
this._waitingEventList = [];
};
Slg.prototype.fireEvent = function (e) {
if (e.commonId() > 0) {
$gameParty.addCommonEvent(e.commonId());
} else if (e.scenarioId()) {
$gameParty.addScenario(e.scenarioId());
}
};
Slg.prototype.updateTime = function () {
return 1;
//return 3;
};
Slg.prototype.updateTanetsuke = function () {
for (var key in this._tanetsukeMap) {
var tanesuke = this._tanetsukeMap[key];
tanesuke.update();
}
};
Slg.prototype.updateActors = function () {
for (var i = 1; i < 20; i++) {
var actor = $gameActors.actor(i);
actor.update();
}
};
Slg.prototype.updateFacilities = function () {
this._facilityInfo.update();
};
Slg.prototype.fps = function () {
return 60;
};
Slg.prototype.setDirty = function () {
this._dirty = true;
};
Slg.prototype.isDirty = function () {
if (this._dirty) {
return true;
}
for (var key in this._tanetsukeMap) {
var tanesuke = this._tanetsukeMap[key];
if (tanesuke.isDirty()) {
return true;
}
}
return false;
};
Slg.prototype.clearDirty = function () {
for (var key in this._tanetsukeMap) {
var tanesuke = this._tanetsukeMap[key];
tanesuke.clearDirty();
}
this._dirty = false;
};
Slg.prototype.eventList = function () {
var result = [];
for (var key in this._tanetsukeMap) {
var tanesuke = this._tanetsukeMap[key];
var history_1 = tanesuke.lastHistory();
if (history_1.status() == TanetsukeStatus.fertilize) {
result.push(history_1);
}
if (history_1.status() == TanetsukeStatus.firstSex) {
result.push(history_1);
}
if (history_1.status() == TanetsukeStatus.syusan) {
result.push(history_1);
}
}
return result;
};
Slg.prototype.facilityInfo = function () {
return this._facilityInfo;
};
Slg.prototype.avInfo = function () {
return this._avInfo;
};
Slg.prototype.manInfo = function () {
return this._manInfo;
};
Slg.prototype.calcAllAvReward = function () {
return this.avInfo().avReward();
};
Slg.prototype.calcNewAvReward = function () {
return 8;
};
Slg.prototype.formation = function () {
return this._formation;
};
Slg.prototype.decisiveBattleInfo = function () {
return this._decisiveBattleInfo;
};
Slg.prototype.calcKikakuReward = function () {
return 5;
};
Slg.prototype.avRewardRate = function () {
return 1;
};
Slg.prototype.reserveCommonId = function (day, commonId, slgOnly) {
if (slgOnly === void 0) {
slgOnly = false;
}
this._waitingEventList.push(new TimeEvent(day, commonId, null, slgOnly));
};
Slg.prototype.reserveScenarioId = function (day, scenarioId, slgOnly) {
if (slgOnly === void 0) {
slgOnly = false;
}
this._waitingEventList.push(new TimeEvent(day, -1, scenarioId, slgOnly));
};
Slg.prototype.inSlg = function () {
return this._inSlg;
};
Slg.prototype.setSlg = function (b) {
this._inSlg = b;
this._dirty = true;
};
Slg.prototype.battleInfo = function () {
return this._battleInfo;
};
Slg.prototype.manList = function () {
return this._manInfo.manList();
};
Slg.prototype.hideSideBattle = function () {
$gameSwitches.setValue(SHOW_SIDE_BATTLE_SW, false);
};
Slg.prototype.showSideBattle = function () {
$gameSwitches.setValue(SHOW_SIDE_BATTLE_SW, true);
};
Slg.prototype.isHideSideBattle = function () {
if ($gameTemp.inRecordAv) {
return true;
}
if ($gameSwitches.value(17)) {
return false;
}
if ($gameTemp.inSlg) {
return false;
}
if ($gameMap._interpreter.isRunning()) {
if (!this._interWait) {
this._interWait = 1;
} else {
this._interWait++;
if (this._interWait >= 4) {
if (!$gameMap._interpreter.isRunning()) {
this._interWait = 0;
}
return true;
}
}
} else {
this._interWait = 0;
}
return !$gameSwitches.value(SHOW_SIDE_BATTLE_SW);
};
Slg.prototype.onSlgTerminate = function () {
this._interWait = 0;
};
Slg.prototype.addAvTimeGaugeEvent = function (av) {
if (!av) {
console.error("AVが nullです");
return;
}
var e = new AvTimeGaugeEvent(TimeGaugeEventType.sale, 600, av);
this._timeGaugeEventList.push(e);
this._timeGaugeChanged = true;
};
Slg.prototype.hasLastSaleTimeGaugeEvent = function (actorId) {
for (var i = 0; i < this._timeGaugeEventList.length; i++) {
var e = this._timeGaugeEventList[i];
if (e.type() == TimeGaugeEventType.sale) {
var ee = e;
if (ee.av().actorId() == actorId) {
return true;
}
}
}
return false;
};
Slg.prototype.addTimeGaugeEvent = function (event) {
this._timeGaugeEventList.push(event);
this._timeGaugeChanged = true;
};
Slg.prototype.removeCommonTimeGaugeEvent = function (commonId) {
for (var i = 0; i < this._timeGaugeEventList.length; i++) {
var e = this._timeGaugeEventList[i];
if (e.type() == TimeGaugeEventType.commonEvent) {
var ee = e;
if (ee._commonEventId == commonId) {
this._timeGaugeEventList.splice(i, 1);
this._timeGaugeChanged = true;
return;
}
}
}
};
Slg.prototype.removeTimeGaugeEventType = function (type) {
for (var i = 0; i < this._timeGaugeEventList.length; i++) {
var e = this._timeGaugeEventList[i];
if (e.type() == type) {
this._timeGaugeEventList.splice(i, 1);
this._timeGaugeChanged = true;
return;
}
}
};
Slg.prototype.fadeoutTimeGaugeEventType = function (type) {
for (var i = 0; i < this._timeGaugeEventList.length; i++) {
var e = this._timeGaugeEventList[i];
if (e.type() == type) {
e.fadeout();
return;
}
}
};
Slg.prototype.hasWaitFireTimeEvent = function () {
for (var i = 0; i < this._timeGaugeEventList.length; i++) {
var e = this._timeGaugeEventList[i];
if (e.isWaitFire()) {
return true;
}
}
return false;
};
Slg.prototype.clickerStage = function () {
return this._clicker.currentStage();
};
Slg.prototype.clicker = function () {
return this._clicker;
};
Slg.prototype.isBossBattle = function () {
var clickerStage = this.clickerStage();
if (clickerStage.inBattle()) {
return clickerStage.isBoss();
}
return false;
};
Slg.prototype.isLastBossBattle = function () {
var clickerStage = this.clickerStage();
if (clickerStage.inBattle()) {
return clickerStage.isLastBoss();
}
return false;
};
Slg.prototype.isBattle = function () {
if (!$gameSwitches.value(SHOW_SIDE_BATTLE_SW)) {
return false;
}
var clickerStage = this.clickerStage();
if (clickerStage.inBattle()) {
return true;
}
return false;
};
return Slg;
})();
var $slg;