856 lines
26 KiB
JavaScript
856 lines
26 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 addFacility
|
|
* @text 施設追加
|
|
* @des 施設追加
|
|
* @arg facilityId
|
|
* @type number
|
|
* @text facilityId
|
|
* @desc facilityId
|
|
* @arg level
|
|
* @type number
|
|
* @text level
|
|
* @desc level
|
|
* @arg note
|
|
* @type sting
|
|
*
|
|
* @command levelUp
|
|
* @text レベルアップ
|
|
* @des レベルアップ
|
|
* @arg facilityId
|
|
* @type number
|
|
* @text facilityId
|
|
* @desc facilityId
|
|
* @arg level
|
|
* @type number
|
|
* @text level
|
|
* @desc level
|
|
* @arg note
|
|
* @type sting
|
|
*/
|
|
var Nore;
|
|
(function (Nore) {
|
|
var pluginName = "Nore_Facility";
|
|
PluginManager.registerCommand(pluginName, "addFacility", function (args) {
|
|
var facilityId = parseInt(args.facilityId);
|
|
var level = parseInt(args.level);
|
|
$slg.facilityInfo().addFacility(facilityId, level);
|
|
});
|
|
PluginManager.registerCommand(pluginName, "levelUp", function (args) {
|
|
var facilityId = parseInt(args.facilityId);
|
|
var level = parseInt(args.level);
|
|
var facility = $slg.facilityInfo().findFacility(facilityId);
|
|
if (!facility) {
|
|
return;
|
|
}
|
|
var count = level - facility.level();
|
|
for (var i = 0; i < count; i++) {
|
|
$slg.facilityInfo().levelUp(facilityId);
|
|
}
|
|
});
|
|
})(Nore || (Nore = {}));
|
|
var MAP_CHANGED_SW = 110;
|
|
var MAP_CHANGED_VAR = 27;
|
|
var FacilityType;
|
|
(function (FacilityType) {
|
|
FacilityType[(FacilityType["headquarters"] = 0)] = "headquarters";
|
|
FacilityType[(FacilityType["combatant"] = 1)] = "combatant";
|
|
FacilityType[(FacilityType["monster"] = 2)] = "monster";
|
|
FacilityType[(FacilityType["shootingStudio"] = 3)] = "shootingStudio";
|
|
FacilityType[(FacilityType["sharedRoom"] = 4)] = "sharedRoom";
|
|
FacilityType[(FacilityType["barracks"] = 5)] = "barracks";
|
|
FacilityType[(FacilityType["soupKitchen"] = 6)] = "soupKitchen";
|
|
FacilityType[(FacilityType["baby"] = 7)] = "baby";
|
|
FacilityType[(FacilityType["gene"] = 8)] = "gene";
|
|
FacilityType[(FacilityType["kichen"] = 9)] = "kichen";
|
|
FacilityType[(FacilityType["radar"] = 10)] = "radar";
|
|
FacilityType[(FacilityType["weapon"] = 11)] = "weapon";
|
|
FacilityType[(FacilityType["live"] = 12)] = "live";
|
|
FacilityType[(FacilityType["stage4"] = 13)] = "stage4";
|
|
FacilityType[(FacilityType["piercingStudio"] = 14)] = "piercingStudio";
|
|
FacilityType[(FacilityType["stage5"] = 15)] = "stage5";
|
|
FacilityType[(FacilityType["bodyCustom"] = 16)] = "bodyCustom";
|
|
FacilityType[(FacilityType["douseiFree"] = 17)] = "douseiFree";
|
|
FacilityType[(FacilityType["training"] = 18)] = "training";
|
|
FacilityType[(FacilityType["trainingPlus"] = 19)] = "trainingPlus";
|
|
FacilityType[(FacilityType["accelerator"] = 20)] = "accelerator";
|
|
FacilityType[(FacilityType["ninshinSokusei"] = 22)] = "ninshinSokusei";
|
|
FacilityType[(FacilityType["douseiNinshin"] = 23)] = "douseiNinshin";
|
|
FacilityType[(FacilityType["aloma"] = 24)] = "aloma";
|
|
})(FacilityType || (FacilityType = {}));
|
|
var FacilityId;
|
|
(function (FacilityId) {
|
|
FacilityId[(FacilityId["sharedRoom"] = 46)] = "sharedRoom";
|
|
FacilityId[(FacilityId["barracks"] = 37)] = "barracks";
|
|
FacilityId[(FacilityId["soupKichen"] = 43)] = "soupKichen";
|
|
})(FacilityId || (FacilityId = {}));
|
|
var FacilityCommand;
|
|
(function (FacilityCommand) {
|
|
FacilityCommand["levelUp"] = "levelUp";
|
|
})(FacilityCommand || (FacilityCommand = {}));
|
|
var FacilityEvent = /** @class */ (function () {
|
|
function FacilityEvent(commonId, sceratioId) {
|
|
if (sceratioId === void 0) {
|
|
sceratioId = "";
|
|
}
|
|
this._commonId = 0;
|
|
this._sceratioId = "";
|
|
this._commonId = commonId;
|
|
this._sceratioId = sceratioId;
|
|
}
|
|
FacilityEvent.prototype.run = function () {
|
|
if (this._commonId > 0) {
|
|
$gameParty.addCommonEvent(this._commonId, -1);
|
|
}
|
|
if (this._sceratioId.length > 0) {
|
|
$gameParty.addScenario(this._sceratioId, -1);
|
|
}
|
|
};
|
|
return FacilityEvent;
|
|
})();
|
|
var FacilityInfo = /** @class */ (function () {
|
|
function FacilityInfo() {
|
|
this._facilityList = [];
|
|
this._resultList = [];
|
|
}
|
|
FacilityInfo.prototype.resultList = function () {
|
|
return this._resultList || [];
|
|
};
|
|
FacilityInfo.prototype.clearResultList = function () {
|
|
this._resultList = [];
|
|
};
|
|
FacilityInfo.prototype.onStart = function () {
|
|
//this.addFacility(21);
|
|
//this.addFacility(41, 1);
|
|
};
|
|
FacilityInfo.prototype.hasFacility = function (itemId) {
|
|
for (var _i = 0, _a = this._facilityList; _i < _a.length; _i++) {
|
|
var f = _a[_i];
|
|
if (f.itemId() == itemId) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
FacilityInfo.prototype.hasDouseiRoom = function () {
|
|
for (var _i = 0, _a = this._facilityList; _i < _a.length; _i++) {
|
|
var f = _a[_i];
|
|
if (f.type() == FacilityType.sharedRoom) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
FacilityInfo.prototype.matchFacilityType = function (type, level) {
|
|
for (var _i = 0, _a = this._facilityList; _i < _a.length; _i++) {
|
|
var f = _a[_i];
|
|
if (f.type() == type) {
|
|
return f.level() >= level;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
FacilityInfo.prototype.addFacility = function (itemId) {
|
|
var facility = this.facilityAt(itemId);
|
|
if (!facility.isValid()) {
|
|
console.error("施設が不正です:" + itemId);
|
|
return;
|
|
}
|
|
this._facilityList.push(facility);
|
|
//this.checkFacilityEvent(facility);
|
|
//this.checkNextFacility(facility);
|
|
this._dirty = true;
|
|
};
|
|
/*checkNextFacility(facility: Facility) {
|
|
for (let i = 21; i <= 100; i++) {
|
|
const item = $dataItems[i];
|
|
if (! item) {
|
|
continue;
|
|
}
|
|
if (! item.name || item.name.length == 0) {
|
|
continue;
|
|
}
|
|
const before = parseInt(item.meta['before']);
|
|
if (before == facility.itemId()) {
|
|
this.addFacility(item.id);
|
|
|
|
}
|
|
}
|
|
}*/
|
|
FacilityInfo.prototype.checkFacilityEvent = function (facility) {
|
|
if (facility.type() == FacilityType.combatant) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "1面_03_施設イベント_01");
|
|
}
|
|
if (facility.level() == 2) {
|
|
return new FacilityEvent(0, "1面_03_施設イベント_02");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.sharedRoom) {
|
|
//$gameVariables.setValue(MAP_CHANGED_VAR, facility.level());
|
|
var actorId = parseInt(facility.item().meta["actor"]);
|
|
switch (actorId) {
|
|
case 9:
|
|
return new FacilityEvent(206);
|
|
case 4:
|
|
return new FacilityEvent(247);
|
|
case 13:
|
|
return new FacilityEvent(250);
|
|
case 17:
|
|
return new FacilityEvent(251);
|
|
}
|
|
return null;
|
|
}
|
|
if (facility.type() == FacilityType.soupKitchen) {
|
|
if (facility.level() == 1) {
|
|
var time = this.calcSoupKichenReloadTime();
|
|
//$slg.addTimeGaugeEvent(new SoupKichenTimeGaugeEvent(time));
|
|
return new FacilityEvent(0, "炊き出し所イベント_01");
|
|
}
|
|
$slg.manInfo().soupKichen().reload();
|
|
}
|
|
if (facility.type() == FacilityType.baby) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "分娩室イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.kichen) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "キッチンイベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.piercingStudio) {
|
|
if (facility.level() == 1) {
|
|
if ($gameSwitches.value(356)) {
|
|
return new FacilityEvent(0, "ピアススタジオイベント_02");
|
|
} else {
|
|
return new FacilityEvent(0, "ピアススタジオイベント_01");
|
|
}
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.radar) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "3面_03_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.live) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "センリ_同棲ライブ_02");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.monster) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "研究所イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.stage4) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(258);
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.stage5) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(261);
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.weapon) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "武器イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.bodyCustom) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "肉体変化イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.douseiFree) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "同棲制限解除イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.training) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "怪人訓練イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.trainingPlus) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "怪人促成所イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.accelerator) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "粒子加速器イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.ninshinSokusei) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "妊娠促成所イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.douseiNinshin) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "受精研究所イベント_01");
|
|
}
|
|
}
|
|
if (facility.type() == FacilityType.aloma) {
|
|
if (facility.level() == 1) {
|
|
return new FacilityEvent(0, "友好アロマイベント_01");
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
FacilityInfo.prototype.calcSoupKichenReloadTime = function () {
|
|
var level = this.findMaxFacility(FacilityType.soupKitchen);
|
|
return 3000;
|
|
};
|
|
FacilityInfo.prototype.facilityList = function () {
|
|
return this._facilityList;
|
|
};
|
|
FacilityInfo.prototype.update = function () {
|
|
this._resultList = [];
|
|
for (var _i = 0, _a = this._facilityList; _i < _a.length; _i++) {
|
|
var f = _a[_i];
|
|
var result = f.update();
|
|
if (result) {
|
|
this._resultList.push(result);
|
|
}
|
|
}
|
|
};
|
|
FacilityInfo.prototype.levelUp = function (facilityId, eventId) {
|
|
//$gameParty.loseGold(facility.price());
|
|
this.addFacility(facilityId);
|
|
var facility = this.findFacility(facilityId);
|
|
if (facility.type() == FacilityType.combatant) {
|
|
$factoryManager.onFactoryLevelUp(facility.level());
|
|
}
|
|
this._dirty = true;
|
|
var facilityEvent = this.checkFacilityEvent(facility);
|
|
if (facilityEvent) {
|
|
facilityEvent.run();
|
|
$slg.fadeoutTimeGaugeEvent(eventId);
|
|
} else {
|
|
AudioManager.playSe({ name: "Recovery", volume: 80, pitch: 100, pan: 0 });
|
|
$slg.removeTimeGaugeEvent(eventId);
|
|
}
|
|
//this.removeFacility(facility);
|
|
//this.addFacility(facility.itemId() + 1);
|
|
};
|
|
FacilityInfo.prototype.removeFacility = function (facility) {
|
|
var index = -1;
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.itemId() == facility.itemId()) {
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
if (index < 0) {
|
|
return;
|
|
}
|
|
this._facilityList.splice(index, 1);
|
|
};
|
|
FacilityInfo.prototype.facilityAt = function (itemId) {
|
|
var item = $dataItems[itemId];
|
|
return new Facility(itemId, parseInt(item.meta["lv"]));
|
|
};
|
|
FacilityInfo.prototype.isDirty = function () {
|
|
return this._dirty;
|
|
};
|
|
FacilityInfo.prototype.clearDirty = function () {
|
|
this._dirty = false;
|
|
};
|
|
FacilityInfo.prototype.maxPower = function () {
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.type() == FacilityType.monster) {
|
|
return f.max();
|
|
}
|
|
}
|
|
};
|
|
FacilityInfo.prototype.avRewardRate = function () {
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.type() == FacilityType.headquarters) {
|
|
return f.value();
|
|
}
|
|
}
|
|
return 0;
|
|
};
|
|
FacilityInfo.prototype.findFacility = function (itemId) {
|
|
var max = null;
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.itemId() == itemId) {
|
|
if (!max) {
|
|
max = f;
|
|
} else if (max.level() < f.level()) {
|
|
max = f;
|
|
}
|
|
}
|
|
}
|
|
return max;
|
|
};
|
|
FacilityInfo.prototype.findMaxFacility = function (type) {
|
|
var max = null;
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.type() == type) {
|
|
if (!max) {
|
|
max = f;
|
|
} else if (max.level() < f.level()) {
|
|
max = f;
|
|
}
|
|
}
|
|
}
|
|
return max;
|
|
};
|
|
FacilityInfo.prototype.findMaxFacilityLevel = function (type) {
|
|
var f = this.findMaxFacility(type);
|
|
if (!f) {
|
|
return 0;
|
|
}
|
|
return f.level();
|
|
};
|
|
FacilityInfo.prototype.isFacilityExists = function (facilityId) {
|
|
for (var i = 0; i < this._facilityList.length; i++) {
|
|
var f = this._facilityList[i];
|
|
if (f.itemId() == facilityId) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
FacilityInfo.prototype.inConstruction = function (facility) {
|
|
var list = $slg.timeGaugeEventList();
|
|
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
|
|
var e = list_1[_i];
|
|
if (e.type() == TimeGaugeEventType.facility) {
|
|
var f = e;
|
|
if (f.facilityId() == facility.itemId()) {
|
|
if (f._remain > 0) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
FacilityInfo.prototype.isDouseiOptionEnabled = function (play) {
|
|
if (play.itemId() == 12) {
|
|
return this.hasFacility(56);
|
|
}
|
|
return false;
|
|
};
|
|
return FacilityInfo;
|
|
})();
|
|
var FacilityResult = /** @class */ (function () {
|
|
function FacilityResult(type1, value1, type2, value2, facilityType) {
|
|
this._type1 = type1;
|
|
this._type2 = type2;
|
|
this._value1 = value1;
|
|
this._value2 = value2;
|
|
this._facilityType = facilityType;
|
|
}
|
|
FacilityResult.prototype.type1 = function () {
|
|
return this._type1;
|
|
};
|
|
FacilityResult.prototype.type2 = function () {
|
|
return this._type2;
|
|
};
|
|
FacilityResult.prototype.value1 = function () {
|
|
return this._value1;
|
|
};
|
|
FacilityResult.prototype.value2 = function () {
|
|
return this._value2;
|
|
};
|
|
FacilityResult.prototype.facilityType = function () {
|
|
return this._facilityType;
|
|
};
|
|
return FacilityResult;
|
|
})();
|
|
var Facility = /** @class */ (function () {
|
|
function Facility(itemId, lv) {
|
|
this._time = 0;
|
|
this._itemId = itemId;
|
|
this._lv = lv;
|
|
}
|
|
Facility.prototype.itemId = function () {
|
|
return this._itemId;
|
|
};
|
|
Facility.prototype.item = function () {
|
|
return $dataItems[this._itemId];
|
|
};
|
|
Facility.prototype.maxLevel = function () {
|
|
return parseInt(this.item().meta["maxLevel"]);
|
|
};
|
|
Facility.prototype.type = function () {
|
|
return parseInt(this.item().meta["type"]);
|
|
};
|
|
Facility.prototype.max = function () {
|
|
if (this.level() == 0) {
|
|
return 0;
|
|
}
|
|
return (
|
|
parseInt(this.item().meta["max"]) +
|
|
(this.level() - 1) * this.levelUpMaxValue()
|
|
);
|
|
};
|
|
Facility.prototype.levelUpMaxValue = function () {
|
|
return parseInt(this.item().meta["levelUpMaxValue"]);
|
|
};
|
|
Facility.prototype.levelUpValue = function () {
|
|
return parseInt(this.item().meta["levelUpValue"]);
|
|
};
|
|
Facility.prototype.levelUp = function () {
|
|
this._lv++;
|
|
};
|
|
Facility.prototype.level = function () {
|
|
return this._lv;
|
|
};
|
|
Facility.prototype.value = function () {
|
|
return (
|
|
parseInt(this.item().meta["value"]) +
|
|
(this.level() - 1) * this.levelUpValue()
|
|
);
|
|
};
|
|
Facility.prototype.cost = function () {
|
|
return parseInt(this.item().meta["cost"]);
|
|
};
|
|
Facility.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;
|
|
};
|
|
Facility.prototype.nameWithoutLevel = function () {
|
|
var texts = this.name().split(" ");
|
|
if (texts && texts.length > 0) {
|
|
return texts[0];
|
|
}
|
|
return this.name();
|
|
};
|
|
Facility.prototype.iconIndex = function () {
|
|
return this.item().iconIndex;
|
|
};
|
|
Facility.prototype.price = function () {
|
|
return this.item().price;
|
|
};
|
|
Facility.prototype.expForLevel = function (level) {
|
|
var c = this.currentClass();
|
|
var basis = c.expParams[0];
|
|
var extra = c.expParams[1];
|
|
var acc_a = c.expParams[2];
|
|
var acc_b = c.expParams[3];
|
|
return Math.round(
|
|
(basis * Math.pow(level - 1, 0.9 + acc_a / 250) * level * (level + 1)) /
|
|
(6 + Math.pow(level, 2) / 50 / acc_b) +
|
|
(level - 1) * extra
|
|
);
|
|
};
|
|
Facility.prototype.currentClass = function () {
|
|
return $dataClasses[this.itemId()];
|
|
};
|
|
Facility.prototype.description = function () {
|
|
if (this.type() == FacilityType.combatant) {
|
|
return this.factoryDescription();
|
|
}
|
|
if (this.type() == FacilityType.barracks) {
|
|
return this.barracksDescription();
|
|
}
|
|
if (this.level() == 1) {
|
|
switch (ConfigManager.language) {
|
|
case "en":
|
|
if (this.item().meta["descLv0En"]) {
|
|
return this.item().meta["descLv0En"].replace("\\n", "\n");
|
|
}
|
|
break;
|
|
case "ch":
|
|
case "jp":
|
|
break;
|
|
}
|
|
if (this.item().meta["descLv0"]) {
|
|
return this.item().meta["descLv0"].replace("\\n", "\n");
|
|
}
|
|
}
|
|
switch (ConfigManager.language) {
|
|
case "en":
|
|
if (this.item().meta["descEn"]) {
|
|
return this.item().meta["descEn"].format(this.value(), this.max());
|
|
}
|
|
if (this.item().meta["desc1En"]) {
|
|
var desc1 = this.item().meta["desc1En"];
|
|
if (this.item().meta["desc2En"]) {
|
|
var desc2 = this.item().meta["desc2En"];
|
|
return desc1 + "\n" + desc2;
|
|
}
|
|
return desc1;
|
|
}
|
|
break;
|
|
case "ch":
|
|
case "jp":
|
|
break;
|
|
}
|
|
return this.item().description.format(this.value(), this.max());
|
|
};
|
|
Facility.prototype.factoryDescription = function () {
|
|
if (this.level() == 1) {
|
|
return TextManager.facilityFactory1;
|
|
}
|
|
return TextManager.facilityFactory2;
|
|
};
|
|
Facility.prototype.barracksDescription = function () {
|
|
if (this.level() >= 0) {
|
|
return "バトルに参加できるユニットが1つ増えます";
|
|
}
|
|
return "";
|
|
};
|
|
Facility.prototype.rate = function () {
|
|
return this._time / this.maxTime();
|
|
};
|
|
Facility.prototype.update = function () {
|
|
if (this.level() == 0) {
|
|
return null;
|
|
}
|
|
this._time++;
|
|
if (this._time > this.maxTime()) {
|
|
this._time -= this.maxTime();
|
|
return this.onTime();
|
|
}
|
|
return null;
|
|
};
|
|
Facility.prototype.onTime = function () {
|
|
return null;
|
|
/*
|
|
switch (this.type()) {
|
|
case FacilityType.headquarters:
|
|
return this.onHeadquarters();
|
|
case FacilityType.combatant:
|
|
case FacilityType.shootingStudio:
|
|
return;
|
|
default:
|
|
console.error('不正な施設です');
|
|
}
|
|
return null;*/
|
|
};
|
|
Facility.prototype.onHeadquarters = function () {
|
|
return null;
|
|
/*
|
|
const reward = $slg.calcAllAvReward();
|
|
$gameParty.gainGold(reward);
|
|
$slg.avInfo().onReward();
|
|
return new FacilityResult(Nore.EffectType.gold, reward, Nore.EffectType.none, 0, this.type());
|
|
*/
|
|
};
|
|
Facility.prototype.onShootingStudio = function () {};
|
|
Facility.prototype.maxTime = function () {
|
|
return parseInt(this.item().meta["time"]);
|
|
};
|
|
Facility.prototype.isValid = function () {
|
|
return !isNaN(this.level());
|
|
};
|
|
Facility.prototype.timeRate = function () {
|
|
if (!this.item().meta["timeRate"]) {
|
|
return 1;
|
|
}
|
|
return parseInt(this.item().meta["timeRate"]);
|
|
};
|
|
Facility.prototype.constructionTime = function () {
|
|
return parseInt(this.item().meta["time"]);
|
|
};
|
|
Facility.prototype.inConstruction = function () {
|
|
for (var _i = 0, _a = $slg.timeGaugeEventList(); _i < _a.length; _i++) {
|
|
var e = _a[_i];
|
|
if (e.type() == TimeGaugeEventType.facility) {
|
|
var event_1 = e;
|
|
if (event_1.facilityId() == this.itemId()) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
return Facility;
|
|
})();
|
|
(function (Nore) {
|
|
var Window_FacilityList = /** @class */ (function (_super) {
|
|
__extends(Window_FacilityList, _super);
|
|
function Window_FacilityList() {
|
|
var _this = this;
|
|
var r = new Rectangle(160, Nore.TOP_Y, 400, 540);
|
|
_this = _super.call(this, r) || this;
|
|
_this._dataList = [];
|
|
_this._additionalSprites = {};
|
|
_this.makeItems();
|
|
_this.refresh();
|
|
return _this;
|
|
}
|
|
Window_FacilityList.prototype.maxItems = function () {
|
|
return this._dataList.length;
|
|
};
|
|
Window_FacilityList.prototype.makeItems = function () {
|
|
this._dataList = [];
|
|
this._dataList = $slg.facilityInfo().facilityList();
|
|
};
|
|
Window_FacilityList.prototype.itemHeight = function () {
|
|
return 100;
|
|
};
|
|
Window_FacilityList.prototype.update = function () {
|
|
if ($slg.facilityInfo().isDirty()) {
|
|
$slg.facilityInfo().clearDirty();
|
|
this.refresh();
|
|
}
|
|
_super.prototype.update.call(this);
|
|
};
|
|
Window_FacilityList.prototype.refresh = function () {
|
|
this._windowContentsSprite.removeChildren();
|
|
_super.prototype.refresh.call(this);
|
|
};
|
|
Window_FacilityList.prototype.drawItem = function (index) {
|
|
this.resetFontSettings();
|
|
var rect = this.itemRect(index);
|
|
var facility = this._dataList[index];
|
|
var inConstruction = $slg.facilityInfo().inConstruction(facility);
|
|
if (inConstruction) {
|
|
this.changePaintOpacity(false);
|
|
} else {
|
|
this.changePaintOpacity(true);
|
|
}
|
|
this.contents.fontSize = 22;
|
|
this.drawIcon(facility.iconIndex(), rect.x, rect.y);
|
|
var name = facility.name();
|
|
if (inConstruction) {
|
|
name += " 建設中";
|
|
}
|
|
this.drawText(name, rect.x + 40, rect.y, 300);
|
|
if (facility.level() > 0 && facility.maxLevel() > 1) {
|
|
this.drawText(
|
|
"Lv " + facility.level(),
|
|
rect.x + 240,
|
|
rect.y,
|
|
120,
|
|
"right"
|
|
);
|
|
}
|
|
if (facility.level() < facility.maxLevel()) {
|
|
this.drawText(facility.price(), rect.x + 80, rect.y + 32, 120);
|
|
this.drawIcon(Icon.gold, rect.x + 40, rect.y + 32);
|
|
}
|
|
this.drawTextEx(facility.description(), rect.x + 140, rect.y + 40, 300);
|
|
};
|
|
Window_FacilityList.prototype.resetFontSettings = function () {
|
|
_super.prototype.resetFontSettings.call(this);
|
|
this.contents.fontSize = 14;
|
|
};
|
|
Window_FacilityList.prototype.lineHeight = function () {
|
|
return 28;
|
|
};
|
|
Window_FacilityList.prototype.placeGauge = function (actor, type, x, y) {
|
|
var key = "actor%1-gauge-%2".format(actor.actorId(), type);
|
|
var sprite = this.createInnerSprite(key, Sprite_Gauge);
|
|
sprite.setup(actor, type);
|
|
sprite.move(x, y);
|
|
sprite.show();
|
|
};
|
|
Window_FacilityList.prototype.createInnerSprite = function (
|
|
key,
|
|
spriteClass
|
|
) {
|
|
var dict = this._additionalSprites;
|
|
if (dict[key]) {
|
|
return dict[key];
|
|
} else {
|
|
var sprite = new spriteClass();
|
|
dict[key] = sprite;
|
|
this.addInnerChild(sprite);
|
|
return sprite;
|
|
}
|
|
};
|
|
Window_FacilityList.prototype.selectedFacility = function () {
|
|
return this._dataList[this.index()];
|
|
};
|
|
Window_FacilityList.prototype.isCurrentItemEnabled = function () {
|
|
var facility = this.selectedFacility();
|
|
return !$slg.facilityInfo().inConstruction(facility);
|
|
};
|
|
return Window_FacilityList;
|
|
})(Window_Selectable);
|
|
Nore.Window_FacilityList = Window_FacilityList;
|
|
var Window_FacilityCommand = /** @class */ (function (_super) {
|
|
__extends(Window_FacilityCommand, _super);
|
|
function Window_FacilityCommand() {
|
|
var _this = this;
|
|
var r = new Rectangle(570, Nore.TOP_Y, 260, 146);
|
|
_this = _super.call(this, r) || this;
|
|
_this.refresh();
|
|
_this.hide();
|
|
return _this;
|
|
}
|
|
Window_FacilityCommand.prototype.itemHeight = function () {
|
|
return 60;
|
|
};
|
|
Window_FacilityCommand.prototype.makeCommandList = function () {
|
|
if (!this._facility) {
|
|
return;
|
|
}
|
|
var enable = this._facility.price() <= $gameParty.gold();
|
|
this.addCommand(
|
|
TextManager.levelUpFacility.format(this._facility.price()),
|
|
FacilityCommand.levelUp,
|
|
enable
|
|
);
|
|
this.addCommand(TextManager._cancel, "cancel", true);
|
|
};
|
|
Window_FacilityCommand.prototype.resetFontSettings = function () {
|
|
this.contents.fontFace = $gameSystem.mainFontFace();
|
|
this.contents.fontSize = 22;
|
|
this.resetTextColor();
|
|
};
|
|
Window_FacilityCommand.prototype.setFacility = function (facility) {
|
|
this._facility = facility;
|
|
this.refresh();
|
|
};
|
|
return Window_FacilityCommand;
|
|
})(Window_Command);
|
|
Nore.Window_FacilityCommand = Window_FacilityCommand;
|
|
})(Nore || (Nore = {}));
|