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

784 lines
23 KiB
JavaScript
Raw 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 __());
};
})();
var Place = /** @class */ (function () {
function Place(enemyId) {
this._stageList = [];
this._enemyId = enemyId;
this.createStage();
this.calcDifficulty();
}
Place.prototype.enemyId = function () {
return this._enemyId;
};
Place.prototype.orderId = function () {
var enemy = $dataEnemies[this.enemyId()];
if (enemy.meta["order"]) {
return parseInt(enemy.meta["order"]);
}
return this._enemyId;
};
Place.prototype.calcDifficulty = function () {
var stage = this.lastStage();
var bossDefficulty = this.bossDifficulty(stage._enemyId);
if (bossDefficulty > 0) {
this._difficulty = bossDefficulty;
return;
}
var enemy = $dataEnemies[stage._enemyId];
var hp = enemy.params[0];
var atk = enemy.params[2];
var interval = enemy.params[6];
var dps = Math.floor((atk * 1000) / interval);
var total = dps * 4 + hp;
//p(enemy.name + ':' + total )
if (total <= 1500) {
this._difficulty = 1;
} else if (total <= 3500) {
this._difficulty = 2;
} else if (total <= 5000) {
this._difficulty = 3;
} else if (total <= 10000) {
this._difficulty = 4;
} else {
this._difficulty = 5;
}
};
Place.prototype.bossDifficulty = function (enemyId) {
switch (enemyId) {
case 50:
return 5;
case 51:
return 2;
case 31:
case 32:
case 33:
case 34:
case 35:
return 4;
case 41:
case 42:
case 43:
return 1;
case 80:
case 81:
case 82:
return 5;
case 62:
return 3;
}
return -1;
};
Place.prototype.difficulty = function () {
return this._difficulty;
};
Place.prototype.lastStage = function () {
return this._stageList[this._stageList.length - 1];
};
Place.prototype.createStage = function () {
for (var i = 0; i < 10; i++) {
var placeStageId = this._enemyId + i;
var weapon = $dataEnemies[placeStageId];
if (weapon.name == this.nameJp()) {
this._stageList.push(new PlaceStage(placeStageId));
} else {
break;
}
}
};
Place.prototype.rewardList = function () {
var stage = this.currentPlaceStage();
if (!stage) {
return [];
}
return stage.rewardList();
};
Place.prototype.currentPlaceStage = function () {
for (var _i = 0, _a = this._stageList; _i < _a.length; _i++) {
var placeStage = _a[_i];
if (!placeStage.isClear()) {
return placeStage;
}
}
return null;
};
Place.prototype.currentStage = function () {
if (this.isClear()) {
return null;
}
var current = this.currentPlaceStage();
return $slg.clicker().getStage(current.stageId());
};
Place.prototype.inBattle = function () {
if (this.isClear()) {
return false;
}
return this.currentStage() == $slg.clicker().currentStage();
};
Place.prototype.isClear = function () {
for (var _i = 0, _a = this._stageList; _i < _a.length; _i++) {
var placeStage = _a[_i];
if (!placeStage.isClear()) {
return false;
}
}
return true;
};
Place.prototype.maxStep = function () {
return this._stageList.length;
};
Place.prototype.step = function () {
var max = 0;
for (var _i = 0, _a = this._stageList; _i < _a.length; _i++) {
var placeStage = _a[_i];
max = placeStage.step();
if (!placeStage.isClear()) {
break;
}
}
return max;
};
Place.prototype.name = function () {
if (this._enemyId <= 0) {
return "";
}
var item = this.item();
switch (ConfigManager.language) {
case "en":
if (item.meta["nameEn"]) {
return item.meta["nameEn"];
}
break;
case "ch":
case "jp":
break;
}
return item.name;
};
Place.prototype.nameJp = function () {
if (this._enemyId <= 0) {
return "";
}
var item = this.item();
return item.name;
};
Place.prototype.item = function () {
if (this._enemyId <= 0) {
return null;
}
return $dataEnemies[this._enemyId];
};
Place.prototype.mapId = function () {
var item = this.item();
return parseInt(item.meta["mapId"]);
};
Place.prototype.iconIndex = function () {
var item = this.item();
if (!item.meta["iconIndex"]) {
return 0;
}
return parseInt(item.meta["iconIndex"]);
};
Place.prototype.getLastStage = function () {
return this._stageList[this._stageList.length - 1];
};
Place.prototype.clearReward = function () {
var list = this.getLastStage().rewardList();
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var r = list_1[_i];
if (r.type() == PlaceRewardType.sw) {
return r;
}
}
return null;
};
Place.prototype.rewardDesc = function () {
var item = this.item();
if (!item.meta["rewardDesc"]) {
return "";
}
var rewardDesc = parseInt(item.meta["rewardDesc"]);
return TextManager["rewardDesc" + rewardDesc];
};
return Place;
})();
var PlaceStage = /** @class */ (function () {
function PlaceStage(enemyId) {
this._enemyId = enemyId;
if (isNaN(this.step())) {
console.error("step が不正です:" + enemyId);
}
}
PlaceStage.prototype.enemyId = function () {
return this._enemyId;
};
PlaceStage.prototype.name = function () {
if (this._enemyId <= 0) {
return "";
}
var item = this.item();
return item.name;
};
PlaceStage.prototype.item = function () {
if (this._enemyId <= 0) {
return null;
}
return $dataEnemies[this._enemyId];
};
PlaceStage.prototype.step = function () {
if (this._enemyId <= 0) {
return 0;
}
return parseInt(this.item().meta["step"]);
};
PlaceStage.prototype.inBattle = function () {
if (this.isClear()) {
return false;
}
return this.getStage() == $slg.clickerStage();
};
PlaceStage.prototype.isClear = function () {
var stage = $slg.clicker().getStage(this._enemyId);
return stage.isClear();
};
PlaceStage.prototype.getStage = function () {
return $slg.clicker().getStage(this.stageId());
};
PlaceStage.prototype.stageId = function () {
return this._enemyId;
};
PlaceStage.prototype.rewardList = function () {
var result = [];
var item = this.item();
if (item.gold > 0) {
result.push(
new PlaceReward(this._enemyId, PlaceRewardType.gold, item.gold)
);
}
if (item.meta["sw"]) {
var sw = parseInt(item.meta["sw"]);
result.push(new PlaceReward(this._enemyId, PlaceRewardType.sw, sw));
}
return result;
};
PlaceStage.prototype.mapId = function () {
var item = this.item();
return parseInt(item.meta["mapId"]);
};
PlaceStage.prototype.gainReward = function () {
var stage = $slg.battleInfo().getStage(this.stageId());
if (stage.isGainReward()) {
console.error("すでに報酬を受取済みです");
return;
}
stage.gainReward();
for (var _i = 0, _a = this.rewardList(); _i < _a.length; _i++) {
var r = _a[_i];
r.gainReward();
}
};
return PlaceStage;
})();
var PlaceRewardType;
(function (PlaceRewardType) {
PlaceRewardType["gold"] = "gold";
PlaceRewardType["sw"] = "sw";
})(PlaceRewardType || (PlaceRewardType = {}));
var PlaceReward = /** @class */ (function () {
function PlaceReward(itemId, type, value) {
this._itemId = itemId;
this._type = type;
this._value = value;
}
PlaceReward.prototype.type = function () {
return this._type;
};
PlaceReward.prototype.value = function () {
return this._value;
};
PlaceReward.prototype.swDescription = function () {
if (this._itemId == 31) {
// マリナの家付近の基地
return "決戦が可能になります";
}
if (this._value == 213) {
// ノノカの学校
return "カのAV撮影解放";
}
if (this._value == 218) {
// 2面決戦開始
return "マリナの息子を捕らえることができます";
}
if (this._value == 219) {
// 2面決戦勝利
return "マリナを捕らえることができます";
}
return "";
};
PlaceReward.prototype.gainReward = function () {
switch (this._type) {
case PlaceRewardType.gold:
$gameParty.gainGold(this._value);
break;
}
};
return PlaceReward;
})();
var Nore;
(function (Nore) {
var STAGE_VAR = 2;
var MILITATY_TOP_OFFSET = 60;
var MilitaryCommand;
(function (MilitaryCommand) {
MilitaryCommand["formation"] = "formation";
MilitaryCommand["battle1"] = "battle1";
MilitaryCommand["battle2"] = "battle2";
MilitaryCommand["battle3"] = "battle3";
MilitaryCommand["boss"] = "boss";
})((MilitaryCommand = Nore.MilitaryCommand || (Nore.MilitaryCommand = {})));
var Window_Military = /** @class */ (function (_super) {
__extends(Window_Military, _super);
//_towerWindow: Window_TowerInfo;
function Window_Military() {
var _this = this;
var r = new Rectangle(
Nore.MAIN_MENU_W,
Nore.TOP_Y,
580,
800 - Nore.TOP_Y
);
_this = _super.call(this, r) || this;
_this.setHandler("change", _this.onChange.bind(_this));
_this.refresh();
_this.createDetailWindow();
_this.autoSelect();
return _this;
//this._towerWindow = new Window_TowerInfo();
//this.addChild(this._towerWindow);
}
Window_Military.prototype.createDetailWindow = function () {
this._detailWindow = new Window_MilitaryDetail();
this.addChild(this._detailWindow);
};
Window_Military.prototype.autoSelect = function () {
for (var i = 0; i < this._dataList.length; i++) {
var place = this._dataList[i];
var placeStage = place.currentPlaceStage();
var isCurretPlace =
$slg.clicker().currentStageId() == placeStage.stageId();
if (isCurretPlace) {
this.select(i);
return;
}
}
this.select(0);
};
Window_Military.prototype.select = function (index) {
_super.prototype.select.call(this, index);
var place = this.selectedPlace();
if (!place) {
return;
}
this._detailWindow.setPlace(place);
};
Window_Military.prototype.refresh = function () {
this._windowContentsSprite.removeChildren();
this.makeItems();
_super.prototype.refresh.call(this);
this.drawTitle();
this.onChange();
};
Window_Military.prototype.makeItems = function () {
this._dataList = [];
this._dataList.push(new Place(1)); // アンテナ基地
if ($gameSwitches.value(245) && $slg.stage() == 1) {
this._dataList.push(new Place(6)); // ノノカ
}
if ($slg.stage() >= 2) {
this._dataList.push(new Place(11)); // 防衛施設
}
if ($gameSwitches.value(328)) {
this._dataList.push(new Place(31)); // 怪人王の研究所
}
if ($gameActors.actor(9).countSyusan() > 0) {
this._dataList.push(new Place(21)); // A区のヒーロー駐屯所
}
if ($gameSwitches.value(241)) {
this._dataList.push(new Place(23)); // A区の基地
}
if ($gameSwitches.value(265)) {
// ミユのHイベント
this._dataList.push(new Place(26)); // 洗脳施設
}
if ($gameSwitches.value(216)) {
this._dataList.push(new Place(41)); // マリナの家付近
}
if ($gameSwitches.value(242)) {
this._dataList.push(new Place(16)); // 公園の基地
}
if ($gameSwitches.value(218)) {
this._dataList.push(new Place(51)); //マリナと決戦
} else {
if ($gameSwitches.value(216)) {
this._dataList.push(new Place(50)); //マリナと戦い
}
}
if ($gameSwitches.value(355)) {
this._dataList.push(new Place(55)); //マリナと決戦
}
if ($gameSwitches.value(229)) {
this._dataList.push(new Place(53)); //サキと決戦
}
if ($gameSwitches.value(1084)) {
this._dataList.push(new Place(56)); //マリナの高校
}
if ($gameSwitches.value(1159)) {
this._dataList.push(new Place(62)); //サキの中学
}
if ($gameSwitches.value(235)) {
this._dataList.push(new Place(54)); //ココナと決戦
}
if ($gameSwitches.value(240)) {
this._dataList.push(new Place(80)); // 防衛施設
}
if ($gameSwitches.value(249)) {
this._dataList.push(new Place(70)); //ヒーロー本部
}
if ($gameSwitches.value(327)) {
this._dataList.push(new Place(100)); //最終決戦
}
if ($slg.stage() >= 2 && $gameSwitches.value(346)) {
this._dataList.push(new Place(64)); //さらしもの(ノノカ)
}
if ($slg.stage() >= 3 && $gameSwitches.value(347)) {
this._dataList.push(new Place(65)); //さらしもの(マリナ)
}
if ($slg.stage() >= 4 && $gameSwitches.value(348)) {
this._dataList.push(new Place(66)); //さらしもの(サキ)
}
if ($slg.stage() >= 5 && $gameSwitches.value(349)) {
this._dataList.push(new Place(67)); //さらしもの(ココナ)
}
if ($gameSwitches.value(332)) {
this._dataList.push(new Place(90)); // Dr.ゲーリー
}
this.removeClearedPlace();
this.sortPlace();
};
Window_Military.prototype.sortPlace = function () {
this._dataList = this._dataList.sort(function (a, b) {
if (a.difficulty() == b.difficulty()) {
return a.orderId() - b.orderId();
}
return a.difficulty() - b.difficulty();
});
};
Window_Military.prototype.removeClearedPlace = function () {
var list = [];
for (var _i = 0, _a = this._dataList; _i < _a.length; _i++) {
var place = _a[_i];
if (!place.isClear()) {
list.push(place);
}
}
this._dataList = list;
};
Window_Military.prototype.maxItems = function () {
if (!this._dataList) {
return 0;
}
return this._dataList.length;
};
Window_Military.prototype.drawTitle = function () {
this.changeTextColor(ColorManager.normalColor());
{
var r = new Rectangle(0, 392, 170, 32);
if (ConfigManager.language == "en") {
r.y += 32;
}
var s = this.getSprite(r.x, r.y, r.width, r.height);
s.x = 55;
s.y = 30;
this.addChild(s);
}
{
var r = new Rectangle(180, 392, 270, 32);
if (ConfigManager.language == "en") {
r.y += 32;
}
var s = this.getSprite(r.x, r.y, r.width, r.height);
s.x = 300;
s.y = 30;
this.addChild(s);
}
//this.drawText(TextManager.selectTarget, 20, 10, 200);
//this.drawText(TextManager.battleDifficulty, 310, 10, 200, 'right');
};
Window_Military.prototype.getSprite = function (x, y, w, h) {
var baseTexture = Nore.getSystemBaseTexture("gacha");
var r = new Rectangle(x, y, w, h);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
return s;
};
Window_Military.prototype.addBg = function () {};
Window_Military.prototype.itemHeight = function () {
return 112;
};
Window_Military.prototype.itemRect = function (index) {
var r = _super.prototype.itemRect.call(this, index);
r.y += MILITATY_TOP_OFFSET;
return r;
};
Window_Military.prototype.overallHeight = function () {
return _super.prototype.overallHeight.call(this) + MILITATY_TOP_OFFSET;
};
Window_Military.prototype.maxCols = function () {
return 1;
};
Window_Military.prototype.canBattle = function () {
return $slg.nextTroopId() > 0;
};
Window_Military.prototype.rowSpacing = function () {
return 8;
};
Window_Military.prototype.drawItem = function (index) {
this.contents.fontSize = 16;
this.changeTextColor(ColorManager.normalColor());
var rect = this.itemRect(index);
var place = this._dataList[index];
var placeStage = place.currentPlaceStage();
var isCurretPlace =
$slg.clicker().currentStageId() == placeStage.stageId();
if (isCurretPlace) {
this.contents.fillRect(
rect.x,
rect.y,
rect.width,
rect.height,
"#FFFF0044"
);
}
{
var s = this.getSprite(0, 457, 464, 3);
s.x = 82 + rect.x;
s.y = 48 + rect.y;
this._windowContentsSprite.addChild(s);
}
//this.drawBattleStatus(placeStage, rect, isCurretPlace);
this.drawStage(rect.x + 10, place, rect);
this.drawClearReward(rect.x + 72, place, rect);
this.drawName(rect.x + 16, place, rect);
this.drawDifficulty(place, rect);
this.drawTaikenbanNg(place, rect);
};
Window_Military.prototype.drawTaikenbanNg = function (place, rect) {
if ($gameSystem.isTaikenbanOkBattle(place.enemyId())) {
return;
}
this.contents.fontSize = 14;
this.changeTextColor(ColorManager.deathColor());
this.drawText("体験版では選択できません", rect.x + 62, rect.y - 17, 200);
};
Window_Military.prototype.drawBattleStatus = function (
placeStage,
rect,
isCurretPlace
) {
if (isCurretPlace) {
this.drawText("戦闘中", rect.x + 2, rect.y - 5, 100);
}
};
Window_Military.prototype.drawStage = function (x, place, rect) {
var paramY = -5;
this.drawText(
place.step() + "/" + place.maxStep(),
x,
rect.y + paramY,
rect.width,
"left"
);
};
Window_Military.prototype.drawClearReward = function (x, place, rect) {
this.contents.fontSize = 15;
var paramY = 42;
var xx = 60;
this.changeTextColor(ColorManager.crisisColor());
this.drawText(
TextManager.areaReward,
x,
rect.y + paramY,
rect.width,
"left"
);
var list = place.rewardList();
var rewardY = paramY;
this.changeTextColor(ColorManager.normalColor());
for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
var r = list_2[_i];
var rewardX = rect.x + 120 + xx;
if (r.type() == PlaceRewardType.gold) {
this.drawIcon(Icon.gold, rewardX, rect.y + rewardY + 2);
this.drawText(
r.value(),
rewardX - 40,
rect.y + rewardY,
100,
"right"
);
}
}
var desc = place.rewardDesc();
if (desc) {
rewardY += 25;
this.changeTextColor(ColorManager.crisisColor());
this.drawText(
TextManager.clearReward,
x,
rect.y + rewardY,
rect.width,
"left"
);
this.changeTextColor(ColorManager.normalColor());
this.drawText(
place.rewardDesc(),
rect.x + 124 + xx,
rect.y + rewardY,
380,
"left"
);
}
};
Window_Military.prototype.drawDifficulty = function (place, rect) {
var x = rect.x + 400;
var y = rect.y + 0;
var offset = 0;
for (var i = 0; i < place.difficulty(); i++) {
this.drawIcon(407, x + offset, y);
offset += 26;
}
};
Window_Military.prototype.drawName = function (x, place, rect) {
this.contents.fontSize = 20;
this.drawIconBig(place.iconIndex(), x, rect.y + 23);
this.drawText(place.name(), x + 54, rect.y + 0, rect.width - 200);
var stage = place.currentStage();
if (!stage) {
return;
}
};
Window_Military.prototype.drawIconBig = function (index, x, y) {
var bitmap = ImageManager.loadSystem("IconSet");
var pw = ImageManager.iconWidth;
var ph = ImageManager.iconHeight;
var iconIndex = 64 + index * 2;
var sx = (iconIndex % 16) * pw;
var sy = Math.floor(64 / 16) * ph + Math.floor(index / 8) * ph * 3;
this.contents.blt(bitmap, sx, sy, pw * 2, ph * 2 + 10, x, y);
};
Window_Military.prototype.onChange = function () {
//this._windowContentsSprite.removeChildren();
var index = this.index();
//this.drawTroop(troopId);
};
Window_Military.prototype.decide = function () {
var place = this.selectedPlace();
if ($slg.clickerStage().enemyId() == place.currentStage().enemyId()) {
return -1;
}
var reserveCommon = $slg.clicker().start(place.currentStage().enemyId());
this.refresh();
return reserveCommon;
};
Window_Military.prototype.isCurrentItemEnabled = function () {
var place = this.selectedPlace();
if (!place) {
return false;
}
if (!$gameSystem.isTaikenbanOkBattle(place.enemyId())) {
return false;
}
var placeStage = place.currentPlaceStage();
var isCurretPlace =
$slg.clicker().currentStageId() == placeStage.stageId();
if (isCurretPlace) {
return false;
}
return !place.isClear();
};
Window_Military.prototype.selectedPlace = function () {
if (!this._dataList) {
return null;
}
return this._dataList[this.index()];
};
return Window_Military;
})(Window_Selectable);
Nore.Window_Military = Window_Military;
})(Nore || (Nore = {}));
var HeroEnemy = /** @class */ (function () {
function HeroEnemy(enemyId) {
this._enemyId = enemyId;
}
HeroEnemy.prototype.battlerName = function () {
return this.enemy().battlerName;
};
HeroEnemy.prototype.enemy = function () {
return $dataEnemies[this._enemyId];
};
HeroEnemy.prototype.hp = function () {
return this.enemy().params[0];
};
HeroEnemy.prototype.atk = function () {
return this.enemy().params[2];
};
HeroEnemy.prototype.spd = function () {
return Math.floor(AGI_BASE_VALUE / this.enemy().params[6]);
};
HeroEnemy.prototype.element = function () {
for (var _i = 0, _a = this.enemy().traits; _i < _a.length; _i++) {
var t = _a[_i];
if (t.code == 11) {
if (t.dataId == 2) {
return MonsterElement.flame;
}
if (t.dataId == 3) {
return MonsterElement.water;
}
if (t.dataId == 4) {
return MonsterElement.wood;
}
}
}
return MonsterElement.none;
};
return HeroEnemy;
})();